From 4da5d369fb6a724a03a3c2e79ed6623980fc72ac Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Thu, 11 Mar 2010 17:27:12 +0100 Subject: [PATCH] nv50: fix damage from merging master into sampler-view Fixed the state array sizes at 3 (instead of PIPE_SHADER_TYPES) because we'll never have domain and hull shaders on nv50; also the numbering doesn't correspond to the hw numbering. --- src/gallium/drivers/nv50/nv50_context.h | 8 +++----- src/gallium/drivers/nv50/nv50_state_validate.c | 10 ++++------ src/gallium/drivers/nv50/nv50_tex.c | 18 ++++++++++-------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index 8a5f7cb2519..f35bc411feb 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -137,7 +137,7 @@ struct nv50_state { struct nouveau_stateobj *hw[64]; uint64_t hw_dirty; - unsigned miptree_nr[PIPE_SHADER_TYPES]; + unsigned sampler_view_nr[3]; struct nouveau_stateobj *vtxbuf; struct nouveau_stateobj *vtxattr; unsigned vtxelt_nr; @@ -169,12 +169,10 @@ struct nv50_context { struct pipe_vertex_buffer vtxbuf[PIPE_MAX_ATTRIBS]; unsigned vtxbuf_nr; struct nv50_vtxelt_stateobj *vtxelt; - struct nv50_sampler_stateobj *sampler[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS]; - unsigned sampler_nr[PIPE_SHADER_TYPES]; + struct nv50_sampler_stateobj *sampler[3][PIPE_MAX_SAMPLERS]; + unsigned sampler_nr[3]; struct pipe_sampler_view *sampler_views[3][PIPE_MAX_SAMPLERS]; unsigned sampler_view_nr[3]; - struct nv50_miptree *miptree[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS]; - unsigned miptree_nr[PIPE_SHADER_TYPES]; unsigned vbo_fifo; }; diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index 2c8e7ca7982..63d73b5ce83 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -310,15 +310,13 @@ validate_sampler(struct nv50_context *nv50) struct nouveau_stateobj *so; unsigned nr = 0, i; - for (i = 0; i < PIPE_SHADER_TYPES; ++i) + for (i = 0; i < 3; ++i) nr += nv50->sampler_nr[i]; - so = so_new(1 + 5 * PIPE_SHADER_TYPES, - 1 + 19 * PIPE_SHADER_TYPES + nr * 8, - PIPE_SHADER_TYPES * 2); + so = so_new(1 + 5 * 3, 1 + 19 * 3 + nr * 8, 3 * 2); - nv50_validate_samplers(nv50, so, PIPE_SHADER_VERTEX); - nv50_validate_samplers(nv50, so, PIPE_SHADER_FRAGMENT); + nv50_validate_samplers(nv50, so, 0); /* VP */ + nv50_validate_samplers(nv50, so, 2); /* FP */ so_method(so, tesla, 0x1334, 1); /* flush TSC */ so_data (so, 0); diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index 7ed73eac50f..aa885e71688 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -54,8 +54,8 @@ static const uint32_t nv50_texture_formats[PIPE_FORMAT_COUNT] = _(A8_UNORM, UNORM, ZERO, ZERO, ZERO, C0, 8), _(I8_UNORM, UNORM, C0, C0, C0, C0, 8), - _(A8L8_UNORM, UNORM, C0, C0, C0, C1, 8_8), - _(A8L8_SRGB, UNORM, C0, C0, C0, C1, 8_8), + _(L8A8_UNORM, UNORM, C0, C0, C0, C1, 8_8), + _(L8A8_SRGB, UNORM, C0, C0, C0, C1, 8_8), _(DXT1_RGB, UNORM, C0, C1, C2, ONE, DXT1), _(DXT1_RGBA, UNORM, C0, C1, C2, C3, DXT1), @@ -221,23 +221,25 @@ nv50_tex_relocs(struct nv50_context *nv50) int p, unit; p = PIPE_SHADER_FRAGMENT; - for (unit = 0; unit < nv50->miptree_nr[p]; unit++) { - if (!nv50->miptree[p][unit]) + for (unit = 0; unit < nv50->sampler_view_nr[p]; unit++) { + struct pipe_sampler_view *view = nv50->sampler_views[p][unit]; + if (!view) continue; nouveau_reloc_emit(chan, nv50->screen->tic, ((p * 32) + unit) * 32, NULL, - nv50->miptree[p][unit]->base.bo, 0, 0, + nv50_miptree(view->texture)->base.bo, 0, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW | NOUVEAU_BO_RD, 0, 0); } p = PIPE_SHADER_VERTEX; - for (unit = 0; unit < nv50->miptree_nr[p]; unit++) { - if (!nv50->miptree[p][unit]) + for (unit = 0; unit < nv50->sampler_view_nr[p]; unit++) { + struct pipe_sampler_view *view = nv50->sampler_views[p][unit]; + if (!view) continue; nouveau_reloc_emit(chan, nv50->screen->tic, ((p * 32) + unit) * 32, NULL, - nv50->miptree[p][unit]->base.bo, 0, 0, + nv50_miptree(view->texture)->base.bo, 0, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW | NOUVEAU_BO_RD, 0, 0); } -- 2.30.2