Home | History | Annotate | Download | only in main

Lines Matching refs:ctx

122 _mesa_print_texunit_state( struct gl_context *ctx, GLuint unit )
124 const struct gl_texture_unit *texUnit = ctx->Texture.Unit + unit;
293 GET_CURRENT_CONTEXT(ctx);
296 k = MAX2(ctx->Const.MaxCombinedTextureImageUnits,
297 ctx->Const.MaxTextureCoordUnits);
299 ASSERT(k <= Elements(ctx->Texture.Unit));
301 ASSERT_OUTSIDE_BEGIN_END(ctx);
304 _mesa_debug(ctx, "glActiveTexture %s\n",
308 _mesa_error(ctx, GL_INVALID_ENUM, "glActiveTexture(texture=%s)",
313 if (ctx->Texture.CurrentUnit == texUnit)
316 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
318 ctx->Texture.CurrentUnit = texUnit;
319 if (ctx->Transform.MatrixMode == GL_TEXTURE) {
321 ctx->CurrentStack = &ctx->TextureMatrixStack[texUnit];
330 GET_CURRENT_CONTEXT(ctx);
332 ASSERT_OUTSIDE_BEGIN_END(ctx);
335 _mesa_debug(ctx, "glClientActiveTexture %s\n",
338 if (texUnit >= ctx->Const.MaxTextureCoordUnits) {
339 _mesa_error(ctx, GL_INVALID_ENUM, "glClientActiveTexture(texture)");
343 if (ctx->Array.ActiveTexture == texUnit)
346 FLUSH_VERTICES(ctx, _NEW_ARRAY);
347 ctx->Array.ActiveTexture = texUnit;
363 * \param ctx GL context.
366 update_texture_matrices( struct gl_context *ctx )
370 ctx->Texture._TexMatEnabled = 0x0;
372 for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) {
373 ASSERT(u < Elements(ctx->TextureMatrixStack));
374 if (_math_matrix_is_dirty(ctx->TextureMatrixStack[u].Top)) {
375 _math_matrix_analyse( ctx->TextureMatrixStack[u].Top );
377 if (ctx->Texture.Unit[u]._ReallyEnabled &&
378 ctx->TextureMatrixStack[u].Top->type != MATRIX_IDENTITY)
379 ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(u);
389 update_tex_combine(struct gl_context *ctx, struct gl_texture_unit *texUnit)
450 _mesa_problem(ctx, "invalid RGB combine mode in update_texture_state");
478 _mesa_problem(ctx, "invalid Alpha combine mode in update_texture_state");
490 * \param ctx GL context.
493 update_texture_state( struct gl_context *ctx )
500 if (ctx->Shader.CurrentVertexProgram &&
501 ctx->Shader.CurrentVertexProgram->LinkStatus) {
502 vprog = ctx->Shader.CurrentVertexProgram->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
503 } else if (ctx->VertexProgram._Enabled) {
506 vprog = &ctx->VertexProgram.Current->Base;
510 if (ctx->Shader.CurrentFragmentProgram &&
511 ctx->Shader.CurrentFragmentProgram->LinkStatus) {
512 fprog = ctx->Shader.CurrentFragmentProgram->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program;
514 else if (ctx->FragmentProgram._Enabled) {
515 fprog = &ctx->FragmentProgram.Current->Base;
523 ctx->NewState |= _NEW_TEXTURE;
525 ctx->Texture._EnabledUnits = 0x0;
526 ctx->Texture._GenFlags = 0x0;
527 ctx->Texture._TexMatEnabled = 0x0;
528 ctx->Texture._TexGenEnabled = 0x0;
533 for (unit = 0; unit < ctx->Const.MaxCombinedTextureImageUnits; unit++) {
534 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
580 _mesa_test_texobj_completeness(ctx, texObj);
602 texObj = _mesa_get_fallback_texture(ctx, texTarget);
621 ctx->Texture._EnabledUnits |= (1 << unit);
626 update_tex_combine(ctx, texUnit);
633 ctx->Texture._EnabledCoordUnits
637 ctx->Texture._EnabledCoordUnits = enabledFragUnits;
641 for (unit = 0; unit < ctx->Const.MaxTextureCoordUnits; unit++) {
642 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
646 if (!(ctx->Texture._EnabledCoordUnits & (1 << unit)))
663 ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(unit);
664 ctx->Texture._GenFlags |= texUnit->_GenFlags;
667 ASSERT(unit < Elements(ctx->TextureMatrixStack));
668 if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY)
669 ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit);
678 _mesa_update_texture( struct gl_context *ctx, GLuint new_state )
681 update_texture_matrices( ctx );
684 update_texture_state( ctx );
695 * \param ctx the context to allocate proxies for.
703 alloc_proxy_textures( struct gl_context *ctx )
726 if (!(ctx->Texture.ProxyTex[tgt]
727 = ctx->Driver.NewTextureObject(ctx, 0, targets[tgt]))) {
730 ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]);
736 assert(ctx->Texture.ProxyTex[0]->RefCount == 1); /* sanity check */
744 * \param ctx GL context.
748 init_texture_unit( struct gl_context *ctx, GLuint unit )
750 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
787 ctx->Shared->DefaultTex[tex]);
796 _mesa_init_texture(struct gl_context *ctx)
801 ctx->Texture.CurrentUnit = 0; /* multitexture */
802 ctx->Texture._EnabledUnits = 0x0;
804 for (u = 0; u < Elements(ctx->Texture.Unit); u++)
805 init_texture_unit(ctx, u);
811 assert(ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]->RefCount
815 if (!alloc_proxy_textures( ctx ))
819 _mesa_reference_buffer_object(ctx, &ctx->Texture.BufferObject,
820 ctx->Shared->NullBufferObj);
830 _mesa_free_texture_data(struct gl_context *ctx)
835 for (u = 0; u < Elements(ctx->Texture.Unit); u++) {
837 _mesa_reference_texobj(&ctx->Texture.Unit[u]._Current, NULL);
840 _mesa_reference_texobj(&ctx->Texture.Unit[u].CurrentTex[tgt], NULL);
846 ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]);
849 _mesa_reference_buffer_object(ctx, &ctx->Texture.BufferObject, NULL);
852 for (u = 0; u < Elements(ctx->Texture.Unit); u++) {
853 _mesa_reference_sampler_object(ctx, &ctx->Texture.Unit[u].Sampler, NULL);
865 _mesa_update_default_objects_texture(struct gl_context *ctx)
869 for (u = 0; u < Elements(ctx->Texture.Unit); u++) {
870 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[u];
873 ctx->Shared->DefaultTex[tex]);