diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml index 4c8f73e..c50c874 100644 --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml @@ -484,18 +484,39 @@ + + + + + + + + + + + + + + + + + + + + + @@ -514,10 +535,22 @@ + + + + + + + + + + + + diff --git a/src/mesa/main/genmipmap.c b/src/mesa/main/genmipmap.c index 4ec8385..b8ddbd0 100644 --- a/src/mesa/main/genmipmap.c +++ b/src/mesa/main/genmipmap.c @@ -165,3 +165,19 @@ _mesa_GenerateTextureMipmap(GLuint texture) _mesa_generate_texture_mipmap(ctx, texObj, texObj->Target, true); } + +void GLAPIENTRY +_mesa_GenerateTextureMipmapEXT(GLuint texture, GLenum target) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + /* TODO - Should implicitly create texture object here if one + * does not exist. + */ + texObj = _mesa_lookup_texture_err(ctx, texture, "glGenerateTextureMipmapEXT"); + if (!texObj) + return; + + _mesa_generate_texture_mipmap(ctx, texObj, texObj->Target, true); +} diff --git a/src/mesa/main/genmipmap.h b/src/mesa/main/genmipmap.h index f4ef859..1be82b3 100644 --- a/src/mesa/main/genmipmap.h +++ b/src/mesa/main/genmipmap.h @@ -39,4 +39,7 @@ _mesa_GenerateMipmap(GLenum target); extern void GLAPIENTRY _mesa_GenerateTextureMipmap(GLuint texture); +extern void GLAPIENTRY +_mesa_GenerateTextureMipmapEXT(GLuint texture, GLenum target); + #endif /* GENMIPMAP_H */ diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 89f286c..742c119 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -36,6 +36,7 @@ #include "main/enums.h" #include "main/formats.h" #include "main/glformats.h" +#include "main/hash.h" #include "main/macros.h" #include "main/mtypes.h" #include "main/state.h" @@ -1120,6 +1121,52 @@ _mesa_TextureParameterfv(GLuint texture, GLenum pname, const GLfloat *params) _mesa_texture_parameterfv(ctx, texObj, pname, params, true); } +static struct gl_texture_object * +get_create_texture(GLuint texture, GLenum target, const char *caller) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = get_texobj_by_name(ctx, texture, GL_FALSE); + + if (texObj) { + /* Check possible target mismatch. */ + if (texObj && target != texObj->Target) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(target)", caller); + return NULL; + } + return texObj; + } + + /* A new texture id, allocate a texture object now, */ + texObj = ctx->Driver.NewTextureObject(ctx, texture, target); + if (!texObj) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, caller); + return NULL; + } + + /* and insert it into hash table. */ + mtx_lock(&ctx->Shared->Mutex); + _mesa_HashInsert(ctx->Shared->TexObjects, texture, texObj); + mtx_unlock(&ctx->Shared->Mutex); + + return texObj; +} + +void GLAPIENTRY +_mesa_TextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname, + const GLfloat *params) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = get_create_texture(texture, target, "glTextureParameterfvEXT"); + if (!texObj) + return; + + _mesa_texture_parameterfv(ctx, texObj, pname, params, true); +} + void GLAPIENTRY _mesa_TextureParameterf(GLuint texture, GLenum pname, GLfloat param) { @@ -1137,6 +1184,19 @@ _mesa_TextureParameterf(GLuint texture, GLenum pname, GLfloat param) } void GLAPIENTRY +_mesa_TextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = get_create_texture(texture, target, "glTextureParameterfEXT"); + if (!texObj) + return; + + _mesa_texture_parameterf(ctx, texObj, pname, param, true); +} + +void GLAPIENTRY _mesa_TextureParameteri(GLuint texture, GLenum pname, GLint param) { struct gl_texture_object *texObj; @@ -1153,6 +1213,20 @@ _mesa_TextureParameteri(GLuint texture, GLenum pname, GLint param) } void GLAPIENTRY +_mesa_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, + GLint param) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = get_create_texture(texture, target, "glTextureParameteriEXT"); + if (!texObj) + return; + + _mesa_texture_parameteri(ctx, texObj, pname, param, true); +} + +void GLAPIENTRY _mesa_TextureParameteriv(GLuint texture, GLenum pname, const GLint *params) { @@ -1169,6 +1243,19 @@ _mesa_TextureParameteriv(GLuint texture, GLenum pname, _mesa_texture_parameteriv(ctx, texObj, pname, params, true); } +void GLAPIENTRY +_mesa_TextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, + const GLint *params) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = get_create_texture(texture, target, "glTextureParameterivEXT"); + if (!texObj) + return; + + _mesa_texture_parameteriv(ctx, texObj, pname, params, true); +} void GLAPIENTRY _mesa_TextureParameterIiv(GLuint texture, GLenum pname, const GLint *params) diff --git a/src/mesa/main/texparam.h b/src/mesa/main/texparam.h index 96defbe..14fd20a 100644 --- a/src/mesa/main/texparam.h +++ b/src/mesa/main/texparam.h @@ -152,4 +152,18 @@ _mesa_TextureParameterIiv(GLuint texture, GLenum pname, const GLint *params); extern void GLAPIENTRY _mesa_TextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params); +/* EXT_direct_state_access variants */ + +extern void GLAPIENTRY +_mesa_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint param); + +extern void GLAPIENTRY +_mesa_TextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, const GLint *params); + +extern void GLAPIENTRY +_mesa_TextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param); + +extern void GLAPIENTRY +_mesa_TextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname, const GLfloat *params); + #endif /* TEXPARAM_H */