summaryrefslogtreecommitdiff
path: root/pipeline.cpp
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2025-02-09 18:49:00 +1100
committerquou <quou@disroot.org>2025-02-09 18:51:30 +1100
commit8c644dd120c63244f4b576b45cd4ae96842736f8 (patch)
tree6074b73b48f391634f6b8fd431d2391de3a2dbfc /pipeline.cpp
parentdf87506693471686140282e79f5513dfc27a7854 (diff)
support for structured buffers
Diffstat (limited to 'pipeline.cpp')
-rw-r--r--pipeline.cpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/pipeline.cpp b/pipeline.cpp
index 30c110c..647ff49 100644
--- a/pipeline.cpp
+++ b/pipeline.cpp
@@ -232,10 +232,10 @@ void Pipeline_Builder::cbuffer(
int size
) {
Descriptor* d;
- Constant_Buffer_Descriptor* cd;
+ Buffer_Descriptor* cd;
assert(pip->descriptor_count < pipeline_max_descriptors);
d = &pip->descriptors[pip->descriptor_count++];
- cd = (Constant_Buffer_Descriptor*)d->payload;
+ cd = (Buffer_Descriptor*)d->payload;
d->slot = binding;
d->type = Descriptor::Type::constant_buffer;
cd->buffer = id;
@@ -243,6 +243,24 @@ void Pipeline_Builder::cbuffer(
cd->size = size;
}
+void Pipeline_Builder::sbuffer(
+ int binding,
+ Buffer_Id id,
+ int offset,
+ int size
+) {
+ Descriptor* d;
+ Buffer_Descriptor* cd;
+ assert(pip->descriptor_count < pipeline_max_descriptors);
+ d = &pip->descriptors[pip->descriptor_count++];
+ cd = (Buffer_Descriptor*)d->payload;
+ d->slot = binding;
+ d->type = Descriptor::Type::structured_buffer;
+ cd->buffer = id;
+ cd->offset = offset;
+ cd->size = size;
+}
+
void Pipeline_Builder::vertex_format(Vertex_Format_Id vf) {
pip->vertex_format = vf;
}
@@ -295,8 +313,9 @@ void Pipeline::hash() {
h(descriptor_resource_hash, td->sampler);
h(descriptor_resource_hash, td->texture);
} break;
- case Descriptor::Type::constant_buffer: {
- auto cd = (Constant_Buffer_Descriptor*)d->payload;
+ case Descriptor::Type::constant_buffer:
+ case Descriptor::Type::structured_buffer: {
+ auto cd = (Buffer_Descriptor*)d->payload;
h(descriptor_resource_hash, cd->buffer);
h(descriptor_resource_hash, cd->size);
h(descriptor_resource_hash, cd->offset);