#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "pipe/p_util.h"
+#include "pipe/p_inlines.h"
#include "nv30_context.h"
#include "nv30_state.h"
struct nv30_sampler_state *ps;
uint32_t filter = 0;
- ps = malloc(sizeof(struct nv30_sampler_state));
+ ps = MALLOC(sizeof(struct nv30_sampler_state));
ps->fmt = 0;
if (!cso->normalized_coords)
ps->filt = filter;
+ /*{
+ float limit;
+
+ limit = CLAMP(cso->lod_bias, -16.0, 15.0);
+ ps->filt |= (int)(cso->lod_bias * 256.0) & 0x1fff;
+
+ limit = CLAMP(cso->max_lod, 0.0, 15.0);
+ ps->en |= (int)(limit * 256.0) << 7;
+
+ limit = CLAMP(cso->min_lod, 0.0, 15.0);
+ ps->en |= (int)(limit * 256.0) << 19;
+ }*/
+
/* if (cso->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) {
switch (cso->compare_func) {
case PIPE_FUNC_NEVER:
struct nv30_context *nv30 = nv30_context(pipe);
unsigned unit;
- if (!sampler) {
- return;
- }
-
for (unit = 0; unit < nr; unit++) {
nv30->tex_sampler[unit] = sampler[unit];
nv30->dirty_samplers |= (1 << unit);
}
+
+ for (unit = nr; unit < nv30->nr_samplers; unit++) {
+ nv30->tex_sampler[unit] = NULL;
+ nv30->dirty_samplers |= (1 << unit);
+ }
+
+ nv30->nr_samplers = nr;
+ nv30->dirty |= NV30_NEW_SAMPLER;
}
static void
nv30_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
{
- free(hwcso);
+ FREE(hwcso);
}
static void
unsigned unit;
for (unit = 0; unit < nr; unit++) {
- nv30->tex_miptree[unit] = (struct nv30_miptree *)miptree[unit];
+ pipe_texture_reference((struct pipe_texture **)
+ &nv30->tex_miptree[unit], miptree[unit]);
nv30->dirty_samplers |= (1 << unit);
}
+
+ for (unit = nr; unit < nv30->nr_textures; unit++) {
+ pipe_texture_reference((struct pipe_texture **)
+ &nv30->tex_miptree[unit], NULL);
+ nv30->dirty_samplers |= (1 << unit);
+ }
+
+ nv30->nr_textures = nr;
+ nv30->dirty |= NV30_NEW_SAMPLER;
}
static void *
{
struct nv30_state *state = &nv30->state;
struct nv30_screen *screen = nv30->screen;
- unsigned i;
+ unsigned i, samplers;
uint64 states;
if (nv30->pctx_id != screen->cur_pctx) {
nv30->dirty_samplers = 0;
so_emit_reloc_markers(nv30->nvws, state->hw[NV30_STATE_FB]);
+ for (i = 0, samplers = state->fp_samplers; i < 16 && samplers; i++) {
+ if (!(samplers & (1 << i)))
+ continue;
+ so_emit_reloc_markers(nv30->nvws,
+ state->hw[NV30_STATE_FRAGTEX0+i]);
+ samplers &= ~(1ULL << i);
+ }
/* Texture images, emitted in nv30_fragtex_build */
#if 0