Shader decompiler: More smallen-ing

This commit is contained in:
wheremyfoodat 2024-07-26 01:24:52 +03:00
parent 213183895a
commit e8b4992036
2 changed files with 13 additions and 13 deletions

View file

@ -81,8 +81,8 @@ void ShaderDecompiler::writeAttributes() {
uint uniform_bool; uint uniform_bool;
}; };
vec4 temp_registers[16]; vec4 tmp_regs[16];
vec4 output_registers[8]; vec4 out_regs[8];
vec4 dummy_vec = vec4(0.0); vec4 dummy_vec = vec4(0.0);
)"; )";
} }
@ -141,7 +141,7 @@ std::string ShaderDecompiler::getSource(u32 source, [[maybe_unused]] u32 index)
if (source < 0x10) { if (source < 0x10) {
return "inputs[" + std::to_string(source) + "]"; return "inputs[" + std::to_string(source) + "]";
} else if (source < 0x20) { } else if (source < 0x20) {
return "temp_registers[" + std::to_string(source - 0x10) + "]"; return "tmp_regs[" + std::to_string(source - 0x10) + "]";
} else { } else {
const usize floatIndex = (source - 0x20) & 0x7f; const usize floatIndex = (source - 0x20) & 0x7f;
@ -154,9 +154,9 @@ std::string ShaderDecompiler::getSource(u32 source, [[maybe_unused]] u32 index)
std::string ShaderDecompiler::getDest(u32 dest) const { std::string ShaderDecompiler::getDest(u32 dest) const {
if (dest < 0x10) { if (dest < 0x10) {
return "output_registers[" + std::to_string(dest) + "]"; return "out_regs[" + std::to_string(dest) + "]";
} else if (dest < 0x20) { } else if (dest < 0x20) {
return "temp_registers[" + std::to_string(dest - 0x10) + "]"; return "tmp_regs[" + std::to_string(dest - 0x10) + "]";
} else { } else {
return "dummy_vec"; return "dummy_vec";
} }

View file

@ -696,14 +696,14 @@ out vec2 v_texcoord2;
void main() { void main() {
pica_shader_main(); pica_shader_main();
vec4 a_coords = output_registers[0]; vec4 a_coords = out_regs[0];
vec4 a_vertexColour = output_registers[1]; vec4 a_vertexColour = out_regs[1];
vec2 a_texcoord0 = output_registers[2].xy; vec2 a_texcoord0 = out_regs[2].xy;
float a_texcoord0_w = output_registers[2].w; float a_texcoord0_w = out_regs[2].w;
vec2 a_texcoord1 = output_registers[3].xy; vec2 a_texcoord1 = out_regs[3].xy;
vec2 a_texcoord2 = output_registers[4].xy; vec2 a_texcoord2 = out_regs[4].xy;
vec3 a_view = output_registers[5].xyz; vec3 a_view = out_regs[5].xyz;
vec4 a_quaternion = output_registers[6]; vec4 a_quaternion = out_regs[6];
gl_Position = a_coords; gl_Position = a_coords;
vec4 colourAbs = abs(a_vertexColour); vec4 colourAbs = abs(a_vertexColour);