mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 03:55:32 +00:00
rsx: Shader pipeline fixes and improvements
- Do not set zfunc if alphakill is not enabled. This is because at the moment alphakill requires a different shader to be built - use glsl loop-unroll friendly comparison; skip vertex input compare if either key requests it - Minor tweaks to fp key generation
This commit is contained in:
parent
3c9bab8563
commit
c04aa05398
5 changed files with 20 additions and 9 deletions
|
@ -121,8 +121,10 @@ namespace glsl
|
|||
OS << " bool reverse_order = false;\n";
|
||||
OS << "\n";
|
||||
OS << " int first_byte = (vertex_id * desc.stride) + desc.starting_offset;\n";
|
||||
OS << " for (int n = 0; n < desc.attribute_size; n++)\n";
|
||||
OS << " for (int n = 0; n < 4; n++)\n";
|
||||
OS << " {\n";
|
||||
OS << " if (n == desc.attribute_size) break;\n";
|
||||
OS << "\n";
|
||||
OS << " switch (desc.type)\n";
|
||||
OS << " {\n";
|
||||
OS << " case 0:\n";
|
||||
|
|
|
@ -28,7 +28,7 @@ bool vertex_program_compare::operator()(const RSXVertexProgram &binary1, const R
|
|||
return false;
|
||||
if (binary1.data.size() != binary2.data.size())
|
||||
return false;
|
||||
if (!binary1.skip_vertex_input_check && binary1.rsx_vertex_inputs != binary2.rsx_vertex_inputs)
|
||||
if (!binary1.skip_vertex_input_check && !binary2.skip_vertex_input_check && binary1.rsx_vertex_inputs != binary2.rsx_vertex_inputs)
|
||||
return false;
|
||||
|
||||
const qword *instBuffer1 = (const qword*)binary1.data.data();
|
||||
|
|
|
@ -237,7 +237,7 @@ struct RSXFragmentProgram
|
|||
|
||||
float texture_pitch_scale[16];
|
||||
u8 textures_alpha_kill[16];
|
||||
u32 textures_zfunc[16];
|
||||
u8 textures_zfunc[16];
|
||||
|
||||
bool valid;
|
||||
|
||||
|
|
|
@ -1098,18 +1098,27 @@ namespace rsx
|
|||
{
|
||||
auto &tex = rsx::method_registers.fragment_textures[i];
|
||||
result.texture_pitch_scale[i] = 1.f;
|
||||
result.textures_alpha_kill[i] = 0;
|
||||
result.textures_zfunc[i] = 0;
|
||||
|
||||
if (!tex.enabled())
|
||||
{
|
||||
texture_dimensions[i] = texture_dimension_extended::texture_dimension_2d;
|
||||
result.textures_alpha_kill[i] = 0;
|
||||
result.textures_zfunc[i] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
texture_dimensions[i] = tex.get_extended_texture_dimension();
|
||||
result.textures_alpha_kill[i] = tex.alpha_kill_enabled() ? 1 : 0;
|
||||
result.textures_zfunc[i] = tex.zfunc();
|
||||
|
||||
if (tex.alpha_kill_enabled())
|
||||
{
|
||||
//alphakill can be ignored unless a valid comparison function is set
|
||||
const rsx::comparison_function func = (rsx::comparison_function)tex.zfunc();
|
||||
if (func < rsx::comparison_function::always && func > rsx::comparison_function::never)
|
||||
{
|
||||
result.textures_alpha_kill[i] = 1;
|
||||
result.textures_zfunc[i] = (u8)func;
|
||||
}
|
||||
}
|
||||
|
||||
const u32 texaddr = rsx::get_address(tex.offset(), tex.location());
|
||||
const u32 raw_format = tex.format();
|
||||
|
|
|
@ -453,8 +453,8 @@ namespace rsx
|
|||
|
||||
for (u8 index = 0; index < 16; ++index)
|
||||
{
|
||||
data_block.fp_alphakill_mask |= (fp.textures_alpha_kill[index] & 0x1) << index;
|
||||
data_block.fp_zfunc_mask |= (fp.textures_zfunc[index] & 0xF) << (index << 2);
|
||||
data_block.fp_alphakill_mask |= (u32)(fp.textures_alpha_kill[index] & 0x1) << index;
|
||||
data_block.fp_zfunc_mask |= (u32)(fp.textures_zfunc[index] & 0xF) << (index << 2);
|
||||
}
|
||||
|
||||
return data_block;
|
||||
|
|
Loading…
Add table
Reference in a new issue