Skip to content

Commit

Permalink
rsx: Formatting and tidying changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kd-11 committed Jun 30, 2023
1 parent 6f09329 commit db507f0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ vec4 fetch_fog_value(const in uint mode)
// exponential2_abs
result.y = exp(-pow(4.709 * (fog_param1 * abs(fog_c.x) + fog_param0 - 1.5), 2.));
break;
case FOG_LINEAR_ABS:
case FOG_LINEAR_ABS:
// linear_abs
result.y = fog_param1 * abs(fog_c.x) + (fog_param0 - 1.);
break;
Expand All @@ -65,8 +65,8 @@ vec4 fetch_fog_value(const in uint mode)
// Purely stochastic
bool coverage_test_passes(const in vec4 _sample)
{
float random = _rand(gl_FragCoord);
return (_sample.a > random);
float random_val = _rand(gl_FragCoord);
return (_sample.a > random_val);
}
#endif

Expand Down
11 changes: 6 additions & 5 deletions rpcs3/Emu/RSX/Program/GLSLSnippets/RSXProg/RSXVertexFetch.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ uint gen_bits(const in uint x, const in uint y, const in uint z, const in uint w

uint gen_bits(const in uint x, const in uint y, const in bool swap)
{
return (swap)? _set_bits(y, x, 8, 8) : _set_bits(x, y, 8, 8);
return (swap) ? _set_bits(y, x, 8, 8) : _set_bits(x, y, 8, 8);
}

// NOTE: (int(n) or int(n)) is broken on some NVIDIA and INTEL hardware when the sign bit is involved.
Expand Down Expand Up @@ -159,8 +159,8 @@ attribute_desc fetch_desc(const in int location)
uvec2 attrib = texelFetch(vertex_layout_stream, location + int(layout_ptr_offset)).xy;
#else
// Data is packed into a ubo
int block = (location >> 1);
int sub_block = (location & 1) << 1;
const int block = (location >> 1);
const int sub_block = (location & 1) << 1;
uvec2 attrib = uvec2(
ref(input_attributes_blob[block], sub_block + 0),
ref(input_attributes_blob[block], sub_block + 1));
Expand All @@ -180,8 +180,9 @@ attribute_desc fetch_desc(const in int location)

vec4 read_location(const in int location)
{
int vertex_id;
attribute_desc desc = fetch_desc(location);
int vertex_id = _gl_VertexID - int(vertex_base_index);

if (desc.frequency == 0)
{
vertex_id = 0;
Expand All @@ -193,7 +194,7 @@ vec4 read_location(const in int location)
}
else
{
vertex_id /= int(desc.frequency);
vertex_id = (_gl_VertexID - int(vertex_base_index)) / int(desc.frequency);
}

if (desc.is_volatile)
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/RSX/RSXThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2328,7 +2328,7 @@ namespace rsx
// Subpixel offset so that (X + bias) * scale will round correctly.
// This is done to work around fdiv precision issues in some GPUs (NVIDIA)
// We apply the simplification where (x + bias) * z = xz + zbias here.
const auto subpixel_bias = 0.01f;
constexpr auto subpixel_bias = 0.01f;
current_fragment_program.texture_params[i].bias[0] += (subpixel_bias * current_fragment_program.texture_params[i].scale[0]);
current_fragment_program.texture_params[i].bias[1] += (subpixel_bias * current_fragment_program.texture_params[i].scale[1]);
current_fragment_program.texture_params[i].bias[2] += (subpixel_bias * current_fragment_program.texture_params[i].scale[2]);
Expand Down

0 comments on commit db507f0

Please sign in to comment.