shader: Address feedback + clang format
This commit is contained in:
		@@ -197,6 +197,8 @@ else()
 | 
			
		||||
        $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-variable>
 | 
			
		||||
        -Werror=unused-variable
 | 
			
		||||
 | 
			
		||||
        # Bracket depth determines maximum size of a fold expression in Clang since 9c9974c3ccb6.
 | 
			
		||||
        # And this in turns limits the size of a std::array.
 | 
			
		||||
        $<$<CXX_COMPILER_ID:Clang>:-fbracket-depth=1024>
 | 
			
		||||
    )
 | 
			
		||||
endif()
 | 
			
		||||
 
 | 
			
		||||
@@ -304,10 +304,6 @@ Id EmitImageGatherDref(EmitContext& ctx, IR::Inst* inst, const IR::Value& index,
 | 
			
		||||
                ctx.F32[4], Texture(ctx, index), coords, dref, operands.Mask(), operands.Span());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
#pragma optimize("", off)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
Id EmitImageFetch(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, Id offset,
 | 
			
		||||
                  Id lod, Id ms) {
 | 
			
		||||
    const auto info{inst->Flags<IR::TextureInstInfo>()};
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,6 @@
 | 
			
		||||
namespace Shader::Backend::SPIRV {
 | 
			
		||||
namespace {
 | 
			
		||||
Id WarpExtract(EmitContext& ctx, Id value) {
 | 
			
		||||
    [[maybe_unused]] const Id shift{ctx.Constant(ctx.U32[1], 5)};
 | 
			
		||||
    const Id local_index{ctx.OpLoad(ctx.U32[1], ctx.subgroup_local_invocation_id)};
 | 
			
		||||
    return ctx.OpVectorExtractDynamic(ctx.U32[1], value, local_index);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -49,7 +49,7 @@ constexpr std::array META_TABLE{
 | 
			
		||||
#define OPCODE(name_token, type_token, ...)                                                        \
 | 
			
		||||
    OpcodeMeta{                                                                                    \
 | 
			
		||||
        .name{#name_token},                                                                        \
 | 
			
		||||
        .type = type_token,                                                                         \
 | 
			
		||||
        .type = type_token,                                                                        \
 | 
			
		||||
        .arg_types{__VA_ARGS__},                                                                   \
 | 
			
		||||
    },
 | 
			
		||||
#include "opcodes.inc"
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,7 @@ void Split(Block* old_block, Block* new_block, Location pc) {
 | 
			
		||||
    *new_block = Block{};
 | 
			
		||||
    new_block->begin = pc;
 | 
			
		||||
    new_block->end = old_block->end;
 | 
			
		||||
    new_block->end_class = old_block->end_class,
 | 
			
		||||
    new_block->end_class = old_block->end_class;
 | 
			
		||||
    new_block->cond = old_block->cond;
 | 
			
		||||
    new_block->stack = old_block->stack;
 | 
			
		||||
    new_block->branch_true = old_block->branch_true;
 | 
			
		||||
@@ -428,7 +428,7 @@ CFG::AnalysisState CFG::AnalyzeBRX(Block* block, Location pc, Instruction inst,
 | 
			
		||||
        if (!is_absolute) {
 | 
			
		||||
            target += pc.Offset();
 | 
			
		||||
        }
 | 
			
		||||
        target += static_cast<unsigned int>(brx_table->branch_offset);
 | 
			
		||||
        target += static_cast<u32>(brx_table->branch_offset);
 | 
			
		||||
        target += 8;
 | 
			
		||||
        targets.push_back(target);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -78,15 +78,15 @@ struct Block : boost::intrusive::set_base_hook<
 | 
			
		||||
 | 
			
		||||
    Location begin;
 | 
			
		||||
    Location end;
 | 
			
		||||
    EndClass end_class;
 | 
			
		||||
    IR::Condition cond;
 | 
			
		||||
    EndClass end_class{};
 | 
			
		||||
    IR::Condition cond{};
 | 
			
		||||
    Stack stack;
 | 
			
		||||
    Block* branch_true;
 | 
			
		||||
    Block* branch_false;
 | 
			
		||||
    FunctionId function_call;
 | 
			
		||||
    Block* return_block;
 | 
			
		||||
    IR::Reg branch_reg;
 | 
			
		||||
    s32 branch_offset;
 | 
			
		||||
    Block* branch_true{};
 | 
			
		||||
    Block* branch_false{};
 | 
			
		||||
    FunctionId function_call{};
 | 
			
		||||
    Block* return_block{};
 | 
			
		||||
    IR::Reg branch_reg{};
 | 
			
		||||
    s32 branch_offset{};
 | 
			
		||||
    std::vector<IndirectBranch> indirect_branches;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -56,7 +56,7 @@ constexpr std::array UNORDERED_ENCODINGS{
 | 
			
		||||
#define INST(name, cute, encode)                                                                   \
 | 
			
		||||
    InstEncoding{                                                                                  \
 | 
			
		||||
        .mask_value{MaskValueFromEncoding(encode)},                                                \
 | 
			
		||||
        .opcode = Opcode::name,                                                                     \
 | 
			
		||||
        .opcode = Opcode::name,                                                                    \
 | 
			
		||||
    },
 | 
			
		||||
#include "maxwell.inc"
 | 
			
		||||
#undef INST
 | 
			
		||||
 
 | 
			
		||||
@@ -72,8 +72,9 @@ bool IsCompareOpOrdered(FPCompareOp op) {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
IR::U1 FloatingPointCompare(IR::IREmitter& ir, const IR::F16F32F64& operand_1, const IR::F16F32F64& operand_2,
 | 
			
		||||
                            FPCompareOp compare_op, IR::FpControl control) {
 | 
			
		||||
IR::U1 FloatingPointCompare(IR::IREmitter& ir, const IR::F16F32F64& operand_1,
 | 
			
		||||
                            const IR::F16F32F64& operand_2, FPCompareOp compare_op,
 | 
			
		||||
                            IR::FpControl control) {
 | 
			
		||||
    const bool ordered{IsCompareOpOrdered(compare_op)};
 | 
			
		||||
    switch (compare_op) {
 | 
			
		||||
    case FPCompareOp::F:
 | 
			
		||||
 
 | 
			
		||||
@@ -65,7 +65,6 @@ void TranslatorVisitor::CS2R(u64) {
 | 
			
		||||
    ThrowNotImplemented(Opcode::CS2R);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void TranslatorVisitor::FCHK_reg(u64) {
 | 
			
		||||
    ThrowNotImplemented(Opcode::FCHK_reg);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -164,7 +164,8 @@ void DiscardGlobalMemory(IR::Block& block, IR::Inst& inst) {
 | 
			
		||||
        inst.Invalidate();
 | 
			
		||||
        break;
 | 
			
		||||
    default:
 | 
			
		||||
        throw LogicError("Invalid opcode to discard its global memory operation {}", inst.GetOpcode());
 | 
			
		||||
        throw LogicError("Invalid opcode to discard its global memory operation {}",
 | 
			
		||||
                         inst.GetOpcode());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ public:
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    template <typename... Args>
 | 
			
		||||
    requires std::is_constructible_v<T, Args...> [[nodiscard]] T* Create(Args&&... args) {
 | 
			
		||||
    requires std::is_constructible_v<T, Args...>[[nodiscard]] T* Create(Args&&... args) {
 | 
			
		||||
        return std::construct_at(Memory(), std::forward<Args>(args)...);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,9 +4,9 @@
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <mutex>
 | 
			
		||||
#include <condition_variable>
 | 
			
		||||
#include <atomic>
 | 
			
		||||
#include <condition_variable>
 | 
			
		||||
#include <mutex>
 | 
			
		||||
 | 
			
		||||
#include "common/common_types.h"
 | 
			
		||||
#include "common/thread_worker.h"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user