summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp
diff options
context:
space:
mode:
authorFeng Chen <vonchenplus@gmail.com>2021-09-08 03:53:10 +0200
committerFeng Chen <vonchenplus@gmail.com>2021-09-08 03:53:10 +0200
commitbbc1800c1b22097c56ecb799c0e475aaf8502038 (patch)
tree5d315e878ba4d40a8f982ae5a2bc2bf66bcd2cf7 /src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp
parentRe-implement get unused location (diff)
downloadyuzu-bbc1800c1b22097c56ecb799c0e475aaf8502038.tar
yuzu-bbc1800c1b22097c56ecb799c0e475aaf8502038.tar.gz
yuzu-bbc1800c1b22097c56ecb799c0e475aaf8502038.tar.bz2
yuzu-bbc1800c1b22097c56ecb799c0e475aaf8502038.tar.lz
yuzu-bbc1800c1b22097c56ecb799c0e475aaf8502038.tar.xz
yuzu-bbc1800c1b22097c56ecb799c0e475aaf8502038.tar.zst
yuzu-bbc1800c1b22097c56ecb799c0e475aaf8502038.zip
Diffstat (limited to '')
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp16
1 files changed, 8 insertions, 8 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 dd0d01b2a..67df46499 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
@@ -50,16 +50,16 @@ bool IsFixedFncTexture(IR::Attribute attribute) {
u32 FixedFncTextureAttributeIndex(IR::Attribute attribute) {
if (!IsFixedFncTexture(attribute)) {
- throw InvalidArgument("Attribute is not fixedfnctexture {}", attribute);
+ throw InvalidArgument("Attribute {} is not a FixedFncTexture", attribute);
}
return (static_cast<u32>(attribute) - static_cast<u32>(IR::Attribute::FixedFncTexture0S)) / 4u;
}
u32 FixedFncTextureAttributeElement(IR::Attribute attribute) {
if (!IsFixedFncTexture(attribute)) {
- throw InvalidArgument("Attribute is not fixedfnctexture {}", attribute);
+ throw InvalidArgument("Attribute {} is not a FixedFncTexture", attribute);
}
- return static_cast<u32>(attribute) % 4;
+ return static_cast<u32>(attribute) % 4u;
}
template <typename... Args>
@@ -93,7 +93,7 @@ std::optional<OutAttr> OutputAttrPointer(EmitContext& ctx, IR::Attribute attr) {
return OutputAccessChain(ctx, ctx.output_f32, info.id, index_id);
}
}
- if (attr >= IR::Attribute::FixedFncTexture0S && attr <= IR::Attribute::FixedFncTexture9Q) {
+ if (IsFixedFncTexture(attr)) {
const u32 index{FixedFncTextureAttributeIndex(attr)};
const u32 element{FixedFncTextureAttributeElement(attr)};
const Id element_id{ctx.Const(element)};
@@ -341,11 +341,11 @@ Id EmitGetAttribute(EmitContext& ctx, IR::Attribute attr, Id vertex) {
const Id value{ctx.OpLoad(type->id, pointer)};
return type->needs_cast ? ctx.OpBitcast(ctx.F32[1], value) : value;
}
- if (attr >= IR::Attribute::FixedFncTexture0S && attr <= IR::Attribute::FixedFncTexture9Q) {
+ if (IsFixedFncTexture(attr)) {
const u32 index{FixedFncTextureAttributeIndex(attr)};
- return ctx.OpLoad(ctx.F32[1],
- AttrPointer(ctx, ctx.input_f32, vertex,
- ctx.input_fixed_fnc_textures[index], ctx.Const(element)));
+ const Id attr_id{ctx.input_fixed_fnc_textures[index]};
+ const Id attr_ptr{AttrPointer(ctx, ctx.input_f32, vertex, attr_id, ctx.Const(element))};
+ return ctx.OpLoad(ctx.F32[1], attr_ptr);
}
switch (attr) {
case IR::Attribute::PrimitiveId: