diff options
Diffstat (limited to '')
-rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 2 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 14 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_state.cpp | 36 |
3 files changed, 26 insertions, 26 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index dfbf80abd..d7328ff39 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp @@ -317,8 +317,6 @@ std::vector<Texture::FullTextureInfo> Maxwell3D::GetStageTextures(Regs::ShaderSt auto& tex_info_buffer = fragment_shader.const_buffers[regs.tex_cb_index]; ASSERT(tex_info_buffer.enabled && tex_info_buffer.address != 0); - GPUVAddr tic_base_address = regs.tic.TICAddress(); - GPUVAddr tex_info_buffer_end = tex_info_buffer.address + tex_info_buffer.size; // Offset into the texture constbuffer where the texture info begins. diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 5fae95788..a1ac18a71 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -216,7 +216,7 @@ public: } /// Returns a GLSL string representing the current state of the register - const std::string GetActiveString() { + std::string GetActiveString() { declr_type.insert(active_type); return GetPrefixString(active_type) + std::to_string(index) + '_' + suffix; } @@ -518,7 +518,7 @@ public: private: /// Build GLSL conversion function, e.g. floatBitsToInt, intBitsToFloat, etc. - const std::string GetGLSLConversionFunc(GLSLRegister::Type src, GLSLRegister::Type dest) const { + std::string GetGLSLConversionFunc(GLSLRegister::Type src, GLSLRegister::Type dest) const { const std::string src_type = GLSLRegister::GetTypeString(src); std::string dest_type = GLSLRegister::GetTypeString(dest); dest_type[0] = toupper(dest_type[0]); @@ -1405,7 +1405,7 @@ private: // TEXS has two destination registers. RG goes into gpr0+0 and gpr0+1, and BA // goes into gpr28+0 and gpr28+1 - size_t offset{}; + size_t texs_offset{}; for (const auto& dest : {instr.gpr0.Value(), instr.gpr28.Value()}) { for (unsigned elem = 0; elem < 2; ++elem) { @@ -1413,7 +1413,8 @@ private: // Skip disabled components continue; } - regs.SetRegisterToFloat(dest, elem + offset, texture, 1, 4, false, elem); + regs.SetRegisterToFloat(dest, elem + texs_offset, texture, 1, 4, false, + elem); } if (!instr.texs.HasTwoDestinations()) { @@ -1421,7 +1422,7 @@ private: break; } - offset += 2; + texs_offset += 2; } --shader.scope; shader.AddLine("}"); @@ -1463,7 +1464,6 @@ private: op_b = "abs(" + op_b + ')'; } - using Tegra::Shader::Pred; // We can't use the constant predicate as destination. ASSERT(instr.fsetp.pred3 != static_cast<u64>(Pred::UnusedIndex)); @@ -1500,7 +1500,6 @@ private: } } - using Tegra::Shader::Pred; // We can't use the constant predicate as destination. ASSERT(instr.isetp.pred3 != static_cast<u64>(Pred::UnusedIndex)); @@ -1528,7 +1527,6 @@ private: std::string op_b = GetPredicateCondition(instr.psetp.pred29, instr.psetp.neg_pred29 != 0); - using Tegra::Shader::Pred; // We can't use the constant predicate as destination. ASSERT(instr.psetp.pred3 != static_cast<u64>(Pred::UnusedIndex)); diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index 2e8a422a8..68bacd4c5 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp @@ -181,30 +181,34 @@ void OpenGLState::Apply() const { } // Textures - for (int i = 0; i < std::size(texture_units); ++i) { - if (texture_units[i].texture_2d != cur_state.texture_units[i].texture_2d) { - glActiveTexture(TextureUnits::MaxwellTexture(i).Enum()); - glBindTexture(GL_TEXTURE_2D, texture_units[i].texture_2d); + for (std::size_t i = 0; i < std::size(texture_units); ++i) { + const auto& texture_unit = texture_units[i]; + const auto& cur_state_texture_unit = cur_state.texture_units[i]; + + if (texture_unit.texture_2d != cur_state_texture_unit.texture_2d) { + glActiveTexture(TextureUnits::MaxwellTexture(static_cast<int>(i)).Enum()); + glBindTexture(GL_TEXTURE_2D, texture_unit.texture_2d); } - if (texture_units[i].sampler != cur_state.texture_units[i].sampler) { - glBindSampler(static_cast<GLuint>(i), texture_units[i].sampler); + if (texture_unit.sampler != cur_state_texture_unit.sampler) { + glBindSampler(static_cast<GLuint>(i), texture_unit.sampler); } // Update the texture swizzle - if (texture_units[i].swizzle.r != cur_state.texture_units[i].swizzle.r || - texture_units[i].swizzle.g != cur_state.texture_units[i].swizzle.g || - texture_units[i].swizzle.b != cur_state.texture_units[i].swizzle.b || - texture_units[i].swizzle.a != cur_state.texture_units[i].swizzle.a) { - std::array<GLint, 4> mask = {texture_units[i].swizzle.r, texture_units[i].swizzle.g, - texture_units[i].swizzle.b, texture_units[i].swizzle.a}; + if (texture_unit.swizzle.r != cur_state_texture_unit.swizzle.r || + texture_unit.swizzle.g != cur_state_texture_unit.swizzle.g || + texture_unit.swizzle.b != cur_state_texture_unit.swizzle.b || + texture_unit.swizzle.a != cur_state_texture_unit.swizzle.a) { + std::array<GLint, 4> mask = {texture_unit.swizzle.r, texture_unit.swizzle.g, + texture_unit.swizzle.b, texture_unit.swizzle.a}; glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, mask.data()); } } // Constbuffers - for (u32 stage = 0; stage < draw.const_buffers.size(); ++stage) { - for (u32 buffer_id = 0; buffer_id < draw.const_buffers[stage].size(); ++buffer_id) { - auto& current = cur_state.draw.const_buffers[stage][buffer_id]; - auto& new_state = draw.const_buffers[stage][buffer_id]; + for (std::size_t stage = 0; stage < draw.const_buffers.size(); ++stage) { + for (std::size_t buffer_id = 0; buffer_id < draw.const_buffers[stage].size(); ++buffer_id) { + const auto& current = cur_state.draw.const_buffers[stage][buffer_id]; + const auto& new_state = draw.const_buffers[stage][buffer_id]; + if (current.enabled != new_state.enabled || current.bindpoint != new_state.bindpoint || current.ssbo != new_state.ssbo) { if (new_state.enabled) { |