diff options
author | Christoph Bumiller <[email protected]> | 2012-04-29 15:38:20 +0200 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2012-04-29 18:03:18 +0200 |
commit | b328949a37fee7b0f68ed3e068ffc4426c083042 (patch) | |
tree | 14bbe5c9615d06267671b272f79ee10275d1cd28 /src/gallium/drivers/nv50 | |
parent | d46f969b84a405dff6bbc647a7addd0902adc1e4 (diff) |
nv50,nvc0: fix depth/stencil resolve
Cannot sample depth/stencil with a single view, and needed to use
different shader code for nve4.
Diffstat (limited to 'src/gallium/drivers/nv50')
-rw-r--r-- | src/gallium/drivers/nv50/nv50_formats.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/nv50/nv50_resource.h | 12 | ||||
-rw-r--r-- | src/gallium/drivers/nv50/nv50_surface.c | 63 | ||||
-rw-r--r-- | src/gallium/drivers/nv50/nv50_texture.xml.h | 6 |
4 files changed, 65 insertions, 26 deletions
diff --git a/src/gallium/drivers/nv50/nv50_formats.c b/src/gallium/drivers/nv50/nv50_formats.c index a009b27c861..41757d2a00d 100644 --- a/src/gallium/drivers/nv50/nv50_formats.c +++ b/src/gallium/drivers/nv50/nv50_formats.c @@ -60,6 +60,7 @@ #endif #define NV50_SURFACE_FORMAT_NONE 0 +#define NV50_ZETA_FORMAT_NONE 0 /* for vertex buffers: */ #define NV50_TIC_0_FMT_8_8_8 NV50_TIC_0_FMT_8_8_8_8 @@ -167,10 +168,13 @@ const struct nv50_format nv50_format_table[PIPE_FORMAT_COUNT] = ZXB(Z16_UNORM, Z16_UNORM, C0, C0, C0, xx, UNORM, Z16, TZ), ZXB(Z32_FLOAT, Z32_FLOAT, C0, C0, C0, xx, FLOAT, Z32, TZ), ZXB(Z24X8_UNORM, Z24_X8_UNORM, C0, C0, C0, xx, UNORM, Z24_X8, TZ), - ZSB(Z24_UNORM_S8_UINT, Z24_S8_UNORM, C0, C1, C0, xx, UNORM, Z24_S8, TZ), - SZB(S8_UINT_Z24_UNORM, S8_Z24_UNORM, C1, C0, C1, xx, UNORM, S8_Z24, TZ), - ZSB(Z32_FLOAT_S8X24_UINT, Z32_S8_X24_FLOAT, C0, C1, C0, xx, FLOAT, + ZSB(Z24_UNORM_S8_UINT, Z24_S8_UNORM, C0, C0, C0, xx, UNORM, Z24_S8, TZ), + ZSB(X24S8_UINT, NONE, C1, C1, C1, xx, UNORM, Z24_S8, T), + SZB(S8_UINT_Z24_UNORM, S8_Z24_UNORM, C1, C1, C1, xx, UNORM, S8_Z24, TZ), + SZB(S8X24_UINT, NONE, C0, C0, C0, xx, UNORM, S8_Z24, T), + ZSB(Z32_FLOAT_S8X24_UINT, Z32_S8_X24_FLOAT, C0, C0, C0, xx, FLOAT, Z32_S8_X24, TZ), + ZSB(X32_S8X24_UINT, NONE, C1, C1, C1, xx, FLOAT, Z32_S8_X24, T), F3B(B5G6R5_UNORM, B5G6R5_UNORM, C2, C1, C0, xx, UNORM, 5_6_5, T), C4B(B5G5R5A1_UNORM, BGR5_A1_UNORM, C2, C1, C0, C3, UNORM, 5_5_5_1, TB), diff --git a/src/gallium/drivers/nv50/nv50_resource.h b/src/gallium/drivers/nv50/nv50_resource.h index 5d5596ea6e3..920fa0a4a2b 100644 --- a/src/gallium/drivers/nv50/nv50_resource.h +++ b/src/gallium/drivers/nv50/nv50_resource.h @@ -96,6 +96,18 @@ nv50_surface(struct pipe_surface *ps) return (struct nv50_surface *)ps; } +static INLINE enum pipe_format +nv50_zs_to_s_format(enum pipe_format format) +{ + switch (format) { + case PIPE_FORMAT_Z24_UNORM_S8_UINT: return PIPE_FORMAT_X24S8_UINT; + case PIPE_FORMAT_S8_UINT_Z24_UNORM: return PIPE_FORMAT_S8X24_UINT; + case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: return PIPE_FORMAT_X32_S8X24_UINT; + default: + return format; + } +} + #ifndef __NVC0_RESOURCE_H__ unsigned diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index 0d29dcc8a2a..b38e49ffcc1 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -207,7 +207,8 @@ nv50_resource_copy_region(struct pipe_context *pipe, return; } - assert(src->nr_samples == dst->nr_samples); + /* 0 and 1 are equal, only supporting 0/1, 2, 4 and 8 */ + assert((src->nr_samples | 1) == (dst->nr_samples | 1)); m2mf = (src->format == dst->format) || (util_format_get_blocksizebits(src->format) == @@ -433,8 +434,8 @@ struct nv50_blitctx struct nv50_program *fp; unsigned num_textures[3]; unsigned num_samplers[3]; - struct pipe_sampler_view *texture; - struct nv50_tsc_entry *sampler; + struct pipe_sampler_view *texture[2]; + struct nv50_tsc_entry *sampler[2]; unsigned dirty; } saved; struct nv50_program vp; @@ -495,17 +496,21 @@ nv50_blitctx_make_fp(struct nv50_blitctx *blit) /* 3 coords ZS in, S encoded in R, Z encoded in GBA (8_UNORM) */ 0x80000000, /* interp $r0 v[0x00] */ 0x80010004, /* interp $r1 v[0x04] */ - 0x80020009, /* interp $r2 flat v[0x8] */ - 0x00040780, - 0xf6800001, /* texauto live { $r0,1,#,# } $t0 $s0 { $r0,1,2 } */ + 0x80020108, /* interp $r2 flat v[0x8] */ + 0x10008010, /* mov b32 $r4 $r0 */ + 0xf2820201, /* texauto live { $r0,#,#,# } $t1 $s1 { $r0,1,2 } */ + 0x00000784, + 0xa000000d, /* cvt f32 $r3 s32 $r0 */ + 0x44014780, + 0x10000801, /* mov b32 $r0 $r4 */ + 0x0403c780, + 0xf2800001, /* texauto live { $r0,#,#,# } $t0 $s0 { $r0,1,2 } */ 0x00000784, 0xc03f0009, /* mul f32 $r2 $r0 (2^24 - 1) */ 0x04b7ffff, - 0xa0000201, /* cvt f32 $r0 s32 $r1 */ - 0x44014780, 0xa0000409, /* cvt rni s32 $r2 f32 $r2 */ 0x8c004780, - 0xc0010001, /* mul f32 $r0 $r0 1/0xff */ + 0xc0010601, /* mul f32 $r0 $r3 1/0xff */ 0x03b8080b, 0xd03f0405, /* and b32 $r1 $r2 0x0000ff */ 0x0000000f, @@ -531,14 +536,18 @@ nv50_blitctx_make_fp(struct nv50_blitctx *blit) /* 3 coords ZS in, Z encoded in RGB, S encoded in A (U8_UNORM) */ 0x80000000, /* interp $r0 v[0x00] */ 0x80010004, /* interp $r1 v[0x04] */ - 0x80020009, /* interp $r2 flat v[0x8] */ - 0x00040780, - 0xf6800001, /* texauto live { $r0,1,#,# } $t0 $s0 { $r0,1,2 } */ + 0x80020108, /* interp $r2 flat v[0x8] */ + 0x10008010, /* mov b32 $r4 $r0 */ + 0xf2820201, /* texauto live { $r0,#,#,# } $t1 $s1 { $r0,1,2 } */ + 0x00000784, + 0xa000000d, /* cvt f32 $r3 s32 $r0 */ + 0x44014780, + 0x10000801, /* mov b32 $r0 $r4 */ + 0x0403c780, + 0xf2800001, /* texauto live { $r0,#,#,# } $t0 $s0 { $r0,1,2 } */ 0x00000784, 0xc03f0009, /* mul f32 $r2 $r0 (2^24 - 1) */ 0x04b7ffff, - 0xa0000281, /* cvt f32 $r3 s32 $r1 */ - 0x44014780, 0xa0000409, /* cvt rni s32 $r2 f32 $r2 */ 0x8c004780, 0xc001060d, /* mul f32 $r3 $r3 1/0xff */ @@ -569,7 +578,7 @@ nv50_blitctx_make_fp(struct nv50_blitctx *blit) blit->fp.translated = TRUE; blit->fp.code = (uint32_t *)code; /* const_cast */ blit->fp.code_size = sizeof(code); - blit->fp.max_gpr = 4; + blit->fp.max_gpr = 5; blit->fp.max_out = 4; blit->fp.in_nr = 1; blit->fp.in[0].mask = 0x7; /* last component flat */ @@ -702,11 +711,19 @@ nv50_blit_set_src(struct nv50_context *nv50, templ.swizzle_a = PIPE_SWIZZLE_ALPHA; nv50->textures[2][0] = nv50_create_sampler_view(pipe, res, &templ); + nv50->textures[2][0] = NULL; nv50_blit_fixup_tic_entry(nv50->textures[2][0]); nv50->num_textures[0] = nv50->num_textures[1] = 0; nv50->num_textures[2] = 1; + + templ.format = nv50_zs_to_s_format(res->format); + if (templ.format != res->format) { + nv50->textures[2][1] = nv50_create_sampler_view(pipe, res, &templ); + nv50_blit_fixup_tic_entry(nv50->textures[2][1]); + nv50->num_textures[2] = 2; + } } static void @@ -781,13 +798,16 @@ nv50_blitctx_pre_blit(struct nv50_blitctx *blit, struct nv50_context *nv50) blit->saved.num_textures[s] = nv50->num_textures[s]; blit->saved.num_samplers[s] = nv50->num_samplers[s]; } - blit->saved.texture = nv50->textures[2][0]; - blit->saved.sampler = nv50->samplers[2][0]; + blit->saved.texture[0] = nv50->textures[2][0]; + blit->saved.texture[1] = nv50->textures[2][1]; + blit->saved.sampler[0] = nv50->samplers[2][0]; + blit->saved.sampler[1] = nv50->samplers[2][1]; nv50->samplers[2][0] = &blit->sampler[blit->filter]; + nv50->samplers[2][1] = &blit->sampler[blit->filter]; nv50->num_samplers[0] = nv50->num_samplers[1] = 0; - nv50->num_samplers[2] = 1; + nv50->num_samplers[2] = 2; blit->saved.dirty = nv50->dirty; @@ -815,13 +835,16 @@ nv50_blitctx_post_blit(struct nv50_context *nv50, struct nv50_blitctx *blit) nv50->fragprog = blit->saved.fp; pipe_sampler_view_reference(&nv50->textures[2][0], NULL); + pipe_sampler_view_reference(&nv50->textures[2][1], NULL); for (s = 0; s < 3; ++s) { nv50->num_textures[s] = blit->saved.num_textures[s]; nv50->num_samplers[s] = blit->saved.num_samplers[s]; } - nv50->textures[2][0] = blit->saved.texture; - nv50->samplers[2][0] = blit->saved.sampler; + nv50->textures[2][0] = blit->saved.texture[0]; + nv50->textures[2][1] = blit->saved.texture[1]; + nv50->samplers[2][0] = blit->saved.sampler[0]; + nv50->samplers[2][1] = blit->saved.sampler[1]; nv50->dirty = blit->saved.dirty | (NV50_NEW_FRAMEBUFFER | NV50_NEW_SCISSOR | NV50_NEW_SAMPLE_MASK | diff --git a/src/gallium/drivers/nv50/nv50_texture.xml.h b/src/gallium/drivers/nv50/nv50_texture.xml.h index 2b140be8d80..34accd81741 100644 --- a/src/gallium/drivers/nv50/nv50_texture.xml.h +++ b/src/gallium/drivers/nv50/nv50_texture.xml.h @@ -8,7 +8,7 @@ http://0x04.net/cgit/index.cgi/rules-ng-ng git clone git://0x04.net/rules-ng-ng The rules-ng-ng source files this header was generated from are: -- rnndb/nv50_texture.xml ( 8111 bytes, from 2012-03-31 16:47:45) +- rnndb/nv50_texture.xml ( 8111 bytes, from 2012-04-29 11:17:45) - ./rnndb/copyright.xml ( 6452 bytes, from 2011-08-11 18:25:12) - ./rnndb/nvchipsets.xml ( 3701 bytes, from 2012-03-22 20:40:59) - ./rnndb/nv50_defs.xml ( 5468 bytes, from 2011-08-11 18:25:12) @@ -147,8 +147,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define NV50_TIC_0_FMT_RGTC1 0x00000027 #define NV50_TIC_0_FMT_RGTC2 0x00000028 #define NV50_TIC_0_FMT_S8_Z24 0x00000029 -#define NV50_TIC_0_FMT_Z24_S8 0x0000002a -#define NV50_TIC_0_FMT_Z24_X8 0x0000002b +#define NV50_TIC_0_FMT_Z24_X8 0x0000002a +#define NV50_TIC_0_FMT_Z24_S8 0x0000002b #define NV50_TIC_0_FMT_Z24_C8_MS4_CS4 0x0000002c #define NV50_TIC_0_FMT_Z24_C8_MS8_CS8 0x0000002d #define NV50_TIC_0_FMT_Z24_C8_MS4_CS12 0x0000002e |