Skip to content

Commit

Permalink
Adjust the C output for Metal
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Oct 6, 2023
1 parent 720a716 commit e46c8fb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Sources/integrations/c.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ void c_export(char *directory, api_kind api) {

fprintf(output, "#include \"kong.h\"\n\n");

if (api == API_WEBGPU) {
if (api == API_METAL) {
// Code is added directly to the Xcode project instead
}
else if (api == API_WEBGPU) {
fprintf(output, "#include \"wgsl.h\"\n");
}
else {
Expand Down Expand Up @@ -317,7 +320,7 @@ void c_export(char *directory, api_kind api) {

for (size_t j = 0; j < t->members.size; ++j) {
if (t->members.m[j].name == add_name("vertex")) {
if (api == API_WEBGPU) {
if (api == API_METAL || api == API_WEBGPU) {
fprintf(output, "\tkinc_g4_shader_init(&%s, \"%s\", 0, KINC_G4_SHADER_TYPE_VERTEX);\n", get_name(t->members.m[j].value.identifier),
get_name(t->members.m[j].value.identifier));
}
Expand All @@ -330,7 +333,7 @@ void c_export(char *directory, api_kind api) {
vertex_shader_name = t->members.m[j].value.identifier;
}
else if (t->members.m[j].name == add_name("fragment")) {
if (api == API_WEBGPU) {
if (api == API_METAL || api == API_WEBGPU) {
fprintf(output, "\tkinc_g4_shader_init(&%s, \"%s\", 0, KINC_G4_SHADER_TYPE_FRAGMENT);\n",
get_name(t->members.m[j].value.identifier), get_name(t->members.m[j].value.identifier));
}
Expand Down

0 comments on commit e46c8fb

Please sign in to comment.