summaryrefslogtreecommitdiff
path: root/video.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'video.hpp')
-rw-r--r--video.hpp34
1 files changed, 24 insertions, 10 deletions
diff --git a/video.hpp b/video.hpp
index 3e01ab9..7639b50 100644
--- a/video.hpp
+++ b/video.hpp
@@ -48,7 +48,8 @@ struct Sampler_Id : public Primitive_Id<uint32_t> {
struct Descriptor {
enum class Type {
- texture
+ texture,
+ constant_buffer
} type;
int slot;
uint8_t payload[descriptor_payload_size];
@@ -59,7 +60,12 @@ struct Texture_Descriptor {
Sampler_Id sampler;
};
+struct Constant_Buffer_Descriptor {
+ Buffer_Id buffer;
+};
+
static_assert(sizeof(Texture_Descriptor) <= descriptor_payload_size);
+static_assert(sizeof(Constant_Buffer_Descriptor) <= descriptor_payload_size);
#define pipeline_max_descriptors 16
@@ -103,6 +109,13 @@ 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;
+ if (ca->buffer != cb->buffer) return false;
+ } break;
}
}
return true;
@@ -157,6 +170,7 @@ struct Pipeline_Builder {
void shader(Shader_Id s);
void vertex_format(Vertex_Format_Id vf);
void texture(int binding, Texture_Id t, Sampler_Id s);
+ void cbuffer(int binding, Buffer_Id id);
Pipeline& build();
void validate();
};
@@ -176,14 +190,14 @@ struct Texture : public Asset {
namespace Buffer_Flags {
enum {
- index_buffer = 1 << 0,
- vertex_buffer = 1 << 1,
- uniform_buffer = 1 << 2,
- storage_buffer = 1 << 3,
- cpu_read = 1 << 4,
- cpu_readwrite = 1 << 5,
- copy_src = 1 << 6,
- copy_dst = 1 << 7
+ index_buffer = 1 << 0,
+ vertex_buffer = 1 << 1,
+ constant_buffer = 1 << 2,
+ storage_buffer = 1 << 3,
+ cpu_read = 1 << 4,
+ cpu_readwrite = 1 << 5,
+ copy_src = 1 << 6,
+ copy_dst = 1 << 7
};
};
@@ -301,7 +315,7 @@ struct Shader : public Asset {
int binding_index(const char* name);
int attribute_index(const char* name);
int target_index(const char* name);
- int descriptor_index(const char* name);
+ int descriptor_binding(const char* name);
int descriptor_stage(int slot);
};