summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-06-08 02:39:30 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:37 +0200
commitc5422041134ed2645e7cd32152e36f9d04c66da3 (patch)
treee417bbe88e598fd74dffc576c79427ce5d268cac /src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
parentglsl: Conditionally add GL_ARB_sparse_texture2 (diff)
downloadyuzu-c5422041134ed2645e7cd32152e36f9d04c66da3.tar
yuzu-c5422041134ed2645e7cd32152e36f9d04c66da3.tar.gz
yuzu-c5422041134ed2645e7cd32152e36f9d04c66da3.tar.bz2
yuzu-c5422041134ed2645e7cd32152e36f9d04c66da3.tar.lz
yuzu-c5422041134ed2645e7cd32152e36f9d04c66da3.tar.xz
yuzu-c5422041134ed2645e7cd32152e36f9d04c66da3.tar.zst
yuzu-c5422041134ed2645e7cd32152e36f9d04c66da3.zip
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
index cfcdd45a2..d09187ea7 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
@@ -206,26 +206,12 @@ void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr,
case IR::Attribute::PositionX:
case IR::Attribute::PositionY:
case IR::Attribute::PositionZ:
- case IR::Attribute::PositionW:
- switch (ctx.stage) {
- case Stage::VertexA:
- case Stage::VertexB:
- ctx.AddF32("{}=gl_Position.{};", inst, swizzle);
- break;
- case Stage::TessellationEval:
- ctx.AddF32("{}=gl_TessCoord.{};", inst, swizzle);
- break;
- case Stage::TessellationControl:
- case Stage::Geometry:
- ctx.AddF32("{}=gl_in[{}].gl_Position.{};", inst, vertex, swizzle);
- break;
- case Stage::Fragment:
- ctx.AddF32("{}=gl_FragCoord.{};", inst, swizzle);
- break;
- default:
- throw NotImplementedException("Get Position for stage {}", ctx.stage);
- }
+ case IR::Attribute::PositionW: {
+ const bool is_array{IsInputArray(ctx.stage)};
+ const auto input_decorator{is_array ? fmt::format("gl_in[{}].", vertex) : ""};
+ ctx.AddF32("{}={}{}.{};", inst, input_decorator, ctx.position_name, swizzle);
break;
+ }
case IR::Attribute::PointSpriteS:
case IR::Attribute::PointSpriteT:
ctx.AddF32("{}=gl_PointCoord.{};", inst, swizzle);
@@ -311,6 +297,20 @@ void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, std::string_view val
}
}
+void EmitGetAttributeIndexed(EmitContext& ctx, IR::Inst& inst, std::string_view offset,
+ std::string_view vertex) {
+ const bool is_array{ctx.stage == Stage::Geometry};
+ const auto vertex_arg{is_array ? fmt::format(",{}", vertex) : ""};
+ ctx.AddF32("{}=IndexedAttrLoad(int({}){});", inst, offset, vertex_arg);
+}
+
+void EmitSetAttributeIndexed([[maybe_unused]] EmitContext& ctx,
+ [[maybe_unused]] std::string_view offset,
+ [[maybe_unused]] std::string_view value,
+ [[maybe_unused]] std::string_view vertex) {
+ NotImplemented();
+}
+
void EmitGetPatch(EmitContext& ctx, IR::Inst& inst, IR::Patch patch) {
if (!IR::IsGeneric(patch)) {
throw NotImplementedException("Non-generic patch load");