Add renderer shader uniform command
This commit is contained in:
@@ -2234,6 +2234,7 @@ int record_render(int argc, char** argv)
|
||||
std::byte { 0xff },
|
||||
std::byte { 0xff },
|
||||
};
|
||||
const std::array<std::byte, 64> uniform_mvp {};
|
||||
static constexpr char shader_source[] = "void main() {}";
|
||||
const auto shader = device.create_shader_program(pp::renderer::ShaderProgramDesc {
|
||||
.debug_name = "pano-cli-record-render",
|
||||
@@ -2322,6 +2323,7 @@ int record_render(int argc, char** argv)
|
||||
}
|
||||
|
||||
const auto shader_status = context.bind_shader(*shader.value());
|
||||
const auto uniform_status = context.set_shader_uniform("mvp", uniform_mvp);
|
||||
const auto blend_status = context.set_blend_state(pp::renderer::BlendState {
|
||||
.enabled = true,
|
||||
.source_color = pp::renderer::BlendFactor::source_alpha,
|
||||
@@ -2351,6 +2353,10 @@ int record_render(int argc, char** argv)
|
||||
print_error("record-render", shader_status.message);
|
||||
return 2;
|
||||
}
|
||||
if (!uniform_status.ok()) {
|
||||
print_error("record-render", uniform_status.message);
|
||||
return 2;
|
||||
}
|
||||
if (!blend_status.ok()) {
|
||||
print_error("record-render", blend_status.message);
|
||||
return 2;
|
||||
@@ -2421,6 +2427,7 @@ int record_render(int argc, char** argv)
|
||||
std::size_t scissor_commands = 0;
|
||||
std::size_t blend_commands = 0;
|
||||
std::size_t depth_commands = 0;
|
||||
std::size_t uniform_commands = 0;
|
||||
std::size_t bind_texture_commands = 0;
|
||||
std::size_t bind_sampler_commands = 0;
|
||||
std::size_t upload_commands = 0;
|
||||
@@ -2430,6 +2437,7 @@ int record_render(int argc, char** argv)
|
||||
std::size_t trace_markers = 0;
|
||||
std::uint64_t draw_vertices = 0;
|
||||
std::uint64_t draw_indices = 0;
|
||||
std::uint64_t uniform_bytes = 0;
|
||||
std::uint64_t upload_bytes = 0;
|
||||
std::uint64_t bound_texture_bytes = 0;
|
||||
std::uint64_t readback_bytes = 0;
|
||||
@@ -2448,6 +2456,9 @@ int record_render(int argc, char** argv)
|
||||
++blend_commands;
|
||||
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::set_depth_state) {
|
||||
++depth_commands;
|
||||
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::set_shader_uniform) {
|
||||
++uniform_commands;
|
||||
uniform_bytes += command.uniform_bytes;
|
||||
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::bind_texture) {
|
||||
++bind_texture_commands;
|
||||
const auto bound_bytes = pp::renderer::texture_byte_size(command.texture_desc);
|
||||
@@ -2487,6 +2498,8 @@ int record_render(int argc, char** argv)
|
||||
<< ",\"scissorCommands\":" << scissor_commands
|
||||
<< ",\"blendCommands\":" << blend_commands
|
||||
<< ",\"depthCommands\":" << depth_commands
|
||||
<< ",\"uniformCommands\":" << uniform_commands
|
||||
<< ",\"uniformBytes\":" << uniform_bytes
|
||||
<< ",\"bindTextureCommands\":" << bind_texture_commands
|
||||
<< ",\"bindSamplerCommands\":" << bind_sampler_commands
|
||||
<< ",\"boundTextureBytes\":" << bound_texture_bytes
|
||||
|
||||
Reference in New Issue
Block a user