#define NV50_NEW_FRAGPROG (1 << 10)
#define NV50_NEW_FRAGPROG_CB (1 << 11)
#define NV50_NEW_ARRAYS (1 << 12)
+#define NV50_NEW_SAMPLER (1 << 13)
+#define NV50_NEW_TEXTURE (1 << 14)
struct nv50_blend_stateobj {
struct pipe_blend_state pipe;
struct nouveau_stateobj *so;
};
+struct nv50_miptree {
+ struct pipe_texture base;
+ struct pipe_buffer *buffer;
+};
+
+static INLINE struct nv50_miptree *
+nv50_miptree(struct pipe_texture *pt)
+{
+ return (struct nv50_miptree *)pt;
+}
+
struct nv50_context {
struct pipe_context pipe;
unsigned vtxbuf_nr;
struct pipe_vertex_element vtxelt[PIPE_MAX_ATTRIBS];
unsigned vtxelt_nr;
+ unsigned *sampler[PIPE_MAX_SAMPLERS];
+ unsigned sampler_nr;
+ struct nv50_miptree *miptree[PIPE_MAX_SAMPLERS];
+ unsigned miptree_nr;
};
static INLINE struct nv50_context *
#include "nv50_context.h"
-struct nv50_miptree {
- struct pipe_texture base;
- struct pipe_buffer *buffer;
-};
-
-static INLINE struct nv50_miptree *
-nv50_miptree(struct pipe_texture *pt)
-{
- return (struct nv50_miptree *)pt;
-}
-
static struct pipe_texture *
nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
{
case TGSI_FILE_IMMEDIATE:
r = &pc->immd[src->SrcRegister.Index * 4 + c];
break;
+ case TGSI_FILE_SAMPLER:
+ break;
default:
assert(0);
break;
emit_sub(pc, dst[c], src[0][c], src[1][c]);
}
break;
+ case TGSI_OPCODE_TEX:
+ break;
case TGSI_OPCODE_XPD:
temp = alloc_temp(pc, NULL);
if (mask & (1 << 0)) {
if (pc->param_nr < (last + 1))
pc->param_nr = last + 1;
break;
+ case TGSI_FILE_SAMPLER:
+ break;
default:
NOUVEAU_ERR("bad decl file %d\n",
d->Declaration.File);
break;
case PIPE_TEXTURE:
switch (format) {
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
case PIPE_FORMAT_I8_UNORM:
return TRUE;
default:
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "pipe/p_util.h"
+#include "pipe/p_inlines.h"
#include "nv50_context.h"
nv50_sampler_state_create(struct pipe_context *pipe,
const struct pipe_sampler_state *cso)
{
- return NULL;
+ unsigned *tsc = CALLOC(8, sizeof(unsigned));
+
+ tsc[0] = 0x00024080;
+ tsc[1] = 0x00000062;
+
+ return (void *)tsc;
}
static void
nv50_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler)
{
+ struct nv50_context *nv50 = nv50_context(pipe);
+ int i;
+
+ nv50->sampler_nr = nr;
+ for (i = 0; i < nv50->sampler_nr; i++)
+ nv50->sampler[i] = sampler[i];
+
+ nv50->dirty |= NV50_NEW_SAMPLER;
}
static void
nv50_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
{
+ FREE(hwcso);
}
static void
nv50_set_sampler_texture(struct pipe_context *pipe, unsigned nr,
struct pipe_texture **pt)
{
+ struct nv50_context *nv50 = nv50_context(pipe);
+ int i;
+
+ for (i = 0; i < nr; i++)
+ pipe_texture_reference(&nv50->miptree[i], pt[i]);
+ for (i = nr; i < nv50->miptree_nr; i++)
+ pipe_texture_reference(&nv50->miptree[i], NULL);
+
+ nv50->miptree_nr = nr;
+ nv50->dirty |= NV50_NEW_TEXTURE;
}
static void *
so_ref(NULL, &so);
}
+ if (nv50->dirty & NV50_NEW_SAMPLER) {
+ int i;
+
+ BEGIN_RING(tesla, 0x0f00, 1);
+ OUT_RING ((NV50_CB_TSC << 0) | (0 << 8));
+ BEGIN_RING(tesla, 0x40000f04, nv50->sampler_nr * 8);
+ for (i = 0; i < nv50->sampler_nr; i++)
+ OUT_RINGp(nv50->sampler[i], 8);
+ }
+
+ if (nv50->dirty & NV50_NEW_TEXTURE) {
+ int i;
+
+ BEGIN_RING(tesla, 0x0f00, 1);
+ OUT_RING ((NV50_CB_TIC << 0) | (0 << 8));
+ BEGIN_RING(tesla, 0x40000f04, nv50->miptree_nr * 8);
+ for (i = 0; i < nv50->sampler_nr; i++) {
+ struct nv50_miptree *mt = nv50->miptree[i];
+
+ OUT_RING (0x2a712488);
+ OUT_RELOCl(mt->buffer, 0,
+ NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW);
+ OUT_RING (0xd0c05000);
+ OUT_RING (0x00300000);
+ OUT_RING (mt->base.width[0]);
+ OUT_RING ((mt->base.depth[0] << 16) |
+ mt->base.height[0]);
+ OUT_RING (0x03000000);
+ OUT_RELOCh(mt->buffer, 0,
+ NOUVEAU_BO_VRAM | NOUVEAU_BO_HIGH);
+ }
+ }
+
if (nv50->dirty & NV50_NEW_ARRAYS)
nv50_vbo_validate(nv50);