diff options
Diffstat (limited to 'video.hpp')
-rw-r--r-- | video.hpp | 32 |
1 files changed, 30 insertions, 2 deletions
@@ -133,12 +133,19 @@ struct Pipeline { Cull_Mode cull_mode; Vertex_Format_Id vertex_format; Shader_Id shader; + int samples; + int shader_masks[shader_type_count]; Descriptor descriptors[pipeline_max_descriptors]; int descriptor_count; void hash(); bool pipeline_eq(const Pipeline& other) const { + int i; + for (i = 0; i < shader_type_count; i++) { + if (other.shader_masks[i] != shader_masks[i]) + return false; + } return shader == other.shader && vertex_format == other.vertex_format && @@ -161,7 +168,8 @@ struct Pipeline { blend_dst_alpha == other.blend_dst_alpha && blend_mode == other.blend_mode && blend_mode_alpha == other.blend_mode_alpha && - cull_mode == other.cull_mode; + cull_mode == other.cull_mode && + samples == other.samples; } bool desc_layout_eq(const Pipeline& other) const { @@ -228,6 +236,7 @@ struct Render_Pass { struct Target { Texture_Id id; Texture_Format fmt; + int samples; Clear_Mode mode; union { Colour colour; @@ -266,6 +275,11 @@ struct Render_Pass { } return true; } + + int get_samples() const { + if (colour_count) return colours[0].samples; + return depth.samples; + } }; struct Vertex_Buffer_Binding { @@ -325,6 +339,7 @@ struct Pipeline_Builder { ); PB& cull(Cull_Mode mode); PB& shader(Shader_Id s); + PB& option(Shader_Type type, int mask); PB& vertex_format(Vertex_Format_Id vf); PB& texture(int binding, Texture_Id t, Sampler_Id s); PB& cbuffer( @@ -359,6 +374,7 @@ struct Texture : public Asset { int w, h, d; int mip_count, array_size; int start_mip, start_array; + int samples; bool alias; }; @@ -486,7 +502,8 @@ struct Device { int d, int mip_count, int array_size, - Buffer_Id init + Buffer_Id init, + int samples = 1 ); Texture_Id alias_texture( Texture_Id o, @@ -553,6 +570,16 @@ struct Context { void submit(const Render_Pass& rp); void copy(Buffer_Id dst, Buffer_Id src); void copy(Texture_Id dst, Buffer_Id src); + void copy( + Texture_Id dst, + Buffer_Id src, + int mip, + int x, + int y, + int w, + int h + ); + void resolve(Texture_Id dst, Texture_Id src); void transition(Texture_Id id, Resource_State state); void debug_push(const char* name); void debug_pop(); @@ -568,6 +595,7 @@ struct Shader : public Asset { int attribute_index(const char* name); int target_index(const char* name); int descriptor_binding(const char* name); + int opt_mask(Shader_Type type, const char* name); int descriptor_stage(int slot); }; |