From a585f2454f702675889da8869b9e253bf9b01309 Mon Sep 17 00:00:00 2001 From: boykopovar Date: Wed, 16 Sep 2026 18:42:19 +0300 Subject: [PATCH] refactor(shader): translation context helpers module --- core/shader/recompiler/CMakeLists.txt | 3 + .../Translation/src/InstructionTranslator.cpp | 140 ------------------ .../src/TranslationContext/ExecMask.cpp | 39 +++++ .../src/TranslationContext/OperandAccess.cpp | 54 +++++++ .../src/TranslationContext/SubwordPacking.cpp | 67 +++++++++ 5 files changed, 163 insertions(+), 140 deletions(-) create mode 100644 core/shader/recompiler/Translation/src/TranslationContext/ExecMask.cpp create mode 100644 core/shader/recompiler/Translation/src/TranslationContext/OperandAccess.cpp create mode 100644 core/shader/recompiler/Translation/src/TranslationContext/SubwordPacking.cpp diff --git a/core/shader/recompiler/CMakeLists.txt b/core/shader/recompiler/CMakeLists.txt index 960e8a1b0..4add9dc92 100644 --- a/core/shader/recompiler/CMakeLists.txt +++ b/core/shader/recompiler/CMakeLists.txt @@ -32,6 +32,9 @@ function(add_shader_recompiler target runtimeTarget) ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/IntermediateRepresentation/src/IrBuilder/IrBuilderLogic.cpp ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Translation/src/EmbeddedVertexFetch.cpp ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Translation/src/InstructionTranslator.cpp + ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Translation/src/TranslationContext/OperandAccess.cpp + ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Translation/src/TranslationContext/SubwordPacking.cpp + ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Translation/src/TranslationContext/ExecMask.cpp ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Translation/src/ScalarInstructions.cpp ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Translation/src/VectorInstructions.cpp ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Translation/src/FloatInstructions.cpp diff --git a/core/shader/recompiler/Translation/src/InstructionTranslator.cpp b/core/shader/recompiler/Translation/src/InstructionTranslator.cpp index 7126583df..0784c43d8 100644 --- a/core/shader/recompiler/Translation/src/InstructionTranslator.cpp +++ b/core/shader/recompiler/Translation/src/InstructionTranslator.cpp @@ -15,144 +15,4 @@ TranslationContext::TranslationContext(IrProgram& program, IrBlock& block, std:: throw std::runtime_error("TranslationContext not implemented"); } -const RdnaOperand& TranslationContext::sourceAt(const RdnaInstruction& inst, std::uint32_t index) { - throw std::runtime_error("TranslationContext::sourceAt not implemented"); -} - -RdnaOperand TranslationContext::destinationOperand(const RdnaInstruction& inst) { - throw std::runtime_error("TranslationContext::destinationOperand not implemented"); -} - -RdnaOperand TranslationContext::offsetOperand(const RdnaOperand& operand, std::uint32_t offset) { - throw std::runtime_error("TranslationContext::offsetOperand not implemented"); -} - -RdnaOperand TranslationContext::scalarDestinationOperand(const RdnaOperand& operand, std::uint32_t offset) { - throw std::runtime_error("TranslationContext::scalarDestinationOperand not implemented"); -} - -RdnaOperand TranslationContext::plainOperand(const RdnaOperand& operand) { - throw std::runtime_error("TranslationContext::plainOperand not implemented"); -} - -std::array TranslationContext::ballotMask(IrU1 value) { - throw std::runtime_error("TranslationContext::ballotMask not implemented"); -} - -IrU32 TranslationContext::readRawU32(const RdnaOperand& operand) { - throw std::runtime_error("TranslationContext::readRawU32 not implemented"); -} - -IrU32 TranslationContext::readScalarCode(std::uint32_t code) { - throw std::runtime_error("TranslationContext::readScalarCode not implemented"); -} - -IrU32 TranslationContext::applyBitSourceModifiers(const RdnaOperand& operand, IrU32 value) { - throw std::runtime_error("TranslationContext::applyBitSourceModifiers not implemented"); -} - -IrValue* TranslationContext::readOperand(const RdnaOperand& operand, IrType type) { - throw std::runtime_error("TranslationContext::readOperand not implemented"); -} - -IrU1 TranslationContext::threadBit(const std::array& mask) { - throw std::runtime_error("TranslationContext::threadBit not implemented"); -} - -void TranslationContext::writeRawU32(const RdnaOperand& operand, IrU32 value) { - throw std::runtime_error("TranslationContext::writeRawU32 not implemented"); -} - -IrF32 TranslationContext::applyF32ResultModifiers(const RdnaOperand& operand, IrF32 value) { - throw std::runtime_error("TranslationContext::applyF32ResultModifiers not implemented"); -} - -void TranslationContext::writeOperand(const RdnaOperand& operand, IrValue* value) { - throw std::runtime_error("TranslationContext::writeOperand not implemented"); -} - -IrU32 TranslationContext::packHalf2x16(IrF32 low, IrF32 high) { - throw std::runtime_error("TranslationContext::packHalf2x16 not implemented"); -} - -void TranslationContext::write16Bits(const RdnaOperand& operand, IrU32 value) { - throw std::runtime_error("TranslationContext::write16Bits not implemented"); -} - -void TranslationContext::writeF16(const RdnaOperand& operand, IrF32 value) { - throw std::runtime_error("TranslationContext::writeF16 not implemented"); -} - -IrU32 TranslationContext::readU32(const RdnaOperand& operand) { - throw std::runtime_error("TranslationContext::readU32 not implemented"); -} - -std::array TranslationContext::readU32Pair(const RdnaOperand& operand) { - throw std::runtime_error("TranslationContext::readU32Pair not implemented"); -} - -IrU64 TranslationContext::readU64(const RdnaOperand& operand) { - throw std::runtime_error("TranslationContext::readU64 not implemented"); -} - -IrF32 TranslationContext::readF16LaneAsF32(const RdnaOperand& operand, bool highLane, bool packed) { - throw std::runtime_error("TranslationContext::readF16LaneAsF32 not implemented"); -} - -IrF32 TranslationContext::readF16AsF32(const RdnaOperand& operand) { - throw std::runtime_error("TranslationContext::readF16AsF32 not implemented"); -} - -IrF32 TranslationContext::readMixF32(const RdnaOperand& operand) { - throw std::runtime_error("TranslationContext::readMixF32 not implemented"); -} - -IrU32 TranslationContext::readU16LaneRaw(const RdnaOperand& operand, bool highLane) { - throw std::runtime_error("TranslationContext::readU16LaneRaw not implemented"); -} - -IrU32 TranslationContext::readU16LaneAsU32(const RdnaOperand& operand, bool highLane, bool signExtend) { - throw std::runtime_error("TranslationContext::readU16LaneAsU32 not implemented"); -} - -IrU32 TranslationContext::readU16AsU32(const RdnaOperand& operand, bool signExtend) { - throw std::runtime_error("TranslationContext::readU16AsU32 not implemented"); -} - -IrU32 TranslationContext::readF16LaneBits(const RdnaOperand& operand, bool highLane) { - throw std::runtime_error("TranslationContext::readF16LaneBits not implemented"); -} - -std::array TranslationContext::extractU64(IrU64 value) { - throw std::runtime_error("TranslationContext::extractU64 not implemented"); -} - -void TranslationContext::writeU32Pair(const RdnaOperand& operand, const std::array& value) { - throw std::runtime_error("TranslationContext::writeU32Pair not implemented"); -} - -IrU32 TranslationContext::conditionBit(const RdnaOperand& operand) { - throw std::runtime_error("TranslationContext::conditionBit not implemented"); -} - -IrU1 TranslationContext::readMask(const RdnaOperand& operand) { - throw std::runtime_error("TranslationContext::readMask not implemented"); -} - -IrU1 TranslationContext::readMaskValid(const RdnaOperand& operand) { - throw std::runtime_error("TranslationContext::readMaskValid not implemented"); -} - -std::array TranslationContext::writeMask(const RdnaOperand& operand, IrU1 value, bool write64) { - throw std::runtime_error("TranslationContext::writeMask not implemented"); -} - -void TranslationContext::writeCompareResult(const RdnaOperand& operand, IrU1 value) { - throw std::runtime_error("TranslationContext::writeCompareResult not implemented"); -} - -void TranslationContext::AddBranchCondition(const BasicBlock& source, BlockInfo& info) { - throw std::runtime_error("TranslationContext::AddBranchCondition not implemented"); -} - } diff --git a/core/shader/recompiler/Translation/src/TranslationContext/ExecMask.cpp b/core/shader/recompiler/Translation/src/TranslationContext/ExecMask.cpp new file mode 100644 index 000000000..155f69cb3 --- /dev/null +++ b/core/shader/recompiler/Translation/src/TranslationContext/ExecMask.cpp @@ -0,0 +1,39 @@ +#include "Translation/TranslationContext.hpp" +#include +#include + +namespace ShaderRecompiler { + +std::array TranslationContext::ballotMask(IrU1 value) { + throw std::runtime_error("TranslationContext::ballotMask not implemented"); +} + +IrU1 TranslationContext::threadBit(const std::array& mask) { + throw std::runtime_error("TranslationContext::threadBit not implemented"); +} + +IrU32 TranslationContext::conditionBit(const RdnaOperand& operand) { + throw std::runtime_error("TranslationContext::conditionBit not implemented"); +} + +IrU1 TranslationContext::readMask(const RdnaOperand& operand) { + throw std::runtime_error("TranslationContext::readMask not implemented"); +} + +IrU1 TranslationContext::readMaskValid(const RdnaOperand& operand) { + throw std::runtime_error("TranslationContext::readMaskValid not implemented"); +} + +std::array TranslationContext::writeMask(const RdnaOperand& operand, IrU1 value, bool write64) { + throw std::runtime_error("TranslationContext::writeMask not implemented"); +} + +void TranslationContext::writeCompareResult(const RdnaOperand& operand, IrU1 value) { + throw std::runtime_error("TranslationContext::writeCompareResult not implemented"); +} + +void TranslationContext::AddBranchCondition(const BasicBlock& source, BlockInfo& info) { + throw std::runtime_error("TranslationContext::AddBranchCondition not implemented"); +} + +} diff --git a/core/shader/recompiler/Translation/src/TranslationContext/OperandAccess.cpp b/core/shader/recompiler/Translation/src/TranslationContext/OperandAccess.cpp new file mode 100644 index 000000000..fa4ba7303 --- /dev/null +++ b/core/shader/recompiler/Translation/src/TranslationContext/OperandAccess.cpp @@ -0,0 +1,54 @@ +#include "Translation/TranslationContext.hpp" +#include + +namespace ShaderRecompiler { + +const RdnaOperand& TranslationContext::sourceAt(const RdnaInstruction& inst, std::uint32_t index) { + throw std::runtime_error("TranslationContext::sourceAt not implemented"); +} + +RdnaOperand TranslationContext::destinationOperand(const RdnaInstruction& inst) { + throw std::runtime_error("TranslationContext::destinationOperand not implemented"); +} + +RdnaOperand TranslationContext::offsetOperand(const RdnaOperand& operand, std::uint32_t offset) { + throw std::runtime_error("TranslationContext::offsetOperand not implemented"); +} + +RdnaOperand TranslationContext::scalarDestinationOperand(const RdnaOperand& operand, std::uint32_t offset) { + throw std::runtime_error("TranslationContext::scalarDestinationOperand not implemented"); +} + +RdnaOperand TranslationContext::plainOperand(const RdnaOperand& operand) { + throw std::runtime_error("TranslationContext::plainOperand not implemented"); +} + +IrValue* TranslationContext::readOperand(const RdnaOperand& operand, IrType type) { + throw std::runtime_error("TranslationContext::readOperand not implemented"); +} + +void TranslationContext::writeOperand(const RdnaOperand& operand, IrValue* value) { + throw std::runtime_error("TranslationContext::writeOperand not implemented"); +} + +IrU32 TranslationContext::applyBitSourceModifiers(const RdnaOperand& operand, IrU32 value) { + throw std::runtime_error("TranslationContext::applyBitSourceModifiers not implemented"); +} + +IrF32 TranslationContext::applyF32ResultModifiers(const RdnaOperand& operand, IrF32 value) { + throw std::runtime_error("TranslationContext::applyF32ResultModifiers not implemented"); +} + +IrU32 TranslationContext::readScalarCode(std::uint32_t code) { + throw std::runtime_error("TranslationContext::readScalarCode not implemented"); +} + +IrU32 TranslationContext::readRawU32(const RdnaOperand& operand) { + throw std::runtime_error("TranslationContext::readRawU32 not implemented"); +} + +void TranslationContext::writeRawU32(const RdnaOperand& operand, IrU32 value) { + throw std::runtime_error("TranslationContext::writeRawU32 not implemented"); +} + +} diff --git a/core/shader/recompiler/Translation/src/TranslationContext/SubwordPacking.cpp b/core/shader/recompiler/Translation/src/TranslationContext/SubwordPacking.cpp new file mode 100644 index 000000000..1c3382e17 --- /dev/null +++ b/core/shader/recompiler/Translation/src/TranslationContext/SubwordPacking.cpp @@ -0,0 +1,67 @@ +#include "Translation/TranslationContext.hpp" +#include +#include + +namespace ShaderRecompiler { + +IrU32 TranslationContext::readU32(const RdnaOperand& operand) { + throw std::runtime_error("TranslationContext::readU32 not implemented"); +} + +std::array TranslationContext::readU32Pair(const RdnaOperand& operand) { + throw std::runtime_error("TranslationContext::readU32Pair not implemented"); +} + +IrU64 TranslationContext::readU64(const RdnaOperand& operand) { + throw std::runtime_error("TranslationContext::readU64 not implemented"); +} + +std::array TranslationContext::extractU64(IrU64 value) { + throw std::runtime_error("TranslationContext::extractU64 not implemented"); +} + +void TranslationContext::writeU32Pair(const RdnaOperand& operand, const std::array& value) { + throw std::runtime_error("TranslationContext::writeU32Pair not implemented"); +} + +IrF32 TranslationContext::readF16LaneAsF32(const RdnaOperand& operand, bool highLane, bool packed) { + throw std::runtime_error("TranslationContext::readF16LaneAsF32 not implemented"); +} + +IrF32 TranslationContext::readF16AsF32(const RdnaOperand& operand) { + throw std::runtime_error("TranslationContext::readF16AsF32 not implemented"); +} + +IrF32 TranslationContext::readMixF32(const RdnaOperand& operand) { + throw std::runtime_error("TranslationContext::readMixF32 not implemented"); +} + +IrU32 TranslationContext::readF16LaneBits(const RdnaOperand& operand, bool highLane) { + throw std::runtime_error("TranslationContext::readF16LaneBits not implemented"); +} + +IrU32 TranslationContext::readU16LaneRaw(const RdnaOperand& operand, bool highLane) { + throw std::runtime_error("TranslationContext::readU16LaneRaw not implemented"); +} + +IrU32 TranslationContext::readU16LaneAsU32(const RdnaOperand& operand, bool highLane, bool signExtend) { + throw std::runtime_error("TranslationContext::readU16LaneAsU32 not implemented"); +} + +IrU32 TranslationContext::readU16AsU32(const RdnaOperand& operand, bool signExtend) { + throw std::runtime_error("TranslationContext::readU16AsU32 not implemented"); +} + +IrU32 TranslationContext::packHalf2x16(IrF32 low, IrF32 high) { + throw std::runtime_error("TranslationContext::packHalf2x16 not implemented"); +} + +void TranslationContext::write16Bits(const RdnaOperand& operand, IrU32 value) { + throw std::runtime_error("TranslationContext::write16Bits not implemented"); +} + +void TranslationContext::writeF16(const RdnaOperand& operand, IrF32 value) { + throw std::runtime_error("TranslationContext::writeF16 not implemented"); +} + +}