common/vector_math: Move Vec[x] types into the Common namespace
These types are within the common library, so they should be using the Common namespace.
This commit is contained in:
parent
db58652680
commit
643472e24a
40 changed files with 309 additions and 301 deletions
|
@ -54,18 +54,18 @@ struct DebugData<true> {
|
|||
LOOP_INT_IN = 0x800,
|
||||
};
|
||||
|
||||
Math::Vec4<float24> src1;
|
||||
Math::Vec4<float24> src2;
|
||||
Math::Vec4<float24> src3;
|
||||
Common::Vec4<float24> src1;
|
||||
Common::Vec4<float24> src2;
|
||||
Common::Vec4<float24> src3;
|
||||
|
||||
Math::Vec4<float24> dest_in;
|
||||
Math::Vec4<float24> dest_out;
|
||||
Common::Vec4<float24> dest_in;
|
||||
Common::Vec4<float24> dest_out;
|
||||
|
||||
s32 address_registers[2];
|
||||
bool conditional_code[2];
|
||||
bool cond_bool;
|
||||
bool cond_cmp[2];
|
||||
Math::Vec4<u8> loop_int;
|
||||
Common::Vec4<u8> loop_int;
|
||||
|
||||
u32 instruction_offset;
|
||||
u32 next_instruction;
|
||||
|
@ -152,7 +152,7 @@ inline void SetField<DebugDataRecord::COND_CMP_IN>(DebugDataRecord& record, bool
|
|||
}
|
||||
|
||||
template <>
|
||||
inline void SetField<DebugDataRecord::LOOP_INT_IN>(DebugDataRecord& record, Math::Vec4<u8> value) {
|
||||
inline void SetField<DebugDataRecord::LOOP_INT_IN>(DebugDataRecord& record, Common::Vec4<u8> value) {
|
||||
record.loop_int = value;
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ void UnitState::LoadInput(const ShaderRegs& config, const AttributeBuffer& input
|
|||
}
|
||||
}
|
||||
|
||||
static void CopyRegistersToOutput(const Math::Vec4<float24>* regs, u32 mask,
|
||||
static void CopyRegistersToOutput(const Common::Vec4<float24>* regs, u32 mask,
|
||||
AttributeBuffer& buffer) {
|
||||
int output_i = 0;
|
||||
for (int reg : Common::BitSet<u32>(mask)) {
|
||||
|
@ -107,7 +107,7 @@ GSEmitter::~GSEmitter() {
|
|||
delete handlers;
|
||||
}
|
||||
|
||||
void GSEmitter::Emit(Math::Vec4<float24> (&output_regs)[16]) {
|
||||
void GSEmitter::Emit(Common::Vec4<float24> (&output_regs)[16]) {
|
||||
ASSERT(vertex_id < 3);
|
||||
// TODO: This should be merged with UnitState::WriteOutput somehow
|
||||
CopyRegistersToOutput(output_regs, output_mask, buffer[vertex_id]);
|
||||
|
|
|
@ -28,7 +28,7 @@ constexpr unsigned MAX_PROGRAM_CODE_LENGTH = 4096;
|
|||
constexpr unsigned MAX_SWIZZLE_DATA_LENGTH = 4096;
|
||||
|
||||
struct AttributeBuffer {
|
||||
alignas(16) Math::Vec4<float24> attr[16];
|
||||
alignas(16) Common::Vec4<float24> attr[16];
|
||||
};
|
||||
|
||||
/// Handler type for receiving vertex outputs from vertex shader or geometry shader
|
||||
|
@ -38,16 +38,16 @@ using VertexHandler = std::function<void(const AttributeBuffer&)>;
|
|||
using WindingSetter = std::function<void()>;
|
||||
|
||||
struct OutputVertex {
|
||||
Math::Vec4<float24> pos;
|
||||
Math::Vec4<float24> quat;
|
||||
Math::Vec4<float24> color;
|
||||
Math::Vec2<float24> tc0;
|
||||
Math::Vec2<float24> tc1;
|
||||
Common::Vec4<float24> pos;
|
||||
Common::Vec4<float24> quat;
|
||||
Common::Vec4<float24> color;
|
||||
Common::Vec2<float24> tc0;
|
||||
Common::Vec2<float24> tc1;
|
||||
float24 tc0_w;
|
||||
INSERT_PADDING_WORDS(1);
|
||||
Math::Vec3<float24> view;
|
||||
Common::Vec3<float24> view;
|
||||
INSERT_PADDING_WORDS(1);
|
||||
Math::Vec2<float24> tc2;
|
||||
Common::Vec2<float24> tc2;
|
||||
|
||||
static void ValidateSemantics(const RasterizerRegs& regs);
|
||||
static OutputVertex FromAttributeBuffer(const RasterizerRegs& regs,
|
||||
|
@ -87,7 +87,7 @@ struct GSEmitter {
|
|||
|
||||
GSEmitter();
|
||||
~GSEmitter();
|
||||
void Emit(Math::Vec4<float24> (&output_regs)[16]);
|
||||
void Emit(Common::Vec4<float24> (&output_regs)[16]);
|
||||
};
|
||||
static_assert(std::is_standard_layout<GSEmitter>::value, "GSEmitter is not standard layout type");
|
||||
|
||||
|
@ -102,9 +102,9 @@ struct UnitState {
|
|||
struct Registers {
|
||||
// The registers are accessed by the shader JIT using SSE instructions, and are therefore
|
||||
// required to be 16-byte aligned.
|
||||
alignas(16) Math::Vec4<float24> input[16];
|
||||
alignas(16) Math::Vec4<float24> temporary[16];
|
||||
alignas(16) Math::Vec4<float24> output[16];
|
||||
alignas(16) Common::Vec4<float24> input[16];
|
||||
alignas(16) Common::Vec4<float24> temporary[16];
|
||||
alignas(16) Common::Vec4<float24> output[16];
|
||||
} registers;
|
||||
static_assert(std::is_pod<Registers>::value, "Structure is not POD");
|
||||
|
||||
|
@ -120,11 +120,11 @@ struct UnitState {
|
|||
switch (reg.GetRegisterType()) {
|
||||
case RegisterType::Input:
|
||||
return offsetof(UnitState, registers.input) +
|
||||
reg.GetIndex() * sizeof(Math::Vec4<float24>);
|
||||
reg.GetIndex() * sizeof(Common::Vec4<float24>);
|
||||
|
||||
case RegisterType::Temporary:
|
||||
return offsetof(UnitState, registers.temporary) +
|
||||
reg.GetIndex() * sizeof(Math::Vec4<float24>);
|
||||
reg.GetIndex() * sizeof(Common::Vec4<float24>);
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
|
@ -136,11 +136,11 @@ struct UnitState {
|
|||
switch (reg.GetRegisterType()) {
|
||||
case RegisterType::Output:
|
||||
return offsetof(UnitState, registers.output) +
|
||||
reg.GetIndex() * sizeof(Math::Vec4<float24>);
|
||||
reg.GetIndex() * sizeof(Common::Vec4<float24>);
|
||||
|
||||
case RegisterType::Temporary:
|
||||
return offsetof(UnitState, registers.temporary) +
|
||||
reg.GetIndex() * sizeof(Math::Vec4<float24>);
|
||||
reg.GetIndex() * sizeof(Common::Vec4<float24>);
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
|
@ -175,13 +175,13 @@ struct GSUnitState : public UnitState {
|
|||
struct Uniforms {
|
||||
// The float uniforms are accessed by the shader JIT using SSE instructions, and are
|
||||
// therefore required to be 16-byte aligned.
|
||||
alignas(16) Math::Vec4<float24> f[96];
|
||||
alignas(16) Common::Vec4<float24> f[96];
|
||||
|
||||
std::array<bool, 16> b;
|
||||
std::array<Math::Vec4<u8>, 4> i;
|
||||
std::array<Common::Vec4<u8>, 4> i;
|
||||
|
||||
static std::size_t GetFloatUniformOffset(unsigned index) {
|
||||
return offsetof(Uniforms, f) + index * sizeof(Math::Vec4<float24>);
|
||||
return offsetof(Uniforms, f) + index * sizeof(Common::Vec4<float24>);
|
||||
}
|
||||
|
||||
static std::size_t GetBoolUniformOffset(unsigned index) {
|
||||
|
@ -189,7 +189,7 @@ struct Uniforms {
|
|||
}
|
||||
|
||||
static std::size_t GetIntUniformOffset(unsigned index) {
|
||||
return offsetof(Uniforms, i) + index * sizeof(Math::Vec4<u8>);
|
||||
return offsetof(Uniforms, i) + index * sizeof(Common::Vec4<u8>);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -622,10 +622,10 @@ static void RunInterpreter(const ShaderSetup& setup, UnitState& state, DebugData
|
|||
}
|
||||
|
||||
case OpCode::Id::LOOP: {
|
||||
Math::Vec4<u8> loop_param(uniforms.i[instr.flow_control.int_uniform_id].x,
|
||||
uniforms.i[instr.flow_control.int_uniform_id].y,
|
||||
uniforms.i[instr.flow_control.int_uniform_id].z,
|
||||
uniforms.i[instr.flow_control.int_uniform_id].w);
|
||||
Common::Vec4<u8> loop_param(uniforms.i[instr.flow_control.int_uniform_id].x,
|
||||
uniforms.i[instr.flow_control.int_uniform_id].y,
|
||||
uniforms.i[instr.flow_control.int_uniform_id].z,
|
||||
uniforms.i[instr.flow_control.int_uniform_id].w);
|
||||
state.address_registers[2] = loop_param.y;
|
||||
|
||||
Record<DebugDataRecord::LOOP_INT_IN>(debug_data, iteration, loop_param);
|
||||
|
@ -688,7 +688,7 @@ DebugData<true> InterpreterEngine::ProduceDebugInfo(const ShaderSetup& setup,
|
|||
DebugData<true> debug_data;
|
||||
|
||||
// Setup input register table
|
||||
boost::fill(state.registers.input, Math::Vec4<float24>::AssignToAll(float24::Zero()));
|
||||
boost::fill(state.registers.input, Common::Vec4<float24>::AssignToAll(float24::Zero()));
|
||||
state.LoadInput(config, input);
|
||||
RunInterpreter(setup, state, debug_data, setup.engine_data.entry_point);
|
||||
return debug_data;
|
||||
|
|
|
@ -777,7 +777,7 @@ void JitShader::Compile_JMP(Instruction instr) {
|
|||
}
|
||||
}
|
||||
|
||||
static void Emit(GSEmitter* emitter, Math::Vec4<float24> (*output)[16]) {
|
||||
static void Emit(GSEmitter* emitter, Common::Vec4<float24> (*output)[16]) {
|
||||
emitter->Emit(*output);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue