diff options
author | bunnei <bunneidev@gmail.com> | 2015-10-22 03:50:55 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2015-10-22 04:29:56 +0200 |
commit | 74186a5f016a72f28f2d227bbe524787cd5b685f (patch) | |
tree | f3005c0737a6ade25afc5a912e0a7f14e48adfa5 /src/video_core | |
parent | gl_shader_gen: Optimize code for AppendAlphaTestCondition. (diff) | |
download | yuzu-74186a5f016a72f28f2d227bbe524787cd5b685f.tar yuzu-74186a5f016a72f28f2d227bbe524787cd5b685f.tar.gz yuzu-74186a5f016a72f28f2d227bbe524787cd5b685f.tar.bz2 yuzu-74186a5f016a72f28f2d227bbe524787cd5b685f.tar.lz yuzu-74186a5f016a72f28f2d227bbe524787cd5b685f.tar.xz yuzu-74186a5f016a72f28f2d227bbe524787cd5b685f.tar.zst yuzu-74186a5f016a72f28f2d227bbe524787cd5b685f.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_gen.cpp | 18 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_util.cpp | 6 |
2 files changed, 9 insertions, 15 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp index e456f5847..d19d15e75 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.cpp +++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp @@ -362,15 +362,14 @@ out vec4 color; } std::string GenerateVertexShader() { - static const std::string out = R"( -#version 330 - -in vec4 vert_position; -in vec4 vert_color; -in vec2 vert_texcoord0; -in vec2 vert_texcoord1; -in vec2 vert_texcoord2; - + std::string out = "#version 330\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_TEXCOORD0) + ") in vec2 vert_texcoord0;\n"; + out += "layout(location = " + std::to_string((int)ATTRIBUTE_TEXCOORD1) + ") in vec2 vert_texcoord1;\n"; + out += "layout(location = " + std::to_string((int)ATTRIBUTE_TEXCOORD2) + ") in vec2 vert_texcoord2;\n"; + + out += R"( out vec4 primary_color; out vec2 texcoord[3]; @@ -382,6 +381,7 @@ void main() { gl_Position = vec4(vert_position.x, -vert_position.y, -vert_position.z, vert_position.w); } )"; + return out; } diff --git a/src/video_core/renderer_opengl/gl_shader_util.cpp b/src/video_core/renderer_opengl/gl_shader_util.cpp index 735c86d22..e3f7a5868 100644 --- a/src/video_core/renderer_opengl/gl_shader_util.cpp +++ b/src/video_core/renderer_opengl/gl_shader_util.cpp @@ -66,12 +66,6 @@ GLuint LoadProgram(const char* vertex_shader, const char* fragment_shader) { glAttachShader(program_id, vertex_shader_id); glAttachShader(program_id, fragment_shader_id); - glBindAttribLocation(program_id, Attributes::ATTRIBUTE_POSITION, "vert_position"); - glBindAttribLocation(program_id, Attributes::ATTRIBUTE_COLOR, "vert_color"); - glBindAttribLocation(program_id, Attributes::ATTRIBUTE_TEXCOORD0, "vert_texcoord0"); - glBindAttribLocation(program_id, Attributes::ATTRIBUTE_TEXCOORD1, "vert_texcoord1"); - glBindAttribLocation(program_id, Attributes::ATTRIBUTE_TEXCOORD2, "vert_texcoord2"); - glLinkProgram(program_id); // Check the program |