summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nv50/nv50_state_validate.c
diff options
context:
space:
mode:
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>2009-12-10 20:50:02 +0100
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>2009-12-12 16:38:59 +0100
commit6a15ec9141b070b088d03d87673d0d2741b7db6b (patch)
tree7a9357fad81a223d397f9905d376c7e8898a8232 /src/gallium/drivers/nv50/nv50_state_validate.c
parent784cca9fa527de771754d76545970f78094b9adf (diff)
nv50: support vertex program textures
Diffstat (limited to 'src/gallium/drivers/nv50/nv50_state_validate.c')
-rw-r--r--src/gallium/drivers/nv50/nv50_state_validate.c52
1 files changed, 36 insertions, 16 deletions
diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c
index c871acaab8..871e8097b6 100644
--- a/src/gallium/drivers/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nv50/nv50_state_validate.c
@@ -156,6 +156,30 @@ nv50_state_validate_fb(struct nv50_context *nv50)
}
static void
+nv50_validate_samplers(struct nv50_context *nv50, struct nouveau_stateobj *so,
+ unsigned p)
+{
+ struct nouveau_grobj *eng2d = nv50->screen->eng2d;
+ unsigned i, j, dw = nv50->sampler_nr[p] * 8;
+
+ if (!dw)
+ return;
+ nv50_so_init_sifc(nv50, so, nv50->screen->tsc, NOUVEAU_BO_VRAM,
+ p * (32 * 8 * 4), dw * 4);
+
+ so_method(so, eng2d, NV50_2D_SIFC_DATA | (2 << 29), dw);
+
+ for (i = 0; i < nv50->sampler_nr[p]; ++i) {
+ if (nv50->sampler[p][i])
+ so_datap(so, nv50->sampler[p][i]->tsc, 8);
+ else {
+ for (j = 0; j < 8; ++j) /* you get punished */
+ so_data(so, 0); /* ... for leaving holes */
+ }
+ }
+}
+
+static void
nv50_state_emit(struct nv50_context *nv50)
{
struct nv50_screen *screen = nv50->screen;
@@ -246,7 +270,6 @@ boolean
nv50_state_validate(struct nv50_context *nv50)
{
struct nouveau_grobj *tesla = nv50->screen->tesla;
- struct nouveau_grobj *eng2d = nv50->screen->eng2d;
struct nouveau_stateobj *so;
unsigned i;
@@ -369,22 +392,16 @@ scissor_uptodate:
viewport_uptodate:
if (nv50->dirty & NV50_NEW_SAMPLER) {
- unsigned i;
+ unsigned nr = 0;
- so = so_new(nv50->sampler_nr * 9 + 23 + 4, 2);
+ for (i = 0; i < PIPE_SHADER_TYPES; ++i)
+ nr += nv50->sampler_nr[i];
- nv50_so_init_sifc(nv50, so, nv50->screen->tsc, NOUVEAU_BO_VRAM,
- nv50->sampler_nr * 8 * 4);
+ so = so_new(nr * 8 + 24 * PIPE_SHADER_TYPES + 2, 4);
- for (i = 0; i < nv50->sampler_nr; i++) {
- if (!nv50->sampler[i])
- continue;
- so_method(so, eng2d, NV50_2D_SIFC_DATA | (2 << 29), 8);
- so_datap (so, nv50->sampler[i]->tsc, 8);
- }
+ nv50_validate_samplers(nv50, so, PIPE_SHADER_VERTEX);
+ nv50_validate_samplers(nv50, so, PIPE_SHADER_FRAGMENT);
- so_method(so, tesla, 0x1440, 1); /* sync SIFC */
- so_data (so, 0);
so_method(so, tesla, 0x1334, 1); /* flush TSC */
so_data (so, 0);
@@ -407,10 +424,13 @@ viewport_uptodate:
void nv50_so_init_sifc(struct nv50_context *nv50,
struct nouveau_stateobj *so,
- struct nouveau_bo *bo, unsigned reloc, unsigned size)
+ struct nouveau_bo *bo, unsigned reloc,
+ unsigned offset, unsigned size)
{
struct nouveau_grobj *eng2d = nv50->screen->eng2d;
+ reloc |= NOUVEAU_BO_WR;
+
so_method(so, eng2d, NV50_2D_DST_FORMAT, 2);
so_data (so, NV50_2D_DST_FORMAT_R8_UNORM);
so_data (so, 1);
@@ -418,8 +438,8 @@ void nv50_so_init_sifc(struct nv50_context *nv50,
so_data (so, 262144);
so_data (so, 65536);
so_data (so, 1);
- so_reloc (so, bo, 0, reloc | NOUVEAU_BO_WR | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, bo, 0, reloc | NOUVEAU_BO_WR | NOUVEAU_BO_LOW, 0, 0);
+ so_reloc (so, bo, offset, reloc | NOUVEAU_BO_HIGH, 0, 0);
+ so_reloc (so, bo, offset, reloc | NOUVEAU_BO_LOW, 0, 0);
so_method(so, eng2d, NV50_2D_SIFC_UNK0800, 2);
so_data (so, 0);
so_data (so, NV50_2D_SIFC_FORMAT_R8_UNORM);