summaryrefslogtreecommitdiff
path: root/pipeline.cpp
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-12-26 22:06:57 +1100
committerquou <quou@disroot.org>2024-12-26 22:06:57 +1100
commit7fa078995b3ed62925788ce2460441bc3d373392 (patch)
tree3ea7cb6288319ed56b28b7443d628a4f40a4e5fd /pipeline.cpp
parentdac7103df9f748d3409ac87ac3d015e329f6c7f5 (diff)
constant buffers
Diffstat (limited to 'pipeline.cpp')
-rw-r--r--pipeline.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/pipeline.cpp b/pipeline.cpp
index 527c1e7..89f606d 100644
--- a/pipeline.cpp
+++ b/pipeline.cpp
@@ -56,6 +56,17 @@ void Pipeline_Builder::texture(
td->texture = t;
}
+void Pipeline_Builder::cbuffer(int binding, Buffer_Id id) {
+ Descriptor* d;
+ Constant_Buffer_Descriptor* cd;
+ assert(pip->descriptor_count < pipeline_max_descriptors);
+ d = &pip->descriptors[pip->descriptor_count++];
+ cd = (Constant_Buffer_Descriptor*)d->payload;
+ d->slot = binding;
+ d->type = Descriptor::Type::constant_buffer;
+ cd->buffer = id;
+}
+
void Pipeline_Builder::vertex_format(Vertex_Format_Id vf) {
pip->vertex_format = vf;
}
@@ -83,6 +94,10 @@ Pipeline& Pipeline_Builder::build() {
h(pip->descriptor_resource_hash, td->sampler);
h(pip->descriptor_resource_hash, td->texture);
} break;
+ case Descriptor::Type::constant_buffer: {
+ auto cd = (Constant_Buffer_Descriptor*)d->payload;
+ h(pip->descriptor_resource_hash, cd->buffer);
+ } break;
}
}
}