Skip to content

Compile errors while building example with latest sokol_gfx (sg_usage removed, replaced by sg_buffer_usage struct) #51

@epouv

Description

@epouv

errors:
sokol_gp.h: In function 'sgp_setup':
sokol_gp.h:1760:20: error: 'sg_buffer_desc' has no member named 'type'
1760 | vertex_buf_desc.type = SG_BUFFERTYPE_VERTEXBUFFER;
| ^
sokol_gp.h:1760:28: error: 'SG_BUFFERTYPE_VERTEXBUFFER' undeclared (first use in this function)
1760 | vertex_buf_desc.type = SG_BUFFERTYPE_VERTEXBUFFER;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
sokol_gp.h:1760:28: note: each undeclared identifier is reported only once for each function it appears in
sokol_gp.h:1761:29: error: 'SG_USAGE_STREAM' undeclared (first use in this function)
1761 | vertex_buf_desc.usage = SG_USAGE_STREAM;
| ^~~~~~~~~~~~~~~
sokol_gp.h: In function '_sgp_query_image_size':
sokol_gp.h:2919:47: error: passing argument 1 of '_sg_lookup_image' makes integer from pointer without a cast [-Wint-conversion]
2919 | const _sg_image_t* img = _sg_lookup_image(&_sg.pools, img_id.id);
| ^~~~~~~~~~
| |
| _sg_pools_t * {aka struct _sg_pools_s }
In file included from main.c:5:
sokol_gfx.h:6971:55: note: expected 'uint32_t' {aka 'unsigned int'} but argument is of type '_sg_pools_t ' {aka 'struct _sg_pools_s '}
6971 | _SOKOL_PRIVATE _sg_image_t
_sg_lookup_image(uint32_t img_id) {
| ~~~~~~~~~^~~~~~
sokol_gp.h:2919:30: error: too many arguments to function '_sg_lookup_image'
2919 | const _sg_image_t
img = _sg_lookup_image(&_sg.pools, img_id.id);
| ^~~~~~~~~~~~~~~~
sokol_gfx.h:6971:29: note: declared here
6971 | _SOKOL_PRIVATE _sg_image_t
_sg_lookup_image(uint32_t img_id) {
| ^~~~~~~~~~~~~~~~

I managed to get the example running by changing sokol_gp.h like so
l1760:
// create vertex buffer
sg_buffer_desc vertex_buf_desc;
memset(&vertex_buf_desc, 0, sizeof(sg_buffer_desc));
vertex_buf_desc.size = (size_t)(_sgp.num_vertices * sizeof(sgp_vertex));
vertex_buf_desc.type = SG_BUFFERTYPE_VERTEXBUFFER;
vertex_buf_desc.usage = SG_USAGE_STREAM;

replaced
vertex_buf_desc.type = SG_BUFFERTYPE_VERTEXBUFFER;
vertex_buf_desc.usage = SG_USAGE_STREAM;
by
vertex_buf_desc.usage = (sg_buffer_usage){
.vertex_buffer = true,
.stream_update = true
};

l2919:
static sgp_isize _sgp_query_image_size(sg_image img_id) {
const _sg_image_t* img = _sg_lookup_image(&_sg.pools, img_id.id);
...
}
replaced
_sg_lookup_image(&_sg.pools, img_id.id);
by
_sg_lookup_image(img_id.id);

Hope this helps !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions