From 7383cfcbe8ade4dce057608e971e8cb7d4b1feb7 Mon Sep 17 00:00:00 2001 From: quou Date: Sun, 29 Dec 2024 13:40:45 +1100 Subject: allow binding only a portion of a cbuffer --- video.hpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'video.hpp') diff --git a/video.hpp b/video.hpp index fa479f1..1ccc93d 100644 --- a/video.hpp +++ b/video.hpp @@ -44,7 +44,7 @@ struct Sampler_Id : public Primitive_Id { using Primitive_Id::Primitive_Id; }; -#define descriptor_payload_size 8 +#define descriptor_payload_size 16 struct Descriptor { enum class Type { @@ -61,6 +61,7 @@ struct Texture_Descriptor { }; struct Constant_Buffer_Descriptor { + int offset, size; Buffer_Id buffer; }; @@ -146,6 +147,8 @@ struct Pipeline { Constant_Buffer_Descriptor* cb = (Constant_Buffer_Descriptor*)b.payload; if (ca->buffer != cb->buffer) return false; + if (ca->size != cb->size) return false; + if (ca->offset != cb->offset) return false; } break; } } @@ -254,7 +257,12 @@ struct Pipeline_Builder { void shader(Shader_Id s); void vertex_format(Vertex_Format_Id vf); void texture(int binding, Texture_Id t, Sampler_Id s); - void cbuffer(int binding, Buffer_Id id); + void cbuffer( + int binding, + Buffer_Id id, + int offset = 0, + int size = 0 + ); Pipeline& build(); void validate(); }; -- cgit v1.2.3-54-g00ecf