diff options
| author | Subv <subv2112@gmail.com> | 2015-11-10 11:58:53 -0500 |
|---|---|---|
| committer | Subv <subv2112@gmail.com> | 2015-11-18 21:03:56 -0500 |
| commit | 823ce62f2fead8e436c2c916ed7ce5c8b949d1c6 (patch) | |
| tree | bf0c4bded40858a0db81e993503e2f90f2b9b400 /src/video_core/renderer_opengl/gl_rasterizer.h | |
| parent | 1463127fade260bb38dea80401380f24660ec778 (diff) | |
FragShader: Use an UBO instead of several individual uniforms
Diffstat (limited to 'src/video_core/renderer_opengl/gl_rasterizer.h')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.h | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 872cae7da..071051dbc 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -141,12 +141,9 @@ public: /// Fragment shader uniforms enum Uniform : GLuint { - AlphaTestRef = 0, - TevConstColors = 1, - Texture0 = 7, - Texture1 = 8, - Texture2 = 9, - TevCombinerBufferColor = 10, + Texture0 = 0, + Texture1 = 1, + Texture2 = 2, }; }; @@ -216,6 +213,18 @@ private: GLfloat tex_coord2[2]; }; + /// Uniform structure for the Uniform Buffer Object, all members must be 16-byte aligned + struct UniformData { + // A vec4 color for each of the six tev stages + std::array<GLfloat, 4> const_color[6]; + std::array<GLfloat, 4> tev_combiner_buffer_color; + GLint alphatest_ref; + INSERT_PADDING_BYTES(12); + }; + + static_assert(sizeof(UniformData) == 0x80, "The size of the UniformData structure has changed, update the structure in the shader"); + static_assert(sizeof(UniformData) < 16000, "UniformData structure must be less than 16kb as per the OpenGL spec"); + /// Reconfigure the OpenGL color texture to use the given format and dimensions void ReconfigureColorTexture(TextureInfo& texture, Pica::Regs::ColorFormat format, u32 width, u32 height); @@ -298,7 +307,13 @@ private: std::unordered_map<PicaShaderConfig, std::unique_ptr<PicaShader>> shader_cache; const PicaShader* current_shader = nullptr; + struct { + UniformData data; + bool dirty; + } uniform_block_data; + OGLVertexArray vertex_array; OGLBuffer vertex_buffer; + OGLBuffer uniform_buffer; OGLFramebuffer framebuffer; }; |
