Validate OpenGL texture binding slots

This commit is contained in:
2026-06-02 21:14:07 +02:00
parent d664e9fc39
commit 55b725e876
7 changed files with 99 additions and 17 deletions

View File

@@ -191,12 +191,16 @@ OpenGlPlannedCommand plan_recorded_render_command(pp::renderer::RecordedRenderCo
case pp::renderer::RecordedRenderCommandKind::bind_texture:
planned.kind = OpenGlPlannedCommandKind::bind_texture;
planned.texture_format = texture_format_for_renderer_format(command.texture_desc.format);
planned.supported = texture_format_supported(planned.texture_format);
planned.texture_slot = command.texture_slot;
planned.supported = texture_format_supported(planned.texture_format)
&& planned.texture_slot < pp::renderer::max_texture_slots;
break;
case pp::renderer::RecordedRenderCommandKind::bind_sampler:
planned.kind = OpenGlPlannedCommandKind::bind_sampler;
planned.sampler = sampler_state_for_renderer_sampler_desc(command.sampler_desc);
planned.supported = planned.sampler.supported;
planned.sampler_slot = command.sampler_slot;
planned.supported = planned.sampler.supported
&& planned.sampler_slot < pp::renderer::max_texture_slots;
break;
case pp::renderer::RecordedRenderCommandKind::bind_mesh:
planned.kind = OpenGlPlannedCommandKind::bind_mesh;
@@ -346,6 +350,18 @@ OpenGlCommandPlan plan_recorded_render_commands(
record_dependency_error(plan, index);
}
break;
case OpenGlPlannedCommandKind::bind_texture:
++plan.texture_bind_command_count;
if (!in_render_pass) {
record_render_pass_order_error(plan, index);
}
break;
case OpenGlPlannedCommandKind::bind_sampler:
++plan.sampler_bind_command_count;
if (!in_render_pass) {
record_render_pass_order_error(plan, index);
}
break;
case OpenGlPlannedCommandKind::bind_mesh:
if (!in_render_pass) {
record_render_pass_order_error(plan, index);

View File

@@ -53,6 +53,8 @@ struct OpenGlPlannedCommand {
pp::renderer::ReadbackRegion readback_region;
pp::renderer::ReadbackRegion source_region;
pp::renderer::ReadbackRegion destination_region;
std::uint32_t texture_slot = 0;
std::uint32_t sampler_slot = 0;
std::uint64_t upload_bytes = 0;
std::uint32_t generated_mip_levels = 0;
std::uint64_t generated_mip_bytes = 0;
@@ -79,6 +81,8 @@ struct OpenGlCommandPlan {
std::uint32_t draw_command_count = 0;
std::uint32_t shader_bind_command_count = 0;
std::uint32_t uniform_command_count = 0;
std::uint32_t texture_bind_command_count = 0;
std::uint32_t sampler_bind_command_count = 0;
std::uint32_t upload_command_count = 0;
std::uint32_t mipmap_command_count = 0;
std::uint32_t transition_command_count = 0;