diff options
| author | Subv <subv2112@gmail.com> | 2018-03-26 21:52:43 -0500 | 
|---|---|---|
| committer | James Rowe <jroweboy@gmail.com> | 2018-04-06 20:44:46 -0600 | 
| commit | cb3183212d72836a7b6b196fde9896de66db62e6 (patch) | |
| tree | e3205d3fa2830ad781e1a3b014010203fb0b200c /src/video_core | |
| parent | 65faeb9b2a984268f248250424443902cdfa0fbd (diff) | |
GL: Bind the textures to the shaders used for drawing.
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 13 | 
1 files changed, 11 insertions, 2 deletions
| diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 09cd4859b..77e2fd039 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -524,10 +524,10 @@ void main() {  in vec2 frag_tex_coord;  out vec4 color; -uniform sampler2D color_texture; +uniform sampler2D tex[32];  void main() { -    color = vec4(1.0, 0.0, 1.0, 0.0); +    color = texture(tex[0], frag_tex_coord);  }  )"; @@ -548,6 +548,15 @@ void main() {      state.draw.shader_program = test_shader.shader.handle;      state.Apply(); +    for (u32 texture = 0; texture < texture_samplers.size(); ++texture) { +        // Set the texture samplers to correspond to different texture units +        std::string uniform_name = "tex[" + std::to_string(texture) + "]"; +        GLint uniform_tex = glGetUniformLocation(test_shader.shader.handle, uniform_name.c_str()); +        if (uniform_tex != -1) { +            glUniform1i(uniform_tex, TextureUnits::MaxwellTexture(texture).id); +        } +    } +      if (has_ARB_separate_shader_objects) {          state.draw.shader_program = 0;          state.Apply(); | 
