mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 19:07:01 +02:00
format source files
This commit is contained in:
@@ -18,16 +18,17 @@ enum class ComponentType {
|
||||
|
||||
struct BufferFormatInfo {
|
||||
Prospero::BufferFormat format = Prospero::BufferFormat::kInvalid;
|
||||
ComponentType type = ComponentType::Unknown;
|
||||
uint32_t component_count = 0;
|
||||
uint32_t byte_size = 0;
|
||||
uint32_t component_bits[4] = {};
|
||||
uint32_t component_bit_offset[4] = {};
|
||||
bool packed_bitfield = false;
|
||||
ComponentType type = ComponentType::Unknown;
|
||||
uint32_t component_count = 0;
|
||||
uint32_t byte_size = 0;
|
||||
uint32_t component_bits[4] = {};
|
||||
uint32_t component_bit_offset[4] = {};
|
||||
bool packed_bitfield = false;
|
||||
};
|
||||
|
||||
constexpr Prospero::BufferFormat DecodeTBufferFormat(uint32_t data_format, uint32_t number_format) {
|
||||
return static_cast<Prospero::BufferFormat>(((number_format & 0x7u) << 4u) | (data_format & 0xfu));
|
||||
return static_cast<Prospero::BufferFormat>(((number_format & 0x7u) << 4u) |
|
||||
(data_format & 0xfu));
|
||||
}
|
||||
|
||||
constexpr ComponentType GetFormatComponentType(Prospero::BufferFormat format) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "graphics/shader/recompiler/ShaderIR.h"
|
||||
|
||||
#include "graphics/shader/recompiler/shaderIR/ShaderIRInternal.h"
|
||||
#include "common/assert.h"
|
||||
#include "graphics/shader/recompiler/BufferFormat.h"
|
||||
#include "graphics/shader/recompiler/shaderIR/ShaderIRInternal.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <fmt/format.h>
|
||||
@@ -403,7 +403,6 @@ Decoder::Operand M0Operand() {
|
||||
return operand;
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
bool LowerScalarSelect(const Decoder::Instruction& decoded, BasicBlock* block, std::string* error) {
|
||||
@@ -1145,7 +1144,6 @@ bool LowerDecodedInstruction(const Decoder::Instruction& inst, BasicBlock* block
|
||||
return LowerImplemented(inst, block, error);
|
||||
}
|
||||
|
||||
|
||||
bool LowerImplemented(const Decoder::Instruction& decoded, BasicBlock* block, std::string* error) {
|
||||
Instruction inst;
|
||||
inst.pc = decoded.pc;
|
||||
|
||||
@@ -14,36 +14,34 @@ bool IsVectorCarryOutOpcode(Decoder::Opcode opcode);
|
||||
bool ScalarResultWritesSccNonZero(Decoder::Opcode opcode);
|
||||
bool ScalarResultIs64Bit(Decoder::Opcode opcode);
|
||||
|
||||
Operand MakeSccOperand();
|
||||
Operand MakeImmediateU32(uint32_t value);
|
||||
Operand MakePcRelativeU32(uint32_t value);
|
||||
bool AppendScalarResultSccNonZero(const Decoder::Instruction& decoded, BasicBlock* block,
|
||||
std::string* error);
|
||||
Operand MakeSccOperand();
|
||||
Operand MakeImmediateU32(uint32_t value);
|
||||
Operand MakePcRelativeU32(uint32_t value);
|
||||
bool AppendScalarResultSccNonZero(const Decoder::Instruction& decoded, BasicBlock* block,
|
||||
std::string* error);
|
||||
uint32_t VectorByteConvertIndex(Decoder::Opcode opcode);
|
||||
void CopyOperandModifiers(const Decoder::Operand& decoded, Operand& operand);
|
||||
bool LowerRegisterOperand(const Decoder::Operand& decoded, Operand* operand,
|
||||
std::string* error);
|
||||
bool LowerSourceOperand(const Decoder::Operand& decoded, Operand* operand, std::string* error);
|
||||
void ApplyDppDestinationMask(const Decoder::Instruction& decoded, Operand& dst);
|
||||
uint32_t ResourceIndexFromOperand(const Decoder::Operand& operand);
|
||||
MemoryInfo MemoryInfoFromDecoded(const Decoder::Instruction& decoded, ResourceKind kind);
|
||||
uint32_t RawScalarLoadBase(const Decoder::Operand& operand);
|
||||
void ClearRegisterOffsetModifiers(Decoder::Operand& operand);
|
||||
bool TryGetScalarDestinationCode(const Decoder::Operand& operand, uint32_t& code);
|
||||
bool TryOffsetScalarDestination(const Decoder::Operand& operand, uint32_t index,
|
||||
Decoder::Operand* result);
|
||||
bool LowerRegisterOperand(const Decoder::Operand& decoded, Operand* operand, std::string* error);
|
||||
bool LowerSourceOperand(const Decoder::Operand& decoded, Operand* operand, std::string* error);
|
||||
void ApplyDppDestinationMask(const Decoder::Instruction& decoded, Operand& dst);
|
||||
uint32_t ResourceIndexFromOperand(const Decoder::Operand& operand);
|
||||
MemoryInfo MemoryInfoFromDecoded(const Decoder::Instruction& decoded, ResourceKind kind);
|
||||
uint32_t RawScalarLoadBase(const Decoder::Operand& operand);
|
||||
void ClearRegisterOffsetModifiers(Decoder::Operand& operand);
|
||||
bool TryGetScalarDestinationCode(const Decoder::Operand& operand, uint32_t& code);
|
||||
bool TryOffsetScalarDestination(const Decoder::Operand& operand, uint32_t index,
|
||||
Decoder::Operand* result);
|
||||
Decoder::Operand OffsetDecodedRegister(const Decoder::Operand& operand, uint32_t index);
|
||||
MemoryInfo OffsetMemoryInfo(const Decoder::Instruction& decoded, ResourceKind kind,
|
||||
uint32_t dword_index);
|
||||
uint32_t TypedBufferComponentOffsetBytes(const Decoder::Instruction& decoded,
|
||||
uint32_t component_index);
|
||||
uint32_t TypedBufferFormatComponentCount(const Decoder::Instruction& decoded);
|
||||
bool LowerMoveImmediateU32(uint32_t pc, const Decoder::Operand& dst, uint32_t value,
|
||||
BasicBlock* block, std::string* error);
|
||||
MemoryInfo OffsetBufferMemoryInfo(const Decoder::Instruction& decoded,
|
||||
uint32_t component_index);
|
||||
MemoryInfo ByteOffsetMemoryInfo(const Decoder::Instruction& decoded, ResourceKind kind,
|
||||
uint32_t byte_offset);
|
||||
MemoryInfo OffsetMemoryInfo(const Decoder::Instruction& decoded, ResourceKind kind,
|
||||
uint32_t dword_index);
|
||||
uint32_t TypedBufferComponentOffsetBytes(const Decoder::Instruction& decoded,
|
||||
uint32_t component_index);
|
||||
uint32_t TypedBufferFormatComponentCount(const Decoder::Instruction& decoded);
|
||||
bool LowerMoveImmediateU32(uint32_t pc, const Decoder::Operand& dst, uint32_t value,
|
||||
BasicBlock* block, std::string* error);
|
||||
MemoryInfo OffsetBufferMemoryInfo(const Decoder::Instruction& decoded, uint32_t component_index);
|
||||
MemoryInfo ByteOffsetMemoryInfo(const Decoder::Instruction& decoded, ResourceKind kind,
|
||||
uint32_t byte_offset);
|
||||
ResourceKind FlatSegmentResourceKind(uint32_t segment);
|
||||
const Decoder::Operand& DecodedSourceAt(const Decoder::Instruction& decoded, uint32_t index);
|
||||
Decoder::Operand M0Operand();
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#include "graphics/shader/recompiler/ShaderIR.h"
|
||||
|
||||
#include "graphics/shader/recompiler/shaderIR/ShaderIRInternal.h"
|
||||
#include "common/assert.h"
|
||||
#include "graphics/shader/recompiler/BufferFormat.h"
|
||||
#include "graphics/shader/recompiler/ShaderIR.h"
|
||||
#include "graphics/shader/recompiler/shaderIR/ShaderIRInternal.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <fmt/format.h>
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#include "graphics/shader/recompiler/ShaderIR.h"
|
||||
|
||||
#include "graphics/shader/recompiler/shaderIR/ShaderIRInternal.h"
|
||||
#include "common/assert.h"
|
||||
#include "graphics/shader/recompiler/BufferFormat.h"
|
||||
#include "graphics/shader/recompiler/ShaderIR.h"
|
||||
#include "graphics/shader/recompiler/shaderIR/ShaderIRInternal.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <fmt/format.h>
|
||||
@@ -470,7 +469,6 @@ bool LowerImageOperation(const Decoder::Instruction& decoded, BasicBlock* block,
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
bool LowerMemoryInstruction(const Decoder::Instruction& decoded, BasicBlock* block,
|
||||
@@ -647,7 +645,6 @@ bool LowerMemoryInstruction(const Decoder::Instruction& decoded, BasicBlock* blo
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool IsMemoryOpcode(Decoder::Opcode opcode) {
|
||||
switch (opcode) {
|
||||
case Decoder::Opcode::SLoadDword:
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#include "graphics/shader/recompiler/ShaderIR.h"
|
||||
|
||||
#include "graphics/shader/recompiler/shaderIR/ShaderIRInternal.h"
|
||||
#include "common/assert.h"
|
||||
#include "graphics/shader/recompiler/BufferFormat.h"
|
||||
#include "graphics/shader/recompiler/ShaderIR.h"
|
||||
#include "graphics/shader/recompiler/shaderIR/ShaderIRInternal.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <fmt/format.h>
|
||||
@@ -425,7 +424,6 @@ constexpr LowerMap LOWER_OPS[] = {
|
||||
{Decoder::Opcode::ImageGather4H, Opcode::ImageGather4},
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
void SetError(std::string* error, const char* message) {
|
||||
|
||||
@@ -913,9 +913,11 @@ uint32_t AddressSourceCount(const IR::Instruction& inst, uint32_t first_src);
|
||||
|
||||
bool IsFormattedBufferComponent(const IR::Instruction& inst);
|
||||
|
||||
Prospero::BufferFormat FormattedBufferFormat(const EmitterState& state, const IR::Instruction& inst);
|
||||
Prospero::BufferFormat FormattedBufferFormat(const EmitterState& state,
|
||||
const IR::Instruction& inst);
|
||||
|
||||
IR::Instruction WithFormatComponentByteOffset(const IR::Instruction& inst, Prospero::BufferFormat format);
|
||||
IR::Instruction WithFormatComponentByteOffset(const IR::Instruction& inst,
|
||||
Prospero::BufferFormat format);
|
||||
|
||||
uint32_t EmitTBufferBitcastF32ToU32(EmitterState* state, uint32_t value);
|
||||
|
||||
@@ -953,7 +955,7 @@ bool EmitTypedTBufferLoad(EmitterState* state, const IR::Instruction& inst,
|
||||
bool EmitFormattedBufferLoad(EmitterState* state, const IR::Instruction& inst);
|
||||
|
||||
uint32_t FormattedBufferDwordStoreComponentCount(Prospero::BufferFormat format,
|
||||
uint32_t opcode_components);
|
||||
uint32_t opcode_components);
|
||||
|
||||
bool EmitBufferIntegerFormatStore(EmitterState* state, const IR::Instruction& inst);
|
||||
|
||||
|
||||
@@ -726,13 +726,16 @@ bool IsFormattedBufferComponent(const IR::Instruction& inst) {
|
||||
inst.memory.data_dwords == 1u;
|
||||
}
|
||||
|
||||
Prospero::BufferFormat FormattedBufferFormat(const EmitterState& state, const IR::Instruction& inst) {
|
||||
Prospero::BufferFormat FormattedBufferFormat(const EmitterState& state,
|
||||
const IR::Instruction& inst) {
|
||||
return inst.memory.typed
|
||||
? Format::DecodeTBufferFormat(inst.memory.data_format, inst.memory.number_format)
|
||||
: static_cast<Prospero::BufferFormat>(StorageBufferFormat(state, inst.memory, inst.pc));
|
||||
: static_cast<Prospero::BufferFormat>(
|
||||
StorageBufferFormat(state, inst.memory, inst.pc));
|
||||
}
|
||||
|
||||
IR::Instruction WithFormatComponentByteOffset(const IR::Instruction& inst, Prospero::BufferFormat format) {
|
||||
IR::Instruction WithFormatComponentByteOffset(const IR::Instruction& inst,
|
||||
Prospero::BufferFormat format) {
|
||||
auto rebased = inst;
|
||||
if (inst.memory.typed || inst.memory.component_index == 0u) {
|
||||
return rebased;
|
||||
@@ -972,7 +975,7 @@ bool EmitFormattedBufferLoad(EmitterState* state, const IR::Instruction& inst) {
|
||||
}
|
||||
|
||||
uint32_t FormattedBufferDwordStoreComponentCount(Prospero::BufferFormat format,
|
||||
uint32_t opcode_components) {
|
||||
uint32_t opcode_components) {
|
||||
switch (format) {
|
||||
case Prospero::BufferFormat::k32UInt:
|
||||
case Prospero::BufferFormat::k32SInt:
|
||||
|
||||
Reference in New Issue
Block a user