Add renderer scissor state contract
This commit is contained in:
@@ -2272,6 +2272,18 @@ int record_render(int argc, char** argv)
|
||||
return 2;
|
||||
}
|
||||
|
||||
const auto scissor_status = context.set_scissor(pp::renderer::ScissorRect {
|
||||
.enabled = true,
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = args.width,
|
||||
.height = args.height,
|
||||
});
|
||||
if (!scissor_status.ok()) {
|
||||
print_error("record-render", scissor_status.message);
|
||||
return 2;
|
||||
}
|
||||
|
||||
const auto shader_status = context.bind_shader(shader);
|
||||
const auto blend_status = context.set_blend_state(pp::renderer::BlendState {
|
||||
.enabled = true,
|
||||
@@ -2348,6 +2360,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 bind_texture_commands = 0;
|
||||
std::size_t upload_commands = 0;
|
||||
@@ -2365,6 +2378,8 @@ int record_render(int argc, char** argv)
|
||||
for (const auto& command : commands) {
|
||||
if (command.kind == pp::renderer::RecordedRenderCommandKind::draw) {
|
||||
++draw_commands;
|
||||
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::set_scissor) {
|
||||
++scissor_commands;
|
||||
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::set_blend_state) {
|
||||
++blend_commands;
|
||||
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::bind_texture) {
|
||||
@@ -2398,6 +2413,7 @@ int record_render(int argc, char** argv)
|
||||
<< ",\"format\":\"rgba8\"}"
|
||||
<< ",\"commands\":" << commands.size()
|
||||
<< ",\"drawCommands\":" << draw_commands
|
||||
<< ",\"scissorCommands\":" << scissor_commands
|
||||
<< ",\"blendCommands\":" << blend_commands
|
||||
<< ",\"bindTextureCommands\":" << bind_texture_commands
|
||||
<< ",\"boundTextureBytes\":" << bound_texture_bytes
|
||||
|
||||
Reference in New Issue
Block a user