rsx: Implement proper decoding for some obscure fragment instructions

PK4UBG and UP4UBG were dropped from the NV_fragment_program spec in 2002.
Not much information about them remains but seems pretty straightforward.
This commit is contained in:
kd-11 2021-06-05 02:40:39 +03:00 committed by kd-11
parent 11ab9b7fa9
commit 39815801aa
6 changed files with 47 additions and 8 deletions

View file

@ -673,7 +673,7 @@ namespace glsl
"}\n\n";
}
if (!props.fp32_outputs)
if (!props.fp32_outputs || props.require_linear_to_srgb)
{
OS <<
"vec4 linear_to_srgb(const in vec4 cl)\n"
@ -685,6 +685,17 @@ namespace glsl
"}\n\n";
}
if (props.require_texture_ops || props.require_srgb_to_linear)
{
OS <<
"vec4 srgb_to_linear(const in vec4 cs)\n"
"{\n"
" vec4 a = cs / 12.92;\n"
" vec4 b = pow((cs + 0.055) / 1.055, vec4(2.4));\n"
" return _select(a, b, greaterThan(cs, vec4(0.04045)));\n"
"}\n\n";
}
if (props.require_depth_conversion)
{
ensure(props.require_texture_ops);
@ -763,12 +774,6 @@ namespace glsl
" return mix(direct, indexed, choice);\n"
"}\n\n"
#endif
"vec4 srgb_to_linear(const in vec4 cs)\n"
"{\n"
" vec4 a = cs / 12.92;\n"
" vec4 b = pow((cs + 0.055) / 1.055, vec4(2.4));\n"
" return _select(a, b, greaterThan(cs, vec4(0.04045)));\n"
"}\n\n"
//TODO: Move all the texture read control operations here
"vec4 process_texel(in vec4 rgba, const in uint control_bits)\n"