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,
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);
}
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
}
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 *
struct nv30_vertex_program *vp;
vp = CALLOC(1, sizeof(struct nv30_vertex_program));
- vp->pipe = cso;
+ vp->pipe = *cso;
return (void *)vp;
}
struct nv30_fragment_program *fp;
fp = CALLOC(1, sizeof(struct nv30_fragment_program));
- fp->pipe = cso;
+ fp->pipe = *cso;
return (void *)fp;
}
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;
};
struct nv30_vertex_program {
- const struct pipe_shader_state *pipe;
+ struct pipe_shader_state pipe;
boolean translated;
struct nv30_vertex_program_exec *insns;
};
struct nv30_fragment_program {
- const struct pipe_shader_state *pipe;
+ struct pipe_shader_state pipe;
boolean translated;
boolean on_hw;
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;
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);
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];
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,
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);
#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"
}
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;
}
}
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;
}
struct nv40_vertex_program *vp;
vp = CALLOC(1, sizeof(struct nv40_vertex_program));
- vp->pipe = cso;
+ vp->pipe = *cso;
return (void *)vp;
}
struct nv40_fragment_program *fp;
fp = CALLOC(1, sizeof(struct nv40_fragment_program));
- fp->pipe = cso;
+ fp->pipe = *cso;
return (void *)fp;
}
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;
};
struct nv40_vertex_program {
- const struct pipe_shader_state *pipe;
+ struct pipe_shader_state pipe;
boolean translated;
struct nv40_vertex_program_exec *insns;
};
struct nv40_fragment_program {
- const struct pipe_shader_state *pipe;
+ struct pipe_shader_state pipe;
boolean translated;
unsigned samplers;
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;
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);
}
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)
{
}
}
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)
{
}
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;