summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp24
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 a5cc1a86f..4a8c7edc9 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -984,10 +984,10 @@ private:
984 return {std::move(temporary), value.GetType()}; 984 return {std::move(temporary), value.GetType()};
985 } 985 }
986 986
987 Expression GetOutputAttribute(const AbufNode* abuf) { 987 std::optional<Expression> GetOutputAttribute(const AbufNode* abuf) {
988 switch (const auto attribute = abuf->GetIndex()) { 988 switch (const auto attribute = abuf->GetIndex()) {
989 case Attribute::Index::Position: 989 case Attribute::Index::Position:
990 return {"gl_Position"s + GetSwizzle(abuf->GetElement()), Type::Float}; 990 return {{"gl_Position"s + GetSwizzle(abuf->GetElement()), Type::Float}};
991 case Attribute::Index::LayerViewportPointSize: 991 case Attribute::Index::LayerViewportPointSize:
992 switch (abuf->GetElement()) { 992 switch (abuf->GetElement()) {
993 case 0: 993 case 0:
@@ -997,25 +997,25 @@ private:
997 if (IsVertexShader(stage) && !device.HasVertexViewportLayer()) { 997 if (IsVertexShader(stage) && !device.HasVertexViewportLayer()) {
998 return {}; 998 return {};
999 } 999 }
1000 return {"gl_Layer", Type::Int}; 1000 return {{"gl_Layer", Type::Int}};
1001 case 2: 1001 case 2:
1002 if (IsVertexShader(stage) && !device.HasVertexViewportLayer()) { 1002 if (IsVertexShader(stage) && !device.HasVertexViewportLayer()) {
1003 return {}; 1003 return {};
1004 } 1004 }
1005 return {"gl_ViewportIndex", Type::Int}; 1005 return {{"gl_ViewportIndex", Type::Int}};
1006 case 3: 1006 case 3:
1007 UNIMPLEMENTED_MSG("Requires some state changes for gl_PointSize to work in shader"); 1007 UNIMPLEMENTED_MSG("Requires some state changes for gl_PointSize to work in shader");
1008 return {"gl_PointSize", Type::Float}; 1008 return {{"gl_PointSize", Type::Float}};
1009 } 1009 }
1010 return {}; 1010 return {};
1011 case Attribute::Index::ClipDistances0123: 1011 case Attribute::Index::ClipDistances0123:
1012 return {fmt::format("gl_ClipDistance[{}]", abuf->GetElement()), Type::Float}; 1012 return {{fmt::format("gl_ClipDistance[{}]", abuf->GetElement()), Type::Float}};
1013 case Attribute::Index::ClipDistances4567: 1013 case Attribute::Index::ClipDistances4567:
1014 return {fmt::format("gl_ClipDistance[{}]", abuf->GetElement() + 4), Type::Float}; 1014 return {{fmt::format("gl_ClipDistance[{}]", abuf->GetElement() + 4), Type::Float}};
1015 default: 1015 default:
1016 if (IsGenericAttribute(attribute)) { 1016 if (IsGenericAttribute(attribute)) {
1017 return {GetOutputAttribute(attribute) + GetSwizzle(abuf->GetElement()), 1017 return {
1018 Type::Float}; 1018 {GetOutputAttribute(attribute) + GetSwizzle(abuf->GetElement()), Type::Float}};
1019 } 1019 }
1020 UNIMPLEMENTED_MSG("Unhandled output attribute: {}", static_cast<u32>(attribute)); 1020 UNIMPLEMENTED_MSG("Unhandled output attribute: {}", static_cast<u32>(attribute));
1021 return {}; 1021 return {};
@@ -1187,7 +1187,11 @@ private:
1187 target = {GetRegister(gpr->GetIndex()), Type::Float}; 1187 target = {GetRegister(gpr->GetIndex()), Type::Float};
1188 } else if (const auto abuf = std::get_if<AbufNode>(&*dest)) { 1188 } else if (const auto abuf = std::get_if<AbufNode>(&*dest)) {
1189 UNIMPLEMENTED_IF(abuf->IsPhysicalBuffer()); 1189 UNIMPLEMENTED_IF(abuf->IsPhysicalBuffer());
1190 target = GetOutputAttribute(abuf); 1190 auto output = GetOutputAttribute(abuf);
1191 if (!output) {
1192 return {};
1193 }
1194 target = std::move(*output);
1191 } else if (const auto lmem = std::get_if<LmemNode>(&*dest)) { 1195 } else if (const auto lmem = std::get_if<LmemNode>(&*dest)) {
1192 if (stage == ProgramType::Compute) { 1196 if (stage == ProgramType::Compute) {
1193 LOG_WARNING(Render_OpenGL, "Local memory is stubbed on compute shaders"); 1197 LOG_WARNING(Render_OpenGL, "Local memory is stubbed on compute shaders");