diff options
Diffstat (limited to 'video.hpp')
-rw-r--r-- | video.hpp | 33 |
1 files changed, 31 insertions, 2 deletions
@@ -72,11 +72,27 @@ static_assert(sizeof(Constant_Buffer_Descriptor) <= descriptor_payload_size); struct Pipeline { uint64_t pipeline_hash; uint64_t descriptor_resource_hash; + int viewport[4]; + int scissor[4]; Vertex_Format_Id vertex_format; Shader_Id shader; Descriptor descriptors[pipeline_max_descriptors]; int descriptor_count; + bool pipeline_eq(const Pipeline& other) const { + return + shader == other.shader && + vertex_format == other.vertex_format && + viewport[0] == other.viewport[0] && + viewport[1] == other.viewport[1] && + viewport[2] == other.viewport[2] && + viewport[3] == other.viewport[3] && + scissor[0] == other.scissor[0] && + scissor[1] == other.scissor[1] && + scissor[2] == other.scissor[2] && + scissor[3] == other.scissor[3]; + } + bool desc_layout_eq(const Pipeline& other) const { int i, c = descriptor_count; if (other.pipeline_hash != pipeline_hash) @@ -122,6 +138,12 @@ struct Pipeline { } }; +enum class Clear_Mode { + discard, + clear, + restore +}; + struct Colour { uint8_t r, g, b, a; }; @@ -129,6 +151,7 @@ struct Colour { struct Render_Pass { Texture_Id target; Colour clear; + Clear_Mode mode; bool operator==(const Render_Pass& other) const { int size = sizeof *this, i; @@ -154,6 +177,7 @@ struct Draw { int first_instance; }; +struct Device; struct Pipeline_Builder { Arena* arena; Render_Pass* pass; @@ -163,10 +187,13 @@ struct Pipeline_Builder { void begin_rp(); void rp_target(Texture_Id id, Colour clear_colour); + void rp_target(Texture_Id id, Clear_Mode mode); Render_Pass& build_rp(); void validate_rp(); - void begin(); + void begin(Device* dev); + void viewport(float x, float y, float w, float h); + void scissor(float x, float y, float w, float h); void shader(Shader_Id s); void vertex_format(Vertex_Format_Id vf); void texture(int binding, Texture_Id t, Sampler_Id s); @@ -179,7 +206,9 @@ enum Resource_State { undefined, copy_dst, copy_src, - shader_read + shader_read, + render_target, + presentable }; struct Texture : public Asset { |