diff options
| author | 2019-09-20 17:11:20 -0400 | |
|---|---|---|
| committer | 2019-09-20 17:11:20 -0400 | |
| commit | bbe82d62b0b449b8ff46f0856fec91488bcdca06 (patch) | |
| tree | 2f96e9a3d9f9f50d8c3363405f0ae750af4b7927 /src | |
| parent | Merge pull request #2855 from ReinUsesLisp/shfl (diff) | |
| parent | gl_shader_decompiler: Avoid writing output attribute when unimplemented (diff) | |
| download | yuzu-bbe82d62b0b449b8ff46f0856fec91488bcdca06.tar.gz yuzu-bbe82d62b0b449b8ff46f0856fec91488bcdca06.tar.xz yuzu-bbe82d62b0b449b8ff46f0856fec91488bcdca06.zip | |
Merge pull request #2846 from ReinUsesLisp/fixup-viewport-index
gl_shader_decompiler: Avoid writing output attribute when unimplemented
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 6c5402e33..76439e7ab 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -1021,10 +1021,10 @@ private: | |||
| 1021 | return {std::move(temporary), value.GetType()}; | 1021 | return {std::move(temporary), value.GetType()}; |
| 1022 | } | 1022 | } |
| 1023 | 1023 | ||
| 1024 | Expression GetOutputAttribute(const AbufNode* abuf) { | 1024 | std::optional<Expression> GetOutputAttribute(const AbufNode* abuf) { |
| 1025 | switch (const auto attribute = abuf->GetIndex()) { | 1025 | switch (const auto attribute = abuf->GetIndex()) { |
| 1026 | case Attribute::Index::Position: | 1026 | case Attribute::Index::Position: |
| 1027 | return {"gl_Position"s + GetSwizzle(abuf->GetElement()), Type::Float}; | 1027 | return {{"gl_Position"s + GetSwizzle(abuf->GetElement()), Type::Float}}; |
| 1028 | case Attribute::Index::LayerViewportPointSize: | 1028 | case Attribute::Index::LayerViewportPointSize: |
| 1029 | switch (abuf->GetElement()) { | 1029 | switch (abuf->GetElement()) { |
| 1030 | case 0: | 1030 | case 0: |
| @@ -1034,25 +1034,25 @@ private: | |||
| 1034 | if (IsVertexShader(stage) && !device.HasVertexViewportLayer()) { | 1034 | if (IsVertexShader(stage) && !device.HasVertexViewportLayer()) { |
| 1035 | return {}; | 1035 | return {}; |
| 1036 | } | 1036 | } |
| 1037 | return {"gl_Layer", Type::Int}; | 1037 | return {{"gl_Layer", Type::Int}}; |
| 1038 | case 2: | 1038 | case 2: |
| 1039 | if (IsVertexShader(stage) && !device.HasVertexViewportLayer()) { | 1039 | if (IsVertexShader(stage) && !device.HasVertexViewportLayer()) { |
| 1040 | return {}; | 1040 | return {}; |
| 1041 | } | 1041 | } |
| 1042 | return {"gl_ViewportIndex", Type::Int}; | 1042 | return {{"gl_ViewportIndex", Type::Int}}; |
| 1043 | case 3: | 1043 | case 3: |
| 1044 | UNIMPLEMENTED_MSG("Requires some state changes for gl_PointSize to work in shader"); | 1044 | UNIMPLEMENTED_MSG("Requires some state changes for gl_PointSize to work in shader"); |
| 1045 | return {"gl_PointSize", Type::Float}; | 1045 | return {{"gl_PointSize", Type::Float}}; |
| 1046 | } | 1046 | } |
| 1047 | return {}; | 1047 | return {}; |
| 1048 | case Attribute::Index::ClipDistances0123: | 1048 | case Attribute::Index::ClipDistances0123: |
| 1049 | return {fmt::format("gl_ClipDistance[{}]", abuf->GetElement()), Type::Float}; | 1049 | return {{fmt::format("gl_ClipDistance[{}]", abuf->GetElement()), Type::Float}}; |
| 1050 | case Attribute::Index::ClipDistances4567: | 1050 | case Attribute::Index::ClipDistances4567: |
| 1051 | return {fmt::format("gl_ClipDistance[{}]", abuf->GetElement() + 4), Type::Float}; | 1051 | return {{fmt::format("gl_ClipDistance[{}]", abuf->GetElement() + 4), Type::Float}}; |
| 1052 | default: | 1052 | default: |
| 1053 | if (IsGenericAttribute(attribute)) { | 1053 | if (IsGenericAttribute(attribute)) { |
| 1054 | return {GetOutputAttribute(attribute) + GetSwizzle(abuf->GetElement()), | 1054 | return { |
| 1055 | Type::Float}; | 1055 | {GetOutputAttribute(attribute) + GetSwizzle(abuf->GetElement()), Type::Float}}; |
| 1056 | } | 1056 | } |
| 1057 | UNIMPLEMENTED_MSG("Unhandled output attribute: {}", static_cast<u32>(attribute)); | 1057 | UNIMPLEMENTED_MSG("Unhandled output attribute: {}", static_cast<u32>(attribute)); |
| 1058 | return {}; | 1058 | return {}; |
| @@ -1292,7 +1292,11 @@ private: | |||
| 1292 | target = {GetRegister(gpr->GetIndex()), Type::Float}; | 1292 | target = {GetRegister(gpr->GetIndex()), Type::Float}; |
| 1293 | } else if (const auto abuf = std::get_if<AbufNode>(&*dest)) { | 1293 | } else if (const auto abuf = std::get_if<AbufNode>(&*dest)) { |
| 1294 | UNIMPLEMENTED_IF(abuf->IsPhysicalBuffer()); | 1294 | UNIMPLEMENTED_IF(abuf->IsPhysicalBuffer()); |
| 1295 | target = GetOutputAttribute(abuf); | 1295 | auto output = GetOutputAttribute(abuf); |
| 1296 | if (!output) { | ||
| 1297 | return {}; | ||
| 1298 | } | ||
| 1299 | target = std::move(*output); | ||
| 1296 | } else if (const auto lmem = std::get_if<LmemNode>(&*dest)) { | 1300 | } else if (const auto lmem = std::get_if<LmemNode>(&*dest)) { |
| 1297 | if (stage == ProgramType::Compute) { | 1301 | if (stage == ProgramType::Compute) { |
| 1298 | LOG_WARNING(Render_OpenGL, "Local memory is stubbed on compute shaders"); | 1302 | LOG_WARNING(Render_OpenGL, "Local memory is stubbed on compute shaders"); |