aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/sokol_gfx_test.c
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2025-05-10 14:34:03 +0200
committerAndre Weissflog <floooh@gmail.com>2025-05-10 14:34:03 +0200
commita660e2f98a49a802ce56e5ee6cfc1ce2236a267f (patch)
treea7776a9d8fade407429a234166c11497f0d9af16 /tests/functional/sokol_gfx_test.c
parent1db5da49cc7c235037db81fbe4699eaa53dd4ff6 (diff)
fix tests
Diffstat (limited to 'tests/functional/sokol_gfx_test.c')
-rw-r--r--tests/functional/sokol_gfx_test.c257
1 files changed, 127 insertions, 130 deletions
diff --git a/tests/functional/sokol_gfx_test.c b/tests/functional/sokol_gfx_test.c
index cb34c4e1..82742b8d 100644
--- a/tests/functional/sokol_gfx_test.c
+++ b/tests/functional/sokol_gfx_test.c
@@ -49,7 +49,7 @@ static sg_buffer create_buffer(void) {
static sg_image create_image(void) {
return sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 256,
.height = 128
});
@@ -70,7 +70,7 @@ static sg_pipeline create_pipeline(void) {
static sg_attachments create_attachments(void) {
sg_image_desc img_desc = {
- .render_target = true,
+ .usage.render_attachment = true,
.width = 128,
.height = 128,
};
@@ -345,8 +345,8 @@ UTEST(sokol_gfx, make_destroy_buffers) {
T(bufptr->cmn.size == sizeof(data));
T(bufptr->cmn.append_pos == 0);
T(!bufptr->cmn.append_overflow);
- T(bufptr->cmn.type == SG_BUFFERTYPE_VERTEXBUFFER);
- T(bufptr->cmn.usage == SG_USAGE_IMMUTABLE);
+ T(bufptr->cmn.usage.vertex_buffer);
+ T(bufptr->cmn.usage.immutable);
T(bufptr->cmn.update_frame_index == 0);
T(bufptr->cmn.append_frame_index == 0);
T(bufptr->cmn.num_slots == 1);
@@ -387,12 +387,12 @@ UTEST(sokol_gfx, make_destroy_images) {
T(imgptr->slot.id == img[i].id);
T(imgptr->slot.state == SG_RESOURCESTATE_VALID);
T(imgptr->cmn.type == SG_IMAGETYPE_2D);
- T(!imgptr->cmn.render_target);
+ T(!imgptr->cmn.usage.render_attachment);
T(imgptr->cmn.width == 8);
T(imgptr->cmn.height == 8);
T(imgptr->cmn.num_slices == 1);
T(imgptr->cmn.num_mipmaps == 1);
- T(imgptr->cmn.usage == SG_USAGE_IMMUTABLE);
+ T(imgptr->cmn.usage.immutable);
T(imgptr->cmn.pixel_format == SG_PIXELFORMAT_RGBA8);
T(imgptr->cmn.sample_count == 1);
T(imgptr->cmn.upd_frame_index == 0);
@@ -541,7 +541,7 @@ UTEST(sokol_gfx, make_destroy_attachments) {
sg_attachments atts[3] = { {0} };
sg_image_desc img_desc = {
- .render_target = true,
+ .usage.render_attachment = true,
.width = 128,
.height = 128,
};
@@ -601,18 +601,14 @@ UTEST(sokol_gfx, query_buffer_defaults) {
setup(&(sg_desc){0});
sg_buffer_desc desc;
desc = sg_query_buffer_defaults(&(sg_buffer_desc){0});
- T(desc.type == SG_BUFFERTYPE_VERTEXBUFFER);
- T(desc.usage == SG_USAGE_IMMUTABLE);
- desc = sg_query_buffer_defaults(&(sg_buffer_desc){
- .type = SG_BUFFERTYPE_INDEXBUFFER,
- });
- T(desc.type == SG_BUFFERTYPE_INDEXBUFFER);
- T(desc.usage == SG_USAGE_IMMUTABLE);
- desc = sg_query_buffer_defaults(&(sg_buffer_desc){
- .usage = SG_USAGE_DYNAMIC
- });
- T(desc.type == SG_BUFFERTYPE_VERTEXBUFFER);
- T(desc.usage == SG_USAGE_DYNAMIC);
+ T(desc.usage.vertex_buffer);
+ T(desc.usage.immutable);
+ desc = sg_query_buffer_defaults(&(sg_buffer_desc){ .usage.index_buffer = true });
+ T(desc.usage.index_buffer);
+ T(desc.usage.immutable);
+ desc = sg_query_buffer_defaults(&(sg_buffer_desc){ .usage.stream_update = true });
+ T(desc.usage.vertex_buffer);
+ T(desc.usage.stream_update);
sg_shutdown();
}
@@ -620,9 +616,9 @@ UTEST(sokol_gfx, query_image_defaults) {
setup(&(sg_desc){0});
const sg_image_desc desc = sg_query_image_defaults(&(sg_image_desc){0});
T(desc.type == SG_IMAGETYPE_2D);
- T(!desc.render_target);
+ T(!desc.usage.render_attachment);
+ T(desc.usage.immutable);
T(desc.num_mipmaps == 1);
- T(desc.usage == SG_USAGE_IMMUTABLE);
T(desc.pixel_format == SG_PIXELFORMAT_RGBA8);
T(desc.sample_count == 1);
sg_shutdown();
@@ -810,8 +806,10 @@ UTEST(sokol_gfx, query_buffer_info) {
setup(&(sg_desc){0});
sg_buffer buf = sg_make_buffer(&(sg_buffer_desc){
.size = 256,
- .type = SG_BUFFERTYPE_VERTEXBUFFER,
- .usage = SG_USAGE_STREAM
+ .usage = {
+ .vertex_buffer = true,
+ .stream_update = true,
+ },
});
T(buf.id != SG_INVALID_ID);
const sg_buffer_info info = sg_query_buffer_info(buf);
@@ -823,7 +821,7 @@ UTEST(sokol_gfx, query_buffer_info) {
UTEST(sokol_gfx, query_image_info) {
setup(&(sg_desc){0});
sg_image img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 256,
.height = 128
});
@@ -883,7 +881,7 @@ UTEST(sokol_gfx, query_pipeline_info) {
UTEST(sokol_gfx, query_attachments_info) {
setup(&(sg_desc){0});
sg_image_desc img_desc = {
- .render_target = true,
+ .usage.render_attachment = true,
.width = 128,
.height = 128,
};
@@ -905,13 +903,13 @@ UTEST(sokol_gfx, query_buffer_desc) {
sg_buffer b0 = sg_make_buffer(&(sg_buffer_desc){
.size = 32,
- .usage = SG_USAGE_STREAM,
+ .usage.stream_update = true,
.label = "bla",
});
const sg_buffer_desc b0_desc = sg_query_buffer_desc(b0);
T(b0_desc.size == 32);
- T(b0_desc.type == SG_BUFFERTYPE_VERTEXBUFFER);
- T(b0_desc.usage == SG_USAGE_STREAM);
+ T(b0_desc.usage.vertex_buffer);
+ T(b0_desc.usage.stream_update);
T(b0_desc.data.ptr == 0);
T(b0_desc.data.size == 0);
T(b0_desc.gl_buffers[0] == 0);
@@ -919,8 +917,7 @@ UTEST(sokol_gfx, query_buffer_desc) {
T(b0_desc.d3d11_buffer == 0);
T(b0_desc.wgpu_buffer == 0);
T(sg_query_buffer_size(b0) == 32);
- T(sg_query_buffer_type(b0) == SG_BUFFERTYPE_VERTEXBUFFER);
- T(sg_query_buffer_usage(b0) == SG_USAGE_STREAM);
+ T(sg_query_buffer_usage(b0).stream_update);
float vtx_data[16];
sg_buffer b1 = sg_make_buffer(&(sg_buffer_desc){
@@ -928,44 +925,41 @@ UTEST(sokol_gfx, query_buffer_desc) {
});
const sg_buffer_desc b1_desc = sg_query_buffer_desc(b1);
T(b1_desc.size == sizeof(vtx_data));
- T(b1_desc.type == SG_BUFFERTYPE_VERTEXBUFFER);
- T(b1_desc.usage == SG_USAGE_IMMUTABLE);
+ T(b1_desc.usage.vertex_buffer);
+ T(b1_desc.usage.immutable);
T(b1_desc.data.ptr == 0);
T(b1_desc.data.size == 0);
T(sg_query_buffer_size(b1) == sizeof(vtx_data));
- T(sg_query_buffer_type(b1) == SG_BUFFERTYPE_VERTEXBUFFER);
- T(sg_query_buffer_usage(b1) == SG_USAGE_IMMUTABLE);
+ T(sg_query_buffer_usage(b1).vertex_buffer);
+ T(sg_query_buffer_usage(b1).immutable);
uint16_t idx_data[8];
sg_buffer b2 = sg_make_buffer(&(sg_buffer_desc){
- .type = SG_BUFFERTYPE_INDEXBUFFER,
+ .usage.index_buffer = true,
.data = SG_RANGE(idx_data),
});
const sg_buffer_desc b2_desc = sg_query_buffer_desc(b2);
T(b2_desc.size == sizeof(idx_data));
- T(b2_desc.type == SG_BUFFERTYPE_INDEXBUFFER);
- T(b2_desc.usage == SG_USAGE_IMMUTABLE);
+ T(b2_desc.usage.index_buffer);
+ T(b2_desc.usage.immutable);
T(b2_desc.data.ptr == 0);
T(b2_desc.data.size == 0);
T(sg_query_buffer_size(b2) == sizeof(idx_data));
- T(sg_query_buffer_type(b2) == SG_BUFFERTYPE_INDEXBUFFER);
- T(sg_query_buffer_usage(b2) == SG_USAGE_IMMUTABLE);
+ T(sg_query_buffer_usage(b2).index_buffer);
+ T(sg_query_buffer_usage(b2).immutable);
// invalid buffer (returns zeroed desc)
sg_buffer b3 = sg_make_buffer(&(sg_buffer_desc){
.size = 32,
- .usage = SG_USAGE_STREAM,
+ .usage.stream_update = true,
.label = "bla",
});
sg_destroy_buffer(b3);
const sg_buffer_desc b3_desc = sg_query_buffer_desc(b3);
T(b3_desc.size == 0);
- T(b3_desc.type == 0);
- T(b3_desc.usage == 0);
+ T(!b3_desc.usage.stream_update);
T(sg_query_buffer_size(b3) == 0);
- T(sg_query_buffer_type(b3) == _SG_BUFFERTYPE_DEFAULT);
- T(sg_query_buffer_usage(b3) == _SG_USAGE_DEFAULT);
-
+ T(!sg_query_buffer_usage(b3).stream_update);
sg_shutdown();
}
@@ -976,16 +970,16 @@ UTEST(sokol_gfx, query_image_desc) {
.width = 256,
.height = 512,
.pixel_format = SG_PIXELFORMAT_R8,
- .usage = SG_USAGE_DYNAMIC,
+ .usage.dynamic_update = true,
});
const sg_image_desc i0_desc = sg_query_image_desc(i0);
T(i0_desc.type == SG_IMAGETYPE_2D);
- T(i0_desc.render_target == false);
+ T(!i0_desc.usage.render_attachment);
+ T(i0_desc.usage.dynamic_update);
T(i0_desc.width == 256);
T(i0_desc.height == 512);
T(i0_desc.num_slices == 1);
T(i0_desc.num_mipmaps == 1);
- T(i0_desc.usage == SG_USAGE_DYNAMIC);
T(i0_desc.pixel_format == SG_PIXELFORMAT_R8);
T(i0_desc.sample_count == 1);
T(i0_desc.data.subimage[0][0].ptr == 0);
@@ -1003,16 +997,15 @@ UTEST(sokol_gfx, query_image_desc) {
T(sg_query_image_num_mipmaps(i0) == 1);
T(sg_query_image_pixelformat(i0) == SG_PIXELFORMAT_R8);
T(sg_query_image_sample_count(i0) == 1);
-
sg_destroy_image(i0);
const sg_image_desc i0_desc_x = sg_query_image_desc(i0);
T(i0_desc_x.type == 0);
- T(i0_desc_x.render_target == false);
+ T(!i0_desc_x.usage.render_attachment);
+ T(!i0_desc_x.usage.dynamic_update);
T(i0_desc_x.width == 0);
T(i0_desc_x.height == 0);
T(i0_desc_x.num_slices == 0);
T(i0_desc_x.num_mipmaps == 0);
- T(i0_desc_x.usage == 0);
T(i0_desc_x.pixel_format == 0);
T(i0_desc_x.sample_count == 0);
T(sg_query_image_type(i0) == _SG_IMAGETYPE_DEFAULT);
@@ -1225,12 +1218,12 @@ UTEST(sokol_gfx, query_attachments_desc) {
setup(&(sg_desc){0});
const sg_image_desc color_img_desc = {
- .render_target = true,
+ .usage.render_attachment = true,
.width = 128,
.height = 128,
};
const sg_image_desc depth_img_desc = {
- .render_target = true,
+ .usage.render_attachment = true,
.width = 128,
.height = 128,
.pixel_format = SG_PIXELFORMAT_DEPTH,
@@ -1269,7 +1262,7 @@ UTEST(sokol_gfx, buffer_resource_states) {
setup(&(sg_desc){0});
sg_buffer buf = sg_alloc_buffer();
T(sg_query_buffer_state(buf) == SG_RESOURCESTATE_ALLOC);
- sg_init_buffer(buf, &(sg_buffer_desc){ .usage = SG_USAGE_STREAM, .size = 128 });
+ sg_init_buffer(buf, &(sg_buffer_desc){ .usage.stream_update = true, .size = 128 });
T(sg_query_buffer_state(buf) == SG_RESOURCESTATE_VALID);
sg_uninit_buffer(buf);
T(sg_query_buffer_state(buf) == SG_RESOURCESTATE_ALLOC);
@@ -1282,7 +1275,7 @@ UTEST(sokol_gfx, image_resource_states) {
setup(&(sg_desc){0});
sg_image img = sg_alloc_image();
T(sg_query_image_state(img) == SG_RESOURCESTATE_ALLOC);
- sg_init_image(img, &(sg_image_desc){ .render_target = true, .width = 16, .height = 16 });
+ sg_init_image(img, &(sg_image_desc){ .usage.render_attachment = true, .width = 16, .height = 16 });
T(sg_query_image_state(img) == SG_RESOURCESTATE_VALID);
sg_uninit_image(img);
T(sg_query_image_state(img) == SG_RESOURCESTATE_ALLOC);
@@ -1338,7 +1331,7 @@ UTEST(sokol_gfx, attachments_resource_states) {
sg_attachments atts = sg_alloc_attachments();
T(sg_query_attachments_state(atts) == SG_RESOURCESTATE_ALLOC);
sg_init_attachments(atts, &(sg_attachments_desc){
- .colors[0].image = sg_make_image(&(sg_image_desc){ .render_target=true, .width=16, .height=16})
+ .colors[0].image = sg_make_image(&(sg_image_desc){ .usage.render_attachment = true, .width=16, .height=16})
});
T(sg_query_attachments_state(atts) == SG_RESOURCESTATE_VALID);
sg_uninit_attachments(atts);
@@ -1352,7 +1345,7 @@ UTEST(sokol_gfx, query_buffer_will_overflow) {
setup(&(sg_desc){0});
sg_buffer buf = sg_make_buffer(&(sg_buffer_desc){
.size = 64,
- .usage = SG_USAGE_STREAM
+ .usage.stream_update = true,
});
T(!sg_query_buffer_will_overflow(buf, 32));
T(!sg_query_buffer_will_overflow(buf, 64));
@@ -1849,7 +1842,7 @@ UTEST(sokol_gfx, make_attachments_with_nonvalid_color_images) {
},
.depth_stencil = {
.image = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 128,
.height = 128
})
@@ -1865,7 +1858,7 @@ UTEST(sokol_gfx, make_attachments_without_color_attachments) {
setup(&(sg_desc){0});
sg_attachments atts = sg_make_attachments(&(sg_attachments_desc){
.depth_stencil.image = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.pixel_format = SG_PIXELFORMAT_DEPTH,
@@ -1906,7 +1899,8 @@ UTEST(sokol_gfx, make_buffer_validate_immutable_nodata) {
sg_buffer buf = sg_make_buffer(&(sg_buffer_desc){ 0 });
T(sg_query_buffer_state(buf) == SG_RESOURCESTATE_FAILED);
T(log_items[0] == SG_LOGITEM_VALIDATE_BUFFERDESC_EXPECT_NONZERO_SIZE);
- T(log_items[1] == SG_LOGITEM_VALIDATION_FAILED);
+ T(log_items[1] == SG_LOGITEM_VALIDATE_BUFFERDESC_EXPECT_DATA);
+ T(log_items[2] == SG_LOGITEM_VALIDATION_FAILED);
sg_shutdown();
}
@@ -1956,8 +1950,9 @@ UTEST(sokol_gfx, make_buffer_validate_no_data_ptr_but_data_size) {
.data.size = sizeof(data),
});
T(sg_query_buffer_state(buf) == SG_RESOURCESTATE_FAILED);
- T(log_items[0] == SG_LOGITEM_VALIDATE_BUFFERDESC_EXPECT_ZERO_DATA_SIZE);
- T(log_items[1] == SG_LOGITEM_VALIDATION_FAILED);
+ T(log_items[0] == SG_LOGITEM_VALIDATE_BUFFERDESC_EXPECT_DATA);
+ T(log_items[1] == SG_LOGITEM_VALIDATE_BUFFERDESC_EXPECT_ZERO_DATA_SIZE);
+ T(log_items[2] == SG_LOGITEM_VALIDATION_FAILED);
sg_shutdown();
}
@@ -1965,7 +1960,7 @@ UTEST(sokol_gfx, make_buffer_usage_dynamic_expect_no_data) {
setup(&(sg_desc){0});
const uint32_t data[16] = {0};
sg_buffer buf = sg_make_buffer(&(sg_buffer_desc){
- .usage = SG_USAGE_DYNAMIC,
+ .usage.dynamic_update = true,
.data = SG_RANGE(data),
});
T(sg_query_buffer_state(buf) == SG_RESOURCESTATE_FAILED);
@@ -1979,7 +1974,7 @@ UTEST(sokol_gfx, make_buffer_usage_stream_expect_no_data) {
setup(&(sg_desc){0});
const uint32_t data[16] = {0};
sg_buffer buf = sg_make_buffer(&(sg_buffer_desc){
- .usage = SG_USAGE_STREAM,
+ .usage.dynamic_update = true,
.data = SG_RANGE(data),
});
T(sg_query_buffer_state(buf) == SG_RESOURCESTATE_FAILED);
@@ -1993,7 +1988,7 @@ UTEST(sokol_gfx, make_buffer_storagebuffer_not_supported_and_size) {
setup(&(sg_desc){0});
const uint8_t data[10] = {0};
sg_buffer buf = sg_make_buffer(&(sg_buffer_desc){
- .type = SG_BUFFERTYPE_STORAGEBUFFER,
+ .usage.storage_buffer = true,
.data = SG_RANGE(data),
});
T(sg_query_buffer_state(buf) == SG_RESOURCESTATE_FAILED);
@@ -2059,7 +2054,7 @@ UTEST(sokol_gfx, make_image_validate_msaa_no_rt) {
.data.subimage[0][0] = SG_RANGE(pixels),
});
T(sg_query_image_state(img) == SG_RESOURCESTATE_FAILED);
- T(log_items[0] == SG_LOGITEM_VALIDATE_IMAGEDESC_MSAA_BUT_NO_RT);
+ T(log_items[0] == SG_LOGITEM_VALIDATE_IMAGEDESC_MSAA_BUT_NO_ATTACHMENT);
T(log_items[1] == SG_LOGITEM_VALIDATION_FAILED);
sg_shutdown();
}
@@ -2067,14 +2062,14 @@ UTEST(sokol_gfx, make_image_validate_msaa_no_rt) {
UTEST(sokol_gfx, make_image_validate_msaa_num_mipmaps) {
setup(&(sg_desc){0});
sg_image img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.sample_count = 4,
.num_mipmaps = 2,
});
T(sg_query_image_state(img) == SG_RESOURCESTATE_FAILED);
- T(log_items[0] == SG_LOGITEM_VALIDATE_IMAGEDESC_MSAA_NUM_MIPMAPS);
+ T(log_items[0] == SG_LOGITEM_VALIDATE_IMAGEDESC_RENDERATTACHMENT_MSAA_NUM_MIPMAPS);
T(log_items[1] == SG_LOGITEM_VALIDATION_FAILED);
sg_shutdown();
}
@@ -2082,7 +2077,7 @@ UTEST(sokol_gfx, make_image_validate_msaa_num_mipmaps) {
UTEST(sokol_gfx, make_image_validate_msaa_3d_image) {
setup(&(sg_desc){0});
sg_image img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.type = SG_IMAGETYPE_3D,
.width = 32,
.height = 32,
@@ -2090,7 +2085,7 @@ UTEST(sokol_gfx, make_image_validate_msaa_3d_image) {
.sample_count = 4,
});
T(sg_query_image_state(img) == SG_RESOURCESTATE_FAILED);
- T(log_items[0] == SG_LOGITEM_VALIDATE_IMAGEDESC_MSAA_3D_IMAGE);
+ T(log_items[0] == SG_LOGITEM_VALIDATE_IMAGEDESC_RENDERATTACHMENT_MSAA_3D_IMAGE);
T(log_items[1] == SG_LOGITEM_VALIDATION_FAILED);
sg_shutdown();
}
@@ -2098,7 +2093,7 @@ UTEST(sokol_gfx, make_image_validate_msaa_3d_image) {
UTEST(sokol_gfx, make_image_validate_depth_3d_image_with_depth_format) {
setup(&(sg_desc){0});
sg_image img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.type = SG_IMAGETYPE_3D,
.width = 8,
.height = 8,
@@ -2114,13 +2109,15 @@ UTEST(sokol_gfx, make_image_validate_depth_3d_image_with_depth_format) {
UTEST(sokol_gfx, make_image_validate_rt_immutable) {
setup(&(sg_desc){0});
sg_image img = sg_make_image(&(sg_image_desc){
- .render_target = true,
- .usage = SG_USAGE_DYNAMIC,
+ .usage = {
+ .render_attachment = true,
+ .dynamic_update = true,
+ },
.width = 8,
.height = 8,
});
T(sg_query_image_state(img) == SG_RESOURCESTATE_FAILED);
- T(log_items[0] == SG_LOGITEM_VALIDATE_IMAGEDESC_RT_IMMUTABLE);
+ T(log_items[0] == SG_LOGITEM_VALIDATE_IMAGEDESC_ATTACHMENT_EXPECT_IMMUTABLE);
T(log_items[1] == SG_LOGITEM_VALIDATION_FAILED);
sg_shutdown();
}
@@ -2129,9 +2126,9 @@ UTEST(sokol_gfx, make_image_validate_dynamic_no_data) {
setup(&(sg_desc){0});
uint32_t pixels[8][8] = {0};
sg_image img = sg_make_image(&(sg_image_desc){
+ .usage.dynamic_update = true,
.width = 8,
.height = 8,
- .usage = SG_USAGE_DYNAMIC,
.data.subimage[0][0] = SG_RANGE(pixels),
});
T(sg_query_image_state(img) == SG_RESOURCESTATE_FAILED);
@@ -2140,13 +2137,13 @@ UTEST(sokol_gfx, make_image_validate_dynamic_no_data) {
sg_shutdown();
}
-UTEST(sokol_gfx, make_image_valiate_compressed_immutable) {
+UTEST(sokol_gfx, make_image_validate_compressed_immutable) {
setup(&(sg_desc){0});
sg_image img = sg_make_image(&(sg_image_desc){
+ .usage.dynamic_update = true,
.width = 8,
.height = 8,
.pixel_format = SG_PIXELFORMAT_BC1_RGBA,
- .usage = SG_USAGE_DYNAMIC,
});
T(sg_query_image_state(img) == SG_RESOURCESTATE_FAILED);
T(log_items[0] == SG_LOGITEM_VALIDATE_IMAGEDESC_COMPRESSED_IMMUTABLE);
@@ -2293,7 +2290,7 @@ UTEST(sokol_gfx, make_attachments_validate_start_canary) {
sg_attachments atts = sg_make_attachments(&(sg_attachments_desc){
._start_canary = 1234,
.colors[0].image = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
}),
@@ -2307,7 +2304,7 @@ UTEST(sokol_gfx, make_attachments_validate_end_canary) {
setup(&(sg_desc){0});
sg_attachments atts = sg_make_attachments(&(sg_attachments_desc){
.colors[0].image = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
}),
@@ -2321,7 +2318,7 @@ UTEST(sokol_gfx, make_attachments_validate_end_canary) {
UTEST(sokol_gfx, make_attachments_validate_no_cont_color_atts1) {
setup(&(sg_desc){0});
- const sg_image_desc img_desc = { .render_target = true, .width = 64, .height = 64 };
+ const sg_image_desc img_desc = { .usage.render_attachment = true, .width = 64, .height = 64 };
sg_attachments atts = sg_make_attachments(&(sg_attachments_desc){
.colors = {
[0].image = sg_make_image(&img_desc),
@@ -2336,7 +2333,7 @@ UTEST(sokol_gfx, make_attachments_validate_no_cont_color_atts1) {
UTEST(sokol_gfx, make_attachments_validate_image) {
setup(&(sg_desc){0});
- const sg_image_desc img_desc = { .render_target = true, .width = 64, .height = 64 };
+ const sg_image_desc img_desc = { .usage.render_attachment = true, .width = 64, .height = 64 };
const sg_image img0 = sg_make_image(&img_desc);
const sg_image img1 = sg_make_image(&img_desc);
sg_destroy_image(img1);
@@ -2347,7 +2344,7 @@ UTEST(sokol_gfx, make_attachments_validate_image) {
}
});
T(sg_query_attachments_state(atts) == SG_RESOURCESTATE_FAILED);
- T(log_items[0] == SG_LOGITEM_VALIDATE_ATTACHMENTSDESC_IMAGE);
+ T(log_items[0] == SG_LOGITEM_VALIDATE_ATTACHMENTSDESC_COLOR_IMAGE);
T(log_items[1] == SG_LOGITEM_VALIDATION_FAILED);
sg_shutdown();
}
@@ -2355,7 +2352,7 @@ UTEST(sokol_gfx, make_attachments_validate_image) {
UTEST(sokol_gfx, make_attachments_validate_miplevel) {
setup(&(sg_desc){0});
const sg_image img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 16,
.height = 16,
.num_mipmaps = 4,
@@ -2364,7 +2361,7 @@ UTEST(sokol_gfx, make_attachments_validate_miplevel) {
.colors[0] = { .image = img, .mip_level = 4 }
});
T(sg_query_attachments_state(atts) == SG_RESOURCESTATE_FAILED);
- T(log_items[0] == SG_LOGITEM_VALIDATE_ATTACHMENTSDESC_MIPLEVEL);
+ T(log_items[0] == SG_LOGITEM_VALIDATE_ATTACHMENTSDESC_COLOR_MIPLEVEL);
T(log_items[1] == SG_LOGITEM_VALIDATION_FAILED);
sg_shutdown();
}
@@ -2372,7 +2369,7 @@ UTEST(sokol_gfx, make_attachments_validate_miplevel) {
UTEST(sokol_gfx, make_attachments_validate_face) {
setup(&(sg_desc){0});
const sg_image img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.type = SG_IMAGETYPE_CUBE,
.width = 64,
.height = 64,
@@ -2381,7 +2378,7 @@ UTEST(sokol_gfx, make_attachments_validate_face) {
.colors[0] = { .image = img, .slice = 6 }
});
T(sg_query_attachments_state(atts) == SG_RESOURCESTATE_FAILED);
- T(log_items[0] == SG_LOGITEM_VALIDATE_ATTACHMENTSDESC_FACE);
+ T(log_items[0] == SG_LOGITEM_VALIDATE_ATTACHMENTSDESC_COLOR_FACE);
T(log_items[1] == SG_LOGITEM_VALIDATION_FAILED);
sg_shutdown();
}
@@ -2389,7 +2386,7 @@ UTEST(sokol_gfx, make_attachments_validate_face) {
UTEST(sokol_gfx, make_attachments_validate_layer) {
setup(&(sg_desc){0});
const sg_image img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.type = SG_IMAGETYPE_ARRAY,
.width = 64,
.height = 64,
@@ -2399,7 +2396,7 @@ UTEST(sokol_gfx, make_attachments_validate_layer) {
.colors[0] = { .image = img, .slice = 5 },
});
T(sg_query_attachments_state(atts) == SG_RESOURCESTATE_FAILED);
- T(log_items[0] == SG_LOGITEM_VALIDATE_ATTACHMENTSDESC_LAYER);
+ T(log_items[0] == SG_LOGITEM_VALIDATE_ATTACHMENTSDESC_COLOR_LAYER);
T(log_items[1] == SG_LOGITEM_VALIDATION_FAILED);
sg_shutdown();
}
@@ -2407,7 +2404,7 @@ UTEST(sokol_gfx, make_attachments_validate_layer) {
UTEST(sokol_gfx, make_attachments_validate_slice) {
setup(&(sg_desc){0});
const sg_image img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.type = SG_IMAGETYPE_3D,
.width = 64,
.height = 64,
@@ -2417,7 +2414,7 @@ UTEST(sokol_gfx, make_attachments_validate_slice) {
.colors[0] = { .image = img, .slice = 5 },
});
T(sg_query_attachments_state(atts) == SG_RESOURCESTATE_FAILED);
- T(log_items[0] == SG_LOGITEM_VALIDATE_ATTACHMENTSDESC_SLICE);
+ T(log_items[0] == SG_LOGITEM_VALIDATE_ATTACHMENTSDESC_COLOR_SLICE);
T(log_items[1] == SG_LOGITEM_VALIDATION_FAILED);
sg_shutdown();
}
@@ -2425,15 +2422,15 @@ UTEST(sokol_gfx, make_attachments_validate_slice) {
UTEST(sokol_gfx, make_attachments_validate_image_no_rt) {
setup(&(sg_desc){0});
const sg_image img = sg_make_image(&(sg_image_desc){
+ .usage.dynamic_update = true,
.width = 8,
.height = 8,
- .usage = SG_USAGE_DYNAMIC,
});
const sg_attachments atts = sg_make_attachments(&(sg_attachments_desc){
.colors[0].image = img,
});
T(sg_query_attachments_state(atts) == SG_RESOURCESTATE_FAILED);
- T(log_items[0] == SG_LOGITEM_VALIDATE_ATTACHMENTSDESC_IMAGE_NO_RT);
+ T(log_items[0] == SG_LOGITEM_VALIDATE_ATTACHMENTSDESC_COLOR_IMAGE_NO_RENDERATTACHMENT);
T(log_items[1] == SG_LOGITEM_VALIDATION_FAILED);
sg_shutdown();
}
@@ -2441,7 +2438,7 @@ UTEST(sokol_gfx, make_attachments_validate_image_no_rt) {
UTEST(sokol_gfx, make_attachments_validate_color_inv_pixelformat) {
setup(&(sg_desc){0});
const sg_image_desc img_desc = {
- .render_target = true,
+ .usage.render_attachment = true,
.width = 8,
.height = 8,
.pixel_format = SG_PIXELFORMAT_DEPTH,
@@ -2460,7 +2457,7 @@ UTEST(sokol_gfx, make_attachments_validate_color_inv_pixelformat) {
UTEST(sokol_gfx, make_attachments_validate_depth_inv_pixelformat) {
setup(&(sg_desc){0});
const sg_image_desc img_desc = {
- .render_target = true,
+ .usage.render_attachment = true,
.width = 8,
.height = 8,
};
@@ -2477,12 +2474,12 @@ UTEST(sokol_gfx, make_attachments_validate_depth_inv_pixelformat) {
UTEST(sokol_gfx, make_attachments_validate_image_sizes) {
setup(&(sg_desc){0});
const sg_image img0 = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
});
const sg_image img1 = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 32,
.height = 32,
});
@@ -2502,13 +2499,13 @@ UTEST(sokol_gfx, make_attachments_validate_image_sizes) {
UTEST(sokol_gfx, make_attachments_validate_image_sample_counts) {
setup(&(sg_desc){0});
const sg_image img0 = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.sample_count = 4,
});
const sg_image img1 = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.sample_count = 2,
@@ -2528,13 +2525,13 @@ UTEST(sokol_gfx, make_attachments_validate_image_sample_counts) {
UTEST(sokol_gfx, make_attachments_validate_resolve_color_image_msaa) {
setup(&(sg_desc){0});
const sg_image color_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.sample_count = 1,
});
const sg_image resolve_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.sample_count = 1,
@@ -2552,13 +2549,13 @@ UTEST(sokol_gfx, make_attachments_validate_resolve_color_image_msaa) {
UTEST(sokol_gfx, make_attachments_validate_resolve_image) {
setup(&(sg_desc){0});
const sg_image color_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.sample_count = 4,
});
const sg_image resolve_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.sample_count = 1,
@@ -2577,13 +2574,13 @@ UTEST(sokol_gfx, make_attachments_validate_resolve_image) {
UTEST(sokol_gfx, make_attachments_validate_resolve_sample_count) {
setup(&(sg_desc){0});
const sg_image color_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.sample_count = 4,
});
const sg_image resolve_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.sample_count = 4,
@@ -2601,13 +2598,13 @@ UTEST(sokol_gfx, make_attachments_validate_resolve_sample_count) {
UTEST(sokol_gfx, make_attachments_validate_resolve_miplevel) {
setup(&(sg_desc){0});
const sg_image color_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.sample_count = 4,
});
const sg_image resolve_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.sample_count = 1,
@@ -2628,13 +2625,13 @@ UTEST(sokol_gfx, make_attachments_validate_resolve_miplevel) {
UTEST(sokol_gfx, make_attachments_validate_resolve_face) {
setup(&(sg_desc){0});
const sg_image color_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.sample_count = 4,
});
const sg_image resolve_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.type = SG_IMAGETYPE_CUBE,
.width = 64,
.height = 64,
@@ -2653,13 +2650,13 @@ UTEST(sokol_gfx, make_attachments_validate_resolve_face) {
UTEST(sokol_gfx, make_attachments_validate_resolve_layer) {
setup(&(sg_desc){0});
const sg_image color_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.sample_count = 4,
});
const sg_image resolve_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.type = SG_IMAGETYPE_ARRAY,
.width = 64,
.height = 64,
@@ -2679,13 +2676,13 @@ UTEST(sokol_gfx, make_attachments_validate_resolve_layer) {
UTEST(sokol_gfx, make_attachments_validate_resolve_slice) {
setup(&(sg_desc){0});
const sg_image color_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.sample_count = 4,
});
const sg_image resolve_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.type = SG_IMAGETYPE_3D,
.width = 64,
.height = 64,
@@ -2705,15 +2702,15 @@ UTEST(sokol_gfx, make_attachments_validate_resolve_slice) {
UTEST(sokol_gfx, make_attachments_validate_resolve_image_no_rt) {
setup(&(sg_desc){0});
const sg_image color_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.sample_count = 4,
});
const sg_image resolve_img = sg_make_image(&(sg_image_desc){
+ .usage.dynamic_update = true,
.width = 64,
.height = 64,
- .usage = SG_USAGE_DYNAMIC,
.sample_count = 1,
});
const sg_attachments atts = sg_make_attachments(&(sg_attachments_desc){
@@ -2729,13 +2726,13 @@ UTEST(sokol_gfx, make_attachments_validate_resolve_image_no_rt) {
UTEST(sokol_gfx, make_attachments_validate_resolve_image_sizes) {
setup(&(sg_desc){0});
const sg_image color_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.sample_count = 4,
});
const sg_image resolve_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 32,
.height = 32,
.sample_count = 1,
@@ -2754,13 +2751,13 @@ UTEST(sokol_gfx, make_attachments_validate_resolve_image_sizes) {
UTEST(sokol_gfx, make_attachments_validate_resolve_image_format) {
setup(&(sg_desc){0});
const sg_image color_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.sample_count = 4,
});
const sg_image resolve_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.pixel_format = SG_PIXELFORMAT_R8,
@@ -2779,12 +2776,12 @@ UTEST(sokol_gfx, make_attachments_validate_resolve_image_format) {
UTEST(sokol_gfx, make_attachments_validate_depth_image) {
setup(&(sg_desc){0});
const sg_image color_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
});
const sg_image depth_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.pixel_format = SG_PIXELFORMAT_DEPTH,
@@ -2803,12 +2800,12 @@ UTEST(sokol_gfx, make_attachments_validate_depth_image) {
UTEST(sokol_gfx, make_attachments_validate_depth_miplevel) {
setup(&(sg_desc){0});
const sg_image color_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
});
const sg_image depth_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.pixel_format = SG_PIXELFORMAT_DEPTH,
@@ -2829,12 +2826,12 @@ UTEST(sokol_gfx, make_attachments_validate_depth_miplevel) {
UTEST(sokol_gfx, make_attachments_validate_depth_face) {
setup(&(sg_desc){0});
const sg_image color_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
});
const sg_image depth_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.type = SG_IMAGETYPE_CUBE,
.width = 64,
.height = 64,
@@ -2853,12 +2850,12 @@ UTEST(sokol_gfx, make_attachments_validate_depth_face) {
UTEST(sokol_gfx, make_attachments_validate_depth_layer) {
setup(&(sg_desc){0});
const sg_image color_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
});
const sg_image depth_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.type = SG_IMAGETYPE_ARRAY,
.width = 64,
.height = 64,
@@ -2882,12 +2879,12 @@ UTEST(sokol_gfx, make_attachments_validate_depth_layer) {
UTEST(sokol_gfx, make_attachments_validate_depth_image_sizes) {
setup(&(sg_desc){0});
const sg_image color_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
});
const sg_image depth_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 32,
.height = 32,
.pixel_format = SG_PIXELFORMAT_DEPTH,
@@ -2906,13 +2903,13 @@ UTEST(sokol_gfx, make_attachments_validate_depth_image_sizes) {
UTEST(sokol_gfx, make_attachments_validate_depth_image_sample_count) {
setup(&(sg_desc){0});
const sg_image color_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.sample_count = 4,
});
const sg_image depth_img = sg_make_image(&(sg_image_desc){
- .render_target = true,
+ .usage.render_attachment = true,
.width = 64,
.height = 64,
.pixel_format = SG_PIXELFORMAT_DEPTH,