nouveau: fix 3D blitter for unsigned to signed integer conversions

fixes a couple of packed_pixel CTS tests. No regressions inside a CTS run.

v2: simplify the changes a bit

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
This commit is contained in:
Karol Herbst 2018-06-24 22:10:28 +02:00
parent 87c8af2836
commit 4d0d911875
2 changed files with 22 additions and 10 deletions

View File

@ -17,16 +17,17 @@ nv50_blit_select_mode(const struct pipe_blit_info *);
void
nv50_resource_resolve(struct pipe_context *, const struct pipe_resolve_info *);
#define NV50_BLIT_MODE_PASS 0 /* pass through TEX $t0/$s0 output */
#define NV50_BLIT_MODE_Z24S8 1 /* encode ZS values for RGBA unorm8 */
#define NV50_BLIT_MODE_S8Z24 2
#define NV50_BLIT_MODE_X24S8 3
#define NV50_BLIT_MODE_S8X24 4
#define NV50_BLIT_MODE_Z24X8 5
#define NV50_BLIT_MODE_X8Z24 6
#define NV50_BLIT_MODE_ZS 7 /* put $t0/$s0 into R, $t1/$s1 into G */
#define NV50_BLIT_MODE_XS 8 /* put $t1/$s1 into G */
#define NV50_BLIT_MODES 9
#define NV50_BLIT_MODE_PASS 0 /* pass through TEX $t0/$s0 output */
#define NV50_BLIT_MODE_Z24S8 1 /* encode ZS values for RGBA unorm8 */
#define NV50_BLIT_MODE_S8Z24 2
#define NV50_BLIT_MODE_X24S8 3
#define NV50_BLIT_MODE_S8X24 4
#define NV50_BLIT_MODE_Z24X8 5
#define NV50_BLIT_MODE_X8Z24 6
#define NV50_BLIT_MODE_ZS 7 /* put $t0/$s0 into R, $t1/$s1 into G */
#define NV50_BLIT_MODE_XS 8 /* put $t1/$s1 into G */
#define NV50_BLIT_MODE_INT_CLAMP 9 /* unsigned to signed integer conversion */
#define NV50_BLIT_MODES 10
/* CUBE and RECT textures are reinterpreted as 2D(_ARRAY) */
#define NV50_BLIT_TEXTURE_BUFFER 0

View File

@ -892,6 +892,10 @@ nv50_blitter_make_fp(struct pipe_context *pipe,
bool tex_s = false;
bool cvt_un8 = false;
bool int_clamp = mode == NV50_BLIT_MODE_INT_CLAMP;
if (int_clamp)
mode = NV50_BLIT_MODE_PASS;
if (mode != NV50_BLIT_MODE_PASS &&
mode != NV50_BLIT_MODE_Z24X8 &&
mode != NV50_BLIT_MODE_X8Z24)
@ -936,6 +940,10 @@ nv50_blitter_make_fp(struct pipe_context *pipe,
target, tc, ureg_DECL_sampler(ureg, 0));
}
/* handle signed to unsigned integer conversions */
if (int_clamp)
ureg_UMIN(ureg, data, ureg_src(data), ureg_imm1u(ureg, 0x7fffffff));
if (cvt_un8) {
struct ureg_src mask;
struct ureg_src scale;
@ -1058,6 +1066,9 @@ nv50_blit_select_mode(const struct pipe_blit_info *info)
return NV50_BLIT_MODE_XS;
}
default:
if (util_format_is_pure_uint(info->src.format) &&
util_format_is_pure_sint(info->dst.format))
return NV50_BLIT_MODE_INT_CLAMP;
return NV50_BLIT_MODE_PASS;
}
}