Mesa (master): gallium/draw: Use SATURATE

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 26 22:57:28 UTC 2020


Module: Mesa
Branch: master
Commit: a024b394272c9210d3ff1915fbb54836a8e095fc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a024b394272c9210d3ff1915fbb54836a8e095fc

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Tue May 19 11:10:56 2020 -0400

gallium/draw: Use SATURATE

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Reviewed-by: Eric Engestrom <eric at engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5100>

---

 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];



More information about the mesa-commit mailing list