diff options
| -rw-r--r-- | src/core/hle/service/audio/audren_u.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.h | 6 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 36 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.h | 5 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_resource_manager.h | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 23 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state.cpp | 79 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state.h | 43 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 2 |
10 files changed, 72 insertions, 130 deletions
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index 2188b5625..3dfb3fb52 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp | |||
| @@ -150,7 +150,7 @@ private: | |||
| 150 | UpdateDataHeader() {} | 150 | UpdateDataHeader() {} |
| 151 | 151 | ||
| 152 | UpdateDataHeader(const AudioRendererParameter& config) { | 152 | UpdateDataHeader(const AudioRendererParameter& config) { |
| 153 | revision = config.revision; | 153 | revision = Common::MakeMagic('R', 'E', 'V', '4'); // 5.1.0 Revision |
| 154 | behavior_size = 0xb0; | 154 | behavior_size = 0xb0; |
| 155 | memory_pools_size = (config.effect_count + (config.voice_count * 4)) * 0x10; | 155 | memory_pools_size = (config.effect_count + (config.voice_count * 4)) * 0x10; |
| 156 | voices_size = config.voice_count * 0x10; | 156 | voices_size = config.voice_count * 0x10; |
diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h index bbba8e380..9382a75e5 100644 --- a/src/video_core/debug_utils/debug_utils.h +++ b/src/video_core/debug_utils/debug_utils.h | |||
| @@ -55,8 +55,10 @@ public: | |||
| 55 | virtual ~BreakPointObserver() { | 55 | virtual ~BreakPointObserver() { |
| 56 | auto context = context_weak.lock(); | 56 | auto context = context_weak.lock(); |
| 57 | if (context) { | 57 | if (context) { |
| 58 | std::unique_lock<std::mutex> lock(context->breakpoint_mutex); | 58 | { |
| 59 | context->breakpoint_observers.remove(this); | 59 | std::unique_lock<std::mutex> lock(context->breakpoint_mutex); |
| 60 | context->breakpoint_observers.remove(this); | ||
| 61 | } | ||
| 60 | 62 | ||
| 61 | // If we are the last observer to be destroyed, tell the debugger context that | 63 | // If we are the last observer to be destroyed, tell the debugger context that |
| 62 | // it is free to continue. In particular, this is required for a proper yuzu | 64 | // it is free to continue. In particular, this is required for a proper yuzu |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 3ba20f978..3fbf8e1f9 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -197,8 +197,8 @@ void RasterizerOpenGL::SetupShaders(u8* buffer_ptr, GLintptr buffer_offset) { | |||
| 197 | ASSERT_MSG(!gpu.regs.shader_config[0].enable, "VertexA is unsupported!"); | 197 | ASSERT_MSG(!gpu.regs.shader_config[0].enable, "VertexA is unsupported!"); |
| 198 | 198 | ||
| 199 | // Next available bindpoints to use when uploading the const buffers and textures to the GLSL | 199 | // Next available bindpoints to use when uploading the const buffers and textures to the GLSL |
| 200 | // shaders. | 200 | // shaders. The constbuffer bindpoint starts after the shader stage configuration bind points. |
| 201 | u32 current_constbuffer_bindpoint = 0; | 201 | u32 current_constbuffer_bindpoint = uniform_buffers.size(); |
| 202 | u32 current_texture_bindpoint = 0; | 202 | u32 current_texture_bindpoint = 0; |
| 203 | 203 | ||
| 204 | for (unsigned index = 1; index < Maxwell::MaxShaderProgram; ++index) { | 204 | for (unsigned index = 1; index < Maxwell::MaxShaderProgram; ++index) { |
| @@ -437,7 +437,7 @@ void RasterizerOpenGL::DrawArrays() { | |||
| 437 | 437 | ||
| 438 | // Unbind textures for potential future use as framebuffer attachments | 438 | // Unbind textures for potential future use as framebuffer attachments |
| 439 | for (auto& texture_unit : state.texture_units) { | 439 | for (auto& texture_unit : state.texture_units) { |
| 440 | texture_unit.texture_2d = 0; | 440 | texture_unit.Unbind(); |
| 441 | } | 441 | } |
| 442 | state.Apply(); | 442 | state.Apply(); |
| 443 | 443 | ||
| @@ -608,27 +608,39 @@ u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, GLuint progr | |||
| 608 | 608 | ||
| 609 | boost::optional<VAddr> addr = gpu.memory_manager->GpuToCpuAddress(buffer.address); | 609 | boost::optional<VAddr> addr = gpu.memory_manager->GpuToCpuAddress(buffer.address); |
| 610 | 610 | ||
| 611 | std::vector<u8> data; | 611 | size_t size = 0; |
| 612 | |||
| 612 | if (used_buffer.IsIndirect()) { | 613 | if (used_buffer.IsIndirect()) { |
| 613 | // Buffer is accessed indirectly, so upload the entire thing | 614 | // Buffer is accessed indirectly, so upload the entire thing |
| 614 | data.resize(buffer.size * sizeof(float)); | 615 | size = buffer.size * sizeof(float); |
| 616 | |||
| 617 | if (size > MaxConstbufferSize) { | ||
| 618 | NGLOG_ERROR(HW_GPU, "indirect constbuffer size {} exceeds maximum {}", size, | ||
| 619 | MaxConstbufferSize); | ||
| 620 | size = MaxConstbufferSize; | ||
| 621 | } | ||
| 615 | } else { | 622 | } else { |
| 616 | // Buffer is accessed directly, upload just what we use | 623 | // Buffer is accessed directly, upload just what we use |
| 617 | data.resize(used_buffer.GetSize() * sizeof(float)); | 624 | size = used_buffer.GetSize() * sizeof(float); |
| 618 | } | 625 | } |
| 619 | 626 | ||
| 627 | // Align the actual size so it ends up being a multiple of vec4 to meet the OpenGL std140 | ||
| 628 | // UBO alignment requirements. | ||
| 629 | size = Common::AlignUp(size, sizeof(GLvec4)); | ||
| 630 | ASSERT_MSG(size <= MaxConstbufferSize, "Constbuffer too big"); | ||
| 631 | |||
| 632 | std::vector<u8> data(size); | ||
| 620 | Memory::ReadBlock(*addr, data.data(), data.size()); | 633 | Memory::ReadBlock(*addr, data.data(), data.size()); |
| 621 | 634 | ||
| 622 | glBindBuffer(GL_SHADER_STORAGE_BUFFER, buffer_draw_state.ssbo); | 635 | glBindBuffer(GL_UNIFORM_BUFFER, buffer_draw_state.ssbo); |
| 623 | glBufferData(GL_SHADER_STORAGE_BUFFER, data.size(), data.data(), GL_DYNAMIC_DRAW); | 636 | glBufferData(GL_UNIFORM_BUFFER, data.size(), data.data(), GL_DYNAMIC_DRAW); |
| 624 | glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0); | 637 | glBindBuffer(GL_UNIFORM_BUFFER, 0); |
| 625 | 638 | ||
| 626 | // Now configure the bindpoint of the buffer inside the shader | 639 | // Now configure the bindpoint of the buffer inside the shader |
| 627 | std::string buffer_name = used_buffer.GetName(); | 640 | std::string buffer_name = used_buffer.GetName(); |
| 628 | GLuint index = | 641 | GLuint index = glGetProgramResourceIndex(program, GL_UNIFORM_BLOCK, buffer_name.c_str()); |
| 629 | glGetProgramResourceIndex(program, GL_SHADER_STORAGE_BLOCK, buffer_name.c_str()); | ||
| 630 | if (index != -1) | 642 | if (index != -1) |
| 631 | glShaderStorageBlockBinding(program, index, buffer_draw_state.bindpoint); | 643 | glUniformBlockBinding(program, index, buffer_draw_state.bindpoint); |
| 632 | } | 644 | } |
| 633 | 645 | ||
| 634 | state.Apply(); | 646 | state.Apply(); |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index b7c8cf843..4762983c9 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h | |||
| @@ -54,6 +54,11 @@ public: | |||
| 54 | OGLShader shader; | 54 | OGLShader shader; |
| 55 | }; | 55 | }; |
| 56 | 56 | ||
| 57 | /// Maximum supported size that a constbuffer can have in bytes. | ||
| 58 | static constexpr size_t MaxConstbufferSize = 0x10000; | ||
| 59 | static_assert(MaxConstbufferSize % sizeof(GLvec4) == 0, | ||
| 60 | "The maximum size of a constbuffer must be a multiple of the size of GLvec4"); | ||
| 61 | |||
| 57 | private: | 62 | private: |
| 58 | class SamplerInfo { | 63 | class SamplerInfo { |
| 59 | public: | 64 | public: |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 61d670dcb..857164ff6 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -46,7 +46,7 @@ struct FormatTuple { | |||
| 46 | 46 | ||
| 47 | static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_format_tuples = {{ | 47 | static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_format_tuples = {{ |
| 48 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, false}, // ABGR8 | 48 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, false}, // ABGR8 |
| 49 | {GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, false}, // B5G6R5 | 49 | {GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV, false}, // B5G6R5 |
| 50 | {GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, false}, // A2B10G10R10 | 50 | {GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, false}, // A2B10G10R10 |
| 51 | {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, false}, // A1B5G5R5 | 51 | {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, false}, // A1B5G5R5 |
| 52 | {GL_R8, GL_RED, GL_UNSIGNED_BYTE, false}, // R8 | 52 | {GL_R8, GL_RED, GL_UNSIGNED_BYTE, false}, // R8 |
| @@ -645,7 +645,7 @@ void CachedSurface::DownloadGLTexture(const MathUtil::Rectangle<u32>& rect, GLui | |||
| 645 | glActiveTexture(GL_TEXTURE0); | 645 | glActiveTexture(GL_TEXTURE0); |
| 646 | glGetTexImage(GL_TEXTURE_2D, 0, tuple.format, tuple.type, &gl_buffer[buffer_offset]); | 646 | glGetTexImage(GL_TEXTURE_2D, 0, tuple.format, tuple.type, &gl_buffer[buffer_offset]); |
| 647 | } else { | 647 | } else { |
| 648 | state.ResetTexture(texture.handle); | 648 | state.UnbindTexture(texture.handle); |
| 649 | state.draw.read_framebuffer = read_fb_handle; | 649 | state.draw.read_framebuffer = read_fb_handle; |
| 650 | state.Apply(); | 650 | state.Apply(); |
| 651 | 651 | ||
diff --git a/src/video_core/renderer_opengl/gl_resource_manager.h b/src/video_core/renderer_opengl/gl_resource_manager.h index 93f9172e7..0fed93ca5 100644 --- a/src/video_core/renderer_opengl/gl_resource_manager.h +++ b/src/video_core/renderer_opengl/gl_resource_manager.h | |||
| @@ -38,7 +38,7 @@ public: | |||
| 38 | if (handle == 0) | 38 | if (handle == 0) |
| 39 | return; | 39 | return; |
| 40 | glDeleteTextures(1, &handle); | 40 | glDeleteTextures(1, &handle); |
| 41 | OpenGLState::GetCurState().ResetTexture(handle).Apply(); | 41 | OpenGLState::GetCurState().UnbindTexture(handle).Apply(); |
| 42 | handle = 0; | 42 | handle = 0; |
| 43 | } | 43 | } |
| 44 | 44 | ||
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 65fed77ef..46eaad021 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include "common/assert.h" | 9 | #include "common/assert.h" |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | #include "video_core/engines/shader_bytecode.h" | 11 | #include "video_core/engines/shader_bytecode.h" |
| 12 | #include "video_core/renderer_opengl/gl_rasterizer.h" | ||
| 12 | #include "video_core/renderer_opengl/gl_shader_decompiler.h" | 13 | #include "video_core/renderer_opengl/gl_shader_decompiler.h" |
| 13 | 14 | ||
| 14 | namespace GLShader { | 15 | namespace GLShader { |
| @@ -397,7 +398,8 @@ public: | |||
| 397 | /// Generates code representing a uniform (C buffer) register, interpreted as the input type. | 398 | /// Generates code representing a uniform (C buffer) register, interpreted as the input type. |
| 398 | std::string GetUniform(u64 index, u64 offset, GLSLRegister::Type type) { | 399 | std::string GetUniform(u64 index, u64 offset, GLSLRegister::Type type) { |
| 399 | declr_const_buffers[index].MarkAsUsed(index, offset, stage); | 400 | declr_const_buffers[index].MarkAsUsed(index, offset, stage); |
| 400 | std::string value = 'c' + std::to_string(index) + '[' + std::to_string(offset) + ']'; | 401 | std::string value = 'c' + std::to_string(index) + '[' + std::to_string(offset / 4) + "][" + |
| 402 | std::to_string(offset % 4) + ']'; | ||
| 401 | 403 | ||
| 402 | if (type == GLSLRegister::Type::Float) { | 404 | if (type == GLSLRegister::Type::Float) { |
| 403 | return value; | 405 | return value; |
| @@ -411,8 +413,12 @@ public: | |||
| 411 | std::string GetUniformIndirect(u64 index, s64 offset, const Register& index_reg, | 413 | std::string GetUniformIndirect(u64 index, s64 offset, const Register& index_reg, |
| 412 | GLSLRegister::Type type) { | 414 | GLSLRegister::Type type) { |
| 413 | declr_const_buffers[index].MarkAsUsedIndirect(index, stage); | 415 | declr_const_buffers[index].MarkAsUsedIndirect(index, stage); |
| 414 | std::string value = 'c' + std::to_string(index) + "[(floatBitsToInt(" + | 416 | |
| 415 | GetRegister(index_reg, 0) + ") + " + std::to_string(offset) + ") / 4]"; | 417 | std::string final_offset = "((floatBitsToInt(" + GetRegister(index_reg, 0) + ") + " + |
| 418 | std::to_string(offset) + ") / 4)"; | ||
| 419 | |||
| 420 | std::string value = | ||
| 421 | 'c' + std::to_string(index) + '[' + final_offset + " / 4][" + final_offset + " % 4]"; | ||
| 416 | 422 | ||
| 417 | if (type == GLSLRegister::Type::Float) { | 423 | if (type == GLSLRegister::Type::Float) { |
| 418 | return value; | 424 | return value; |
| @@ -454,9 +460,10 @@ public: | |||
| 454 | 460 | ||
| 455 | unsigned const_buffer_layout = 0; | 461 | unsigned const_buffer_layout = 0; |
| 456 | for (const auto& entry : GetConstBuffersDeclarations()) { | 462 | for (const auto& entry : GetConstBuffersDeclarations()) { |
| 457 | declarations.AddLine("layout(std430) buffer " + entry.GetName()); | 463 | declarations.AddLine("layout(std140) uniform " + entry.GetName()); |
| 458 | declarations.AddLine('{'); | 464 | declarations.AddLine('{'); |
| 459 | declarations.AddLine(" float c" + std::to_string(entry.GetIndex()) + "[];"); | 465 | declarations.AddLine(" vec4 c" + std::to_string(entry.GetIndex()) + |
| 466 | "[MAX_CONSTBUFFER_ELEMENTS];"); | ||
| 460 | declarations.AddLine("};"); | 467 | declarations.AddLine("};"); |
| 461 | declarations.AddNewLine(); | 468 | declarations.AddNewLine(); |
| 462 | ++const_buffer_layout; | 469 | ++const_buffer_layout; |
| @@ -804,6 +811,7 @@ private: | |||
| 804 | if (!opcode) { | 811 | if (!opcode) { |
| 805 | NGLOG_CRITICAL(HW_GPU, "Unhandled instruction: {0:x}", instr.value); | 812 | NGLOG_CRITICAL(HW_GPU, "Unhandled instruction: {0:x}", instr.value); |
| 806 | UNREACHABLE(); | 813 | UNREACHABLE(); |
| 814 | return offset + 1; | ||
| 807 | } | 815 | } |
| 808 | 816 | ||
| 809 | shader.AddLine("// " + std::to_string(offset) + ": " + opcode->GetName()); | 817 | shader.AddLine("// " + std::to_string(offset) + ": " + opcode->GetName()); |
| @@ -1713,7 +1721,10 @@ private: | |||
| 1713 | }; // namespace Decompiler | 1721 | }; // namespace Decompiler |
| 1714 | 1722 | ||
| 1715 | std::string GetCommonDeclarations() { | 1723 | std::string GetCommonDeclarations() { |
| 1716 | return "bool exec_shader();"; | 1724 | std::string declarations = "bool exec_shader();\n"; |
| 1725 | declarations += "#define MAX_CONSTBUFFER_ELEMENTS " + | ||
| 1726 | std::to_string(RasterizerOpenGL::MaxConstbufferSize / (sizeof(GLvec4))); | ||
| 1727 | return declarations; | ||
| 1717 | } | 1728 | } |
| 1718 | 1729 | ||
| 1719 | boost::optional<ProgramResult> DecompileProgram(const ProgramCode& program_code, u32 main_offset, | 1730 | boost::optional<ProgramResult> DecompileProgram(const ProgramCode& program_code, u32 main_offset, |
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index 1f1e48425..2e8a422a8 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp | |||
| @@ -48,24 +48,9 @@ OpenGLState::OpenGLState() { | |||
| 48 | logic_op = GL_COPY; | 48 | logic_op = GL_COPY; |
| 49 | 49 | ||
| 50 | for (auto& texture_unit : texture_units) { | 50 | for (auto& texture_unit : texture_units) { |
| 51 | texture_unit.texture_2d = 0; | 51 | texture_unit.Reset(); |
| 52 | texture_unit.sampler = 0; | ||
| 53 | texture_unit.swizzle.r = GL_RED; | ||
| 54 | texture_unit.swizzle.g = GL_GREEN; | ||
| 55 | texture_unit.swizzle.b = GL_BLUE; | ||
| 56 | texture_unit.swizzle.a = GL_ALPHA; | ||
| 57 | } | 52 | } |
| 58 | 53 | ||
| 59 | lighting_lut.texture_buffer = 0; | ||
| 60 | |||
| 61 | fog_lut.texture_buffer = 0; | ||
| 62 | |||
| 63 | proctex_lut.texture_buffer = 0; | ||
| 64 | proctex_diff_lut.texture_buffer = 0; | ||
| 65 | proctex_color_map.texture_buffer = 0; | ||
| 66 | proctex_alpha_map.texture_buffer = 0; | ||
| 67 | proctex_noise_lut.texture_buffer = 0; | ||
| 68 | |||
| 69 | draw.read_framebuffer = 0; | 54 | draw.read_framebuffer = 0; |
| 70 | draw.draw_framebuffer = 0; | 55 | draw.draw_framebuffer = 0; |
| 71 | draw.vertex_array = 0; | 56 | draw.vertex_array = 0; |
| @@ -223,54 +208,12 @@ void OpenGLState::Apply() const { | |||
| 223 | if (current.enabled != new_state.enabled || current.bindpoint != new_state.bindpoint || | 208 | if (current.enabled != new_state.enabled || current.bindpoint != new_state.bindpoint || |
| 224 | current.ssbo != new_state.ssbo) { | 209 | current.ssbo != new_state.ssbo) { |
| 225 | if (new_state.enabled) { | 210 | if (new_state.enabled) { |
| 226 | glBindBufferBase(GL_SHADER_STORAGE_BUFFER, new_state.bindpoint, new_state.ssbo); | 211 | glBindBufferBase(GL_UNIFORM_BUFFER, new_state.bindpoint, new_state.ssbo); |
| 227 | } | 212 | } |
| 228 | } | 213 | } |
| 229 | } | 214 | } |
| 230 | } | 215 | } |
| 231 | 216 | ||
| 232 | // Lighting LUTs | ||
| 233 | if (lighting_lut.texture_buffer != cur_state.lighting_lut.texture_buffer) { | ||
| 234 | glActiveTexture(TextureUnits::LightingLUT.Enum()); | ||
| 235 | glBindTexture(GL_TEXTURE_BUFFER, lighting_lut.texture_buffer); | ||
| 236 | } | ||
| 237 | |||
| 238 | // Fog LUT | ||
| 239 | if (fog_lut.texture_buffer != cur_state.fog_lut.texture_buffer) { | ||
| 240 | glActiveTexture(TextureUnits::FogLUT.Enum()); | ||
| 241 | glBindTexture(GL_TEXTURE_BUFFER, fog_lut.texture_buffer); | ||
| 242 | } | ||
| 243 | |||
| 244 | // ProcTex Noise LUT | ||
| 245 | if (proctex_noise_lut.texture_buffer != cur_state.proctex_noise_lut.texture_buffer) { | ||
| 246 | glActiveTexture(TextureUnits::ProcTexNoiseLUT.Enum()); | ||
| 247 | glBindTexture(GL_TEXTURE_BUFFER, proctex_noise_lut.texture_buffer); | ||
| 248 | } | ||
| 249 | |||
| 250 | // ProcTex Color Map | ||
| 251 | if (proctex_color_map.texture_buffer != cur_state.proctex_color_map.texture_buffer) { | ||
| 252 | glActiveTexture(TextureUnits::ProcTexColorMap.Enum()); | ||
| 253 | glBindTexture(GL_TEXTURE_BUFFER, proctex_color_map.texture_buffer); | ||
| 254 | } | ||
| 255 | |||
| 256 | // ProcTex Alpha Map | ||
| 257 | if (proctex_alpha_map.texture_buffer != cur_state.proctex_alpha_map.texture_buffer) { | ||
| 258 | glActiveTexture(TextureUnits::ProcTexAlphaMap.Enum()); | ||
| 259 | glBindTexture(GL_TEXTURE_BUFFER, proctex_alpha_map.texture_buffer); | ||
| 260 | } | ||
| 261 | |||
| 262 | // ProcTex LUT | ||
| 263 | if (proctex_lut.texture_buffer != cur_state.proctex_lut.texture_buffer) { | ||
| 264 | glActiveTexture(TextureUnits::ProcTexLUT.Enum()); | ||
| 265 | glBindTexture(GL_TEXTURE_BUFFER, proctex_lut.texture_buffer); | ||
| 266 | } | ||
| 267 | |||
| 268 | // ProcTex Diff LUT | ||
| 269 | if (proctex_diff_lut.texture_buffer != cur_state.proctex_diff_lut.texture_buffer) { | ||
| 270 | glActiveTexture(TextureUnits::ProcTexDiffLUT.Enum()); | ||
| 271 | glBindTexture(GL_TEXTURE_BUFFER, proctex_diff_lut.texture_buffer); | ||
| 272 | } | ||
| 273 | |||
| 274 | // Framebuffer | 217 | // Framebuffer |
| 275 | if (draw.read_framebuffer != cur_state.draw.read_framebuffer) { | 218 | if (draw.read_framebuffer != cur_state.draw.read_framebuffer) { |
| 276 | glBindFramebuffer(GL_READ_FRAMEBUFFER, draw.read_framebuffer); | 219 | glBindFramebuffer(GL_READ_FRAMEBUFFER, draw.read_framebuffer); |
| @@ -338,26 +281,12 @@ void OpenGLState::Apply() const { | |||
| 338 | cur_state = *this; | 281 | cur_state = *this; |
| 339 | } | 282 | } |
| 340 | 283 | ||
| 341 | OpenGLState& OpenGLState::ResetTexture(GLuint handle) { | 284 | OpenGLState& OpenGLState::UnbindTexture(GLuint handle) { |
| 342 | for (auto& unit : texture_units) { | 285 | for (auto& unit : texture_units) { |
| 343 | if (unit.texture_2d == handle) { | 286 | if (unit.texture_2d == handle) { |
| 344 | unit.texture_2d = 0; | 287 | unit.Unbind(); |
| 345 | } | 288 | } |
| 346 | } | 289 | } |
| 347 | if (lighting_lut.texture_buffer == handle) | ||
| 348 | lighting_lut.texture_buffer = 0; | ||
| 349 | if (fog_lut.texture_buffer == handle) | ||
| 350 | fog_lut.texture_buffer = 0; | ||
| 351 | if (proctex_noise_lut.texture_buffer == handle) | ||
| 352 | proctex_noise_lut.texture_buffer = 0; | ||
| 353 | if (proctex_color_map.texture_buffer == handle) | ||
| 354 | proctex_color_map.texture_buffer = 0; | ||
| 355 | if (proctex_alpha_map.texture_buffer == handle) | ||
| 356 | proctex_alpha_map.texture_buffer = 0; | ||
| 357 | if (proctex_lut.texture_buffer == handle) | ||
| 358 | proctex_lut.texture_buffer = 0; | ||
| 359 | if (proctex_diff_lut.texture_buffer == handle) | ||
| 360 | proctex_diff_lut.texture_buffer = 0; | ||
| 361 | return *this; | 290 | return *this; |
| 362 | } | 291 | } |
| 363 | 292 | ||
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h index 839e50e93..3398d7c04 100644 --- a/src/video_core/renderer_opengl/gl_state.h +++ b/src/video_core/renderer_opengl/gl_state.h | |||
| @@ -91,35 +91,20 @@ public: | |||
| 91 | GLint b; // GL_TEXTURE_SWIZZLE_B | 91 | GLint b; // GL_TEXTURE_SWIZZLE_B |
| 92 | GLint a; // GL_TEXTURE_SWIZZLE_A | 92 | GLint a; // GL_TEXTURE_SWIZZLE_A |
| 93 | } swizzle; | 93 | } swizzle; |
| 94 | } texture_units[32]; | ||
| 95 | |||
| 96 | struct { | ||
| 97 | GLuint texture_buffer; // GL_TEXTURE_BINDING_BUFFER | ||
| 98 | } lighting_lut; | ||
| 99 | |||
| 100 | struct { | ||
| 101 | GLuint texture_buffer; // GL_TEXTURE_BINDING_BUFFER | ||
| 102 | } fog_lut; | ||
| 103 | |||
| 104 | struct { | ||
| 105 | GLuint texture_buffer; // GL_TEXTURE_BINDING_BUFFER | ||
| 106 | } proctex_noise_lut; | ||
| 107 | 94 | ||
| 108 | struct { | 95 | void Unbind() { |
| 109 | GLuint texture_buffer; // GL_TEXTURE_BINDING_BUFFER | 96 | texture_2d = 0; |
| 110 | } proctex_color_map; | 97 | swizzle.r = GL_RED; |
| 111 | 98 | swizzle.g = GL_GREEN; | |
| 112 | struct { | 99 | swizzle.b = GL_BLUE; |
| 113 | GLuint texture_buffer; // GL_TEXTURE_BINDING_BUFFER | 100 | swizzle.a = GL_ALPHA; |
| 114 | } proctex_alpha_map; | 101 | } |
| 115 | 102 | ||
| 116 | struct { | 103 | void Reset() { |
| 117 | GLuint texture_buffer; // GL_TEXTURE_BINDING_BUFFER | 104 | Unbind(); |
| 118 | } proctex_lut; | 105 | sampler = 0; |
| 119 | 106 | } | |
| 120 | struct { | 107 | } texture_units[32]; |
| 121 | GLuint texture_buffer; // GL_TEXTURE_BINDING_BUFFER | ||
| 122 | } proctex_diff_lut; | ||
| 123 | 108 | ||
| 124 | struct { | 109 | struct { |
| 125 | GLuint read_framebuffer; // GL_READ_FRAMEBUFFER_BINDING | 110 | GLuint read_framebuffer; // GL_READ_FRAMEBUFFER_BINDING |
| @@ -165,7 +150,7 @@ public: | |||
| 165 | void Apply() const; | 150 | void Apply() const; |
| 166 | 151 | ||
| 167 | /// Resets any references to the given resource | 152 | /// Resets any references to the given resource |
| 168 | OpenGLState& ResetTexture(GLuint handle); | 153 | OpenGLState& UnbindTexture(GLuint handle); |
| 169 | OpenGLState& ResetSampler(GLuint handle); | 154 | OpenGLState& ResetSampler(GLuint handle); |
| 170 | OpenGLState& ResetProgram(GLuint handle); | 155 | OpenGLState& ResetProgram(GLuint handle); |
| 171 | OpenGLState& ResetPipeline(GLuint handle); | 156 | OpenGLState& ResetPipeline(GLuint handle); |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 97be548d7..00a3e9632 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -334,8 +334,6 @@ bool GMainWindow::SupportsRequiredGLExtensions() { | |||
| 334 | unsupported_ext.append("ARB_program_interface_query"); | 334 | unsupported_ext.append("ARB_program_interface_query"); |
| 335 | if (!GLAD_GL_ARB_separate_shader_objects) | 335 | if (!GLAD_GL_ARB_separate_shader_objects) |
| 336 | unsupported_ext.append("ARB_separate_shader_objects"); | 336 | unsupported_ext.append("ARB_separate_shader_objects"); |
| 337 | if (!GLAD_GL_ARB_shader_storage_buffer_object) | ||
| 338 | unsupported_ext.append("ARB_shader_storage_buffer_object"); | ||
| 339 | if (!GLAD_GL_ARB_vertex_attrib_binding) | 337 | if (!GLAD_GL_ARB_vertex_attrib_binding) |
| 340 | unsupported_ext.append("ARB_vertex_attrib_binding"); | 338 | unsupported_ext.append("ARB_vertex_attrib_binding"); |
| 341 | 339 | ||