Add renderer texture binding contract
This commit is contained in:
@@ -2273,6 +2273,7 @@ int record_render(int argc, char** argv)
|
||||
}
|
||||
|
||||
const auto shader_status = context.bind_shader(shader);
|
||||
const auto bind_texture_status = context.bind_texture(0, texture);
|
||||
const auto mesh_status = context.bind_mesh(mesh);
|
||||
const auto draw_status = context.draw();
|
||||
context.end_render_pass();
|
||||
@@ -2281,6 +2282,10 @@ int record_render(int argc, char** argv)
|
||||
print_error("record-render", shader_status.message);
|
||||
return 2;
|
||||
}
|
||||
if (!bind_texture_status.ok()) {
|
||||
print_error("record-render", bind_texture_status.message);
|
||||
return 2;
|
||||
}
|
||||
if (!mesh_status.ok()) {
|
||||
print_error("record-render", mesh_status.message);
|
||||
return 2;
|
||||
@@ -2332,12 +2337,14 @@ int record_render(int argc, char** argv)
|
||||
}
|
||||
|
||||
std::size_t draw_commands = 0;
|
||||
std::size_t bind_texture_commands = 0;
|
||||
std::size_t upload_commands = 0;
|
||||
std::size_t readback_commands = 0;
|
||||
std::size_t capture_commands = 0;
|
||||
std::size_t blit_commands = 0;
|
||||
std::size_t trace_markers = 0;
|
||||
std::uint64_t upload_bytes = 0;
|
||||
std::uint64_t bound_texture_bytes = 0;
|
||||
std::uint64_t readback_bytes = 0;
|
||||
std::uint64_t capture_bytes = 0;
|
||||
std::uint64_t blit_source_bytes = 0;
|
||||
@@ -2346,6 +2353,12 @@ 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::bind_texture) {
|
||||
++bind_texture_commands;
|
||||
const auto bound_bytes = pp::renderer::texture_byte_size(command.texture_desc);
|
||||
if (bound_bytes.ok()) {
|
||||
bound_texture_bytes += bound_bytes.value();
|
||||
}
|
||||
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::upload_texture) {
|
||||
++upload_commands;
|
||||
upload_bytes += command.upload_bytes;
|
||||
@@ -2371,6 +2384,8 @@ int record_render(int argc, char** argv)
|
||||
<< ",\"format\":\"rgba8\"}"
|
||||
<< ",\"commands\":" << commands.size()
|
||||
<< ",\"drawCommands\":" << draw_commands
|
||||
<< ",\"bindTextureCommands\":" << bind_texture_commands
|
||||
<< ",\"boundTextureBytes\":" << bound_texture_bytes
|
||||
<< ",\"uploadCommands\":" << upload_commands
|
||||
<< ",\"uploadBytes\":" << upload_bytes
|
||||
<< ",\"readbackCommands\":" << readback_commands
|
||||
|
||||
Reference in New Issue
Block a user