2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #1254 from bunnei/fix-gl-uniforms

renderer_opengl: Fix uniform issues with #1253
This commit is contained in:
bunnei 2015-11-25 22:43:28 -05:00
commit 913be80782
2 changed files with 8 additions and 6 deletions

View file

@ -492,10 +492,12 @@ void RasterizerOpenGL::SetShader() {
state.Apply(); state.Apply();
// Set the texture samplers to correspond to different texture units // Set the texture samplers to correspond to different texture units
GLuint uniform_tex = glGetUniformLocation(shader->shader.handle, "tex"); GLuint uniform_tex = glGetUniformLocation(shader->shader.handle, "tex[0]");
glUniform1i(uniform_tex, 0); if (uniform_tex != -1) { glUniform1i(uniform_tex, 0); }
glUniform1i(uniform_tex + 1, 1); uniform_tex = glGetUniformLocation(shader->shader.handle, "tex[1]");
glUniform1i(uniform_tex + 2, 2); if (uniform_tex != -1) { glUniform1i(uniform_tex, 1); }
uniform_tex = glGetUniformLocation(shader->shader.handle, "tex[2]");
if (uniform_tex != -1) { glUniform1i(uniform_tex, 2); }
current_shader = shader_cache.emplace(config, std::move(shader)).first->second.get(); current_shader = shader_cache.emplace(config, std::move(shader)).first->second.get();

View file

@ -320,7 +320,7 @@ static void WriteTevStage(std::string& out, const PicaShaderConfig& config, unsi
std::string GenerateFragmentShader(const PicaShaderConfig& config) { std::string GenerateFragmentShader(const PicaShaderConfig& config) {
std::string out = R"( std::string out = R"(
#version 330 #version 330 core
#define NUM_TEV_STAGES 6 #define NUM_TEV_STAGES 6
in vec4 primary_color; in vec4 primary_color;
@ -362,7 +362,7 @@ layout (std140) uniform shader_data {
} }
std::string GenerateVertexShader() { std::string GenerateVertexShader() {
std::string out = "#version 330\n"; std::string out = "#version 330 core\n";
out += "layout(location = " + std::to_string((int)ATTRIBUTE_POSITION) + ") in vec4 vert_position;\n"; out += "layout(location = " + std::to_string((int)ATTRIBUTE_POSITION) + ") in vec4 vert_position;\n";
out += "layout(location = " + std::to_string((int)ATTRIBUTE_COLOR) + ") in vec4 vert_color;\n"; out += "layout(location = " + std::to_string((int)ATTRIBUTE_COLOR) + ") in vec4 vert_color;\n";
out += "layout(location = " + std::to_string((int)ATTRIBUTE_TEXCOORD0) + ") in vec2 vert_texcoord0;\n"; out += "layout(location = " + std::to_string((int)ATTRIBUTE_TEXCOORD0) + ") in vec2 vert_texcoord0;\n";