Add renderer depth state contract
This commit is contained in:
@@ -2292,6 +2292,11 @@ int record_render(int argc, char** argv)
|
||||
.source_alpha = pp::renderer::BlendFactor::one,
|
||||
.destination_alpha = pp::renderer::BlendFactor::one_minus_source_alpha,
|
||||
});
|
||||
const auto depth_status = context.set_depth_state(pp::renderer::DepthState {
|
||||
.test_enabled = true,
|
||||
.write_enabled = true,
|
||||
.compare = pp::renderer::CompareOp::less_or_equal,
|
||||
});
|
||||
const auto bind_texture_status = context.bind_texture(0, texture);
|
||||
const auto mesh_status = context.bind_mesh(mesh);
|
||||
const auto draw_status = context.draw();
|
||||
@@ -2305,6 +2310,10 @@ int record_render(int argc, char** argv)
|
||||
print_error("record-render", blend_status.message);
|
||||
return 2;
|
||||
}
|
||||
if (!depth_status.ok()) {
|
||||
print_error("record-render", depth_status.message);
|
||||
return 2;
|
||||
}
|
||||
if (!bind_texture_status.ok()) {
|
||||
print_error("record-render", bind_texture_status.message);
|
||||
return 2;
|
||||
@@ -2362,6 +2371,7 @@ int record_render(int argc, char** argv)
|
||||
std::size_t draw_commands = 0;
|
||||
std::size_t scissor_commands = 0;
|
||||
std::size_t blend_commands = 0;
|
||||
std::size_t depth_commands = 0;
|
||||
std::size_t bind_texture_commands = 0;
|
||||
std::size_t upload_commands = 0;
|
||||
std::size_t readback_commands = 0;
|
||||
@@ -2382,6 +2392,8 @@ int record_render(int argc, char** argv)
|
||||
++scissor_commands;
|
||||
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::set_blend_state) {
|
||||
++blend_commands;
|
||||
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::set_depth_state) {
|
||||
++depth_commands;
|
||||
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::bind_texture) {
|
||||
++bind_texture_commands;
|
||||
const auto bound_bytes = pp::renderer::texture_byte_size(command.texture_desc);
|
||||
@@ -2415,6 +2427,7 @@ int record_render(int argc, char** argv)
|
||||
<< ",\"drawCommands\":" << draw_commands
|
||||
<< ",\"scissorCommands\":" << scissor_commands
|
||||
<< ",\"blendCommands\":" << blend_commands
|
||||
<< ",\"depthCommands\":" << depth_commands
|
||||
<< ",\"bindTextureCommands\":" << bind_texture_commands
|
||||
<< ",\"boundTextureBytes\":" << bound_texture_bytes
|
||||
<< ",\"uploadCommands\":" << upload_commands
|
||||
|
||||
Reference in New Issue
Block a user