summaryrefslogtreecommitdiff
path: root/pipeline.cpp
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-12-29 13:40:45 +1100
committerquou <quou@disroot.org>2024-12-29 13:41:56 +1100
commit7383cfcbe8ade4dce057608e971e8cb7d4b1feb7 (patch)
tree6e00d45e89c46560b2a6de6729781e6079c678d7 /pipeline.cpp
parentc41a63370e54cc1e6e0c1b1dc20e219f3cac2845 (diff)
allow binding only a portion of a cbuffer
Diffstat (limited to 'pipeline.cpp')
-rw-r--r--pipeline.cpp11
1 files changed, 10 insertions, 1 deletions
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;
}
}