summaryrefslogtreecommitdiff
path: root/src/video_core/shader
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2019-07-15 16:28:07 -0400
committerGravatar GitHub2019-07-15 16:28:07 -0400
commit1bdb59fc6e52ac9d2c2432511fe7524994cc4f55 (patch)
treebcef764c59b000dba9eb040281799bf0152cb363 /src/video_core/shader
parentMerge pull request #2705 from FernandoS27/tex-cache-fixes (diff)
parentgl_shader_decompiler: Fix gl_PointSize redeclaration (diff)
downloadyuzu-1bdb59fc6e52ac9d2c2432511fe7524994cc4f55.tar.gz
yuzu-1bdb59fc6e52ac9d2c2432511fe7524994cc4f55.tar.xz
yuzu-1bdb59fc6e52ac9d2c2432511fe7524994cc4f55.zip
Merge pull request #2695 from ReinUsesLisp/layer-viewport
gl_shader_decompiler: Implement gl_ViewportIndex and gl_Layer in vertex shaders
Diffstat (limited to 'src/video_core/shader')
-rw-r--r--src/video_core/shader/shader_ir.cpp16
-rw-r--r--src/video_core/shader/shader_ir.h15
2 files changed, 31 insertions, 0 deletions
diff --git a/src/video_core/shader/shader_ir.cpp b/src/video_core/shader/shader_ir.cpp
index 5994bfc4e..caa409788 100644
--- a/src/video_core/shader/shader_ir.cpp
+++ b/src/video_core/shader/shader_ir.cpp
@@ -89,6 +89,22 @@ Node ShaderIR::GetPhysicalInputAttribute(Tegra::Shader::Register physical_addres
89} 89}
90 90
91Node ShaderIR::GetOutputAttribute(Attribute::Index index, u64 element, Node buffer) { 91Node ShaderIR::GetOutputAttribute(Attribute::Index index, u64 element, Node buffer) {
92 if (index == Attribute::Index::LayerViewportPointSize) {
93 switch (element) {
94 case 0:
95 UNIMPLEMENTED();
96 break;
97 case 1:
98 uses_layer = true;
99 break;
100 case 2:
101 uses_viewport_index = true;
102 break;
103 case 3:
104 uses_point_size = true;
105 break;
106 }
107 }
92 if (index == Attribute::Index::ClipDistances0123 || 108 if (index == Attribute::Index::ClipDistances0123 ||
93 index == Attribute::Index::ClipDistances4567) { 109 index == Attribute::Index::ClipDistances4567) {
94 const auto clip_index = 110 const auto clip_index =
diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.h
index 6145f0a70..03c888def 100644
--- a/src/video_core/shader/shader_ir.h
+++ b/src/video_core/shader/shader_ir.h
@@ -115,6 +115,18 @@ public:
115 return static_cast<std::size_t>(coverage_end * sizeof(u64)); 115 return static_cast<std::size_t>(coverage_end * sizeof(u64));
116 } 116 }
117 117
118 bool UsesLayer() const {
119 return uses_layer;
120 }
121
122 bool UsesViewportIndex() const {
123 return uses_viewport_index;
124 }
125
126 bool UsesPointSize() const {
127 return uses_point_size;
128 }
129
118 bool HasPhysicalAttributes() const { 130 bool HasPhysicalAttributes() const {
119 return uses_physical_attributes; 131 return uses_physical_attributes;
120 } 132 }
@@ -346,6 +358,9 @@ private:
346 std::set<Image> used_images; 358 std::set<Image> used_images;
347 std::array<bool, Tegra::Engines::Maxwell3D::Regs::NumClipDistances> used_clip_distances{}; 359 std::array<bool, Tegra::Engines::Maxwell3D::Regs::NumClipDistances> used_clip_distances{};
348 std::map<GlobalMemoryBase, GlobalMemoryUsage> used_global_memory; 360 std::map<GlobalMemoryBase, GlobalMemoryUsage> used_global_memory;
361 bool uses_layer{};
362 bool uses_viewport_index{};
363 bool uses_point_size{};
349 bool uses_physical_attributes{}; // Shader uses AL2P or physical attribute read/writes 364 bool uses_physical_attributes{}; // Shader uses AL2P or physical attribute read/writes
350 365
351 Tegra::Shader::Header header; 366 Tegra::Shader::Header header;