Skip to content

Commit

Permalink
msvc doesn't like VLA arg syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
rajveermalviya committed Oct 4, 2023
1 parent b101dbc commit ffc7c21
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion examples/framework/framework.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ WGPUShaderModule frmwrk_load_shader_module(WGPUDevice device,
#define MAX(A, B) ((A) > (B) ? (A) : (B))

WGPUBuffer frmwrk_device_create_buffer_init(
WGPUDevice device, frmwrk_buffer_init_descriptor descriptor[static 1]) {
WGPUDevice device, const frmwrk_buffer_init_descriptor *descriptor) {
assert(descriptor);
if (descriptor->content_size == 0) {
return wgpuDeviceCreateBuffer(device, &(WGPUBufferDescriptor){
.label = descriptor->label,
Expand Down
2 changes: 1 addition & 1 deletion examples/framework/framework.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ void frmwrk_setup_logging(WGPULogLevel level);
WGPUShaderModule frmwrk_load_shader_module(WGPUDevice device, const char *name);
void frmwrk_print_global_report(WGPUGlobalReport report);
WGPUBuffer frmwrk_device_create_buffer_init(
WGPUDevice device, frmwrk_buffer_init_descriptor descriptor[static 1]);
WGPUDevice device, const frmwrk_buffer_init_descriptor *descriptor);

#endif // FRAMEWORK_H
16 changes: 8 additions & 8 deletions examples/texture_arrays/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ int main(int argc, char *argv[]) {

wgpuAdapterRequestDevice(
demo.adapter,
&(WGPUDeviceDescriptor){
&(const WGPUDeviceDescriptor){
.requiredFeatureCount = required_device_feature_count,
.requiredFeatures = required_device_features,
},
Expand Down Expand Up @@ -327,7 +327,7 @@ int main(int argc, char *argv[]) {
printf("Using fragment entry point: '%s'\n", fragment_entry_point);

WGPUBuffer vertex_buffer = frmwrk_device_create_buffer_init(
demo.device, &(frmwrk_buffer_init_descriptor){
demo.device, &(const frmwrk_buffer_init_descriptor){
.label = "Vertex Buffer",
.content = (void *)vertices,
.content_size = sizeof(vertices),
Expand All @@ -336,7 +336,7 @@ int main(int argc, char *argv[]) {
assert(vertex_buffer);

WGPUBuffer index_buffer = frmwrk_device_create_buffer_init(
demo.device, &(frmwrk_buffer_init_descriptor){
demo.device, &(const frmwrk_buffer_init_descriptor){
.label = "Index Buffer",
.content = (void *)indices,
.content_size = sizeof(indices),
Expand All @@ -349,7 +349,7 @@ int main(int argc, char *argv[]) {
[64] = 1,
};
WGPUBuffer texture_index_buffer = frmwrk_device_create_buffer_init(
demo.device, &(frmwrk_buffer_init_descriptor){
demo.device, &(const frmwrk_buffer_init_descriptor){
.label = "Texture Index Buffer",
.content = texture_index_buffer_contents,
.content_size = sizeof(texture_index_buffer_contents),
Expand All @@ -374,25 +374,25 @@ int main(int argc, char *argv[]) {
/* clang-format on */

WGPUTexture red_texture = wgpuDeviceCreateTexture(
demo.device, &(WGPUTextureDescriptor){
demo.device, &(const WGPUTextureDescriptor){
COLOR_TEXTURE_DESCRIPTOR_COMMON_FIELDS,
.label = "red",
});
assert(red_texture);
WGPUTexture green_texture = wgpuDeviceCreateTexture(
demo.device, &(WGPUTextureDescriptor){
demo.device, &(const WGPUTextureDescriptor){
COLOR_TEXTURE_DESCRIPTOR_COMMON_FIELDS,
.label = "green",
});
assert(green_texture);
WGPUTexture blue_texture = wgpuDeviceCreateTexture(
demo.device, &(WGPUTextureDescriptor){
demo.device, &(const WGPUTextureDescriptor){
COLOR_TEXTURE_DESCRIPTOR_COMMON_FIELDS,
.label = "blue",
});
assert(blue_texture);
WGPUTexture white_texture = wgpuDeviceCreateTexture(
demo.device, &(WGPUTextureDescriptor){
demo.device, &(const WGPUTextureDescriptor){
COLOR_TEXTURE_DESCRIPTOR_COMMON_FIELDS,
.label = "white",
});
Expand Down

0 comments on commit ffc7c21

Please sign in to comment.