mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
feat(shader) update ntermediateepresentation metadata and signatures
This commit is contained in:
+17
-3
@@ -1,17 +1,28 @@
|
||||
#ifndef SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_GUESTREGISTER_HPP
|
||||
#define SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_GUESTREGISTER_HPP
|
||||
#ifndef CORE_SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_INCLUDE_INTERMEDIATEREPRESENTATION_GUESTREGISTER_HPP
|
||||
#define CORE_SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_INCLUDE_INTERMEDIATEREPRESENTATION_GUESTREGISTER_HPP
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace ShaderRecompiler {
|
||||
|
||||
enum class ScalarReg : std::uint16_t {};
|
||||
enum class VectorReg : std::uint16_t {};
|
||||
|
||||
inline constexpr std::uint32_t NumScalarRegs = 106;
|
||||
inline constexpr std::uint32_t NumVectorRegs = 256;
|
||||
|
||||
enum class RegisterBank {
|
||||
Scalar,
|
||||
Vector,
|
||||
VectorConditionCode,
|
||||
ScalarConditionCode,
|
||||
ExecutionMask,
|
||||
Memory
|
||||
Memory,
|
||||
ThreadBitScalar,
|
||||
ScalarMaskTag,
|
||||
GotoVariable,
|
||||
M0,
|
||||
UserData
|
||||
};
|
||||
|
||||
struct GuestRegister {
|
||||
@@ -22,6 +33,9 @@ struct GuestRegister {
|
||||
[[nodiscard]] bool operator==(const GuestRegister& lhs, const GuestRegister& rhs);
|
||||
[[nodiscard]] bool operator<(const GuestRegister& lhs, const GuestRegister& rhs);
|
||||
|
||||
[[nodiscard]] std::uint32_t RegIndex(ScalarReg reg);
|
||||
[[nodiscard]] std::uint32_t RegIndex(VectorReg reg);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+21
-3
@@ -1,8 +1,9 @@
|
||||
#ifndef SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_IRBLOCK_HPP
|
||||
#define SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_IRBLOCK_HPP
|
||||
#ifndef CORE_SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_INCLUDE_INTERMEDIATEREPRESENTATION_IRBLOCK_HPP
|
||||
#define CORE_SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_INCLUDE_INTERMEDIATEREPRESENTATION_IRBLOCK_HPP
|
||||
|
||||
#include <IntermediateRepresentation/IrValue.hpp>
|
||||
#include "IntermediateRepresentation/IrValue.hpp"
|
||||
#include <cstdint>
|
||||
#include <array>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
@@ -11,6 +12,10 @@ namespace ShaderRecompiler {
|
||||
class IrBlock {
|
||||
public:
|
||||
explicit IrBlock(std::uint32_t id);
|
||||
IrBlock(const IrBlock& other) = delete;
|
||||
IrBlock& operator=(const IrBlock& other) = delete;
|
||||
IrBlock(IrBlock&& other) = delete;
|
||||
IrBlock& operator=(IrBlock&& other) = delete;
|
||||
|
||||
[[nodiscard]] std::uint32_t Id() const;
|
||||
[[nodiscard]] std::list<IrValue*>& Instructions();
|
||||
@@ -24,7 +29,20 @@ public:
|
||||
void AddPredecessor(IrBlock* block);
|
||||
void AddSuccessor(IrBlock* block);
|
||||
|
||||
std::array<IrValue*, NumScalarRegs> ssaScalarValues{};
|
||||
std::array<IrValue*, NumScalarRegs> ssaThreadBitScalarValues{};
|
||||
std::array<IrValue*, NumScalarRegs> ssaScalarMaskTags{};
|
||||
std::array<IrValue*, NumVectorRegs> ssaVectorValues{};
|
||||
|
||||
[[nodiscard]] const std::vector<IrBlock*>& Predecessors() const;
|
||||
[[nodiscard]] const std::vector<IrBlock*>& Successors() const;
|
||||
void SsaSeal();
|
||||
[[nodiscard]] bool IsSsaSealed() const;
|
||||
void AddBranch(IrBlock* block);
|
||||
[[nodiscard]] bool Empty() const;
|
||||
|
||||
private:
|
||||
bool ssaSealed = false;
|
||||
std::uint32_t id;
|
||||
std::list<IrValue*> instructions;
|
||||
std::vector<IrBlock*> predecessors;
|
||||
|
||||
+69
-4
@@ -1,8 +1,8 @@
|
||||
#ifndef SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_IRBUILDER_HPP
|
||||
#define SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_IRBUILDER_HPP
|
||||
#ifndef CORE_SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_INCLUDE_INTERMEDIATEREPRESENTATION_IRBUILDER_HPP
|
||||
#define CORE_SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_INCLUDE_INTERMEDIATEREPRESENTATION_IRBUILDER_HPP
|
||||
|
||||
#include <IntermediateRepresentation/IrProgram.hpp>
|
||||
#include <IntermediateRepresentation/GuestRegister.hpp>
|
||||
#include "IntermediateRepresentation/IrProgram.hpp"
|
||||
#include "IntermediateRepresentation/GuestRegister.hpp"
|
||||
#include <initializer_list>
|
||||
|
||||
namespace ShaderRecompiler {
|
||||
@@ -19,6 +19,71 @@ public:
|
||||
void Branch(IrBlock& target);
|
||||
void BranchConditional(IrValue& condition, IrBlock& trueTarget, IrBlock& falseTarget);
|
||||
|
||||
[[nodiscard]] IrValue& ConstantU64(std::uint64_t value);
|
||||
[[nodiscard]] IrValue& ConstantF16(std::uint16_t bits);
|
||||
[[nodiscard]] IrValue& ConstantF32(float value);
|
||||
[[nodiscard]] IrValue& ConstantBool(bool value);
|
||||
[[nodiscard]] IrValue& ConstantU8(std::uint8_t value);
|
||||
[[nodiscard]] IrValue& ConstantU16(std::uint16_t value);
|
||||
[[nodiscard]] IrValue& Emit(IrOpcode opcode, IrType type, std::initializer_list<IrValue*> arguments, std::uint64_t flags);
|
||||
|
||||
IrValue& GetUserData(ScalarReg reg);
|
||||
IrValue& GetScalarReg(ScalarReg reg);
|
||||
void SetScalarReg(ScalarReg reg, IrValue& value);
|
||||
IrValue& GetThreadBitScalarReg(ScalarReg reg);
|
||||
void SetThreadBitScalarReg(ScalarReg reg, IrValue& value);
|
||||
IrValue& GetScalarMaskTag(ScalarReg reg);
|
||||
void SetScalarMaskTag(ScalarReg reg, IrValue& value);
|
||||
IrValue& GetVectorReg(VectorReg reg);
|
||||
void SetVectorReg(VectorReg reg, IrValue& value);
|
||||
IrValue& GetGotoVariable(std::uint32_t id);
|
||||
void SetGotoVariable(std::uint32_t id, IrValue& value);
|
||||
IrValue& GetScc();
|
||||
void SetScc(IrValue& value);
|
||||
IrValue& GetExec();
|
||||
void SetExec(IrValue& value);
|
||||
IrValue& GetExecLo();
|
||||
void SetExecLo(IrValue& value);
|
||||
IrValue& GetExecHi();
|
||||
void SetExecHi(IrValue& value);
|
||||
IrValue& GetVcc();
|
||||
void SetVcc(IrValue& value);
|
||||
IrValue& GetVccLo();
|
||||
void SetVccLo(IrValue& value);
|
||||
IrValue& GetVccHi();
|
||||
void SetVccHi(IrValue& value);
|
||||
IrValue& GetM0();
|
||||
void SetM0(IrValue& value);
|
||||
IrValue& BitCastF32(IrValue& value);
|
||||
IrValue& BitCastU32(IrValue& value);
|
||||
IrValue& BitCastF16(IrValue& value);
|
||||
IrValue& BitCastU32FromF16(IrValue& value);
|
||||
IrValue& ConstructU64(IrValue& low, IrValue& high);
|
||||
IrValue& CompositeExtract(IrValue& composite, std::uint32_t index);
|
||||
IrValue& IAdd(IrValue& lhs, IrValue& rhs);
|
||||
IrValue& ISub(IrValue& lhs, IrValue& rhs);
|
||||
IrValue& IMul(IrValue& lhs, IrValue& rhs);
|
||||
IrValue& ShiftLeftLogical(IrValue& value, IrValue& shift);
|
||||
IrValue& ShiftRightLogical(IrValue& value, IrValue& shift);
|
||||
IrValue& ShiftRightArithmetic(IrValue& value, IrValue& shift);
|
||||
IrValue& BitwiseAnd(IrValue& lhs, IrValue& rhs);
|
||||
IrValue& BitwiseOr(IrValue& lhs, IrValue& rhs);
|
||||
IrValue& BitwiseXor(IrValue& lhs, IrValue& rhs);
|
||||
IrValue& BitwiseNot(IrValue& value);
|
||||
IrValue& Select(IrValue& condition, IrValue& trueValue, IrValue& falseValue);
|
||||
IrValue& IEqual(IrValue& lhs, IrValue& rhs);
|
||||
IrValue& INotEqual(IrValue& lhs, IrValue& rhs);
|
||||
IrValue& ULessThan(IrValue& lhs, IrValue& rhs);
|
||||
IrValue& UGreaterThan(IrValue& lhs, IrValue& rhs);
|
||||
IrValue& LogicalAnd(IrValue& lhs, IrValue& rhs);
|
||||
IrValue& LogicalOr(IrValue& lhs, IrValue& rhs);
|
||||
IrValue& LogicalNot(IrValue& value);
|
||||
|
||||
template<typename TFlags> requires(sizeof(TFlags) <= sizeof(std::uint64_t) && std::is_trivially_copyable_v<TFlags>)
|
||||
[[nodiscard]] IrValue& Emit(IrOpcode opcode, IrType type, std::initializer_list<IrValue*> arguments, TFlags flags) {
|
||||
throw std::runtime_error("IrBuilder::Emit not implemented");
|
||||
}
|
||||
|
||||
private:
|
||||
IrProgram& program;
|
||||
IrBlock* insertionPoint;
|
||||
|
||||
+572
@@ -0,0 +1,572 @@
|
||||
#ifndef CORE_SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_INCLUDE_INTERMEDIATEREPRESENTATION_IRMETADATA_HPP
|
||||
#define CORE_SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_INCLUDE_INTERMEDIATEREPRESENTATION_IRMETADATA_HPP
|
||||
|
||||
#include "IntermediateRepresentation/IrValue.hpp"
|
||||
#include "ControlFlow/ControlFlowGraph.hpp"
|
||||
#include "RdnaDecoder/RdnaInstruction.hpp"
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace ShaderRecompiler {
|
||||
|
||||
enum class IrShaderStage {
|
||||
Unknown,
|
||||
Vertex,
|
||||
Pixel,
|
||||
Fetch,
|
||||
Compute,
|
||||
Mesh,
|
||||
Local,
|
||||
TessellationControl,
|
||||
TessellationEvaluation
|
||||
};
|
||||
|
||||
enum class IrBufferFormat : std::uint32_t {
|
||||
Invalid = 0,
|
||||
Format8UNorm = 1,
|
||||
Format8SNorm = 2,
|
||||
Format8UScaled = 3,
|
||||
Format8SScaled = 4,
|
||||
Format8UInt = 5,
|
||||
Format8SInt = 6,
|
||||
Format16UNorm = 7,
|
||||
Format16SNorm = 8,
|
||||
Format16UScaled = 9,
|
||||
Format16SScaled = 10,
|
||||
Format16UInt = 11,
|
||||
Format16SInt = 12,
|
||||
Format16Float = 13,
|
||||
Format8_8UNorm = 14,
|
||||
Format8_8SNorm = 15,
|
||||
Format8_8UScaled = 16,
|
||||
Format8_8SScaled = 17,
|
||||
Format8_8UInt = 18,
|
||||
Format8_8SInt = 19,
|
||||
Format32UInt = 20,
|
||||
Format32SInt = 21,
|
||||
Format32Float = 22,
|
||||
Format16_16UNorm = 23,
|
||||
Format16_16SNorm = 24,
|
||||
Format16_16UScaled = 25,
|
||||
Format16_16SScaled = 26,
|
||||
Format16_16UInt = 27,
|
||||
Format16_16SInt = 28,
|
||||
Format16_16Float = 29,
|
||||
Format11_11_10UNorm = 30,
|
||||
Format11_11_10SNorm = 31,
|
||||
Format11_11_10UScaled = 32,
|
||||
Format11_11_10SScaled = 33,
|
||||
Format11_11_10UInt = 34,
|
||||
Format11_11_10SInt = 35,
|
||||
Format11_11_10Float = 36,
|
||||
Format10_11_11UNorm = 37,
|
||||
Format10_11_11SNorm = 38,
|
||||
Format10_11_11UScaled = 39,
|
||||
Format10_11_11SScaled = 40,
|
||||
Format10_11_11UInt = 41,
|
||||
Format10_11_11SInt = 42,
|
||||
Format10_11_11Float = 43,
|
||||
Format2_10_10_10UNorm = 44,
|
||||
Format2_10_10_10SNorm = 45,
|
||||
Format2_10_10_10UScaled = 46,
|
||||
Format2_10_10_10SScaled = 47,
|
||||
Format2_10_10_10UInt = 48,
|
||||
Format2_10_10_10SInt = 49,
|
||||
Format10_10_10_2UNorm = 50,
|
||||
Format10_10_10_2SNorm = 51,
|
||||
Format10_10_10_2UScaled = 52,
|
||||
Format10_10_10_2SScaled = 53,
|
||||
Format10_10_10_2UInt = 54,
|
||||
Format10_10_10_2SInt = 55,
|
||||
Format8_8_8_8UNorm = 56,
|
||||
Format8_8_8_8SNorm = 57,
|
||||
Format8_8_8_8UScaled = 58,
|
||||
Format8_8_8_8SScaled = 59,
|
||||
Format8_8_8_8UInt = 60,
|
||||
Format8_8_8_8SInt = 61,
|
||||
Format32_32UInt = 62,
|
||||
Format32_32SInt = 63,
|
||||
Format32_32Float = 64,
|
||||
Format16_16_16_16UNorm = 65,
|
||||
Format16_16_16_16SNorm = 66,
|
||||
Format16_16_16_16UScaled = 67,
|
||||
Format16_16_16_16SScaled = 68,
|
||||
Format16_16_16_16UInt = 69,
|
||||
Format16_16_16_16SInt = 70,
|
||||
Format16_16_16_16Float = 71,
|
||||
Format32_32_32UInt = 72,
|
||||
Format32_32_32SInt = 73,
|
||||
Format32_32_32Float = 74,
|
||||
Format32_32_32_32UInt = 75,
|
||||
Format32_32_32_32SInt = 76,
|
||||
Format32_32_32_32Float = 77,
|
||||
Format8Srgb = 128,
|
||||
Format8_8Srgb = 129,
|
||||
Format8_8_8_8Srgb = 130,
|
||||
Format10_10_10_2Float = 131,
|
||||
Format9_9_9_5Float = 132,
|
||||
Format5_6_5UNorm = 133,
|
||||
Format5_5_5_1UNorm = 134,
|
||||
Format1_5_5_5UNorm = 135,
|
||||
Format4_4_4_4UNorm = 136,
|
||||
Fmask8_S2_F1 = 156,
|
||||
Fmask8_S4_F1 = 157,
|
||||
Fmask8_S8_F1 = 158,
|
||||
Fmask8_S2_F2 = 159,
|
||||
Fmask8_S4_F2 = 160,
|
||||
Fmask8_S4_F4 = 161,
|
||||
Fmask16_S16_F1 = 162,
|
||||
Fmask16_S8_F2 = 163,
|
||||
Fmask32_S16_F2 = 164,
|
||||
Fmask32_S8_F4 = 165,
|
||||
Fmask32_S8_F8 = 166,
|
||||
Fmask64_S16_F4 = 167,
|
||||
Fmask64_S16_F8 = 168,
|
||||
Bc1UNorm = 169,
|
||||
Bc1Srgb = 170,
|
||||
Bc2UNorm = 171,
|
||||
Bc2Srgb = 172,
|
||||
Bc3UNorm = 173,
|
||||
Bc3Srgb = 174,
|
||||
Bc4UNorm = 175,
|
||||
Bc4SNorm = 176,
|
||||
Bc5UNorm = 177,
|
||||
Bc5SNorm = 178,
|
||||
Bc6UFloat = 179,
|
||||
Bc6SFloat = 180,
|
||||
Bc7UNorm = 181,
|
||||
Bc7Srgb = 182,
|
||||
};
|
||||
|
||||
enum class IrTextureNumericClass { Unsupported, Float, Uint, Sint };
|
||||
|
||||
inline constexpr std::uint32_t ShaderImageIdentitySwizzle = 0x00000facu;
|
||||
|
||||
enum class ResourceKind {
|
||||
None,
|
||||
ScalarBuffer,
|
||||
ScalarAddress,
|
||||
Buffer,
|
||||
Flat,
|
||||
Global,
|
||||
Scratch,
|
||||
Lds,
|
||||
Gds,
|
||||
Image,
|
||||
Sampler
|
||||
};
|
||||
|
||||
struct MemoryInfo {
|
||||
ResourceKind kind = ResourceKind::None;
|
||||
std::uint32_t resource = 0;
|
||||
std::uint32_t sampler = 0;
|
||||
std::uint32_t offset = 0;
|
||||
std::uint32_t secondaryOffset = 0;
|
||||
std::uint32_t dmask = 0;
|
||||
std::uint32_t dataDwords = 1;
|
||||
std::uint32_t dataBits = 32;
|
||||
std::uint32_t componentIndex = 0;
|
||||
std::uint32_t componentCount = 1;
|
||||
std::uint32_t dataFormat = 0;
|
||||
std::uint32_t numberFormat = 0;
|
||||
std::uint32_t imageSampleFlags = 0;
|
||||
RdnaImageDimension imageDimension = RdnaImageDimension::Unknown;
|
||||
std::uint32_t imageAddressComponents = 0;
|
||||
bool addressIsFull = false;
|
||||
bool dataSigned = false;
|
||||
bool typed = false;
|
||||
bool formatted = false;
|
||||
bool imageHasMip = false;
|
||||
bool imageR128 = false;
|
||||
bool idxen = false;
|
||||
bool offen = false;
|
||||
bool planningOnly = false;
|
||||
|
||||
bool operator==(const MemoryInfo& other) const {
|
||||
throw std::runtime_error("operator== not implemented");
|
||||
}
|
||||
};
|
||||
|
||||
enum class ExportTargetKind { Unknown, Null, Position, Primitive, Parameter, Mrt, MrtZ };
|
||||
|
||||
struct ExportInfo {
|
||||
ExportTargetKind kind = ExportTargetKind::Unknown;
|
||||
std::uint32_t target = 0;
|
||||
std::uint32_t index = 0;
|
||||
std::uint32_t en = 0;
|
||||
bool done = false;
|
||||
bool compr = false;
|
||||
bool vm = false;
|
||||
|
||||
bool operator==(const ExportInfo& other) const {
|
||||
throw std::runtime_error("operator== not implemented");
|
||||
}
|
||||
};
|
||||
|
||||
struct BufferResource {
|
||||
static constexpr std::uint32_t NoImageAlias = std::numeric_limits<std::uint32_t>::max();
|
||||
|
||||
std::uint32_t source = 0;
|
||||
std::uint32_t firstUsePc = 0;
|
||||
std::uint32_t maxByteExtent = 0;
|
||||
std::uint32_t packedStride = 0;
|
||||
IrBufferFormat descriptorFormat = IrBufferFormat::Invalid;
|
||||
std::uint32_t descriptorSwizzle = 0x00000facu;
|
||||
std::uint32_t imageAlias = NoImageAlias;
|
||||
bool read = false;
|
||||
bool written = false;
|
||||
bool atomic = false;
|
||||
bool formatted = false;
|
||||
bool scalar = false;
|
||||
|
||||
bool operator==(const BufferResource& other) const {
|
||||
throw std::runtime_error("operator== not implemented");
|
||||
}
|
||||
};
|
||||
|
||||
enum class ImageMipMode { None, DynamicStorage };
|
||||
|
||||
struct ImageResource {
|
||||
static constexpr std::uint32_t NoIndirectImage = std::numeric_limits<std::uint32_t>::max();
|
||||
|
||||
std::uint32_t source = 0;
|
||||
std::uint32_t firstUsePc = 0;
|
||||
ImageResourceClass resourceClass = ImageResourceClass::None;
|
||||
IrTextureNumericClass numericClass = IrTextureNumericClass::Unsupported;
|
||||
RdnaImageDimension dimension = RdnaImageDimension::Unknown;
|
||||
ImageMipMode mipMode = ImageMipMode::None;
|
||||
std::uint32_t mipCount = 1;
|
||||
IrBufferFormat conversionFormat = IrBufferFormat::Invalid;
|
||||
std::uint32_t shaderSwizzle = ShaderImageIdentitySwizzle;
|
||||
bool read = false;
|
||||
bool written = false;
|
||||
bool atomic = false;
|
||||
bool depthCompare = false;
|
||||
bool cube = false;
|
||||
bool r128 = false;
|
||||
std::uint32_t indirectRoot = NoIndirectImage;
|
||||
std::uint32_t indirectMappingOffset = 0;
|
||||
std::uint32_t indirectSearchIterations = 0;
|
||||
std::vector<std::uint32_t> indirectResources;
|
||||
|
||||
bool operator==(const ImageResource& other) const {
|
||||
throw std::runtime_error("operator== not implemented");
|
||||
}
|
||||
};
|
||||
|
||||
struct SamplerResource {
|
||||
std::uint32_t source = 0;
|
||||
std::uint32_t firstUsePc = 0;
|
||||
bool forcePointFiltering = false;
|
||||
bool depthCompare = false;
|
||||
|
||||
bool operator==(const SamplerResource& other) const {
|
||||
throw std::runtime_error("operator== not implemented");
|
||||
}
|
||||
};
|
||||
|
||||
struct SampledResourcePair {
|
||||
std::uint32_t image = 0;
|
||||
std::uint32_t sampler = 0;
|
||||
std::uint32_t firstUsePc = 0;
|
||||
|
||||
bool operator==(const SampledResourcePair& other) const {
|
||||
throw std::runtime_error("operator== not implemented");
|
||||
}
|
||||
};
|
||||
|
||||
enum class TessellationAttribute {
|
||||
LocalOutput,
|
||||
ControlInput,
|
||||
ControlOutput,
|
||||
EvaluationInput,
|
||||
PatchOutput,
|
||||
Factor
|
||||
};
|
||||
|
||||
enum class StageInputKind {
|
||||
VertexIndex,
|
||||
InvocationId,
|
||||
PrimitiveId,
|
||||
TessCoord,
|
||||
InstanceIndex,
|
||||
FragCoord,
|
||||
FrontFacing,
|
||||
PackedAncillary,
|
||||
Layer,
|
||||
SampleId,
|
||||
BaryCoordSmooth,
|
||||
BaryCoordNoPerspective,
|
||||
WorkgroupId,
|
||||
LocalInvocationId,
|
||||
LocalInvocationIndex,
|
||||
GlobalInvocationId,
|
||||
Parameter,
|
||||
};
|
||||
|
||||
enum class StageOutputKind {
|
||||
Position,
|
||||
Parameter,
|
||||
Mrt,
|
||||
Depth,
|
||||
SampleMask,
|
||||
PointSize,
|
||||
ClipDistance,
|
||||
CullDistance,
|
||||
Layer,
|
||||
ViewportIndex
|
||||
};
|
||||
|
||||
struct PositionExportComponent {
|
||||
std::uint32_t clipDistance = std::numeric_limits<std::uint32_t>::max();
|
||||
std::uint32_t cullDistance = std::numeric_limits<std::uint32_t>::max();
|
||||
bool pointSize = false;
|
||||
bool layer = false;
|
||||
bool viewport = false;
|
||||
};
|
||||
|
||||
struct StageInput {
|
||||
StageInputKind kind = StageInputKind::VertexIndex;
|
||||
std::uint32_t location = 0;
|
||||
std::uint32_t componentCount = 1;
|
||||
std::string debugName;
|
||||
bool perVertex = false;
|
||||
|
||||
bool operator==(const StageInput& other) const {
|
||||
throw std::runtime_error("operator== not implemented");
|
||||
}
|
||||
};
|
||||
|
||||
struct StageOutput {
|
||||
StageOutputKind kind = StageOutputKind::Parameter;
|
||||
std::uint32_t index = 0;
|
||||
std::uint32_t location = 0;
|
||||
std::string debugName;
|
||||
|
||||
bool operator==(const StageOutput& other) const {
|
||||
throw std::runtime_error("operator== not implemented");
|
||||
}
|
||||
};
|
||||
|
||||
inline constexpr std::uint32_t FirstImageBinding = 1u;
|
||||
inline constexpr std::uint32_t FirstComparisonImageBinding = 22u;
|
||||
inline constexpr std::uint32_t FirstStorageImageBinding = 29u;
|
||||
inline constexpr std::uint32_t ImageBindingCount = 43u;
|
||||
|
||||
enum class DescriptorBindingKind : std::uint32_t {
|
||||
Buffers = 0u,
|
||||
Samplers = FirstImageBinding + ImageBindingCount,
|
||||
Gds,
|
||||
BdaPagetable,
|
||||
FaultBuffer,
|
||||
FlattenedSrt,
|
||||
ShaderData,
|
||||
Count,
|
||||
};
|
||||
|
||||
struct PushData {
|
||||
static constexpr std::uint32_t DwordCount = 32;
|
||||
static constexpr std::uint32_t MeshDrawDwordCount = 6;
|
||||
static constexpr std::uint32_t NoStart = std::numeric_limits<std::uint32_t>::max();
|
||||
std::array<std::uint32_t, DwordCount> dwords {};
|
||||
|
||||
[[nodiscard]] static bool CanFit(std::uint32_t start, std::uint32_t size) {
|
||||
throw std::runtime_error("CanFit not implemented");
|
||||
}
|
||||
[[nodiscard]] static std::uint32_t StartFor(std::uint32_t cursor, std::uint32_t size) {
|
||||
throw std::runtime_error("StartFor not implemented");
|
||||
}
|
||||
};
|
||||
|
||||
struct IrDescriptorBinding {
|
||||
DescriptorBindingKind kind = DescriptorBindingKind::Buffers;
|
||||
std::vector<std::uint32_t> resources;
|
||||
|
||||
bool operator==(const IrDescriptorBinding& other) const {
|
||||
throw std::runtime_error("operator== not implemented");
|
||||
}
|
||||
};
|
||||
|
||||
struct IrBindingLayout {
|
||||
std::uint32_t pushDataStartDword = PushData::NoStart;
|
||||
std::uint32_t memoryOffsetDword = 0;
|
||||
std::uint32_t memoryOffsetCount = 0;
|
||||
std::vector<std::uint32_t> userDataRegisters;
|
||||
std::vector<IrDescriptorBinding> descriptors;
|
||||
|
||||
[[nodiscard]] std::uint32_t ShaderDataDwords() const {
|
||||
throw std::runtime_error("ShaderDataDwords not implemented");
|
||||
}
|
||||
[[nodiscard]] bool UsesPushData() const {
|
||||
throw std::runtime_error("UsesPushData not implemented");
|
||||
}
|
||||
void AdvancePushData(std::uint32_t& cursor) const {
|
||||
throw std::runtime_error("AdvancePushData not implemented");
|
||||
}
|
||||
|
||||
bool operator==(const IrBindingLayout& other) const {
|
||||
throw std::runtime_error("operator== not implemented");
|
||||
}
|
||||
};
|
||||
|
||||
struct ShaderInfo {
|
||||
std::uint32_t scratchDwords = 0;
|
||||
std::uint32_t sharedMemoryBytes = 0;
|
||||
static constexpr std::uint32_t MaxBuffers = 32;
|
||||
static constexpr std::uint32_t MaxImages = 64;
|
||||
static constexpr std::uint32_t MaxSamplers = 32;
|
||||
static constexpr std::uint32_t MaxSampledPairs = 64;
|
||||
|
||||
std::vector<BufferResource> buffers;
|
||||
std::vector<ImageResource> images;
|
||||
std::vector<SamplerResource> samplers;
|
||||
std::vector<SampledResourcePair> sampledPairs;
|
||||
std::vector<StageInput> inputs;
|
||||
std::vector<StageOutput> outputs;
|
||||
std::array<std::uint8_t, 32> vertexFetchComponents {};
|
||||
std::int32_t vertexOffsetSgpr = -1;
|
||||
std::int32_t instanceOffsetSgpr = -1;
|
||||
bool hasBitwiseXor = false;
|
||||
bool usesDma = false;
|
||||
|
||||
bool operator==(const ShaderInfo& other) const {
|
||||
throw std::runtime_error("operator== not implemented");
|
||||
}
|
||||
};
|
||||
|
||||
struct BlockInfo {
|
||||
std::uint32_t id = 0;
|
||||
std::uint32_t startPc = 0;
|
||||
std::uint32_t endPc = 0;
|
||||
Terminator terminator;
|
||||
IrValue* condition = nullptr;
|
||||
IrValue* indirectTarget = nullptr;
|
||||
};
|
||||
|
||||
struct DescriptorSource {
|
||||
struct IndirectImage {
|
||||
std::uint32_t materialSource = 0;
|
||||
std::uint32_t heapSource = 0;
|
||||
std::uint32_t selectorStride = 0;
|
||||
std::uint32_t selectorOffset = 0;
|
||||
std::uint32_t keyArg = 0;
|
||||
|
||||
bool operator==(const IndirectImage& other) const {
|
||||
throw std::runtime_error("operator== not implemented");
|
||||
}
|
||||
};
|
||||
|
||||
std::array<IrValue*, 8> dwords {};
|
||||
std::uint32_t dwordCount = 0;
|
||||
std::optional<IndirectImage> indirectImage;
|
||||
|
||||
bool operator==(const DescriptorSource& other) const {
|
||||
throw std::runtime_error("operator== not implemented");
|
||||
}
|
||||
};
|
||||
|
||||
struct SrtRead {
|
||||
IrValue* value = nullptr;
|
||||
std::uint32_t flatOffset = 0;
|
||||
|
||||
bool operator==(const SrtRead& other) const {
|
||||
throw std::runtime_error("operator== not implemented");
|
||||
}
|
||||
};
|
||||
|
||||
struct ResourceBlock {
|
||||
IrValue* condition = nullptr;
|
||||
std::vector<std::uint32_t> successors;
|
||||
std::vector<std::uint32_t> sources;
|
||||
};
|
||||
|
||||
struct CompiledShaderInfo {
|
||||
IrShaderStage stage = IrShaderStage::Unknown;
|
||||
std::uint64_t shaderHash = 0;
|
||||
std::uint32_t waveSize = 64;
|
||||
std::uint32_t userDataBase = 0;
|
||||
std::uint32_t userDataCount = 64;
|
||||
std::uint32_t scratchDwords = 0;
|
||||
std::uint32_t paramExportMask = 0;
|
||||
ShaderInfo info;
|
||||
IrBindingLayout bindings;
|
||||
};
|
||||
|
||||
struct DescriptorValue {
|
||||
std::array<std::uint32_t, 8> dwords = {};
|
||||
std::uint32_t dwordCount = 0;
|
||||
|
||||
bool operator==(const DescriptorValue& other) const {
|
||||
throw std::runtime_error("operator== not implemented");
|
||||
}
|
||||
};
|
||||
|
||||
enum class UniformFillKind { None, Buffer, Image };
|
||||
|
||||
struct UniformFill {
|
||||
UniformFillKind kind = UniformFillKind::None;
|
||||
std::uint32_t resource = 0;
|
||||
std::array<std::uint32_t, 3> groupStride {};
|
||||
std::uint32_t words = 0;
|
||||
std::uint32_t value = 0;
|
||||
|
||||
bool operator==(const UniformFill& other) const {
|
||||
throw std::runtime_error("operator== not implemented");
|
||||
}
|
||||
};
|
||||
|
||||
struct ResourceSnapshot {
|
||||
std::vector<DescriptorValue> buffers;
|
||||
std::vector<DescriptorValue> images;
|
||||
std::vector<DescriptorValue> samplers;
|
||||
std::vector<std::uint32_t> flattenedSrt;
|
||||
std::vector<std::uint32_t> userData;
|
||||
UniformFill uniformFill;
|
||||
};
|
||||
|
||||
struct UniformFillPlan {
|
||||
UniformFill fill;
|
||||
std::array<IrValue*, 4> values{};
|
||||
};
|
||||
|
||||
inline constexpr std::uint32_t NativePushConstantSize = sizeof(PushData);
|
||||
|
||||
struct IrResourcePlan {
|
||||
IrShaderStage stage = IrShaderStage::Unknown;
|
||||
std::uint64_t shaderHash = 0;
|
||||
std::uint32_t userDataBase = 0;
|
||||
std::uint32_t userDataCount = 64;
|
||||
std::vector<std::unique_ptr<IrValue>> valueStorage;
|
||||
std::vector<MemoryInfo> memoryInfo;
|
||||
std::vector<DescriptorSource> descriptorSources;
|
||||
std::vector<ResourceBlock> controlFlow;
|
||||
std::vector<std::uint32_t> materializationSources;
|
||||
std::vector<SrtRead> srtReads;
|
||||
std::vector<std::uint8_t> cleanFlatSlots;
|
||||
bool requiresSpecializationMemory = false;
|
||||
bool srtPlanComplete = false;
|
||||
bool resourceTrackingComplete = false;
|
||||
ShaderInfo info;
|
||||
UniformFillPlan uniformFill;
|
||||
};
|
||||
|
||||
struct IrProgramMetadata {
|
||||
FailureKind cfgFailureKind = FailureKind::None;
|
||||
std::string failureReason;
|
||||
std::vector<BlockInfo> blockInfo;
|
||||
std::vector<ExportInfo> exportInfo;
|
||||
std::vector<IrValue*> dynamicReads;
|
||||
bool shaderInfoComplete = false;
|
||||
IrBindingLayout bindings;
|
||||
bool bindingLayoutComplete = false;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
+328
-4
@@ -1,7 +1,10 @@
|
||||
#ifndef SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_IROPCODE_HPP
|
||||
#define SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_IROPCODE_HPP
|
||||
#ifndef CORE_SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_INCLUDE_INTERMEDIATEREPRESENTATION_IROPCODE_HPP
|
||||
#define CORE_SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_INCLUDE_INTERMEDIATEREPRESENTATION_IROPCODE_HPP
|
||||
|
||||
#include "IntermediateRepresentation/IrType.hpp"
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include <string_view>
|
||||
|
||||
namespace ShaderRecompiler {
|
||||
|
||||
@@ -66,10 +69,331 @@ enum class IrOpcode : std::uint16_t {
|
||||
Discard,
|
||||
ReadFirstLane,
|
||||
ReadLane,
|
||||
Ballot
|
||||
Ballot,
|
||||
Void,
|
||||
Reference,
|
||||
ReferenceU32,
|
||||
GetUserData,
|
||||
GetShaderBase,
|
||||
MeshDrawParameter,
|
||||
MeshAllocate,
|
||||
TessellationBase,
|
||||
GetTessellationAttribute,
|
||||
SetTessellationAttribute,
|
||||
GetBuiltin,
|
||||
GetThreadBitScalarRegister,
|
||||
SetThreadBitScalarRegister,
|
||||
GetScalarMaskTag,
|
||||
SetScalarMaskTag,
|
||||
GetScalarRegister,
|
||||
SetScalarRegister,
|
||||
GetVectorRegister,
|
||||
SetVectorRegister,
|
||||
GetGotoVariable,
|
||||
SetGotoVariable,
|
||||
GetScc,
|
||||
SetScc,
|
||||
GetExec,
|
||||
SetExec,
|
||||
GetExecLo,
|
||||
SetExecLo,
|
||||
GetExecHi,
|
||||
SetExecHi,
|
||||
GetVcc,
|
||||
SetVcc,
|
||||
GetVccLo,
|
||||
SetVccLo,
|
||||
GetVccHi,
|
||||
SetVccHi,
|
||||
GetM0,
|
||||
SetM0,
|
||||
UndefU1,
|
||||
UndefU8,
|
||||
UndefU16,
|
||||
UndefU32,
|
||||
UndefU64,
|
||||
BitCastU16F16,
|
||||
BitCastF16U16,
|
||||
BitCastU32F32,
|
||||
BitCastF32U32,
|
||||
ConvertU16U32,
|
||||
ConvertU32U16,
|
||||
ConvertU8U32,
|
||||
ConvertU32U8,
|
||||
ConvertF32F16,
|
||||
ConvertF16F32,
|
||||
ConvertS32F32,
|
||||
ConvertU32F32,
|
||||
ConvertF32S32,
|
||||
ConvertF32U32,
|
||||
CompositeConstructU64,
|
||||
CompositeConstructU32x2,
|
||||
CompositeConstructU32x3,
|
||||
CompositeConstructF32x2,
|
||||
CompositeConstructU32x4,
|
||||
CompositeExtractU64,
|
||||
CompositeExtractU32x2,
|
||||
CompositeExtractU32x3,
|
||||
CompositeExtractU32x4,
|
||||
PackHalf2x16,
|
||||
PackSnorm2x16,
|
||||
PackUnorm2x16,
|
||||
PackFloat2x16Rtz,
|
||||
FPAbs32,
|
||||
FPNeg32,
|
||||
FPSaturate32,
|
||||
BitFieldInsert,
|
||||
BitFieldUExtract,
|
||||
BitFieldSExtract,
|
||||
DppMoveU32,
|
||||
DppUpdateU32,
|
||||
WqmU64,
|
||||
SelectU1,
|
||||
SelectF32,
|
||||
IAdd64,
|
||||
IAddCarry32,
|
||||
ISub64,
|
||||
IMul64,
|
||||
UDiv32,
|
||||
SMulHi,
|
||||
UMulHi,
|
||||
IAbs32,
|
||||
ShiftLeftLogical32,
|
||||
ShiftLeftLogical64,
|
||||
ShiftRightLogical32,
|
||||
ShiftRightLogical64,
|
||||
ShiftRightArithmetic32,
|
||||
ShiftRightArithmetic64,
|
||||
BitwiseAnd32,
|
||||
BitwiseAnd64,
|
||||
BitwiseOr32,
|
||||
BitwiseXor32,
|
||||
BitwiseNot32,
|
||||
BitReverse32,
|
||||
BitCount32,
|
||||
BitCount64,
|
||||
FindUMsb32,
|
||||
FindUMsb64,
|
||||
FindILsb32,
|
||||
SMin32,
|
||||
UMin32,
|
||||
SMax32,
|
||||
UMax32,
|
||||
SMinTri32,
|
||||
UMinTri32,
|
||||
SMaxTri32,
|
||||
UMaxTri32,
|
||||
SMedTri32,
|
||||
UMedTri32,
|
||||
SLessThan32,
|
||||
SLessThan64,
|
||||
ULessThan32,
|
||||
ULessThan64,
|
||||
IEqual32,
|
||||
IEqual64,
|
||||
SLessThanEqual32,
|
||||
ULessThanEqual32,
|
||||
SGreaterThan32,
|
||||
UGreaterThan32,
|
||||
UGreaterThan64,
|
||||
INotEqual32,
|
||||
INotEqual64,
|
||||
SGreaterThanEqual32,
|
||||
UGreaterThanEqual32,
|
||||
LogicalOr,
|
||||
LogicalAnd,
|
||||
LogicalXor,
|
||||
LogicalNot,
|
||||
FPOrdEqual32,
|
||||
FPUnordEqual32,
|
||||
FPOrdNotEqual32,
|
||||
FPUnordNotEqual32,
|
||||
FPOrdLessThan32,
|
||||
FPUnordLessThan32,
|
||||
FPOrdGreaterThan32,
|
||||
FPUnordGreaterThan32,
|
||||
FPOrdLessThanEqual32,
|
||||
FPUnordLessThanEqual32,
|
||||
FPOrdGreaterThanEqual32,
|
||||
FPUnordGreaterThanEqual32,
|
||||
FPIsNan32,
|
||||
FPCmpClass32,
|
||||
FPAdd32,
|
||||
FPSub32,
|
||||
FPFma32,
|
||||
FPMul32,
|
||||
FPMin32,
|
||||
FPMax32,
|
||||
FPMinTri32,
|
||||
FPMaxTri32,
|
||||
FPMedTri32,
|
||||
FPRecip32,
|
||||
FPRecipIFlag32,
|
||||
FPRecipSqrt32,
|
||||
FPSqrt,
|
||||
FPSin,
|
||||
FPCos,
|
||||
FPExp2,
|
||||
FPLog2,
|
||||
FPLdexp,
|
||||
FPRoundEven32,
|
||||
FPFloor32,
|
||||
FPCeil32,
|
||||
FPTrunc32,
|
||||
FPFract32,
|
||||
LaneId,
|
||||
WriteLane,
|
||||
Permlane16U32,
|
||||
BpermuteU32,
|
||||
GetSrtResource,
|
||||
GetBufferResource,
|
||||
GetAddressResource,
|
||||
GetScratchResource,
|
||||
GetImageResource,
|
||||
GetSamplerResource,
|
||||
MakeImageAddress,
|
||||
ReadConst,
|
||||
ReadConstBuffer,
|
||||
LoadAddressU8,
|
||||
LoadAddressU16,
|
||||
LoadAddressU32,
|
||||
StoreAddressU8,
|
||||
StoreAddressU16,
|
||||
StoreAddressU32,
|
||||
LoadBufferU8,
|
||||
LoadBufferU16,
|
||||
LoadBufferU32,
|
||||
LoadBufferU32x2,
|
||||
LoadBufferU32x3,
|
||||
LoadBufferU32x4,
|
||||
StoreBufferU8,
|
||||
StoreBufferU16,
|
||||
StoreBufferU32,
|
||||
StoreBufferU32x2,
|
||||
StoreBufferU32x3,
|
||||
StoreBufferU32x4,
|
||||
BufferAtomicSwap32,
|
||||
BufferAtomicCmpSwap32,
|
||||
BufferAtomicSwap64,
|
||||
BufferAtomicIAdd32,
|
||||
BufferAtomicISub32,
|
||||
BufferAtomicSMin32,
|
||||
BufferAtomicUMin32,
|
||||
BufferAtomicSMax32,
|
||||
BufferAtomicUMax32,
|
||||
BufferAtomicAnd32,
|
||||
BufferAtomicOr32,
|
||||
BufferAtomicOr64,
|
||||
BufferAtomicXor32,
|
||||
BufferAtomicFMin32,
|
||||
BufferAtomicFMax32,
|
||||
LoadSharedU8,
|
||||
LoadSharedU16,
|
||||
LoadSharedU32,
|
||||
LoadSharedU32x2,
|
||||
LoadSharedU32x3,
|
||||
LoadSharedU32x4,
|
||||
WriteSharedU8,
|
||||
WriteSharedU16,
|
||||
WriteSharedU32,
|
||||
WriteSharedU32x2,
|
||||
WriteSharedU32x3,
|
||||
WriteSharedU32x4,
|
||||
SharedAtomicFMin32,
|
||||
SharedAtomicFMax32,
|
||||
SharedAtomicSwap32,
|
||||
SharedAtomicIAdd32,
|
||||
SharedAtomicISub32,
|
||||
SharedAtomicInc32,
|
||||
SharedAtomicDec32,
|
||||
SharedAtomicSMin32,
|
||||
SharedAtomicUMin32,
|
||||
SharedAtomicSMax32,
|
||||
SharedAtomicUMax32,
|
||||
SharedAtomicAnd32,
|
||||
SharedAtomicOr32,
|
||||
SharedAtomicXor32,
|
||||
DataAppend,
|
||||
DataConsume,
|
||||
SwizzleU32,
|
||||
ImageQueryDimensions,
|
||||
ImageQueryLod,
|
||||
ImageRead,
|
||||
ImageWrite,
|
||||
ImageSampleRaw,
|
||||
ImageGatherRaw,
|
||||
ImageAtomicSwap32,
|
||||
ImageAtomicIAdd32,
|
||||
ImageAtomicUMin32,
|
||||
ImageAtomicUMax32,
|
||||
ImageAtomicAnd32,
|
||||
ImageAtomicOr32,
|
||||
ImageAtomicXor32,
|
||||
GetAttribute,
|
||||
GetInterpolationParameter,
|
||||
SetAttribute,
|
||||
ControlNop,
|
||||
Waitcnt,
|
||||
Sendmsg,
|
||||
TtraceData,
|
||||
InstPrefetch,
|
||||
SelectU32,
|
||||
Count
|
||||
};
|
||||
|
||||
[[nodiscard]] std::uint32_t IrOpcodeOperandCount(IrOpcode opcode);
|
||||
enum class BufferAccess { None, Read, Write, Atomic };
|
||||
enum class SharedAccess { None, Read, Write, Atomic, Append, Consume };
|
||||
enum class AddressAccess { None, Read, Write };
|
||||
enum class ImageAccess { None, Read, Write, Atomic };
|
||||
enum class ImageResourceClass { None, Sampled, Storage };
|
||||
|
||||
struct AddressOpcodeInfo {
|
||||
AddressAccess access = AddressAccess::None;
|
||||
std::uint32_t dataBits = 0;
|
||||
};
|
||||
|
||||
struct ImageOpcodeInfo {
|
||||
ImageAccess access = ImageAccess::None;
|
||||
ImageResourceClass resourceClass = ImageResourceClass::None;
|
||||
bool needsSampler = false;
|
||||
};
|
||||
|
||||
struct DppMoveFlags {
|
||||
std::uint16_t control = 0;
|
||||
std::uint8_t rowMask = 0xf;
|
||||
std::uint8_t bankMask = 0xf;
|
||||
bool fetchInactive = false;
|
||||
bool boundControl = false;
|
||||
};
|
||||
|
||||
struct PermlaneFlags {
|
||||
bool x16 = false;
|
||||
bool fetchInactive = false;
|
||||
bool boundControl = false;
|
||||
};
|
||||
|
||||
struct MemoryFlags {
|
||||
std::uint32_t index = 0;
|
||||
std::uint32_t pc = 0;
|
||||
};
|
||||
|
||||
struct ExportFlags {
|
||||
std::uint32_t index = 0;
|
||||
std::uint32_t pc = 0;
|
||||
};
|
||||
|
||||
[[nodiscard]] std::size_t IrOpcodeOperandCount(IrOpcode opcode);
|
||||
|
||||
[[nodiscard]] IrType IrOpcodeType(IrOpcode opcode);
|
||||
[[nodiscard]] IrType IrOpcodeArgumentType(IrOpcode opcode, std::size_t index);
|
||||
[[nodiscard]] bool IrOpcodeHasSideEffects(IrOpcode opcode);
|
||||
[[nodiscard]] BufferAccess BufferAccessOf(IrOpcode opcode);
|
||||
[[nodiscard]] std::uint32_t BufferComponentCount(IrOpcode opcode);
|
||||
[[nodiscard]] SharedAccess SharedAccessOf(IrOpcode opcode);
|
||||
[[nodiscard]] std::uint32_t SharedComponentCount(IrOpcode opcode);
|
||||
[[nodiscard]] AddressOpcodeInfo AddressOpcodeInfoOf(IrOpcode opcode);
|
||||
[[nodiscard]] ImageOpcodeInfo ImageOpcodeInfoOf(IrOpcode opcode);
|
||||
[[nodiscard]] std::string_view IrOpcodeName(IrOpcode opcode);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+33
-14
@@ -1,20 +1,14 @@
|
||||
#ifndef SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_IRPROGRAM_HPP
|
||||
#define SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_IRPROGRAM_HPP
|
||||
#ifndef CORE_SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_INCLUDE_INTERMEDIATEREPRESENTATION_IRPROGRAM_HPP
|
||||
#define CORE_SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_INCLUDE_INTERMEDIATEREPRESENTATION_IRPROGRAM_HPP
|
||||
|
||||
#include <IntermediateRepresentation/IrBlock.hpp>
|
||||
#include "IntermediateRepresentation/IrBlock.hpp"
|
||||
#include "IntermediateRepresentation/IrMetadata.hpp"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace ShaderRecompiler {
|
||||
|
||||
struct ShaderInfo {
|
||||
std::uint32_t scratchDwords;
|
||||
std::uint32_t sharedMemoryBytes;
|
||||
std::int32_t vertexOffsetSgpr;
|
||||
std::int32_t instanceOffsetSgpr;
|
||||
};
|
||||
|
||||
class IrProgram {
|
||||
public:
|
||||
[[nodiscard]] std::vector<std::unique_ptr<IrBlock>>& Blocks();
|
||||
@@ -28,15 +22,40 @@ public:
|
||||
[[nodiscard]] IrBlock& CreateBlock();
|
||||
[[nodiscard]] IrValue& CreateValue(IrOpcode opcode, IrType type);
|
||||
|
||||
IrResourcePlan& Resources();
|
||||
const IrResourcePlan& Resources() const;
|
||||
IrProgramMetadata& Metadata();
|
||||
const IrProgramMetadata& Metadata() const;
|
||||
CompiledShaderInfo TakeCompiledInfo() &&;
|
||||
IrValue& CreateValue(IrOpcode opcode, IrType type, std::uint64_t flags);
|
||||
void SetEntryBlock(IrBlock& block);
|
||||
[[nodiscard]] std::vector<IrBlock*>& BlockOrder();
|
||||
[[nodiscard]] const std::vector<IrBlock*>& BlockOrder() const;
|
||||
|
||||
private:
|
||||
std::vector<std::unique_ptr<IrBlock>> blocks;
|
||||
std::vector<IrBlock*> blockOrder;
|
||||
std::vector<std::unique_ptr<IrValue>> values;
|
||||
ShaderInfo info;
|
||||
std::uint32_t waveSize;
|
||||
std::uint32_t nextValueId;
|
||||
std::uint32_t nextBlockId;
|
||||
IrResourcePlan resourcePlan;
|
||||
IrProgramMetadata metadata;
|
||||
IrBlock* entryBlock = nullptr;
|
||||
std::uint32_t waveSize = 64;
|
||||
std::uint32_t nextValueId = 0;
|
||||
std::uint32_t nextBlockId = 0;
|
||||
};
|
||||
|
||||
std::string ProgramToString(const IrProgram& program);
|
||||
void ValidateProgram(const IrProgram& program, bool requireSsa);
|
||||
void ResolveControlFlowIdentities(IrProgram& program);
|
||||
bool EquivalentValue(const IrResourcePlan& program, const IrValue* left, const IrValue* right);
|
||||
IrValue* ResolveInvariantPhi(const IrResourcePlan& program, IrValue* value);
|
||||
bool IsAddressResourceKind(ResourceKind kind);
|
||||
PositionExportComponent DecodePositionExportComponent(std::uint32_t control, std::uint32_t positionIndex, std::uint32_t component);
|
||||
std::uint32_t NativeBinding(IrShaderStage stage, DescriptorBindingKind kind);
|
||||
ImageResourceClass ImageBindingResourceClass(DescriptorBindingKind kind);
|
||||
std::uint32_t ImageBindingIndex(DescriptorBindingKind kind);
|
||||
DescriptorBindingKind DescriptorBindingForImage(const ImageResource& image);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+40
-18
@@ -1,27 +1,44 @@
|
||||
#ifndef SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_IRTYPE_HPP
|
||||
#define SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_IRTYPE_HPP
|
||||
#ifndef CORE_SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_INCLUDE_INTERMEDIATEREPRESENTATION_IRTYPE_HPP
|
||||
#define CORE_SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_INCLUDE_INTERMEDIATEREPRESENTATION_IRTYPE_HPP
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace ShaderRecompiler {
|
||||
|
||||
enum class IrType {
|
||||
Void,
|
||||
Bool,
|
||||
U32,
|
||||
S32,
|
||||
F32,
|
||||
U64,
|
||||
S64,
|
||||
F64,
|
||||
Vec2U32,
|
||||
Vec3U32,
|
||||
Vec4U32,
|
||||
Vec2F32,
|
||||
Vec3F32,
|
||||
Vec4F32,
|
||||
Label
|
||||
enum class IrType : std::uint32_t {
|
||||
Void = 0,
|
||||
Bool = 1u << 0u,
|
||||
U32 = 1u << 1u,
|
||||
S32 = 1u << 2u,
|
||||
F32 = 1u << 3u,
|
||||
U64 = 1u << 4u,
|
||||
S64 = 1u << 5u,
|
||||
F64 = 1u << 6u,
|
||||
Vec2U32 = 1u << 7u,
|
||||
Vec3U32 = 1u << 8u,
|
||||
Vec4U32 = 1u << 9u,
|
||||
Vec2F32 = 1u << 10u,
|
||||
Vec3F32 = 1u << 11u,
|
||||
Vec4F32 = 1u << 12u,
|
||||
Label = 1u << 13u,
|
||||
Opaque = 1u << 14u,
|
||||
ScalarReg = 1u << 15u,
|
||||
VectorReg = 1u << 16u,
|
||||
U8 = 1u << 17u,
|
||||
U16 = 1u << 18u,
|
||||
F16 = 1u << 19u,
|
||||
SrtResource = 1u << 20u,
|
||||
BufferResource = 1u << 21u,
|
||||
AddressResource = 1u << 22u,
|
||||
ImageResource = 1u << 23u,
|
||||
SamplerResource = 1u << 24u,
|
||||
ImageAddress = 1u << 25u,
|
||||
U1 = Bool,
|
||||
U32x2 = Vec2U32,
|
||||
U32x3 = Vec3U32,
|
||||
U32x4 = Vec4U32,
|
||||
F32x2 = Vec2F32
|
||||
};
|
||||
|
||||
[[nodiscard]] bool IsFloatType(IrType type);
|
||||
@@ -30,6 +47,11 @@ enum class IrType {
|
||||
[[nodiscard]] std::uint32_t ComponentCount(IrType type);
|
||||
[[nodiscard]] std::string TypeToString(IrType type);
|
||||
|
||||
[[nodiscard]] IrType operator|(IrType lhs, IrType rhs);
|
||||
[[nodiscard]] IrType operator&(IrType lhs, IrType rhs);
|
||||
[[nodiscard]] bool TypesOverlap(IrType lhs, IrType rhs);
|
||||
[[nodiscard]] bool AreTypesCompatible(IrType lhs, IrType rhs);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+101
-6
@@ -1,18 +1,34 @@
|
||||
#ifndef SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_IRVALUE_HPP
|
||||
#define SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_IRVALUE_HPP
|
||||
#ifndef CORE_SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_INCLUDE_INTERMEDIATEREPRESENTATION_IRVALUE_HPP
|
||||
#define CORE_SHADER_RECOMPILIER_INTERMEDIATEREPRESENTATION_INCLUDE_INTERMEDIATEREPRESENTATION_IRVALUE_HPP
|
||||
|
||||
#include <IntermediateRepresentation/IrOpcode.hpp>
|
||||
#include <IntermediateRepresentation/IrType.hpp>
|
||||
#include "IntermediateRepresentation/IrOpcode.hpp"
|
||||
#include "IntermediateRepresentation/IrType.hpp"
|
||||
#include "IntermediateRepresentation/GuestRegister.hpp"
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include <stdexcept>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
namespace ShaderRecompiler {
|
||||
|
||||
class IrBlock;
|
||||
class IrValue;
|
||||
|
||||
struct IrUse {
|
||||
IrValue* user = nullptr;
|
||||
std::size_t operand = 0;
|
||||
|
||||
bool operator==(const IrUse& other) const;
|
||||
};
|
||||
|
||||
class IrValue {
|
||||
public:
|
||||
IrValue(IrOpcode opcode, IrType type, std::uint32_t id);
|
||||
IrValue(const IrValue& other) = delete;
|
||||
IrValue& operator=(const IrValue& other) = delete;
|
||||
IrValue(IrValue&& other) = delete;
|
||||
IrValue& operator=(IrValue&& other) = delete;
|
||||
|
||||
[[nodiscard]] IrOpcode Opcode() const;
|
||||
[[nodiscard]] IrType Type() const;
|
||||
@@ -24,22 +40,101 @@ public:
|
||||
[[nodiscard]] std::uint32_t ImmediateU32() const;
|
||||
|
||||
void AddArgument(IrValue* argument);
|
||||
void ReplaceArgument(std::uint32_t index, IrValue* argument);
|
||||
void ReplaceArgument(std::size_t index, IrValue* argument);
|
||||
void ReplaceAllUsesWith(IrValue* replacement);
|
||||
void SetImmediateU32(std::uint32_t value);
|
||||
void SetParent(IrBlock* parent);
|
||||
|
||||
template<typename TValue> requires(sizeof(TValue) <= sizeof(std::uint64_t) && std::is_trivially_copyable_v<TValue>)
|
||||
[[nodiscard]] TValue Flags() const {
|
||||
throw std::runtime_error("IrValue::Flags not implemented");
|
||||
}
|
||||
|
||||
template<typename TValue> requires(sizeof(TValue) <= sizeof(std::uint64_t) && std::is_trivially_copyable_v<TValue>)
|
||||
void SetFlags(TValue value) {
|
||||
throw std::runtime_error("IrValue::SetFlags not implemented");
|
||||
}
|
||||
|
||||
[[nodiscard]] bool IsEmpty() const;
|
||||
[[nodiscard]] bool IsIdentity() const;
|
||||
[[nodiscard]] bool IsPhi() const;
|
||||
[[nodiscard]] IrValue* Resolve() const;
|
||||
[[nodiscard]] bool MayHaveSideEffects() const;
|
||||
[[nodiscard]] bool HasUses() const;
|
||||
[[nodiscard]] std::size_t UseCount() const;
|
||||
[[nodiscard]] std::size_t ArgumentCount() const;
|
||||
[[nodiscard]] std::size_t PhiBlockCount() const;
|
||||
[[nodiscard]] IrValue* Argument(std::size_t index) const;
|
||||
[[nodiscard]] IrBlock* PhiBlock(std::size_t index) const;
|
||||
[[nodiscard]] const std::vector<IrUse>& OperandUses() const;
|
||||
[[nodiscard]] std::uint64_t ImmediateU64() const;
|
||||
[[nodiscard]] std::uint16_t ImmediateF16Bits() const;
|
||||
[[nodiscard]] float ImmediateF32() const;
|
||||
[[nodiscard]] bool ImmediateBool() const;
|
||||
[[nodiscard]] std::uint8_t ImmediateU8() const;
|
||||
[[nodiscard]] std::uint16_t ImmediateU16() const;
|
||||
[[nodiscard]] GuestRegister Register() const;
|
||||
void SetImmediateU64(std::uint64_t value);
|
||||
void SetImmediateF16Bits(std::uint16_t bits);
|
||||
void SetImmediateF32(float value);
|
||||
void SetImmediateBool(bool value);
|
||||
void SetImmediateU8(std::uint8_t value);
|
||||
void SetImmediateU16(std::uint16_t value);
|
||||
void SetRegister(const GuestRegister& reg);
|
||||
void AddPhiOperand(IrBlock* predecessor, IrValue* value);
|
||||
void ReplaceOpcode(IrOpcode opcode);
|
||||
void Invalidate();
|
||||
void ReplaceUsesWith(IrValue* replacement, bool preserve);
|
||||
[[nodiscard]] bool operator==(const IrValue& other) const;
|
||||
|
||||
private:
|
||||
IrOpcode opcode;
|
||||
IrType type;
|
||||
std::uint32_t id;
|
||||
std::uint32_t immediateU32;
|
||||
std::uint64_t immediateBits = 0;
|
||||
GuestRegister registerValue{};
|
||||
std::uint64_t flags = 0;
|
||||
std::vector<IrBlock*> phiBlocks;
|
||||
std::vector<IrUse> operandUses;
|
||||
bool hasImmediate;
|
||||
std::vector<IrValue*> arguments;
|
||||
std::vector<IrValue*> uses;
|
||||
IrBlock* parent;
|
||||
};
|
||||
|
||||
template<IrType TValueType>
|
||||
class IrTypedValue {
|
||||
public:
|
||||
IrTypedValue() {
|
||||
throw std::runtime_error("IrTypedValue not implemented");
|
||||
}
|
||||
|
||||
explicit IrTypedValue(IrValue& value) {
|
||||
throw std::runtime_error("IrTypedValue not implemented");
|
||||
}
|
||||
|
||||
template<IrType TOtherType> requires((static_cast<std::uint32_t>(TValueType) & static_cast<std::uint32_t>(TOtherType)) != 0u)
|
||||
IrTypedValue(const IrTypedValue<TOtherType>& value) {
|
||||
throw std::runtime_error("IrTypedValue not implemented");
|
||||
}
|
||||
|
||||
[[nodiscard]] IrValue& Value() const {
|
||||
throw std::runtime_error("IrTypedValue::Value not implemented");
|
||||
}
|
||||
|
||||
private:
|
||||
IrValue* value = nullptr;
|
||||
};
|
||||
|
||||
using IrU1 = IrTypedValue<IrType::Bool>;
|
||||
using IrU8 = IrTypedValue<IrType::U8>;
|
||||
using IrU16 = IrTypedValue<IrType::U16>;
|
||||
using IrU32 = IrTypedValue<IrType::U32>;
|
||||
using IrU64 = IrTypedValue<IrType::U64>;
|
||||
using IrF16 = IrTypedValue<IrType::F16>;
|
||||
using IrF32 = IrTypedValue<IrType::F32>;
|
||||
using IrU32F32 = IrTypedValue<static_cast<IrType>(static_cast<std::uint32_t>(IrType::U32) | static_cast<std::uint32_t>(IrType::F32))>;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <IntermediateRepresentation/GuestRegister.hpp>
|
||||
#include "IntermediateRepresentation/GuestRegister.hpp"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace ShaderRecompiler {
|
||||
@@ -10,4 +10,12 @@ bool operator<(const GuestRegister& lhs, const GuestRegister& rhs) {
|
||||
throw std::runtime_error("operator< not implemented");
|
||||
}
|
||||
|
||||
std::uint32_t RegIndex(ScalarReg reg) {
|
||||
throw std::runtime_error("RegIndex not implemented");
|
||||
}
|
||||
|
||||
std::uint32_t RegIndex(VectorReg reg) {
|
||||
throw std::runtime_error("RegIndex not implemented");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <IntermediateRepresentation/IrBlock.hpp>
|
||||
#include "IntermediateRepresentation/IrBlock.hpp"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace ShaderRecompiler {
|
||||
@@ -37,4 +37,28 @@ void IrBlock::AddSuccessor(IrBlock* block) {
|
||||
throw std::runtime_error("IrBlock::AddSuccessor not implemented");
|
||||
}
|
||||
|
||||
const std::vector<IrBlock*>& IrBlock::Predecessors() const {
|
||||
throw std::runtime_error("IrBlock::Predecessors not implemented");
|
||||
}
|
||||
|
||||
const std::vector<IrBlock*>& IrBlock::Successors() const {
|
||||
throw std::runtime_error("IrBlock::Successors not implemented");
|
||||
}
|
||||
|
||||
void IrBlock::SsaSeal() {
|
||||
throw std::runtime_error("IrBlock::SsaSeal not implemented");
|
||||
}
|
||||
|
||||
bool IrBlock::IsSsaSealed() const {
|
||||
throw std::runtime_error("IrBlock::IsSsaSealed not implemented");
|
||||
}
|
||||
|
||||
void IrBlock::AddBranch(IrBlock* block) {
|
||||
throw std::runtime_error("IrBlock::AddBranch not implemented");
|
||||
}
|
||||
|
||||
bool IrBlock::Empty() const {
|
||||
throw std::runtime_error("IrBlock::Empty not implemented");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <IntermediateRepresentation/IrBuilder.hpp>
|
||||
#include "IntermediateRepresentation/IrBuilder.hpp"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace ShaderRecompiler {
|
||||
@@ -28,4 +28,236 @@ void IrBuilder::BranchConditional(IrValue& condition, IrBlock& trueTarget, IrBlo
|
||||
throw std::runtime_error("IrBuilder::BranchConditional not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::ConstantU64(std::uint64_t value) {
|
||||
throw std::runtime_error("IrBuilder::ConstantU64 not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::ConstantF16(std::uint16_t bits) {
|
||||
throw std::runtime_error("IrBuilder::ConstantF16 not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::ConstantF32(float value) {
|
||||
throw std::runtime_error("IrBuilder::ConstantF32 not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::ConstantBool(bool value) {
|
||||
throw std::runtime_error("IrBuilder::ConstantBool not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::ConstantU8(std::uint8_t value) {
|
||||
throw std::runtime_error("IrBuilder::ConstantU8 not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::ConstantU16(std::uint16_t value) {
|
||||
throw std::runtime_error("IrBuilder::ConstantU16 not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::Emit(IrOpcode opcode, IrType type, std::initializer_list<IrValue*> arguments, std::uint64_t flags) {
|
||||
throw std::runtime_error("IrBuilder::Emit not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::GetUserData(ScalarReg reg) {
|
||||
throw std::runtime_error("IrBuilder::GetUserData not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::GetScalarReg(ScalarReg reg) {
|
||||
throw std::runtime_error("IrBuilder::GetScalarReg not implemented");
|
||||
}
|
||||
|
||||
void IrBuilder::SetScalarReg(ScalarReg reg, IrValue& value) {
|
||||
throw std::runtime_error("IrBuilder::SetScalarReg not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::GetThreadBitScalarReg(ScalarReg reg) {
|
||||
throw std::runtime_error("IrBuilder::GetThreadBitScalarReg not implemented");
|
||||
}
|
||||
|
||||
void IrBuilder::SetThreadBitScalarReg(ScalarReg reg, IrValue& value) {
|
||||
throw std::runtime_error("IrBuilder::SetThreadBitScalarReg not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::GetScalarMaskTag(ScalarReg reg) {
|
||||
throw std::runtime_error("IrBuilder::GetScalarMaskTag not implemented");
|
||||
}
|
||||
|
||||
void IrBuilder::SetScalarMaskTag(ScalarReg reg, IrValue& value) {
|
||||
throw std::runtime_error("IrBuilder::SetScalarMaskTag not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::GetVectorReg(VectorReg reg) {
|
||||
throw std::runtime_error("IrBuilder::GetVectorReg not implemented");
|
||||
}
|
||||
|
||||
void IrBuilder::SetVectorReg(VectorReg reg, IrValue& value) {
|
||||
throw std::runtime_error("IrBuilder::SetVectorReg not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::GetGotoVariable(std::uint32_t id) {
|
||||
throw std::runtime_error("IrBuilder::GetGotoVariable not implemented");
|
||||
}
|
||||
|
||||
void IrBuilder::SetGotoVariable(std::uint32_t id, IrValue& value) {
|
||||
throw std::runtime_error("IrBuilder::SetGotoVariable not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::GetScc() {
|
||||
throw std::runtime_error("IrBuilder::GetScc not implemented");
|
||||
}
|
||||
|
||||
void IrBuilder::SetScc(IrValue& value) {
|
||||
throw std::runtime_error("IrBuilder::SetScc not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::GetExec() {
|
||||
throw std::runtime_error("IrBuilder::GetExec not implemented");
|
||||
}
|
||||
|
||||
void IrBuilder::SetExec(IrValue& value) {
|
||||
throw std::runtime_error("IrBuilder::SetExec not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::GetExecLo() {
|
||||
throw std::runtime_error("IrBuilder::GetExecLo not implemented");
|
||||
}
|
||||
|
||||
void IrBuilder::SetExecLo(IrValue& value) {
|
||||
throw std::runtime_error("IrBuilder::SetExecLo not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::GetExecHi() {
|
||||
throw std::runtime_error("IrBuilder::GetExecHi not implemented");
|
||||
}
|
||||
|
||||
void IrBuilder::SetExecHi(IrValue& value) {
|
||||
throw std::runtime_error("IrBuilder::SetExecHi not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::GetVcc() {
|
||||
throw std::runtime_error("IrBuilder::GetVcc not implemented");
|
||||
}
|
||||
|
||||
void IrBuilder::SetVcc(IrValue& value) {
|
||||
throw std::runtime_error("IrBuilder::SetVcc not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::GetVccLo() {
|
||||
throw std::runtime_error("IrBuilder::GetVccLo not implemented");
|
||||
}
|
||||
|
||||
void IrBuilder::SetVccLo(IrValue& value) {
|
||||
throw std::runtime_error("IrBuilder::SetVccLo not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::GetVccHi() {
|
||||
throw std::runtime_error("IrBuilder::GetVccHi not implemented");
|
||||
}
|
||||
|
||||
void IrBuilder::SetVccHi(IrValue& value) {
|
||||
throw std::runtime_error("IrBuilder::SetVccHi not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::GetM0() {
|
||||
throw std::runtime_error("IrBuilder::GetM0 not implemented");
|
||||
}
|
||||
|
||||
void IrBuilder::SetM0(IrValue& value) {
|
||||
throw std::runtime_error("IrBuilder::SetM0 not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::BitCastF32(IrValue& value) {
|
||||
throw std::runtime_error("IrBuilder::BitCastF32 not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::BitCastU32(IrValue& value) {
|
||||
throw std::runtime_error("IrBuilder::BitCastU32 not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::BitCastF16(IrValue& value) {
|
||||
throw std::runtime_error("IrBuilder::BitCastF16 not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::BitCastU32FromF16(IrValue& value) {
|
||||
throw std::runtime_error("IrBuilder::BitCastU32FromF16 not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::ConstructU64(IrValue& low, IrValue& high) {
|
||||
throw std::runtime_error("IrBuilder::ConstructU64 not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::CompositeExtract(IrValue& composite, std::uint32_t index) {
|
||||
throw std::runtime_error("IrBuilder::CompositeExtract not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::IAdd(IrValue& lhs, IrValue& rhs) {
|
||||
throw std::runtime_error("IrBuilder::IAdd not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::ISub(IrValue& lhs, IrValue& rhs) {
|
||||
throw std::runtime_error("IrBuilder::ISub not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::IMul(IrValue& lhs, IrValue& rhs) {
|
||||
throw std::runtime_error("IrBuilder::IMul not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::ShiftLeftLogical(IrValue& value, IrValue& shift) {
|
||||
throw std::runtime_error("IrBuilder::ShiftLeftLogical not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::ShiftRightLogical(IrValue& value, IrValue& shift) {
|
||||
throw std::runtime_error("IrBuilder::ShiftRightLogical not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::ShiftRightArithmetic(IrValue& value, IrValue& shift) {
|
||||
throw std::runtime_error("IrBuilder::ShiftRightArithmetic not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::BitwiseAnd(IrValue& lhs, IrValue& rhs) {
|
||||
throw std::runtime_error("IrBuilder::BitwiseAnd not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::BitwiseOr(IrValue& lhs, IrValue& rhs) {
|
||||
throw std::runtime_error("IrBuilder::BitwiseOr not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::BitwiseXor(IrValue& lhs, IrValue& rhs) {
|
||||
throw std::runtime_error("IrBuilder::BitwiseXor not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::BitwiseNot(IrValue& value) {
|
||||
throw std::runtime_error("IrBuilder::BitwiseNot not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::Select(IrValue& condition, IrValue& trueValue, IrValue& falseValue) {
|
||||
throw std::runtime_error("IrBuilder::Select not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::IEqual(IrValue& lhs, IrValue& rhs) {
|
||||
throw std::runtime_error("IrBuilder::IEqual not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::INotEqual(IrValue& lhs, IrValue& rhs) {
|
||||
throw std::runtime_error("IrBuilder::INotEqual not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::ULessThan(IrValue& lhs, IrValue& rhs) {
|
||||
throw std::runtime_error("IrBuilder::ULessThan not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::UGreaterThan(IrValue& lhs, IrValue& rhs) {
|
||||
throw std::runtime_error("IrBuilder::UGreaterThan not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::LogicalAnd(IrValue& lhs, IrValue& rhs) {
|
||||
throw std::runtime_error("IrBuilder::LogicalAnd not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::LogicalOr(IrValue& lhs, IrValue& rhs) {
|
||||
throw std::runtime_error("IrBuilder::LogicalOr not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrBuilder::LogicalNot(IrValue& value) {
|
||||
throw std::runtime_error("IrBuilder::LogicalNot not implemented");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,50 @@
|
||||
#include <IntermediateRepresentation/IrOpcode.hpp>
|
||||
#include "IntermediateRepresentation/IrOpcode.hpp"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace ShaderRecompiler {
|
||||
|
||||
std::uint32_t IrOpcodeOperandCount(IrOpcode opcode) {
|
||||
std::size_t IrOpcodeOperandCount(IrOpcode opcode) {
|
||||
throw std::runtime_error("IrOpcodeOperandCount not implemented");
|
||||
}
|
||||
|
||||
IrType IrOpcodeType(IrOpcode opcode) {
|
||||
throw std::runtime_error("IrOpcodeType not implemented");
|
||||
}
|
||||
|
||||
IrType IrOpcodeArgumentType(IrOpcode opcode, std::size_t index) {
|
||||
throw std::runtime_error("IrOpcodeArgumentType not implemented");
|
||||
}
|
||||
|
||||
bool IrOpcodeHasSideEffects(IrOpcode opcode) {
|
||||
throw std::runtime_error("IrOpcodeHasSideEffects not implemented");
|
||||
}
|
||||
|
||||
BufferAccess BufferAccessOf(IrOpcode opcode) {
|
||||
throw std::runtime_error("BufferAccessOf not implemented");
|
||||
}
|
||||
|
||||
std::uint32_t BufferComponentCount(IrOpcode opcode) {
|
||||
throw std::runtime_error("BufferComponentCount not implemented");
|
||||
}
|
||||
|
||||
SharedAccess SharedAccessOf(IrOpcode opcode) {
|
||||
throw std::runtime_error("SharedAccessOf not implemented");
|
||||
}
|
||||
|
||||
std::uint32_t SharedComponentCount(IrOpcode opcode) {
|
||||
throw std::runtime_error("SharedComponentCount not implemented");
|
||||
}
|
||||
|
||||
AddressOpcodeInfo AddressOpcodeInfoOf(IrOpcode opcode) {
|
||||
throw std::runtime_error("AddressOpcodeInfoOf not implemented");
|
||||
}
|
||||
|
||||
ImageOpcodeInfo ImageOpcodeInfoOf(IrOpcode opcode) {
|
||||
throw std::runtime_error("ImageOpcodeInfoOf not implemented");
|
||||
}
|
||||
|
||||
std::string_view IrOpcodeName(IrOpcode opcode) {
|
||||
throw std::runtime_error("IrOpcodeName not implemented");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <IntermediateRepresentation/IrProgram.hpp>
|
||||
#include "IntermediateRepresentation/IrProgram.hpp"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace ShaderRecompiler {
|
||||
@@ -31,4 +31,84 @@ IrValue& IrProgram::CreateValue(IrOpcode opcode, IrType type) {
|
||||
throw std::runtime_error("IrProgram::CreateValue not implemented");
|
||||
}
|
||||
|
||||
IrResourcePlan& IrProgram::Resources() {
|
||||
throw std::runtime_error("IrProgram::Resources not implemented");
|
||||
}
|
||||
|
||||
const IrResourcePlan& IrProgram::Resources() const {
|
||||
throw std::runtime_error("IrProgram::Resources not implemented");
|
||||
}
|
||||
|
||||
IrProgramMetadata& IrProgram::Metadata() {
|
||||
throw std::runtime_error("IrProgram::Metadata not implemented");
|
||||
}
|
||||
|
||||
const IrProgramMetadata& IrProgram::Metadata() const {
|
||||
throw std::runtime_error("IrProgram::Metadata not implemented");
|
||||
}
|
||||
|
||||
CompiledShaderInfo IrProgram::TakeCompiledInfo() && {
|
||||
throw std::runtime_error("IrProgram::TakeCompiledInfo not implemented");
|
||||
}
|
||||
|
||||
IrValue& IrProgram::CreateValue(IrOpcode opcode, IrType type, std::uint64_t flags) {
|
||||
throw std::runtime_error("IrProgram::CreateValue not implemented");
|
||||
}
|
||||
|
||||
void IrProgram::SetEntryBlock(IrBlock& block) {
|
||||
throw std::runtime_error("IrProgram::SetEntryBlock not implemented");
|
||||
}
|
||||
|
||||
std::string ProgramToString(const IrProgram& program) {
|
||||
throw std::runtime_error("ProgramToString not implemented");
|
||||
}
|
||||
|
||||
void ValidateProgram(const IrProgram& program, bool requireSsa) {
|
||||
throw std::runtime_error("ValidateProgram not implemented");
|
||||
}
|
||||
|
||||
void ResolveControlFlowIdentities(IrProgram& program) {
|
||||
throw std::runtime_error("ResolveControlFlowIdentities not implemented");
|
||||
}
|
||||
|
||||
bool EquivalentValue(const IrResourcePlan& program, const IrValue* left, const IrValue* right) {
|
||||
throw std::runtime_error("EquivalentValue not implemented");
|
||||
}
|
||||
|
||||
IrValue* ResolveInvariantPhi(const IrResourcePlan& program, IrValue* value) {
|
||||
throw std::runtime_error("ResolveInvariantPhi not implemented");
|
||||
}
|
||||
|
||||
bool IsAddressResourceKind(ResourceKind kind) {
|
||||
throw std::runtime_error("IsAddressResourceKind not implemented");
|
||||
}
|
||||
|
||||
PositionExportComponent DecodePositionExportComponent(std::uint32_t control, std::uint32_t positionIndex, std::uint32_t component) {
|
||||
throw std::runtime_error("DecodePositionExportComponent not implemented");
|
||||
}
|
||||
|
||||
std::uint32_t NativeBinding(IrShaderStage stage, DescriptorBindingKind kind) {
|
||||
throw std::runtime_error("NativeBinding not implemented");
|
||||
}
|
||||
|
||||
ImageResourceClass ImageBindingResourceClass(DescriptorBindingKind kind) {
|
||||
throw std::runtime_error("ImageBindingResourceClass not implemented");
|
||||
}
|
||||
|
||||
std::uint32_t ImageBindingIndex(DescriptorBindingKind kind) {
|
||||
throw std::runtime_error("ImageBindingIndex not implemented");
|
||||
}
|
||||
|
||||
DescriptorBindingKind DescriptorBindingForImage(const ImageResource& image) {
|
||||
throw std::runtime_error("DescriptorBindingForImage not implemented");
|
||||
}
|
||||
|
||||
std::vector<IrBlock*>& IrProgram::BlockOrder() {
|
||||
throw std::runtime_error("IrProgram::BlockOrder not implemented");
|
||||
}
|
||||
|
||||
const std::vector<IrBlock*>& IrProgram::BlockOrder() const {
|
||||
throw std::runtime_error("IrProgram::BlockOrder not implemented");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <IntermediateRepresentation/IrType.hpp>
|
||||
#include "IntermediateRepresentation/IrType.hpp"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace ShaderRecompiler {
|
||||
@@ -19,4 +19,20 @@ std::string TypeToString(IrType type) {
|
||||
throw std::runtime_error("TypeToString not implemented");
|
||||
}
|
||||
|
||||
IrType operator|(IrType lhs, IrType rhs) {
|
||||
throw std::runtime_error("operator| not implemented");
|
||||
}
|
||||
|
||||
IrType operator&(IrType lhs, IrType rhs) {
|
||||
throw std::runtime_error("operator& not implemented");
|
||||
}
|
||||
|
||||
bool TypesOverlap(IrType lhs, IrType rhs) {
|
||||
throw std::runtime_error("TypesOverlap not implemented");
|
||||
}
|
||||
|
||||
bool AreTypesCompatible(IrType lhs, IrType rhs) {
|
||||
throw std::runtime_error("AreTypesCompatible not implemented");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include <IntermediateRepresentation/IrValue.hpp>
|
||||
#include "IntermediateRepresentation/IrValue.hpp"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace ShaderRecompiler {
|
||||
|
||||
IrValue::IrValue(IrOpcode opcode, IrType type, std::uint32_t id) : opcode(opcode), type(type), id(id), immediateU32(0), hasImmediate(false), parent(nullptr) {
|
||||
IrValue::IrValue(IrOpcode opcode, IrType type, std::uint32_t id) : opcode(opcode), type(type), id(id), hasImmediate(false), parent(nullptr) {
|
||||
throw std::runtime_error("IrValue::IrValue not implemented");
|
||||
}
|
||||
IrOpcode IrValue::Opcode() const {
|
||||
@@ -33,7 +33,7 @@ std::uint32_t IrValue::ImmediateU32() const {
|
||||
void IrValue::AddArgument(IrValue* argument) {
|
||||
throw std::runtime_error("IrValue::AddArgument not implemented");
|
||||
}
|
||||
void IrValue::ReplaceArgument(std::uint32_t index, IrValue* argument) {
|
||||
void IrValue::ReplaceArgument(std::size_t index, IrValue* argument) {
|
||||
throw std::runtime_error("IrValue::ReplaceArgument not implemented");
|
||||
}
|
||||
void IrValue::ReplaceAllUsesWith(IrValue* replacement) {
|
||||
@@ -46,4 +46,132 @@ void IrValue::SetParent(IrBlock* parent) {
|
||||
throw std::runtime_error("IrValue::SetParent not implemented");
|
||||
}
|
||||
|
||||
bool IrValue::IsEmpty() const {
|
||||
throw std::runtime_error("IrValue::IsEmpty not implemented");
|
||||
}
|
||||
|
||||
bool IrValue::IsIdentity() const {
|
||||
throw std::runtime_error("IrValue::IsIdentity not implemented");
|
||||
}
|
||||
|
||||
bool IrValue::IsPhi() const {
|
||||
throw std::runtime_error("IrValue::IsPhi not implemented");
|
||||
}
|
||||
|
||||
IrValue* IrValue::Resolve() const {
|
||||
throw std::runtime_error("IrValue::Resolve not implemented");
|
||||
}
|
||||
|
||||
bool IrValue::MayHaveSideEffects() const {
|
||||
throw std::runtime_error("IrValue::MayHaveSideEffects not implemented");
|
||||
}
|
||||
|
||||
bool IrValue::HasUses() const {
|
||||
throw std::runtime_error("IrValue::HasUses not implemented");
|
||||
}
|
||||
|
||||
std::size_t IrValue::UseCount() const {
|
||||
throw std::runtime_error("IrValue::UseCount not implemented");
|
||||
}
|
||||
|
||||
std::size_t IrValue::ArgumentCount() const {
|
||||
throw std::runtime_error("IrValue::ArgumentCount not implemented");
|
||||
}
|
||||
|
||||
std::size_t IrValue::PhiBlockCount() const {
|
||||
throw std::runtime_error("IrValue::PhiBlockCount not implemented");
|
||||
}
|
||||
|
||||
IrValue* IrValue::Argument(std::size_t index) const {
|
||||
throw std::runtime_error("IrValue::Argument not implemented");
|
||||
}
|
||||
|
||||
IrBlock* IrValue::PhiBlock(std::size_t index) const {
|
||||
throw std::runtime_error("IrValue::PhiBlock not implemented");
|
||||
}
|
||||
|
||||
const std::vector<IrUse>& IrValue::OperandUses() const {
|
||||
throw std::runtime_error("IrValue::OperandUses not implemented");
|
||||
}
|
||||
|
||||
std::uint64_t IrValue::ImmediateU64() const {
|
||||
throw std::runtime_error("IrValue::ImmediateU64 not implemented");
|
||||
}
|
||||
|
||||
std::uint16_t IrValue::ImmediateF16Bits() const {
|
||||
throw std::runtime_error("IrValue::ImmediateF16Bits not implemented");
|
||||
}
|
||||
|
||||
float IrValue::ImmediateF32() const {
|
||||
throw std::runtime_error("IrValue::ImmediateF32 not implemented");
|
||||
}
|
||||
|
||||
bool IrValue::ImmediateBool() const {
|
||||
throw std::runtime_error("IrValue::ImmediateBool not implemented");
|
||||
}
|
||||
|
||||
std::uint8_t IrValue::ImmediateU8() const {
|
||||
throw std::runtime_error("IrValue::ImmediateU8 not implemented");
|
||||
}
|
||||
|
||||
std::uint16_t IrValue::ImmediateU16() const {
|
||||
throw std::runtime_error("IrValue::ImmediateU16 not implemented");
|
||||
}
|
||||
|
||||
GuestRegister IrValue::Register() const {
|
||||
throw std::runtime_error("IrValue::Register not implemented");
|
||||
}
|
||||
|
||||
void IrValue::SetImmediateU64(std::uint64_t value) {
|
||||
throw std::runtime_error("IrValue::SetImmediateU64 not implemented");
|
||||
}
|
||||
|
||||
void IrValue::SetImmediateF16Bits(std::uint16_t bits) {
|
||||
throw std::runtime_error("IrValue::SetImmediateF16Bits not implemented");
|
||||
}
|
||||
|
||||
void IrValue::SetImmediateF32(float value) {
|
||||
throw std::runtime_error("IrValue::SetImmediateF32 not implemented");
|
||||
}
|
||||
|
||||
void IrValue::SetImmediateBool(bool value) {
|
||||
throw std::runtime_error("IrValue::SetImmediateBool not implemented");
|
||||
}
|
||||
|
||||
void IrValue::SetImmediateU8(std::uint8_t value) {
|
||||
throw std::runtime_error("IrValue::SetImmediateU8 not implemented");
|
||||
}
|
||||
|
||||
void IrValue::SetImmediateU16(std::uint16_t value) {
|
||||
throw std::runtime_error("IrValue::SetImmediateU16 not implemented");
|
||||
}
|
||||
|
||||
void IrValue::SetRegister(const GuestRegister& reg) {
|
||||
throw std::runtime_error("IrValue::SetRegister not implemented");
|
||||
}
|
||||
|
||||
void IrValue::AddPhiOperand(IrBlock* predecessor, IrValue* value) {
|
||||
throw std::runtime_error("IrValue::AddPhiOperand not implemented");
|
||||
}
|
||||
|
||||
void IrValue::ReplaceOpcode(IrOpcode opcode) {
|
||||
throw std::runtime_error("IrValue::ReplaceOpcode not implemented");
|
||||
}
|
||||
|
||||
void IrValue::Invalidate() {
|
||||
throw std::runtime_error("IrValue::Invalidate not implemented");
|
||||
}
|
||||
|
||||
void IrValue::ReplaceUsesWith(IrValue* replacement, bool preserve) {
|
||||
throw std::runtime_error("IrValue::ReplaceUsesWith not implemented");
|
||||
}
|
||||
|
||||
bool IrValue::operator==(const IrValue& other) const {
|
||||
throw std::runtime_error("operator== not implemented");
|
||||
}
|
||||
|
||||
bool IrUse::operator==(const IrUse& other) const {
|
||||
throw std::runtime_error("IrUse::operator== not implemented");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user