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 --- pipeline.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'pipeline.cpp') diff --git a/pipeline.cpp b/pipeline.cpp index 8867a8d..8750db0 100644 --- a/pipeline.cpp +++ b/pipeline.cpp @@ -185,7 +185,12 @@ void Pipeline_Builder::texture( td->texture = t; } -void Pipeline_Builder::cbuffer(int binding, Buffer_Id id) { +void Pipeline_Builder::cbuffer( + int binding, + Buffer_Id id, + int offset, + int size +) { Descriptor* d; Constant_Buffer_Descriptor* cd; assert(pip->descriptor_count < pipeline_max_descriptors); @@ -194,6 +199,8 @@ void Pipeline_Builder::cbuffer(int binding, Buffer_Id id) { d->slot = binding; d->type = Descriptor::Type::constant_buffer; cd->buffer = id; + cd->offset = offset; + cd->size = size; } void Pipeline_Builder::vertex_format(Vertex_Format_Id vf) { @@ -237,6 +244,8 @@ Pipeline& Pipeline_Builder::build() { case Descriptor::Type::constant_buffer: { auto cd = (Constant_Buffer_Descriptor*)d->payload; h(pip->descriptor_resource_hash, cd->buffer); + h(pip->descriptor_resource_hash, cd->size); + h(pip->descriptor_resource_hash, cd->offset); } break; } } -- cgit v1.2.3-54-g00ecf