gallium/draw: Use SATURATE

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>
This commit is contained in:
Alyssa Rosenzweig 2020-05-19 11:10:56 -04:00 committed by Marge Bot
parent 747cb95e3c
commit a024b39427
2 changed files with 7 additions and 7 deletions

View 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 );
}

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