gallium/draw: Use SATURATE
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 19 May 2020 15:10:56 +0000 (11:10 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 26 May 2020 22:31:31 +0000 (22:31 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5100>

src/gallium/auxiliary/draw/draw_pipe_offset.c
src/gallium/auxiliary/draw/draw_vs_exec.c

index 191bd43d11796122222f1e8da2daa8830580d3d6..08d47f005fd82d284189a98a83061245926fc655 100644 (file)
@@ -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 );
 }
index 29b18d671ff36f9cfbbd05af04324723ecdfb5de..4fba01b5596e70951215eb7094ca3f967e0971b3 100644 (file)
@@ -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];