diff options
| author | 2015-10-21 21:50:55 -0400 | |
|---|---|---|
| committer | 2015-10-21 22:29:56 -0400 | |
| commit | 74186a5f016a72f28f2d227bbe524787cd5b685f (patch) | |
| tree | f3005c0737a6ade25afc5a912e0a7f14e48adfa5 /src | |
| parent | gl_shader_gen: Optimize code for AppendAlphaTestCondition. (diff) | |
| download | yuzu-74186a5f016a72f28f2d227bbe524787cd5b685f.tar.gz yuzu-74186a5f016a72f28f2d227bbe524787cd5b685f.tar.xz yuzu-74186a5f016a72f28f2d227bbe524787cd5b685f.zip | |
gl_shader_gen: Use explicit locations for vertex shader attributes.
Diffstat (limited to 'src')
| -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; | |||
| 362 | } | 362 | } |
| 363 | 363 | ||
| 364 | std::string GenerateVertexShader() { | 364 | std::string GenerateVertexShader() { |
| 365 | static const std::string out = R"( | 365 | std::string out = "#version 330\n"; |
| 366 | #version 330 | 366 | out += "layout(location = " + std::to_string((int)ATTRIBUTE_POSITION) + ") in vec4 vert_position;\n"; |
| 367 | 367 | out += "layout(location = " + std::to_string((int)ATTRIBUTE_COLOR) + ") in vec4 vert_color;\n"; | |
| 368 | in vec4 vert_position; | 368 | out += "layout(location = " + std::to_string((int)ATTRIBUTE_TEXCOORD0) + ") in vec2 vert_texcoord0;\n"; |
| 369 | in vec4 vert_color; | 369 | out += "layout(location = " + std::to_string((int)ATTRIBUTE_TEXCOORD1) + ") in vec2 vert_texcoord1;\n"; |
| 370 | in vec2 vert_texcoord0; | 370 | out += "layout(location = " + std::to_string((int)ATTRIBUTE_TEXCOORD2) + ") in vec2 vert_texcoord2;\n"; |
| 371 | in vec2 vert_texcoord1; | 371 | |
| 372 | in vec2 vert_texcoord2; | 372 | out += R"( |
| 373 | |||
| 374 | out vec4 primary_color; | 373 | out vec4 primary_color; |
| 375 | out vec2 texcoord[3]; | 374 | out vec2 texcoord[3]; |
| 376 | 375 | ||
| @@ -382,6 +381,7 @@ void main() { | |||
| 382 | gl_Position = vec4(vert_position.x, -vert_position.y, -vert_position.z, vert_position.w); | 381 | gl_Position = vec4(vert_position.x, -vert_position.y, -vert_position.z, vert_position.w); |
| 383 | } | 382 | } |
| 384 | )"; | 383 | )"; |
| 384 | |||
| 385 | return out; | 385 | return out; |
| 386 | } | 386 | } |
| 387 | 387 | ||
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) { | |||
| 66 | glAttachShader(program_id, vertex_shader_id); | 66 | glAttachShader(program_id, vertex_shader_id); |
| 67 | glAttachShader(program_id, fragment_shader_id); | 67 | glAttachShader(program_id, fragment_shader_id); |
| 68 | 68 | ||
| 69 | glBindAttribLocation(program_id, Attributes::ATTRIBUTE_POSITION, "vert_position"); | ||
| 70 | glBindAttribLocation(program_id, Attributes::ATTRIBUTE_COLOR, "vert_color"); | ||
| 71 | glBindAttribLocation(program_id, Attributes::ATTRIBUTE_TEXCOORD0, "vert_texcoord0"); | ||
| 72 | glBindAttribLocation(program_id, Attributes::ATTRIBUTE_TEXCOORD1, "vert_texcoord1"); | ||
| 73 | glBindAttribLocation(program_id, Attributes::ATTRIBUTE_TEXCOORD2, "vert_texcoord2"); | ||
| 74 | |||
| 75 | glLinkProgram(program_id); | 69 | glLinkProgram(program_id); |
| 76 | 70 | ||
| 77 | // Check the program | 71 | // Check the program |