From 8c644dd120c63244f4b576b45cd4ae96842736f8 Mon Sep 17 00:00:00 2001 From: quou Date: Sun, 9 Feb 2025 18:49:00 +1100 Subject: support for structured buffers --- video.hpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'video.hpp') diff --git a/video.hpp b/video.hpp index c93093e..ccc1f11 100644 --- a/video.hpp +++ b/video.hpp @@ -52,7 +52,8 @@ struct Sampler_Id : public Primitive_Id { struct Descriptor { enum class Type { texture, - constant_buffer + constant_buffer, + structured_buffer } type; int slot; uint8_t payload[descriptor_payload_size]; @@ -63,13 +64,13 @@ struct Texture_Descriptor { Sampler_Id sampler; }; -struct Constant_Buffer_Descriptor { +struct Buffer_Descriptor { int offset, size; Buffer_Id buffer; }; static_assert(sizeof(Texture_Descriptor) <= descriptor_payload_size); -static_assert(sizeof(Constant_Buffer_Descriptor) <= descriptor_payload_size); +static_assert(sizeof(Buffer_Descriptor) <= descriptor_payload_size); #define pipeline_max_descriptors 16 @@ -195,11 +196,12 @@ struct Pipeline { if (ta->texture != tb->texture) return false; if (ta->sampler != tb->sampler) return false; } break; - case Descriptor::Type::constant_buffer: { - Constant_Buffer_Descriptor* ca = - (Constant_Buffer_Descriptor*)a.payload; - Constant_Buffer_Descriptor* cb = - (Constant_Buffer_Descriptor*)b.payload; + case Descriptor::Type::constant_buffer: + case Descriptor::Type::structured_buffer: { + Buffer_Descriptor* ca = + (Buffer_Descriptor*)a.payload; + Buffer_Descriptor* cb = + (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; @@ -328,6 +330,12 @@ struct Pipeline_Builder { int offset = 0, int size = 0 ); + void sbuffer( + int binding, + Buffer_Id id, + int offset = 0, + int size = 0 + ); Pipeline& build(); void validate(); }; -- cgit v1.2.3-54-g00ecf