From a024b394272c9210d3ff1915fbb54836a8e095fc Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 19 May 2020 11:10:56 -0400 Subject: [PATCH] gallium/draw: Use SATURATE Signed-off-by: Alyssa Rosenzweig Reviewed-by: Eric Engestrom Part-of: --- src/gallium/auxiliary/draw/draw_pipe_offset.c | 6 +++--- src/gallium/auxiliary/draw/draw_vs_exec.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_pipe_offset.c b/src/gallium/auxiliary/draw/draw_pipe_offset.c index 191bd43d117..08d47f005fd 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_offset.c +++ b/src/gallium/auxiliary/draw/draw_pipe_offset.c @@ -120,9 +120,9 @@ static void do_offset_tri( struct draw_stage *stage, * Note: we're applying the offset and clamping per-vertex. * Ideally, the offset is applied per-fragment prior to fragment shading. */ - v0[2] = CLAMP(v0[2] + zoffset, 0.0f, 1.0f); - v1[2] = CLAMP(v1[2] + zoffset, 0.0f, 1.0f); - v2[2] = CLAMP(v2[2] + zoffset, 0.0f, 1.0f); + v0[2] = SATURATE(v0[2] + zoffset); + v1[2] = SATURATE(v1[2] + zoffset); + v2[2] = SATURATE(v2[2] + zoffset); stage->next->tri( stage->next, header ); } diff --git a/src/gallium/auxiliary/draw/draw_vs_exec.c b/src/gallium/auxiliary/draw/draw_vs_exec.c index 29b18d671ff..4fba01b5596 100644 --- a/src/gallium/auxiliary/draw/draw_vs_exec.c +++ b/src/gallium/auxiliary/draw/draw_vs_exec.c @@ -174,10 +174,10 @@ vs_exec_run_linear(struct draw_vertex_shader *shader, enum tgsi_semantic name = shader->info.output_semantic_name[slot]; if (clamp_vertex_color && (name == TGSI_SEMANTIC_COLOR || name == TGSI_SEMANTIC_BCOLOR)) { - output[slot][0] = CLAMP(machine->Outputs[slot].xyzw[0].f[j], 0.0f, 1.0f); - output[slot][1] = CLAMP(machine->Outputs[slot].xyzw[1].f[j], 0.0f, 1.0f); - output[slot][2] = CLAMP(machine->Outputs[slot].xyzw[2].f[j], 0.0f, 1.0f); - output[slot][3] = CLAMP(machine->Outputs[slot].xyzw[3].f[j], 0.0f, 1.0f); + output[slot][0] = SATURATE(machine->Outputs[slot].xyzw[0].f[j]); + output[slot][1] = SATURATE(machine->Outputs[slot].xyzw[1].f[j]); + output[slot][2] = SATURATE(machine->Outputs[slot].xyzw[2].f[j]); + output[slot][3] = SATURATE(machine->Outputs[slot].xyzw[3].f[j]); } else { output[slot][0] = machine->Outputs[slot].xyzw[0].f[j]; output[slot][1] = machine->Outputs[slot].xyzw[1].f[j]; -- 2.30.2