Skip to content

Commit

Permalink
Support try_to_lock functions
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Sep 30, 2024
1 parent 4911de6 commit b6989d1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Sources/integrations/kope.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ void kope_export(char *directory, api_kind api) {
fprintf(output, "void %s_buffer_create(kope_g5_device *device, kope_g5_buffer *buffer);\n", name);
fprintf(output, "void %s_buffer_destroy(kope_g5_buffer *buffer);\n", name);
fprintf(output, "%s *%s_buffer_lock(kope_g5_buffer *buffer);\n", name, name);
fprintf(output, "%s *%s_buffer_try_to_lock(kope_g5_buffer *buffer);\n", name, name);
fprintf(output, "void %s_buffer_unlock(kope_g5_buffer *buffer);\n", name);
}
}
Expand Down Expand Up @@ -723,6 +724,7 @@ void kope_export(char *directory, api_kind api) {

fprintf(output, "void kong_create_buffer_%s(kope_g5_device * device, size_t count, %s_buffer *buffer);\n", get_name(t->name), get_name(t->name));
fprintf(output, "%s *kong_%s_buffer_lock(%s_buffer *buffer);\n", get_name(t->name), get_name(t->name), get_name(t->name));
fprintf(output, "%s *kong_%s_buffer_try_to_lock(%s_buffer *buffer);\n", get_name(t->name), get_name(t->name), get_name(t->name));
fprintf(output, "void kong_%s_buffer_unlock(%s_buffer *buffer);\n", get_name(t->name), get_name(t->name));
fprintf(output, "void kong_set_vertex_buffer_%s(kope_g5_command_list *list, %s_buffer *buffer);\n\n", get_name(t->name), get_name(t->name));
}
Expand Down Expand Up @@ -824,6 +826,10 @@ void kope_export(char *directory, api_kind api) {
fprintf(output, "\treturn (%s *)kope_d3d12_buffer_lock(&buffer->buffer);\n", get_name(t->name));
fprintf(output, "}\n\n");

fprintf(output, "%s *kong_%s_buffer_try_to_lock(%s_buffer *buffer) {\n", get_name(t->name), get_name(t->name), get_name(t->name));
fprintf(output, "\treturn (%s *)kope_d3d12_buffer_try_to_lock(&buffer->buffer);\n", get_name(t->name));
fprintf(output, "}\n\n");

fprintf(output, "void kong_%s_buffer_unlock(%s_buffer *buffer) {\n", get_name(t->name), get_name(t->name));
fprintf(output, "\tkope_d3d12_buffer_unlock(&buffer->buffer);\n");
fprintf(output, "}\n\n");
Expand Down Expand Up @@ -898,6 +904,10 @@ void kope_export(char *directory, api_kind api) {
fprintf(output, "\treturn (%s *)kope_g5_buffer_lock(buffer);\n", type_name);
fprintf(output, "}\n\n");

fprintf(output, "%s *%s_buffer_try_to_lock(kope_g5_buffer *buffer) {\n", type_name, type_name);
fprintf(output, "\treturn (%s *)kope_g5_buffer_try_to_lock(buffer);\n", type_name);
fprintf(output, "}\n\n");

fprintf(output, "void %s_buffer_unlock(kope_g5_buffer *buffer) {\n", type_name);
if (api != API_OPENGL) {
bool has_matrices = false;
Expand Down

0 comments on commit b6989d1

Please sign in to comment.