<div dir="ltr"><div>This has been fairly extensively updated, per your comments: <a href="http://cgit.freedesktop.org/~ldeks/mesa/commit/?h=adsa-textures&id=9a3a8c4fcc95cc6e8834cd7af6b5d8c262942d9a">http://cgit.freedesktop.org/~ldeks/mesa/commit/?h=adsa-textures&id=9a3a8c4fcc95cc6e8834cd7af6b5d8c262942d9a</a><br><br></div>Thanks.<br><br>Laura<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 16, 2014 at 7:46 AM, Brian Paul <span dir="ltr"><<a href="mailto:brianp@vmware.com" target="_blank">brianp@vmware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 12/15/2014 06:22 PM, Laura Ekstrand wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
src/mapi/glapi/gen/ARB_direct_<u></u>state_access.xml | 14 +++<br>
src/mesa/main/texparam.c | 136 ++++++++++++++++++++-----<br>
src/mesa/main/texparam.h | 9 ++<br>
3 files changed, 131 insertions(+), 28 deletions(-)<br>
<br>
diff --git a/src/mapi/glapi/gen/ARB_<u></u>direct_state_access.xml b/src/mapi/glapi/gen/ARB_<u></u>direct_state_access.xml<br>
index 9658fd1..c4213eb 100644<br>
--- a/src/mapi/glapi/gen/ARB_<u></u>direct_state_access.xml<br>
+++ b/src/mapi/glapi/gen/ARB_<u></u>direct_state_access.xml<br>
@@ -116,5 +116,19 @@<br>
<param name="texture" type="GLuint" /><br>
</function><br>
<br>
+ <function name="<u></u>GetTextureLevelParameterfv" offset="assign"><br>
+ <param name="texture" type="GLuint" /><br>
+ <param name="level" type="GLint" /><br>
+ <param name="pname" type="GLenum" /><br>
+ <param name="params" type="GLfloat *" /><br>
+ </function><br>
+<br>
+ <function name="<u></u>GetTextureLevelParameteriv" offset="assign"><br>
+ <param name="texture" type="GLuint" /><br>
+ <param name="level" type="GLint" /><br>
+ <param name="pname" type="GLenum" /><br>
+ <param name="params" type="GLint *" /><br>
+ </function><br>
+<br>
</category><br>
</OpenGLAPI><br>
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c<br>
index 6e3a877..51fbd2a 100644<br>
--- a/src/mesa/main/texparam.c<br>
+++ b/src/mesa/main/texparam.c<br>
@@ -1285,7 +1285,8 @@ static void<br>
get_tex_level_parameter_image(<u></u>struct gl_context *ctx,<br>
const struct gl_texture_object *texObj,<br>
GLenum target, GLint level,<br>
- GLenum pname, GLint *params)<br>
+ GLenum pname, GLint *params,<br>
+ const char *func)<br>
{<br>
const struct gl_texture_image *img = NULL;<br>
struct gl_texture_image dummy_image;<br>
@@ -1400,7 +1401,7 @@ get_tex_level_parameter_image(<u></u>struct gl_context *ctx,<br>
}<br>
else {<br>
_mesa_error(ctx, GL_INVALID_OPERATION,<br>
- "glGetTexLevelParameter[if]v(<u></u>pname)");<br>
+ "%s(pname)", func);<br>
}<br>
break;<br>
case GL_TEXTURE_COMPRESSED:<br>
@@ -1448,7 +1449,7 @@ get_tex_level_parameter_image(<u></u>struct gl_context *ctx,<br>
<br>
invalid_pname:<br>
_mesa_error(ctx, GL_INVALID_ENUM,<br>
- "glGetTexLevelParameter[if]v(<u></u>pname=%s)",<br>
+ "%s(pname=%s)", func,<br>
_mesa_lookup_enum_by_nr(pname)<u></u>);<br>
}<br>
<br>
@@ -1456,7 +1457,8 @@ invalid_pname:<br>
static void<br>
get_tex_level_parameter_<u></u>buffer(struct gl_context *ctx,<br>
const struct gl_texture_object *texObj,<br>
- GLenum pname, GLint *params)<br>
+ GLenum pname, GLint *params,<br>
+ const char *func)<br>
{<br>
const struct gl_buffer_object *bo = texObj->BufferObject;<br>
mesa_format texFormat = texObj->_BufferObjectFormat;<br>
@@ -1531,7 +1533,7 @@ get_tex_level_parameter_<u></u>buffer(struct gl_context *ctx,<br>
case GL_TEXTURE_COMPRESSED_IMAGE_<u></u>SIZE:<br>
/* Always illegal for GL_TEXTURE_BUFFER */<br>
_mesa_error(ctx, GL_INVALID_OPERATION,<br>
- "glGetTexLevelParameter[if]v(<u></u>pname)");<br>
+ "%s(pname)", func);<br>
break;<br>
<br>
/* GL_ARB_texture_float */<br>
@@ -1559,57 +1561,135 @@ get_tex_level_parameter_<u></u>buffer(struct gl_context *ctx,<br>
<br>
invalid_pname:<br>
_mesa_error(ctx, GL_INVALID_ENUM,<br>
- "glGetTexLevelParameter[if]v(<u></u>pname=%s)",<br>
+ "%s(pname=%s)", func,<br>
_mesa_lookup_enum_by_nr(pname)<u></u>);<br>
}<br>
<br>
<br>
+static bool<br>
+levels_valid( struct gl_context *ctx, GLenum target, GLint level,<br>
+ const char *func)<br>
</blockquote>
<br></div></div>
s/levels/level/ and add a comment on the function?<span class=""><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+{<br>
+ GLint maxLevels;<br>
+<br>
+ /* Need this because glGetTexLevelParameteri and f are different. We don't<br>
+ * want to keep track of both the dsa flag and iv, i, f, etc. That's too<br>
+ * much work. */<br>
+ bool dsa = strstr(func, "Texture") ? true : false;<br>
</blockquote>
<br></span>
This seems kind of clunky.<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
+ if (ctx->Texture.CurrentUnit >= ctx->Const.<u></u>MaxCombinedTextureImageUnits) {<br>
+ _mesa_error(ctx, GL_INVALID_OPERATION,<br>
+ "%s(current unit)", func);<br>
+ return false;<br>
+ }<br>
+<br>
+ if (!legal_get_tex_level_<u></u>parameter_target(ctx, target, dsa)) {<br>
+ _mesa_error(ctx, GL_INVALID_ENUM,<br>
+ "%s(target=0x%x)", func, target);<br>
+ return false;<br>
+ }<br>
+<br>
+ maxLevels = _mesa_max_texture_levels(ctx, target);<br>
+ assert(maxLevels != 0);<br>
+<br>
+ if (level < 0 || level >= maxLevels) {<br>
+ _mesa_error( ctx, GL_INVALID_VALUE, "%s", func );<br>
+ return false;<br>
+ }<br>
+<br>
+ return true;<br>
+}<br>
+<br>
+/**<br>
+ * This isn't exposed to the rest of the driver because it is a part of the<br>
+ * OpenGL API that is rarely used.<br>
+ */<br>
+static void<br>
+get_tex_level_parameteriv( struct gl_context *ctx,<br>
+ struct gl_texture_object *texObj,<br>
+ GLenum target, GLint level,<br>
+ GLenum pname, GLint *params,<br>
+ const char *func )<br>
+{<br>
+ if (!levels_valid(ctx, target, level, func))<br>
+ return;<br>
+<br>
+ if (target == GL_TEXTURE_BUFFER) {<br>
+ get_tex_level_parameter_<u></u>buffer(ctx, texObj, pname, params, func);<br>
+ }<br>
+ else {<br>
+ get_tex_level_parameter_image(<u></u>ctx, texObj, target,<br>
+ level, pname, params, func);<br>
+ }<br>
+}<br>
+<br>
void GLAPIENTRY<br>
_mesa_GetTexLevelParameterfv( GLenum target, GLint level,<br>
GLenum pname, GLfloat *params )<br>
{<br>
+ struct gl_texture_object *texObj;<br>
GLint iparam;<br>
- _mesa_GetTexLevelParameteriv( target, level, pname, &iparam );<br>
+ GET_CURRENT_CONTEXT(ctx);<br>
+<br>
+ texObj = _mesa_get_current_tex_object(<u></u>ctx, target);<br>
+ if (!texObj)<br>
+ return;<br>
+<br>
+ get_tex_level_parameteriv(ctx, texObj, target, level,<br>
+ pname, &iparam, "glGetTexLevelParameterfv");<br>
+<br>
*params = (GLfloat) iparam;<br>
}<br>
<br>
-<br>
void GLAPIENTRY<br>
_mesa_GetTexLevelParameteriv( GLenum target, GLint level,<br>
GLenum pname, GLint *params )<br>
{<br>
struct gl_texture_object *texObj;<br>
- GLint maxLevels;<br>
GET_CURRENT_CONTEXT(ctx);<br>
<br>
- if (ctx->Texture.CurrentUnit >= ctx->Const.<u></u>MaxCombinedTextureImageUnits) {<br>
- _mesa_error(ctx, GL_INVALID_OPERATION,<br>
- "glGetTexLevelParameteriv(<u></u>current unit)");<br>
+ texObj = _mesa_get_current_tex_object(<u></u>ctx, target);<br>
+ if (!texObj)<br>
return;<br>
- }<br>
<br>
- if (!legal_get_tex_level_<u></u>parameter_target(ctx, target, false)) {<br>
- _mesa_error(ctx, GL_INVALID_ENUM,<br>
- "glGetTexLevelParameter[if]v(<u></u>target=0x%x)", target);<br>
- return;<br>
- }<br>
+ get_tex_level_parameteriv(ctx, texObj, target, level,<br>
+ pname, params, "glGetTexLevelParameteriv");<br>
+}<br>
<br>
- maxLevels = _mesa_max_texture_levels(ctx, target);<br>
- assert(maxLevels != 0);<br>
+void GLAPIENTRY<br>
+_mesa_<u></u>GetTextureLevelParameterfv( GLuint texture, GLint level,<br>
+ GLenum pname, GLfloat *params )<br>
+{<br>
+ struct gl_texture_object *texObj;<br>
+ GLint iparam;<br>
+ GET_CURRENT_CONTEXT(ctx);<br>
<br>
- if (level < 0 || level >= maxLevels) {<br>
- _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexLevelParameter[if]v" );<br>
+ texObj = _mesa_lookup_texture_err(ctx, texture,<br>
+ "glGetTextureLevelParameterfv"<u></u>);<br>
+ if (!texObj)<br>
return;<br>
- }<br>
<br>
- texObj = _mesa_get_current_tex_object(<u></u>ctx, target);<br>
+ get_tex_level_parameteriv(ctx, texObj, texObj->Target, level,<br>
+ pname, &iparam, "glGetTextureLevelParameterfv"<u></u>);<br>
<br>
- if (target == GL_TEXTURE_BUFFER)<br>
- get_tex_level_parameter_<u></u>buffer(ctx, texObj, pname, params);<br>
- else<br>
- get_tex_level_parameter_image(<u></u>ctx, texObj, target, level, pname, params);<br>
+ *params = (GLfloat) iparam;<br>
}<br>
<br>
+void GLAPIENTRY<br>
+_mesa_<u></u>GetTextureLevelParameteriv( GLuint texture, GLint level,<br>
+ GLenum pname, GLint *params )<br>
+{<br>
+ struct gl_texture_object *texObj;<br>
+ GET_CURRENT_CONTEXT(ctx);<br>
+<br>
+ texObj = _mesa_lookup_texture_err(ctx, texture,<br>
+ "glGetTextureLevelParameteriv"<u></u>);<br>
+ if (!texObj)<br>
+ return;<br>
+<br>
+ get_tex_level_parameteriv(ctx, texObj, texObj->Target, level,<br>
+ pname, params, "glGetTextureLevelParameteriv"<u></u>);<br>
+}<br>
<br>
void GLAPIENTRY<br>
_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )<br>
diff --git a/src/mesa/main/texparam.h b/src/mesa/main/texparam.h<br>
index a2fb3ff..05aeb8a 100644<br>
--- a/src/mesa/main/texparam.h<br>
+++ b/src/mesa/main/texparam.h<br>
@@ -81,6 +81,15 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,<br>
GLenum pname, GLint *params );<br>
<br>
extern void GLAPIENTRY<br>
+_mesa_<u></u>GetTextureLevelParameterfv( GLuint texture, GLint level,<br>
+ GLenum pname, GLfloat *params );<br>
+<br>
+extern void GLAPIENTRY<br>
+_mesa_<u></u>GetTextureLevelParameteriv( GLuint texture, GLint level,<br>
+ GLenum pname, GLint *params );<br>
+<br>
+<br>
+extern void GLAPIENTRY<br>
_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params );<br>
<br>
extern void GLAPIENTRY<br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div>