Add renderer shader uniform command

This commit is contained in:
2026-06-02 16:15:23 +02:00
parent 23c308db1b
commit 8232b0efc8
9 changed files with 189 additions and 21 deletions

View File

@@ -208,6 +208,30 @@ pp::foundation::Status RecordingCommandContext::bind_shader(IShaderProgram& shad
return pp::foundation::Status::success();
}
pp::foundation::Status RecordingCommandContext::set_shader_uniform(
const char* name,
std::span<const std::byte> bytes) noexcept
{
if (!in_render_pass_) {
return pp::foundation::Status::invalid_argument("render pass has not begun");
}
if (!shader_bound_) {
return pp::foundation::Status::invalid_argument("shader must be bound before setting uniforms");
}
const auto status = validate_shader_uniform_write(name, bytes);
if (!status.ok()) {
return status;
}
push_command(commands_, RecordedRenderCommand {
.kind = RecordedRenderCommandKind::set_shader_uniform,
.uniform_bytes = static_cast<std::uint64_t>(bytes.size()),
.name = name,
});
return pp::foundation::Status::success();
}
pp::foundation::Status RecordingCommandContext::bind_texture(
std::uint32_t slot,
ITexture2D& texture) noexcept
@@ -574,6 +598,8 @@ const char* recorded_render_command_kind_name(RecordedRenderCommandKind kind) no
return "set_depth_state";
case RecordedRenderCommandKind::bind_shader:
return "bind_shader";
case RecordedRenderCommandKind::set_shader_uniform:
return "set_shader_uniform";
case RecordedRenderCommandKind::bind_texture:
return "bind_texture";
case RecordedRenderCommandKind::bind_sampler: