summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/backend')
-rw-r--r--src/shader_recompiler/backend/spirv/emit_context.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_context.cpp b/src/shader_recompiler/backend/spirv/emit_context.cpp
index e22bb5371..2d39ea373 100644
--- a/src/shader_recompiler/backend/spirv/emit_context.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_context.cpp
@@ -314,7 +314,7 @@ void EmitContext::DefineSharedMemory(const IR::Program& program) {
}
void EmitContext::DefineAttributeMemAccess(const Info& info) {
- const auto make_load{[&]() {
+ const auto make_load{[&] {
const Id end_block{OpLabel()};
const Id default_label{OpLabel()};
@@ -322,9 +322,9 @@ void EmitContext::DefineAttributeMemAccess(const Info& info) {
const Id func{OpFunction(F32[1], spv::FunctionControlMask::MaskNone, func_type_load)};
const Id offset{OpFunctionParameter(U32[1])};
AddLabel();
- const Id base_index{OpShiftRightLogical(U32[1], offset, Constant(U32[1], 2U))};
+ const Id base_index{OpShiftRightArithmetic(U32[1], offset, Constant(U32[1], 2U))};
const Id masked_index{OpBitwiseAnd(U32[1], base_index, Constant(U32[1], 3U))};
- const Id compare_index{OpShiftRightLogical(U32[1], base_index, Constant(U32[1], 2U))};
+ const Id compare_index{OpShiftRightArithmetic(U32[1], base_index, Constant(U32[1], 2U))};
std::vector<Sirit::Literal> literals;
std::vector<Id> labels;
if (info.loads_position) {
@@ -343,22 +343,22 @@ void EmitContext::DefineAttributeMemAccess(const Info& info) {
OpSwitch(compare_index, default_label, literals, labels);
AddLabel(default_label);
OpReturnValue(Constant(F32[1], 0.0f));
- size_t label_index = 0;
+ size_t label_index{0};
if (info.loads_position) {
AddLabel(labels[label_index]);
const Id result{OpLoad(F32[1], OpAccessChain(input_f32, input_position, masked_index))};
OpReturnValue(result);
- label_index++;
+ ++label_index;
}
- for (u32 i = 0; i < info.input_generics.size(); i++) {
+ for (size_t i = 0; i < info.input_generics.size(); i++) {
if (!info.input_generics[i].used) {
continue;
}
AddLabel(labels[label_index]);
- const auto type{AttrTypes(*this, i)};
+ const auto type{AttrTypes(*this, static_cast<u32>(i))};
if (!type) {
OpReturnValue(Constant(F32[1], 0.0f));
- label_index++;
+ ++label_index;
continue;
}
const Id generic_id{input_generics.at(i)};
@@ -366,14 +366,14 @@ void EmitContext::DefineAttributeMemAccess(const Info& info) {
const Id value{OpLoad(type->id, pointer)};
const Id result{type->needs_cast ? OpBitcast(F32[1], value) : value};
OpReturnValue(result);
- label_index++;
+ ++label_index;
}
AddLabel(end_block);
OpUnreachable();
OpFunctionEnd();
return func;
}};
- const auto make_store{[&]() {
+ const auto make_store{[&] {
const Id end_block{OpLabel()};
const Id default_label{OpLabel()};
@@ -382,9 +382,9 @@ void EmitContext::DefineAttributeMemAccess(const Info& info) {
const Id offset{OpFunctionParameter(U32[1])};
const Id store_value{OpFunctionParameter(F32[1])};
AddLabel();
- const Id base_index{OpShiftRightLogical(U32[1], offset, Constant(U32[1], 2U))};
+ const Id base_index{OpShiftRightArithmetic(U32[1], offset, Constant(U32[1], 2U))};
const Id masked_index{OpBitwiseAnd(U32[1], base_index, Constant(U32[1], 3U))};
- const Id compare_index{OpShiftRightLogical(U32[1], base_index, Constant(U32[1], 2U))};
+ const Id compare_index{OpShiftRightArithmetic(U32[1], base_index, Constant(U32[1], 2U))};
std::vector<Sirit::Literal> literals;
std::vector<Id> labels;
if (info.stores_position) {
@@ -392,11 +392,11 @@ void EmitContext::DefineAttributeMemAccess(const Info& info) {
labels.push_back(OpLabel());
}
const u32 base_attribute_value = static_cast<u32>(IR::Attribute::Generic0X) >> 2;
- for (u32 i = 0; i < info.stores_generics.size(); i++) {
+ for (size_t i = 0; i < info.stores_generics.size(); i++) {
if (!info.stores_generics[i]) {
continue;
}
- literals.push_back(base_attribute_value + i);
+ literals.push_back(base_attribute_value + static_cast<u32>(i));
labels.push_back(OpLabel());
}
if (info.stores_clip_distance) {
@@ -409,15 +409,15 @@ void EmitContext::DefineAttributeMemAccess(const Info& info) {
OpSwitch(compare_index, default_label, literals, labels);
AddLabel(default_label);
OpReturn();
- size_t label_index = 0;
+ size_t label_index{0};
if (info.stores_position) {
AddLabel(labels[label_index]);
const Id pointer{OpAccessChain(output_f32, output_position, masked_index)};
OpStore(pointer, store_value);
OpReturn();
- label_index++;
+ ++label_index;
}
- for (u32 i = 0; i < info.stores_generics.size(); i++) {
+ for (size_t i = 0; i < info.stores_generics.size(); i++) {
if (!info.stores_generics[i]) {
continue;
}
@@ -426,20 +426,20 @@ void EmitContext::DefineAttributeMemAccess(const Info& info) {
const Id pointer{OpAccessChain(output_f32, generic_id, masked_index)};
OpStore(pointer, store_value);
OpReturn();
- label_index++;
+ ++label_index;
}
if (info.stores_clip_distance) {
AddLabel(labels[label_index]);
const Id pointer{OpAccessChain(output_f32, clip_distances, masked_index)};
OpStore(pointer, store_value);
OpReturn();
- label_index++;
+ ++label_index;
AddLabel(labels[label_index]);
const Id fixed_index{OpIAdd(U32[1], masked_index, Constant(U32[1], 4))};
const Id pointer2{OpAccessChain(output_f32, clip_distances, fixed_index)};
OpStore(pointer2, store_value);
OpReturn();
- label_index++;
+ ++label_index;
}
AddLabel(end_block);
OpUnreachable();