zink: add srgb border color clamping

fixes (tu):
dEQP-GLES31.functional.texture.border_clamp.range_clamp.linear_srgb_color
dEQP-GLES31.functional.texture.border_clamp.range_clamp.nearest_srgb_color

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18598>
This commit is contained in:
Mike Blumenkrantz
2022-09-14 09:05:08 -04:00
committed by Marge Bot
parent 61d60bb746
commit 95d4faea49
4 changed files with 20 additions and 3 deletions
@@ -4,8 +4,6 @@ GTF-GL46.gtf32.GL3Tests.draw_elements_base_vertex.draw_elements_base_vertex_inva
KHR-Single-GL46.arrays_of_arrays_gl.AtomicUsage,Fail
KHR-Single-GL46.arrays_of_arrays_gl.SubroutineFunctionCalls2,Crash
dEQP-GLES31.functional.texture.border_clamp.range_clamp.linear_srgb_color,Fail
dEQP-GLES31.functional.texture.border_clamp.range_clamp.nearest_srgb_color,Fail
# Turnip has maxFragmentInputComponents = 124, while GL requires
# gl_MaxFragmentInputComponents >= 128
+3 -1
View File
@@ -431,8 +431,10 @@ zink_create_sampler_state(struct pipe_context *pctx,
memcpy(&cbci.customBorderColor, &state->border_color, sizeof(union pipe_color_union));
} else {
cbci.format = zink_get_format(screen, state->border_color_format);
for (unsigned i = 0; i < 4; i++)
for (unsigned i = 0; i < 4; i++) {
zink_format_clamp_channel_color(util_format_description(state->border_color_format), (void*)&cbci.customBorderColor, &state->border_color, i);
zink_format_clamp_channel_srgb(util_format_description(state->border_color_format), (void*)&cbci.customBorderColor, (void*)&cbci.customBorderColor, i);
}
}
}
cbci.pNext = sci.pNext;
+15
View File
@@ -370,3 +370,18 @@ zink_format_clamp_channel_color(const struct util_format_description *desc, unio
break;
}
}
void
zink_format_clamp_channel_srgb(const struct util_format_description *desc, union pipe_color_union *dst, const union pipe_color_union *src, unsigned i)
{
if (desc->colorspace != UTIL_FORMAT_COLORSPACE_SRGB)
return;
switch (desc->channel[i].type) {
case UTIL_FORMAT_TYPE_SIGNED:
case UTIL_FORMAT_TYPE_UNSIGNED:
dst->f[i] = CLAMP(src->f[i], 0.0, 1.0);
break;
default:
break;
}
}
+2
View File
@@ -48,4 +48,6 @@ enum pipe_format
zink_format_get_emulated_alpha(enum pipe_format format);
void
zink_format_clamp_channel_color(const struct util_format_description *desc, union pipe_color_union *dst, const union pipe_color_union *src, unsigned i);
void
zink_format_clamp_channel_srgb(const struct util_format_description *desc, union pipe_color_union *dst, const union pipe_color_union *src, unsigned i);
#endif