From 17315cee16df0848ed095ba3bc3fc1460465a682 Mon Sep 17 00:00:00 2001 From: FernandoS27 Date: Wed, 10 Oct 2018 15:06:32 -0400 Subject: Cache uniform locations and restructure the implementation --- src/video_core/renderer_opengl/gl_shader_cache.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/video_core/renderer_opengl/gl_shader_cache.h') diff --git a/src/video_core/renderer_opengl/gl_shader_cache.h b/src/video_core/renderer_opengl/gl_shader_cache.h index 2eaa63804..7c80ee86b 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.h +++ b/src/video_core/renderer_opengl/gl_shader_cache.h @@ -73,15 +73,15 @@ public: /// Gets the GL uniform location for the specified resource, caching as needed GLint GetUniformLocation(const GLShader::SamplerEntry& sampler); - GLint GetAlphaTestingEnableLocation(); - GLint GetAlphaTestingFuncLocation(); - GLint GetAlphaTestingRefLocation(); + void SetAlphaTesting(const bool enable, const float ref, const u32 func); private: /// Generates a geometry shader or returns one that already exists. GLuint LazyGeometryProgram(OGLProgram& target_program, const std::string& glsl_topology, const std::string& debug_name); + void SaveAlphaTestingLocations(); + VAddr addr; Maxwell::ShaderProgram program_type; GLShader::ShaderSetup setup; @@ -102,6 +102,12 @@ private: OGLProgram triangles_adjacency; } geometry_programs; + struct { + GLint enable_loc; + GLint ref_loc; + GLint func_loc; + } alpha_test; + std::map resource_cache; std::map uniform_cache; }; -- cgit v1.2.3