mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 02:47:02 +02:00
shader_recompiler: rename/clean up typed SSA SPIR-V emitter
This commit is contained in:
@@ -1,51 +0,0 @@
|
||||
#include "graphics/shader/recompiler/ExecMask.h"
|
||||
|
||||
namespace Libs::Graphics::ShaderRecompiler::Exec {
|
||||
|
||||
Mask FullMask(uint32_t wave_size) {
|
||||
return {0xffffffffu, wave_size == 64u ? 0xffffffffu : 0u};
|
||||
}
|
||||
|
||||
Mask ApplyWaveSize(Mask mask, uint32_t wave_size) {
|
||||
const auto full = FullMask(wave_size);
|
||||
mask.low &= full.low;
|
||||
mask.high &= full.high;
|
||||
return mask;
|
||||
}
|
||||
|
||||
Mask ReadExec(const State& state) {
|
||||
return ApplyWaveSize(state.exec, state.wave_size);
|
||||
}
|
||||
|
||||
void WriteExec(State& state, Mask mask) {
|
||||
state.exec = ApplyWaveSize(mask, state.wave_size);
|
||||
}
|
||||
|
||||
void AndExec(State& state, Mask mask) {
|
||||
WriteExec(state, {state.exec.low & mask.low, state.exec.high & mask.high});
|
||||
}
|
||||
|
||||
void OrExec(State& state, Mask mask) {
|
||||
WriteExec(state, {state.exec.low | mask.low, state.exec.high | mask.high});
|
||||
}
|
||||
|
||||
void XorExec(State& state, Mask mask) {
|
||||
WriteExec(state, {state.exec.low ^ mask.low, state.exec.high ^ mask.high});
|
||||
}
|
||||
|
||||
void InvertExec(State& state) {
|
||||
const auto full = FullMask(state.wave_size);
|
||||
WriteExec(state, {~state.exec.low & full.low, ~state.exec.high & full.high});
|
||||
}
|
||||
|
||||
bool IsExecZero(const State& state) {
|
||||
const auto exec = ReadExec(state);
|
||||
return exec.low == 0u && exec.high == 0u;
|
||||
}
|
||||
|
||||
bool IsVccZero(const State& state) {
|
||||
const auto vcc = ApplyWaveSize(state.vcc, state.wave_size);
|
||||
return vcc.low == 0u && vcc.high == 0u;
|
||||
}
|
||||
|
||||
} // namespace Libs::Graphics::ShaderRecompiler::Exec
|
||||
@@ -1,34 +0,0 @@
|
||||
#ifndef EMULATOR_INCLUDE_EMULATOR_GRAPHICS_SHADER_RECOMPILER_EXECMASK_H_
|
||||
#define EMULATOR_INCLUDE_EMULATOR_GRAPHICS_SHADER_RECOMPILER_EXECMASK_H_
|
||||
|
||||
#include "common/common.h"
|
||||
|
||||
namespace Libs::Graphics::ShaderRecompiler::Exec {
|
||||
|
||||
struct Mask {
|
||||
uint32_t low = 0;
|
||||
uint32_t high = 0;
|
||||
};
|
||||
|
||||
struct State {
|
||||
uint32_t wave_size = 64;
|
||||
Mask exec;
|
||||
Mask vcc;
|
||||
bool scc = false;
|
||||
};
|
||||
|
||||
Mask FullMask(uint32_t wave_size);
|
||||
Mask ApplyWaveSize(Mask mask, uint32_t wave_size);
|
||||
|
||||
Mask ReadExec(const State& state);
|
||||
void WriteExec(State& state, Mask mask);
|
||||
void AndExec(State& state, Mask mask);
|
||||
void OrExec(State& state, Mask mask);
|
||||
void XorExec(State& state, Mask mask);
|
||||
void InvertExec(State& state);
|
||||
bool IsExecZero(const State& state);
|
||||
bool IsVccZero(const State& state);
|
||||
|
||||
} // namespace Libs::Graphics::ShaderRecompiler::Exec
|
||||
|
||||
#endif /* EMULATOR_INCLUDE_EMULATOR_GRAPHICS_SHADER_RECOMPILER_EXECMASK_H_ */
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "graphics/host_gpu/renderer/image/textureCommon.h"
|
||||
#include "graphics/host_gpu/renderer/pipeline/shaderResourceBarrier.h"
|
||||
#include "graphics/host_gpu/renderer/pipeline/shaderSubgroup.h"
|
||||
#include "graphics/shader/recompiler/ExecMask.h"
|
||||
#include "graphics/shader/recompiler/ShaderRecompiler.h"
|
||||
#include "graphics/shader/recompiler/backend/spirv/SpirvEmitter.h"
|
||||
#include "graphics/shader/recompiler/backend/spirv/spirvEmitterInternal.h"
|
||||
@@ -7244,36 +7243,6 @@ void TestNewShaderRecompilerCfgIrreducibleDispatcher() {
|
||||
CheckSpirvBinaryValidates(result.spirv);
|
||||
}
|
||||
|
||||
void TestNewShaderRecompilerExecMaskHelpers() {
|
||||
using namespace ShaderRecompiler::Exec;
|
||||
|
||||
State wave32;
|
||||
wave32.wave_size = 32;
|
||||
WriteExec(wave32, FullMask(64));
|
||||
Check(ReadExec(wave32).low == 0xffffffffu && ReadExec(wave32).high == 0u,
|
||||
"wave32 EXEC high half was not masked off");
|
||||
AndExec(wave32, {0x0fu, 0xffffffffu});
|
||||
Check(ReadExec(wave32).low == 0x0fu && ReadExec(wave32).high == 0u,
|
||||
"wave32 AndExec did not preserve wave size");
|
||||
InvertExec(wave32);
|
||||
Check(ReadExec(wave32).low == 0xfffffff0u && ReadExec(wave32).high == 0u,
|
||||
"wave32 InvertExec did not preserve wave size");
|
||||
WriteExec(wave32, {0u, 0xffffffffu});
|
||||
Check(IsExecZero(wave32), "wave32 IsExecZero used inactive high lanes");
|
||||
|
||||
State wave64;
|
||||
wave64.wave_size = 64;
|
||||
WriteExec(wave64, FullMask(64));
|
||||
Check(ReadExec(wave64).low == 0xffffffffu &&
|
||||
ReadExec(wave64).high == 0xffffffffu,
|
||||
"wave64 EXEC full mask was wrong");
|
||||
XorExec(wave64, {0xffffffffu, 0u});
|
||||
Check(ReadExec(wave64).low == 0u && ReadExec(wave64).high == 0xffffffffu,
|
||||
"wave64 XorExec did not update both halves correctly");
|
||||
wave64.vcc = {0u, 1u};
|
||||
Check(!IsVccZero(wave64), "wave64 VCC high half was ignored");
|
||||
}
|
||||
|
||||
void TestComputeShaderInputWaveSize() {
|
||||
const auto decode_wave_size = [](uint32_t rsrc1) {
|
||||
const bool wave32 = (((rsrc1 >> Pm4::COMPUTE_PGM_RSRC1_W32_EN_SHIFT) &
|
||||
|
||||
Reference in New Issue
Block a user