static void nouveau_light(struct gl_context *ctx, GLenum light, GLenum pname, const GLfloat *params) { switch (pname) { case GL_AMBIENT: context_dirty(ctx, MATERIAL_FRONT_AMBIENT); context_dirty(ctx, MATERIAL_BACK_AMBIENT); break; case GL_DIFFUSE: context_dirty(ctx, MATERIAL_FRONT_DIFFUSE); context_dirty(ctx, MATERIAL_BACK_DIFFUSE); break; case GL_SPECULAR: context_dirty(ctx, MATERIAL_FRONT_SPECULAR); context_dirty(ctx, MATERIAL_BACK_SPECULAR); break; case GL_SPOT_CUTOFF: case GL_POSITION: context_dirty(ctx, MODELVIEW); context_dirty(ctx, LIGHT_ENABLE); context_dirty_i(ctx, LIGHT_SOURCE, light - GL_LIGHT0); break; default: context_dirty_i(ctx, LIGHT_SOURCE, light - GL_LIGHT0); break; } }
static void nouveau_tex_parameter(struct gl_context *ctx, GLenum target, struct gl_texture_object *t, GLenum pname, const GLfloat *params) { switch (pname) { case GL_TEXTURE_MAG_FILTER: case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_T: case GL_TEXTURE_WRAP_R: case GL_TEXTURE_MIN_LOD: case GL_TEXTURE_MAX_LOD: case GL_TEXTURE_MAX_ANISOTROPY_EXT: case GL_TEXTURE_LOD_BIAS: context_dirty_i(ctx, TEX_OBJ, ctx->Texture.CurrentUnit); break; case GL_TEXTURE_MIN_FILTER: case GL_TEXTURE_BASE_LEVEL: case GL_TEXTURE_MAX_LEVEL: nouveau_texture_reallocate(ctx, t); context_dirty_i(ctx, TEX_OBJ, ctx->Texture.CurrentUnit); break; } }
static void nouveau_tex_env(struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param) { switch (target) { case GL_TEXTURE_FILTER_CONTROL_EXT: context_dirty_i(ctx, TEX_OBJ, ctx->Texture.CurrentUnit); break; default: context_dirty_i(ctx, TEX_ENV, ctx->Texture.CurrentUnit); break; } }
static void nouveau_tex_gen(struct gl_context *ctx, GLenum coord, GLenum pname, const GLfloat *params) { switch (pname) { case GL_TEXTURE_GEN_MODE: context_dirty_i(ctx, TEX_GEN, ctx->Texture.CurrentUnit); context_dirty(ctx, MODELVIEW); break; default: context_dirty_i(ctx, TEX_GEN, ctx->Texture.CurrentUnit); break; } }
static void nouveau_update_state(struct gl_context *ctx) { GLbitfield new_state = ctx->NewState; int i; if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT)) _mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer); if (new_state & (_NEW_PROJECTION | _NEW_MODELVIEW)) context_dirty(ctx, PROJECTION); if (new_state & _NEW_MODELVIEW) context_dirty(ctx, MODELVIEW); if (new_state & _NEW_TEXTURE_MATRIX) { for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) context_dirty_i(ctx, TEX_MAT, i); } if (new_state & _NEW_SCISSOR) context_dirty(ctx, SCISSOR); if (new_state & _NEW_VIEWPORT) context_dirty(ctx, VIEWPORT); if (new_state & _NEW_CURRENT_ATTRIB && new_state & _NEW_LIGHT) { context_dirty(ctx, MATERIAL_FRONT_AMBIENT); context_dirty(ctx, MATERIAL_BACK_AMBIENT); context_dirty(ctx, MATERIAL_FRONT_DIFFUSE); context_dirty(ctx, MATERIAL_BACK_DIFFUSE); context_dirty(ctx, MATERIAL_FRONT_SPECULAR); context_dirty(ctx, MATERIAL_BACK_SPECULAR); context_dirty(ctx, MATERIAL_FRONT_SHININESS); context_dirty(ctx, MATERIAL_BACK_SHININESS); } if (new_state & _NEW_TEXTURE) { for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { if (ctx->Texture.Unit[i].Sampler) context_dirty_i(ctx, TEX_OBJ, i); } } _swrast_InvalidateState(ctx, new_state); _tnl_InvalidateState(ctx, new_state); nouveau_state_emit(ctx); }
void nv10_emit_tex_gen(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_GEN0; struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_pushbuf *push = context_push(ctx); struct gl_texture_unit *unit = &ctx->Texture.Unit[i]; int j; for (j = 0; j < 4; j++) { if (nctx->fallback == HWTNL && (unit->TexGenEnabled & 1 << j)) { struct gl_texgen *coord = get_texgen_coord(unit, j); float *k = get_texgen_coeff(coord); if (k) { BEGIN_NV04(push, NV10_3D(TEX_GEN_COEFF(i, j)), 4); PUSH_DATAp(push, k, 4); } BEGIN_NV04(push, NV10_3D(TEX_GEN_MODE(i,j)), 1); PUSH_DATA (push, nvgl_texgen_mode(coord->Mode)); } else { BEGIN_NV04(push, NV10_3D(TEX_GEN_MODE(i,j)), 1); PUSH_DATA (push, 0); } } context_dirty_i(ctx, TEX_MAT, i); }
static void nouveau_clip_plane(struct gl_context *ctx, GLenum plane, const GLfloat *equation) { context_dirty_i(ctx, CLIP_PLANE, plane - GL_CLIP_PLANE0); }
static void nouveau_enable(struct gl_context *ctx, GLenum cap, GLboolean state) { int i; switch (cap) { case GL_ALPHA_TEST: context_dirty(ctx, ALPHA_FUNC); break; case GL_BLEND: context_dirty(ctx, BLEND_EQUATION); break; case GL_COLOR_LOGIC_OP: context_dirty(ctx, LOGIC_OPCODE); break; case GL_COLOR_MATERIAL: context_dirty(ctx, COLOR_MATERIAL); context_dirty(ctx, MATERIAL_FRONT_AMBIENT); context_dirty(ctx, MATERIAL_BACK_AMBIENT); context_dirty(ctx, MATERIAL_FRONT_DIFFUSE); context_dirty(ctx, MATERIAL_BACK_DIFFUSE); context_dirty(ctx, MATERIAL_FRONT_SPECULAR); context_dirty(ctx, MATERIAL_BACK_SPECULAR); break; case GL_COLOR_SUM_EXT: context_dirty(ctx, FRAG); context_dirty(ctx, LIGHT_MODEL); break; case GL_CULL_FACE: context_dirty(ctx, CULL_FACE); break; case GL_DEPTH_TEST: context_dirty(ctx, DEPTH); break; case GL_DITHER: context_dirty(ctx, DITHER); break; case GL_FOG: context_dirty(ctx, FOG); context_dirty(ctx, FRAG); context_dirty(ctx, MODELVIEW); break; case GL_LIGHT0: case GL_LIGHT1: case GL_LIGHT2: case GL_LIGHT3: case GL_LIGHT4: case GL_LIGHT5: case GL_LIGHT6: case GL_LIGHT7: context_dirty(ctx, MODELVIEW); context_dirty(ctx, LIGHT_ENABLE); context_dirty_i(ctx, LIGHT_SOURCE, cap - GL_LIGHT0); context_dirty(ctx, MATERIAL_FRONT_AMBIENT); context_dirty(ctx, MATERIAL_BACK_AMBIENT); context_dirty(ctx, MATERIAL_FRONT_DIFFUSE); context_dirty(ctx, MATERIAL_BACK_DIFFUSE); context_dirty(ctx, MATERIAL_FRONT_SPECULAR); context_dirty(ctx, MATERIAL_BACK_SPECULAR); context_dirty(ctx, MATERIAL_FRONT_SHININESS); context_dirty(ctx, MATERIAL_BACK_SHININESS); break; case GL_LIGHTING: context_dirty(ctx, FRAG); context_dirty(ctx, MODELVIEW); context_dirty(ctx, LIGHT_MODEL); context_dirty(ctx, LIGHT_ENABLE); for (i = 0; i < MAX_LIGHTS; i++) { if (ctx->Light.Light[i].Enabled) context_dirty_i(ctx, LIGHT_SOURCE, i); } context_dirty(ctx, MATERIAL_FRONT_AMBIENT); context_dirty(ctx, MATERIAL_BACK_AMBIENT); context_dirty(ctx, MATERIAL_FRONT_DIFFUSE); context_dirty(ctx, MATERIAL_BACK_DIFFUSE); context_dirty(ctx, MATERIAL_FRONT_SPECULAR); context_dirty(ctx, MATERIAL_BACK_SPECULAR); context_dirty(ctx, MATERIAL_FRONT_SHININESS); context_dirty(ctx, MATERIAL_BACK_SHININESS); break; case GL_LINE_SMOOTH: context_dirty(ctx, LINE_MODE); break; case GL_NORMALIZE: context_dirty(ctx, LIGHT_ENABLE); break; case GL_POINT_SMOOTH: context_dirty(ctx, POINT_MODE); break; case GL_POLYGON_OFFSET_POINT: case GL_POLYGON_OFFSET_LINE: case GL_POLYGON_OFFSET_FILL: context_dirty(ctx, POLYGON_OFFSET); break; case GL_POLYGON_SMOOTH: context_dirty(ctx, POLYGON_MODE); break; case GL_SCISSOR_TEST: context_dirty(ctx, SCISSOR); break; case GL_STENCIL_TEST: context_dirty(ctx, STENCIL_FUNC); break; case GL_TEXTURE_1D: case GL_TEXTURE_2D: case GL_TEXTURE_3D: case GL_TEXTURE_RECTANGLE: context_dirty_i(ctx, TEX_ENV, ctx->Texture.CurrentUnit); context_dirty_i(ctx, TEX_OBJ, ctx->Texture.CurrentUnit); break; case GL_TEXTURE_GEN_S: case GL_TEXTURE_GEN_T: case GL_TEXTURE_GEN_R: case GL_TEXTURE_GEN_Q: context_dirty_i(ctx, TEX_GEN, ctx->Texture.CurrentUnit); context_dirty(ctx, MODELVIEW); break; } }