Skip to content

Commit

Permalink
Bind individual mip levels
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Sep 21, 2024
1 parent 2558adb commit 1cf1016
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions Sources/integrations/kope.c
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,7 @@ void kope_export(char *directory, api_kind api) {
case DEFINITION_TEX2D:
case DEFINITION_TEXCUBE:
fprintf(output, "\tkope_g5_texture *%s;\n", get_name(get_global(d.global)->name));
fprintf(output, "\tuint32_t %s_mip_level;\n", get_name(get_global(d.global)->name));
break;
case DEFINITION_SAMPLER:
fprintf(output, "\tkope_g5_sampler *%s;\n", get_name(get_global(d.global)->name));
Expand Down Expand Up @@ -692,6 +693,7 @@ void kope_export(char *directory, api_kind api) {
case DEFINITION_TEX2D:
case DEFINITION_TEXCUBE:
fprintf(output, "\tkope_g5_texture *%s;\n", get_name(get_global(d.global)->name));
fprintf(output, "\tuint32_t %s_mip_level;\n", get_name(get_global(d.global)->name));
break;
}
}
Expand Down Expand Up @@ -995,14 +997,18 @@ void kope_export(char *directory, api_kind api) {
case DEFINITION_TEX2D: {
attribute *write_attribute = find_attribute(&get_global(d.global)->attributes, add_name("write"));
if (write_attribute != NULL) {
fprintf(output, "\tkope_d3d12_descriptor_set_set_texture_view_uav(device, &set->set, parameters->%s, %" PRIu64 ");\n",
get_name(get_global(d.global)->name), other_index);
fprintf(output,
"\tkope_d3d12_descriptor_set_set_texture_view_uav(device, &set->set, parameters->%s, parameters->%s_mip_level, %" PRIu64 ");\n",
get_name(get_global(d.global)->name), get_name(get_global(d.global)->name), other_index);
}
else {
fprintf(output, "\tkope_d3d12_descriptor_set_set_texture_view_srv(device, &set->set, parameters->%s, %" PRIu64 ");\n",
get_name(get_global(d.global)->name), other_index);
fprintf(output,
"\tkope_d3d12_descriptor_set_set_texture_view_srv(device, &set->set, parameters->%s, parameters->%s_mip_level, %" PRIu64 ");\n",
get_name(get_global(d.global)->name), get_name(get_global(d.global)->name), other_index);
}
fprintf(output, "\tset->%s = parameters->%s;\n", get_name(get_global(d.global)->name), get_name(get_global(d.global)->name));
fprintf(output, "\tset->%s_mip_level = parameters->%s_mip_level;\n", get_name(get_global(d.global)->name),
get_name(get_global(d.global)->name));
other_index += 1;
break;
}
Expand Down Expand Up @@ -1039,10 +1045,12 @@ void kope_export(char *directory, api_kind api) {
case DEFINITION_TEXCUBE: {
attribute *write_attribute = find_attribute(&get_global(d.global)->attributes, add_name("write"));
if (write_attribute != NULL) {
fprintf(output, "\tkope_d3d12_descriptor_set_prepare_uav_texture(list, set->%s);\n", get_name(get_global(d.global)->name));
fprintf(output, "\tkope_d3d12_descriptor_set_prepare_uav_texture(list, set->%s, set->%s_mip_level);\n",
get_name(get_global(d.global)->name), get_name(get_global(d.global)->name));
}
else {
fprintf(output, "\tkope_d3d12_descriptor_set_prepare_srv_texture(list, set->%s);\n", get_name(get_global(d.global)->name));
fprintf(output, "\tkope_d3d12_descriptor_set_prepare_srv_texture(list, set->%s, set->%s_mip_level);\n",
get_name(get_global(d.global)->name), get_name(get_global(d.global)->name));
}
break;
}
Expand Down

0 comments on commit 1cf1016

Please sign in to comment.