st/mesa: handle SNORM formats in generic CopyPixels path
v2: check desc->is_mixed in util_format_is_snorm
This commit is contained in:
@@ -131,6 +131,26 @@ util_format_is_pure_uint(enum pipe_format format)
|
|||||||
return (desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED && desc->channel[i].pure_integer) ? TRUE : FALSE;
|
return (desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED && desc->channel[i].pure_integer) ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if all non-void channels are normalized signed.
|
||||||
|
*/
|
||||||
|
boolean
|
||||||
|
util_format_is_snorm(enum pipe_format format)
|
||||||
|
{
|
||||||
|
const struct util_format_description *desc = util_format_description(format);
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (desc->is_mixed)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
i = util_format_get_first_non_void_channel(format);
|
||||||
|
if (i == -1)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED &&
|
||||||
|
!desc->channel[i].pure_integer &&
|
||||||
|
desc->channel[i].normalized;
|
||||||
|
}
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
util_format_is_luminance_alpha(enum pipe_format format)
|
util_format_is_luminance_alpha(enum pipe_format format)
|
||||||
|
@@ -645,6 +645,9 @@ util_format_is_pure_sint(enum pipe_format format);
|
|||||||
boolean
|
boolean
|
||||||
util_format_is_pure_uint(enum pipe_format format);
|
util_format_is_pure_uint(enum pipe_format format);
|
||||||
|
|
||||||
|
boolean
|
||||||
|
util_format_is_snorm(enum pipe_format format);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the src format can be blitted to the destination format with
|
* Check if the src format can be blitted to the destination format with
|
||||||
* a simple memcpy. For example, blitting from RGBA to RGBx is OK, but not
|
* a simple memcpy. For example, blitting from RGBA to RGBx is OK, but not
|
||||||
|
@@ -1546,6 +1546,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
|
|||||||
|
|
||||||
if (!screen->is_format_supported(screen, srcFormat, st->internal_target, 0,
|
if (!screen->is_format_supported(screen, srcFormat, st->internal_target, 0,
|
||||||
srcBind)) {
|
srcBind)) {
|
||||||
|
/* srcFormat is non-renderable. Find a compatible renderable format. */
|
||||||
if (type == GL_DEPTH) {
|
if (type == GL_DEPTH) {
|
||||||
srcFormat = st_choose_format(st, GL_DEPTH_COMPONENT, GL_NONE,
|
srcFormat = st_choose_format(st, GL_DEPTH_COMPONENT, GL_NONE,
|
||||||
GL_NONE, st->internal_target, 0,
|
GL_NONE, st->internal_target, 0,
|
||||||
@@ -1569,6 +1570,11 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
|
|||||||
GL_NONE, st->internal_target, 0,
|
GL_NONE, st->internal_target, 0,
|
||||||
srcBind, FALSE);
|
srcBind, FALSE);
|
||||||
}
|
}
|
||||||
|
else if (util_format_is_snorm(srcFormat)) {
|
||||||
|
srcFormat = st_choose_format(st, GL_RGBA16_SNORM, GL_NONE,
|
||||||
|
GL_NONE, st->internal_target, 0,
|
||||||
|
srcBind, FALSE);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
srcFormat = st_choose_format(st, GL_RGBA, GL_NONE,
|
srcFormat = st_choose_format(st, GL_RGBA, GL_NONE,
|
||||||
GL_NONE, st->internal_target, 0,
|
GL_NONE, st->internal_target, 0,
|
||||||
|
Reference in New Issue
Block a user