diff options
| author | 2024-01-04 15:53:44 -0500 | |
|---|---|---|
| committer | 2024-01-04 15:53:44 -0500 | |
| commit | 92a331af76cba638f01490eeb0045ca4d6d27df7 (patch) | |
| tree | 2f66b3dad2ee7c47cb8be910e0cbbaeced97ce6d | |
| parent | Merge pull request #12575 from t895/inconsistent-settings-application (diff) | |
| parent | Settings: Indicate AMD's compatibility with SPIR-V on OGL (diff) | |
| download | yuzu-92a331af76cba638f01490eeb0045ca4d6d27df7.tar.gz yuzu-92a331af76cba638f01490eeb0045ca4d6d27df7.tar.xz yuzu-92a331af76cba638f01490eeb0045ca4d6d27df7.zip | |
Merge pull request #12437 from ameerj/gl-amd-fixes
OpenGL: Fixes and workaround updates for AMD
5 files changed, 15 insertions, 14 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp index 6e940bd5a..ad39f44c3 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp | |||
| @@ -449,7 +449,7 @@ void EmitImageGatherDref(EmitContext& ctx, IR::Inst& inst, const IR::Value& inde | |||
| 449 | } | 449 | } |
| 450 | 450 | ||
| 451 | void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | 451 | void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, |
| 452 | std::string_view coords, std::string_view offset, std::string_view lod, | 452 | std::string_view coords, const IR::Value& offset, std::string_view lod, |
| 453 | std::string_view ms) { | 453 | std::string_view ms) { |
| 454 | const auto info{inst.Flags<IR::TextureInstInfo>()}; | 454 | const auto info{inst.Flags<IR::TextureInstInfo>()}; |
| 455 | if (info.has_bias) { | 455 | if (info.has_bias) { |
| @@ -470,9 +470,9 @@ void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | |||
| 470 | const auto int_coords{CoordsCastToInt(coords, info)}; | 470 | const auto int_coords{CoordsCastToInt(coords, info)}; |
| 471 | if (!ms.empty()) { | 471 | if (!ms.empty()) { |
| 472 | ctx.Add("{}=texelFetch({},{},int({}));", texel, texture, int_coords, ms); | 472 | ctx.Add("{}=texelFetch({},{},int({}));", texel, texture, int_coords, ms); |
| 473 | } else if (!offset.empty()) { | 473 | } else if (!offset.IsEmpty()) { |
| 474 | ctx.Add("{}=texelFetchOffset({},{},int({}),{});", texel, texture, int_coords, lod, | 474 | ctx.Add("{}=texelFetchOffset({},{},int({}),{});", texel, texture, int_coords, lod, |
| 475 | CoordsCastToInt(offset, info)); | 475 | GetOffsetVec(ctx, offset)); |
| 476 | } else { | 476 | } else { |
| 477 | if (info.type == TextureType::Buffer) { | 477 | if (info.type == TextureType::Buffer) { |
| 478 | ctx.Add("{}=texelFetch({},int({}));", texel, texture, coords); | 478 | ctx.Add("{}=texelFetch({},int({}));", texel, texture, coords); |
| @@ -485,10 +485,10 @@ void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | |||
| 485 | if (!ms.empty()) { | 485 | if (!ms.empty()) { |
| 486 | throw NotImplementedException("EmitImageFetch Sparse MSAA samples"); | 486 | throw NotImplementedException("EmitImageFetch Sparse MSAA samples"); |
| 487 | } | 487 | } |
| 488 | if (!offset.empty()) { | 488 | if (!offset.IsEmpty()) { |
| 489 | ctx.AddU1("{}=sparseTexelsResidentARB(sparseTexelFetchOffsetARB({},{},int({}),{},{}));", | 489 | ctx.AddU1("{}=sparseTexelsResidentARB(sparseTexelFetchOffsetARB({},{},int({}),{},{}));", |
| 490 | *sparse_inst, texture, CastToIntVec(coords, info), lod, | 490 | *sparse_inst, texture, CastToIntVec(coords, info), lod, GetOffsetVec(ctx, offset), |
| 491 | CastToIntVec(offset, info), texel); | 491 | texel); |
| 492 | } else { | 492 | } else { |
| 493 | ctx.AddU1("{}=sparseTexelsResidentARB(sparseTexelFetchARB({},{},int({}),{}));", | 493 | ctx.AddU1("{}=sparseTexelsResidentARB(sparseTexelFetchARB({},{},int({}),{}));", |
| 494 | *sparse_inst, texture, CastToIntVec(coords, info), lod, texel); | 494 | *sparse_inst, texture, CastToIntVec(coords, info), lod, texel); |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h index 8d0a65047..acebaa785 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h +++ b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h | |||
| @@ -651,7 +651,7 @@ void EmitImageGatherDref(EmitContext& ctx, IR::Inst& inst, const IR::Value& inde | |||
| 651 | std::string_view coords, const IR::Value& offset, const IR::Value& offset2, | 651 | std::string_view coords, const IR::Value& offset, const IR::Value& offset2, |
| 652 | std::string_view dref); | 652 | std::string_view dref); |
| 653 | void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | 653 | void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, |
| 654 | std::string_view coords, std::string_view offset, std::string_view lod, | 654 | std::string_view coords, const IR::Value& offset, std::string_view lod, |
| 655 | std::string_view ms); | 655 | std::string_view ms); |
| 656 | void EmitImageQueryDimensions(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | 656 | void EmitImageQueryDimensions(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, |
| 657 | std::string_view lod, const IR::Value& skip_mips); | 657 | std::string_view lod, const IR::Value& skip_mips); |
diff --git a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp index 89ebab08e..0442adc83 100644 --- a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp +++ b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp | |||
| @@ -1440,7 +1440,7 @@ void EmitContext::DefineInputs(const IR::Program& program) { | |||
| 1440 | if (profile.support_vertex_instance_id) { | 1440 | if (profile.support_vertex_instance_id) { |
| 1441 | instance_id = DefineInput(*this, U32[1], true, spv::BuiltIn::InstanceId); | 1441 | instance_id = DefineInput(*this, U32[1], true, spv::BuiltIn::InstanceId); |
| 1442 | if (loads[IR::Attribute::BaseInstance]) { | 1442 | if (loads[IR::Attribute::BaseInstance]) { |
| 1443 | base_instance = DefineInput(*this, U32[1], true, spv::BuiltIn::BaseVertex); | 1443 | base_instance = DefineInput(*this, U32[1], true, spv::BuiltIn::BaseInstance); |
| 1444 | } | 1444 | } |
| 1445 | } else { | 1445 | } else { |
| 1446 | instance_index = DefineInput(*this, U32[1], true, spv::BuiltIn::InstanceIndex); | 1446 | instance_index = DefineInput(*this, U32[1], true, spv::BuiltIn::InstanceIndex); |
diff --git a/src/video_core/renderer_opengl/gl_device.cpp b/src/video_core/renderer_opengl/gl_device.cpp index 993438a27..9be1b0805 100644 --- a/src/video_core/renderer_opengl/gl_device.cpp +++ b/src/video_core/renderer_opengl/gl_device.cpp | |||
| @@ -195,9 +195,9 @@ Device::Device(Core::Frontend::EmuWindow& emu_window) { | |||
| 195 | has_texture_shadow_lod = HasExtension(extensions, "GL_EXT_texture_shadow_lod"); | 195 | has_texture_shadow_lod = HasExtension(extensions, "GL_EXT_texture_shadow_lod"); |
| 196 | has_astc = !has_slow_software_astc && IsASTCSupported(); | 196 | has_astc = !has_slow_software_astc && IsASTCSupported(); |
| 197 | has_variable_aoffi = TestVariableAoffi(); | 197 | has_variable_aoffi = TestVariableAoffi(); |
| 198 | has_component_indexing_bug = is_amd; | 198 | has_component_indexing_bug = false; |
| 199 | has_precise_bug = TestPreciseBug(); | 199 | has_precise_bug = TestPreciseBug(); |
| 200 | has_broken_texture_view_formats = is_amd || (!is_linux && is_intel); | 200 | has_broken_texture_view_formats = (!is_linux && is_intel); |
| 201 | has_nv_viewport_array2 = GLAD_GL_NV_viewport_array2; | 201 | has_nv_viewport_array2 = GLAD_GL_NV_viewport_array2; |
| 202 | has_derivative_control = GLAD_GL_ARB_derivative_control; | 202 | has_derivative_control = GLAD_GL_ARB_derivative_control; |
| 203 | has_vertex_buffer_unified_memory = GLAD_GL_NV_vertex_buffer_unified_memory; | 203 | has_vertex_buffer_unified_memory = GLAD_GL_NV_vertex_buffer_unified_memory; |
| @@ -238,10 +238,11 @@ Device::Device(Core::Frontend::EmuWindow& emu_window) { | |||
| 238 | has_lmem_perf_bug = is_nvidia; | 238 | has_lmem_perf_bug = is_nvidia; |
| 239 | 239 | ||
| 240 | strict_context_required = emu_window.StrictContextRequired(); | 240 | strict_context_required = emu_window.StrictContextRequired(); |
| 241 | // Blocks AMD and Intel OpenGL drivers on Windows from using asynchronous shader compilation. | 241 | // Blocks Intel OpenGL drivers on Windows from using asynchronous shader compilation. |
| 242 | // Blocks EGL on Wayland from using asynchronous shader compilation. | 242 | // Blocks EGL on Wayland from using asynchronous shader compilation. |
| 243 | use_asynchronous_shaders = Settings::values.use_asynchronous_shaders.GetValue() && | 243 | const bool blacklist_async_shaders = (is_intel && !is_linux) || strict_context_required; |
| 244 | !(is_amd || (is_intel && !is_linux)) && !strict_context_required; | 244 | use_asynchronous_shaders = |
| 245 | Settings::values.use_asynchronous_shaders.GetValue() && !blacklist_async_shaders; | ||
| 245 | use_driver_cache = is_nvidia; | 246 | use_driver_cache = is_nvidia; |
| 246 | supports_conditional_barriers = !is_intel; | 247 | supports_conditional_barriers = !is_intel; |
| 247 | 248 | ||
diff --git a/src/yuzu/configuration/shared_translation.cpp b/src/yuzu/configuration/shared_translation.cpp index 7e908924c..922eb1b1a 100644 --- a/src/yuzu/configuration/shared_translation.cpp +++ b/src/yuzu/configuration/shared_translation.cpp | |||
| @@ -228,7 +228,7 @@ std::unique_ptr<ComboboxTranslationMap> ComboboxEnumeration(QWidget* parent) { | |||
| 228 | { | 228 | { |
| 229 | PAIR(ShaderBackend, Glsl, tr("GLSL")), | 229 | PAIR(ShaderBackend, Glsl, tr("GLSL")), |
| 230 | PAIR(ShaderBackend, Glasm, tr("GLASM (Assembly Shaders, NVIDIA Only)")), | 230 | PAIR(ShaderBackend, Glasm, tr("GLASM (Assembly Shaders, NVIDIA Only)")), |
| 231 | PAIR(ShaderBackend, SpirV, tr("SPIR-V (Experimental, Mesa Only)")), | 231 | PAIR(ShaderBackend, SpirV, tr("SPIR-V (Experimental, AMD/Mesa Only)")), |
| 232 | }}); | 232 | }}); |
| 233 | translations->insert({Settings::EnumMetadata<Settings::GpuAccuracy>::Index(), | 233 | translations->insert({Settings::EnumMetadata<Settings::GpuAccuracy>::Index(), |
| 234 | { | 234 | { |