summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-04-16 07:33:46 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:27 +0200
commit4657cf78fd44c8f205cdbab73f1929e31df776fa (patch)
tree5b0d45522bc5c99f94d69d778175b799f89d76ea /src/shader_recompiler
parentshader: Implement PrimitiveId (diff)
downloadyuzu-4657cf78fd44c8f205cdbab73f1929e31df776fa.tar
yuzu-4657cf78fd44c8f205cdbab73f1929e31df776fa.tar.gz
yuzu-4657cf78fd44c8f205cdbab73f1929e31df776fa.tar.bz2
yuzu-4657cf78fd44c8f205cdbab73f1929e31df776fa.tar.lz
yuzu-4657cf78fd44c8f205cdbab73f1929e31df776fa.tar.xz
yuzu-4657cf78fd44c8f205cdbab73f1929e31df776fa.tar.zst
yuzu-4657cf78fd44c8f205cdbab73f1929e31df776fa.zip
Diffstat (limited to '')
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp
index 23a74f966..f3de577f6 100644
--- a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp
@@ -211,7 +211,7 @@ Id EmitGetAttribute(EmitContext& ctx, IR::Attribute attr, Id vertex) {
}
switch (attr) {
case IR::Attribute::PrimitiveId:
- return ctx.OpLoad(ctx.U32[1], ctx.primitive_id);
+ return ctx.OpBitcast(ctx.F32[1], ctx.OpLoad(ctx.U32[1], ctx.primitive_id));
case IR::Attribute::PositionX:
case IR::Attribute::PositionY:
case IR::Attribute::PositionZ:
@@ -220,17 +220,19 @@ Id EmitGetAttribute(EmitContext& ctx, IR::Attribute attr, Id vertex) {
ctx.F32[1], AttrPointer(ctx, ctx.input_f32, vertex, ctx.input_position, element_id()));
case IR::Attribute::InstanceId:
if (ctx.profile.support_vertex_instance_id) {
- return ctx.OpLoad(ctx.U32[1], ctx.instance_id);
+ return ctx.OpBitcast(ctx.F32[1], ctx.OpLoad(ctx.U32[1], ctx.instance_id));
} else {
- return ctx.OpISub(ctx.U32[1], ctx.OpLoad(ctx.U32[1], ctx.instance_index),
- ctx.OpLoad(ctx.U32[1], ctx.base_instance));
+ const Id index{ctx.OpLoad(ctx.U32[1], ctx.instance_index)};
+ const Id base{ctx.OpLoad(ctx.U32[1], ctx.base_instance)};
+ return ctx.OpBitcast(ctx.F32[1], ctx.OpISub(ctx.U32[1], index, base));
}
case IR::Attribute::VertexId:
if (ctx.profile.support_vertex_instance_id) {
- return ctx.OpLoad(ctx.U32[1], ctx.vertex_id);
+ return ctx.OpBitcast(ctx.F32[1], ctx.OpLoad(ctx.U32[1], ctx.vertex_id));
} else {
- return ctx.OpISub(ctx.U32[1], ctx.OpLoad(ctx.U32[1], ctx.vertex_index),
- ctx.OpLoad(ctx.U32[1], ctx.base_vertex));
+ const Id index{ctx.OpLoad(ctx.U32[1], ctx.vertex_index)};
+ const Id base{ctx.OpLoad(ctx.U32[1], ctx.base_vertex)};
+ return ctx.OpBitcast(ctx.F32[1], ctx.OpISub(ctx.U32[1], index, base));
}
case IR::Attribute::FrontFace:
return ctx.OpSelect(ctx.U32[1], ctx.OpLoad(ctx.U1, ctx.front_face),