summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-06-01 07:49:24 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:37 +0200
commit31147ffe69882141cb83bf83d5e01890524ab85a (patch)
treed4e0466ba6f8e2a819c41c16d8c90c46f7683697 /src/shader_recompiler
parentglsl: Add gl_ViewportIndex out attribute (diff)
downloadyuzu-31147ffe69882141cb83bf83d5e01890524ab85a.tar
yuzu-31147ffe69882141cb83bf83d5e01890524ab85a.tar.gz
yuzu-31147ffe69882141cb83bf83d5e01890524ab85a.tar.bz2
yuzu-31147ffe69882141cb83bf83d5e01890524ab85a.tar.lz
yuzu-31147ffe69882141cb83bf83d5e01890524ab85a.tar.xz
yuzu-31147ffe69882141cb83bf83d5e01890524ab85a.tar.zst
yuzu-31147ffe69882141cb83bf83d5e01890524ab85a.zip
Diffstat (limited to 'src/shader_recompiler')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_context.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_context.cpp b/src/shader_recompiler/backend/glsl/emit_context.cpp
index 6e164b958..6f10002fe 100644
--- a/src/shader_recompiler/backend/glsl/emit_context.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_context.cpp
@@ -32,6 +32,19 @@ std::string_view InputArrayDecorator(Stage stage) {
}
}
+bool StoresPerVertexAttributes(Stage stage) {
+ switch (stage) {
+ case Stage::VertexA:
+ case Stage::VertexB:
+ case Stage::Geometry:
+ case Stage::TessellationControl:
+ case Stage::TessellationEval:
+ return true;
+ default:
+ return false;
+ }
+}
+
std::string OutputDecorator(Stage stage, u32 size) {
switch (stage) {
case Stage::TessellationControl:
@@ -137,7 +150,7 @@ std::string_view OutputPrimitive(OutputTopology topology) {
}
void SetupOutPerVertex(Stage stage, const Info& info, std::string& header) {
- if (stage != Stage::VertexA && stage != Stage::VertexB && stage != Stage::Geometry) {
+ if (!StoresPerVertexAttributes(stage)) {
return;
}
header += "out gl_PerVertex{";
@@ -150,8 +163,11 @@ void SetupOutPerVertex(Stage stage, const Info& info, std::string& header) {
if (info.stores_clip_distance) {
header += "float gl_ClipDistance[];";
}
+ if (info.stores_viewport_index && stage != Stage::Geometry) {
+ header += "int gl_ViewportIndex;";
+ }
header += "};\n";
- if (info.stores_viewport_index) {
+ if (info.stores_viewport_index && stage == Stage::Geometry) {
header += "out int gl_ViewportIndex;";
}
}
@@ -265,7 +281,7 @@ void EmitContext::SetupExtensions(std::string&) {
header += "#extension GL_ARB_gpu_shader_int64 : enable\n";
}
}
- if (info.stores_viewport_index) {
+ if (info.stores_viewport_index && stage != Stage::Geometry) {
header += "#extension GL_ARB_shader_viewport_layer_array : enable\n";
}
}