summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/nv30/nv30_fragprog.c11
-rw-r--r--src/gallium/drivers/nv30/nv30_state.c30
-rw-r--r--src/gallium/drivers/nv30/nv30_state.h4
-rw-r--r--src/gallium/drivers/nv30/nv30_vertprog.c4
-rw-r--r--src/gallium/drivers/nv40/nv40_context.h2
-rw-r--r--src/gallium/drivers/nv40/nv40_fragprog.c11
-rw-r--r--src/gallium/drivers/nv40/nv40_state.c47
-rw-r--r--src/gallium/drivers/nv40/nv40_state.h4
-rw-r--r--src/gallium/drivers/nv40/nv40_vertprog.c4
-rw-r--r--src/gallium/drivers/nv50/nv50_state.c11
10 files changed, 76 insertions, 52 deletions
diff --git a/src/gallium/drivers/nv30/nv30_fragprog.c b/src/gallium/drivers/nv30/nv30_fragprog.c
index 0a2ba04f95..6f61d36f4e 100644
--- a/src/gallium/drivers/nv30/nv30_fragprog.c
+++ b/src/gallium/drivers/nv30/nv30_fragprog.c
@@ -583,15 +583,14 @@ nv30_fragprog_parse_instruction(struct nv30_fpc *fpc,
arith(fpc, sat, ADD, dst, mask, src[0], neg(src[1]), none);
break;
case TGSI_OPCODE_TEX:
- if (finst->FullSrcRegisters[0].SrcRegisterExtSwz.ExtDivide ==
- TGSI_EXTSWIZZLE_W) {
- tex(fpc, sat, TXP, unit, dst, mask, src[0], none, none);
- } else
- tex(fpc, sat, TEX, unit, dst, mask, src[0], none, none);
+ tex(fpc, sat, TEX, unit, dst, mask, src[0], none, none);
break;
case TGSI_OPCODE_TXB:
tex(fpc, sat, TXB, unit, dst, mask, src[0], none, none);
break;
+ case TGSI_OPCODE_TXP:
+ tex(fpc, sat, TXP, unit, dst, mask, src[0], none, none);
+ break;
case TGSI_OPCODE_XPD:
tmp = temp(fpc);
arith(fpc, 0, MUL, tmp, mask,
@@ -683,7 +682,7 @@ nv30_fragprog_translate(struct nv30_context *nv30,
fpc->high_temp = -1;
fpc->num_regs = 2;
- tgsi_parse_init(&parse, fp->pipe->tokens);
+ tgsi_parse_init(&parse, fp->pipe.tokens);
while (!tgsi_parse_end_of_tokens(&parse)) {
tgsi_parse_token(&parse);
diff --git a/src/gallium/drivers/nv30/nv30_state.c b/src/gallium/drivers/nv30/nv30_state.c
index 319d53fcca..951a32bc81 100644
--- a/src/gallium/drivers/nv30/nv30_state.c
+++ b/src/gallium/drivers/nv30/nv30_state.c
@@ -231,14 +231,15 @@ nv30_sampler_state_create(struct pipe_context *pipe,
}
static void
-nv30_sampler_state_bind(struct pipe_context *pipe, unsigned unit,
- void *hwcso)
+nv30_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler)
{
struct nv30_context *nv30 = nv30_context(pipe);
- struct nv30_sampler_state *ps = hwcso;
+ unsigned unit;
- nv30->tex_sampler[unit] = ps;
- nv30->dirty_samplers |= (1 << unit);
+ for (unit = 0; unit < nr; unit++) {
+ nv30->tex_sampler[unit] = sampler[unit];
+ nv30->dirty_samplers |= (1 << unit);
+ }
}
static void
@@ -248,13 +249,16 @@ nv30_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
}
static void
-nv30_set_sampler_texture(struct pipe_context *pipe, unsigned unit,
- struct pipe_texture *miptree)
+nv30_set_sampler_texture(struct pipe_context *pipe, unsigned nr,
+ struct pipe_texture **miptree)
{
struct nv30_context *nv30 = nv30_context(pipe);
+ unsigned unit;
- nv30->tex_miptree[unit] = (struct nv30_miptree *)miptree;
- nv30->dirty_samplers |= (1 << unit);
+ for (unit = 0; unit < nr; unit++) {
+ nv30->tex_miptree[unit] = (struct nv30_miptree *)miptree[unit];
+ nv30->dirty_samplers |= (1 << unit);
+ }
}
static void *
@@ -440,7 +444,7 @@ nv30_vp_state_create(struct pipe_context *pipe,
struct nv30_vertex_program *vp;
vp = CALLOC(1, sizeof(struct nv30_vertex_program));
- vp->pipe = cso;
+ vp->pipe = *cso;
return (void *)vp;
}
@@ -472,7 +476,7 @@ nv30_fp_state_create(struct pipe_context *pipe,
struct nv30_fragment_program *fp;
fp = CALLOC(1, sizeof(struct nv30_fragment_program));
- fp->pipe = cso;
+ fp->pipe = *cso;
return (void *)fp;
}
@@ -709,9 +713,9 @@ nv30_init_state_functions(struct nv30_context *nv30)
nv30->pipe.delete_blend_state = nv30_blend_state_delete;
nv30->pipe.create_sampler_state = nv30_sampler_state_create;
- nv30->pipe.bind_sampler_state = nv30_sampler_state_bind;
+ nv30->pipe.bind_sampler_states = nv30_sampler_state_bind;
nv30->pipe.delete_sampler_state = nv30_sampler_state_delete;
- nv30->pipe.set_sampler_texture = nv30_set_sampler_texture;
+ nv30->pipe.set_sampler_textures = nv30_set_sampler_texture;
nv30->pipe.create_rasterizer_state = nv30_rasterizer_state_create;
nv30->pipe.bind_rasterizer_state = nv30_rasterizer_state_bind;
diff --git a/src/gallium/drivers/nv30/nv30_state.h b/src/gallium/drivers/nv30/nv30_state.h
index 233600f69a..117520dd13 100644
--- a/src/gallium/drivers/nv30/nv30_state.h
+++ b/src/gallium/drivers/nv30/nv30_state.h
@@ -60,7 +60,7 @@ struct nv30_vertex_program_data {
};
struct nv30_vertex_program {
- const struct pipe_shader_state *pipe;
+ struct pipe_shader_state pipe;
boolean translated;
struct nv30_vertex_program_exec *insns;
@@ -84,7 +84,7 @@ struct nv30_fragment_program_data {
};
struct nv30_fragment_program {
- const struct pipe_shader_state *pipe;
+ struct pipe_shader_state pipe;
boolean translated;
boolean on_hw;
diff --git a/src/gallium/drivers/nv30/nv30_vertprog.c b/src/gallium/drivers/nv30/nv30_vertprog.c
index 75f7351261..e9b62ff48b 100644
--- a/src/gallium/drivers/nv30/nv30_vertprog.c
+++ b/src/gallium/drivers/nv30/nv30_vertprog.c
@@ -541,7 +541,7 @@ nv30_vertprog_prepare(struct nv30_vpc *vpc)
struct tgsi_parse_context p;
int nr_imm = 0;
- tgsi_parse_init(&p, vpc->vp->pipe->tokens);
+ tgsi_parse_init(&p, vpc->vp->pipe.tokens);
while (!tgsi_parse_end_of_tokens(&p)) {
const union tgsi_full_token *tok = &p.FullToken;
@@ -582,7 +582,7 @@ nv30_vertprog_translate(struct nv30_context *nv30,
return;
}
- tgsi_parse_init(&parse, vp->pipe->tokens);
+ tgsi_parse_init(&parse, vp->pipe.tokens);
while (!tgsi_parse_end_of_tokens(&parse)) {
tgsi_parse_token(&parse);
diff --git a/src/gallium/drivers/nv40/nv40_context.h b/src/gallium/drivers/nv40/nv40_context.h
index e118776306..100c678187 100644
--- a/src/gallium/drivers/nv40/nv40_context.h
+++ b/src/gallium/drivers/nv40/nv40_context.h
@@ -136,6 +136,8 @@ struct nv40_context {
unsigned idxbuf_format;
struct nv40_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS];
struct nv40_miptree *tex_miptree[PIPE_MAX_SAMPLERS];
+ unsigned nr_samplers;
+ unsigned nr_textures;
unsigned dirty_samplers;
struct pipe_vertex_buffer vtxbuf[PIPE_ATTRIB_MAX];
struct pipe_vertex_element vtxelt[PIPE_ATTRIB_MAX];
diff --git a/src/gallium/drivers/nv40/nv40_fragprog.c b/src/gallium/drivers/nv40/nv40_fragprog.c
index d981a02a63..953f9cd908 100644
--- a/src/gallium/drivers/nv40/nv40_fragprog.c
+++ b/src/gallium/drivers/nv40/nv40_fragprog.c
@@ -580,15 +580,14 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc,
arith(fpc, sat, ADD, dst, mask, src[0], neg(src[1]), none);
break;
case TGSI_OPCODE_TEX:
- if (finst->FullSrcRegisters[0].SrcRegisterExtSwz.ExtDivide ==
- TGSI_EXTSWIZZLE_W) {
- tex(fpc, sat, TXP, unit, dst, mask, src[0], none, none);
- } else
- tex(fpc, sat, TEX, unit, dst, mask, src[0], none, none);
+ tex(fpc, sat, TEX, unit, dst, mask, src[0], none, none);
break;
case TGSI_OPCODE_TXB:
tex(fpc, sat, TXB, unit, dst, mask, src[0], none, none);
break;
+ case TGSI_OPCODE_TXP:
+ tex(fpc, sat, TXP, unit, dst, mask, src[0], none, none);
+ break;
case TGSI_OPCODE_XPD:
tmp = temp(fpc);
arith(fpc, 0, MUL, tmp, mask,
@@ -680,7 +679,7 @@ nv40_fragprog_translate(struct nv40_context *nv40,
fpc->high_temp = -1;
fpc->num_regs = 2;
- tgsi_parse_init(&parse, fp->pipe->tokens);
+ tgsi_parse_init(&parse, fp->pipe.tokens);
while (!tgsi_parse_end_of_tokens(&parse)) {
tgsi_parse_token(&parse);
diff --git a/src/gallium/drivers/nv40/nv40_state.c b/src/gallium/drivers/nv40/nv40_state.c
index caa2f9df0c..321d5de041 100644
--- a/src/gallium/drivers/nv40/nv40_state.c
+++ b/src/gallium/drivers/nv40/nv40_state.c
@@ -1,6 +1,7 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "pipe/p_util.h"
+#include "pipe/p_inlines.h"
#include "nv40_context.h"
#include "nv40_state.h"
@@ -251,14 +252,22 @@ nv40_sampler_state_create(struct pipe_context *pipe,
}
static void
-nv40_sampler_state_bind(struct pipe_context *pipe, unsigned unit,
- void *hwcso)
+nv40_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler)
{
struct nv40_context *nv40 = nv40_context(pipe);
- struct nv40_sampler_state *ps = hwcso;
+ unsigned unit;
- nv40->tex_sampler[unit] = ps;
- nv40->dirty_samplers |= (1 << unit);
+ for (unit = 0; unit < nr; unit++) {
+ nv40->tex_sampler[unit] = sampler[unit];
+ nv40->dirty_samplers |= (1 << unit);
+ }
+
+ for (unit = nr; unit < nv40->nr_samplers; unit++) {
+ nv40->tex_sampler[unit] = NULL;
+ nv40->dirty_samplers |= (1 << unit);
+ }
+
+ nv40->nr_samplers = nr;
nv40->dirty |= NV40_NEW_SAMPLER;
}
@@ -269,13 +278,25 @@ nv40_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
}
static void
-nv40_set_sampler_texture(struct pipe_context *pipe, unsigned unit,
- struct pipe_texture *miptree)
+nv40_set_sampler_texture(struct pipe_context *pipe, unsigned nr,
+ struct pipe_texture **miptree)
{
struct nv40_context *nv40 = nv40_context(pipe);
+ unsigned unit;
+
+ for (unit = 0; unit < nr; unit++) {
+ pipe_texture_reference((struct pipe_texture **)
+ &nv40->tex_miptree[unit], miptree[unit]);
+ nv40->dirty_samplers |= (1 << unit);
+ }
+
+ for (unit = nr; unit < nv40->nr_textures; unit++) {
+ pipe_texture_reference((struct pipe_texture **)
+ &nv40->tex_miptree[unit], NULL);
+ nv40->dirty_samplers |= (1 << unit);
+ }
- nv40->tex_miptree[unit] = (struct nv40_miptree *)miptree;
- nv40->dirty_samplers |= (1 << unit);
+ nv40->nr_textures = nr;
nv40->dirty |= NV40_NEW_SAMPLER;
}
@@ -490,7 +511,7 @@ nv40_vp_state_create(struct pipe_context *pipe,
struct nv40_vertex_program *vp;
vp = CALLOC(1, sizeof(struct nv40_vertex_program));
- vp->pipe = cso;
+ vp->pipe = *cso;
return (void *)vp;
}
@@ -521,7 +542,7 @@ nv40_fp_state_create(struct pipe_context *pipe,
struct nv40_fragment_program *fp;
fp = CALLOC(1, sizeof(struct nv40_fragment_program));
- fp->pipe = cso;
+ fp->pipe = *cso;
return (void *)fp;
}
@@ -649,9 +670,9 @@ nv40_init_state_functions(struct nv40_context *nv40)
nv40->pipe.delete_blend_state = nv40_blend_state_delete;
nv40->pipe.create_sampler_state = nv40_sampler_state_create;
- nv40->pipe.bind_sampler_state = nv40_sampler_state_bind;
+ nv40->pipe.bind_sampler_states = nv40_sampler_state_bind;
nv40->pipe.delete_sampler_state = nv40_sampler_state_delete;
- nv40->pipe.set_sampler_texture = nv40_set_sampler_texture;
+ nv40->pipe.set_sampler_textures = nv40_set_sampler_texture;
nv40->pipe.create_rasterizer_state = nv40_rasterizer_state_create;
nv40->pipe.bind_rasterizer_state = nv40_rasterizer_state_bind;
diff --git a/src/gallium/drivers/nv40/nv40_state.h b/src/gallium/drivers/nv40/nv40_state.h
index e5217fe91c..a02ea0c878 100644
--- a/src/gallium/drivers/nv40/nv40_state.h
+++ b/src/gallium/drivers/nv40/nv40_state.h
@@ -23,7 +23,7 @@ struct nv40_vertex_program_data {
};
struct nv40_vertex_program {
- const struct pipe_shader_state *pipe;
+ struct pipe_shader_state pipe;
boolean translated;
struct nv40_vertex_program_exec *insns;
@@ -48,7 +48,7 @@ struct nv40_fragment_program_data {
};
struct nv40_fragment_program {
- const struct pipe_shader_state *pipe;
+ struct pipe_shader_state pipe;
boolean translated;
unsigned samplers;
diff --git a/src/gallium/drivers/nv40/nv40_vertprog.c b/src/gallium/drivers/nv40/nv40_vertprog.c
index 5b7a343e55..3d730c1a32 100644
--- a/src/gallium/drivers/nv40/nv40_vertprog.c
+++ b/src/gallium/drivers/nv40/nv40_vertprog.c
@@ -535,7 +535,7 @@ nv40_vertprog_prepare(struct nv40_vpc *vpc)
struct tgsi_parse_context p;
int nr_imm = 0;
- tgsi_parse_init(&p, vpc->vp->pipe->tokens);
+ tgsi_parse_init(&p, vpc->vp->pipe.tokens);
while (!tgsi_parse_end_of_tokens(&p)) {
const union tgsi_full_token *tok = &p.FullToken;
@@ -576,7 +576,7 @@ nv40_vertprog_translate(struct nv40_context *nv40,
return;
}
- tgsi_parse_init(&parse, vp->pipe->tokens);
+ tgsi_parse_init(&parse, vp->pipe.tokens);
while (!tgsi_parse_end_of_tokens(&parse)) {
tgsi_parse_token(&parse);
diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c
index aa65fd482e..b096a2583d 100644
--- a/src/gallium/drivers/nv50/nv50_state.c
+++ b/src/gallium/drivers/nv50/nv50_state.c
@@ -90,8 +90,7 @@ nv50_sampler_state_create(struct pipe_context *pipe,
}
static void
-nv50_sampler_state_bind(struct pipe_context *pipe, unsigned unit,
- void *hwcso)
+nv50_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler)
{
}
@@ -101,8 +100,8 @@ nv50_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
}
static void
-nv50_set_sampler_texture(struct pipe_context *pipe, unsigned unit,
- struct pipe_texture *pt)
+nv50_set_sampler_texture(struct pipe_context *pipe, unsigned nr,
+ struct pipe_texture **pt)
{
}
@@ -442,9 +441,9 @@ nv50_init_state_functions(struct nv50_context *nv50)
nv50->pipe.delete_blend_state = nv50_blend_state_delete;
nv50->pipe.create_sampler_state = nv50_sampler_state_create;
- nv50->pipe.bind_sampler_state = nv50_sampler_state_bind;
+ nv50->pipe.bind_sampler_states = nv50_sampler_state_bind;
nv50->pipe.delete_sampler_state = nv50_sampler_state_delete;
- nv50->pipe.set_sampler_texture = nv50_set_sampler_texture;
+ nv50->pipe.set_sampler_textures = nv50_set_sampler_texture;
nv50->pipe.create_rasterizer_state = nv50_rasterizer_state_create;
nv50->pipe.bind_rasterizer_state = nv50_rasterizer_state_bind;