diff options
| author | bunnei <bunneidev@gmail.com> | 2015-11-18 22:20:12 -0500 |
|---|---|---|
| committer | bunnei <bunneidev@gmail.com> | 2015-11-18 22:20:12 -0500 |
| commit | ac829f87e0d32c693b333a35be823878a9b7d178 (patch) | |
| tree | f14c20303507dbf6e3606761a077c699cbe26b74 /src/video_core/renderer_opengl/gl_rasterizer.h | |
| parent | f971aceac39b643765c45dfb25827e7ea689bb67 (diff) | |
| parent | 823ce62f2fead8e436c2c916ed7ce5c8b949d1c6 (diff) | |
Merge pull request #1237 from Subv/ubos
Shaders: Use UBOs instead of individual uniforms in the generated frag shaders
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; }; |
