mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-11 06:28:09 +02:00
nv50: support non-normalized texture coords
This commit is contained in:
parent
b7aa5b1d10
commit
6c1627a51c
4 changed files with 18 additions and 8 deletions
|
|
@ -63,6 +63,11 @@ struct nv50_rasterizer_stateobj {
|
|||
struct nouveau_stateobj *so;
|
||||
};
|
||||
|
||||
struct nv50_sampler_stateobj {
|
||||
bool normalized;
|
||||
unsigned tsc[8];
|
||||
};
|
||||
|
||||
struct nv50_miptree_level {
|
||||
int *image_offset;
|
||||
unsigned pitch;
|
||||
|
|
@ -141,7 +146,7 @@ struct nv50_context {
|
|||
unsigned vtxbuf_nr;
|
||||
struct pipe_vertex_element vtxelt[PIPE_MAX_ATTRIBS];
|
||||
unsigned vtxelt_nr;
|
||||
unsigned *sampler[PIPE_MAX_SAMPLERS];
|
||||
struct nv50_sampler_stateobj *sampler[PIPE_MAX_SAMPLERS];
|
||||
unsigned sampler_nr;
|
||||
struct nv50_miptree *miptree[PIPE_MAX_SAMPLERS];
|
||||
unsigned miptree_nr;
|
||||
|
|
|
|||
|
|
@ -136,7 +136,8 @@ static void *
|
|||
nv50_sampler_state_create(struct pipe_context *pipe,
|
||||
const struct pipe_sampler_state *cso)
|
||||
{
|
||||
unsigned *tsc = CALLOC(8, sizeof(unsigned));
|
||||
struct nv50_sampler_stateobj *sso = CALLOC(1, sizeof(*sso));
|
||||
unsigned *tsc = sso->tsc;
|
||||
float limit;
|
||||
|
||||
tsc[0] = (0x00026000 |
|
||||
|
|
@ -209,7 +210,8 @@ nv50_sampler_state_create(struct pipe_context *pipe,
|
|||
tsc[2] |= ((int)CLAMP(cso->max_lod, 0.0, 15.0) << 20) |
|
||||
((int)CLAMP(cso->min_lod, 0.0, 15.0) << 8);
|
||||
|
||||
return (void *)tsc;
|
||||
sso->normalized = cso->normalized_coords;
|
||||
return (void *)sso;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -295,12 +295,12 @@ viewport_uptodate:
|
|||
so_data (so, NV50_CB_TSC);
|
||||
so_method(so, tesla, 0x40000f04, nv50->sampler_nr * 8);
|
||||
for (i = 0; i < nv50->sampler_nr; i++)
|
||||
so_datap (so, nv50->sampler[i], 8);
|
||||
so_datap (so, nv50->sampler[i]->tsc, 8);
|
||||
so_ref(so, &nv50->state.tsc_upload);
|
||||
so_ref(NULL, &so);
|
||||
}
|
||||
|
||||
if (nv50->dirty & NV50_NEW_TEXTURE)
|
||||
if (nv50->dirty & (NV50_NEW_TEXTURE | NV50_NEW_SAMPLER))
|
||||
nv50_tex_validate(nv50);
|
||||
|
||||
if (nv50->dirty & NV50_NEW_ARRAYS)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
static int
|
||||
nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so,
|
||||
struct nv50_miptree *mt)
|
||||
struct nv50_miptree *mt, int unit)
|
||||
{
|
||||
switch (mt->base.format) {
|
||||
case PIPE_FORMAT_A8R8G8B8_UNORM:
|
||||
|
|
@ -120,7 +120,10 @@ nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so,
|
|||
|
||||
so_reloc(so, mt->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW |
|
||||
NOUVEAU_BO_RD, 0, 0);
|
||||
so_data (so, 0xd0005000 | mt->bo->tile_mode << 22);
|
||||
if (nv50->sampler[unit]->normalized)
|
||||
so_data (so, 0xd0005000 | mt->bo->tile_mode << 22);
|
||||
else
|
||||
so_data (so, 0x5001d000 | mt->bo->tile_mode << 22);
|
||||
so_data (so, 0x00300000);
|
||||
so_data (so, mt->base.width[0]);
|
||||
so_data (so, (mt->base.last_level << 28) |
|
||||
|
|
@ -145,7 +148,7 @@ nv50_tex_validate(struct nv50_context *nv50)
|
|||
for (unit = 0; unit < nv50->miptree_nr; unit++) {
|
||||
struct nv50_miptree *mt = nv50->miptree[unit];
|
||||
|
||||
if (nv50_tex_construct(nv50, so, mt)) {
|
||||
if (nv50_tex_construct(nv50, so, mt, unit)) {
|
||||
NOUVEAU_ERR("failed tex validate\n");
|
||||
so_ref(NULL, &so);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue