<div dir="ltr"><div>These comments have been addressed: <a href="http://cgit.freedesktop.org/~ldeks/mesa/commit/?h=adsa-textures&id=8309dd6981a4d3e007437a860e5a45a823bf04cf">http://cgit.freedesktop.org/~ldeks/mesa/commit/?h=adsa-textures&id=8309dd6981a4d3e007437a860e5a45a823bf04cf</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:45 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 | 32 +++++<br>
src/mesa/main/teximage.c | 170 ++++++++++++++++++-------<br>
src/mesa/main/teximage.h | 21 +++<br>
3 files changed, 177 insertions(+), 46 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 fd154de..eef6536 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>
@@ -75,6 +75,38 @@<br>
<param name="pixels" type="const GLvoid *" /><br>
</function><br>
<br>
+ <function name="CopyTextureSubImage1D" offset="assign"><br>
+ <param name="texture" type="GLuint" /><br>
+ <param name="level" type="GLint" /><br>
+ <param name="xoffset" type="GLint" /><br>
+ <param name="x" type="GLint" /><br>
+ <param name="y" type="GLint" /><br>
+ <param name="width" type="GLsizei" /><br>
+ </function><br>
+<br>
+ <function name="CopyTextureSubImage2D" offset="assign"><br>
+ <param name="texture" type="GLuint" /><br>
+ <param name="level" type="GLint" /><br>
+ <param name="xoffset" type="GLint" /><br>
+ <param name="yoffset" type="GLint" /><br>
+ <param name="x" type="GLint" /><br>
+ <param name="y" type="GLint" /><br>
+ <param name="width" type="GLsizei" /><br>
+ <param name="height" type="GLsizei" /><br>
+ </function><br>
+<br>
+ <function name="CopyTextureSubImage3D" offset="assign"><br>
+ <param name="texture" type="GLuint" /><br>
+ <param name="level" type="GLint" /><br>
+ <param name="xoffset" type="GLint" /><br>
+ <param name="yoffset" type="GLint" /><br>
+ <param name="zoffset" type="GLint" /><br>
+ <param name="x" type="GLint" /><br>
+ <param name="y" type="GLint" /><br>
+ <param name="width" type="GLsizei" /><br>
+ <param name="height" type="GLsizei" /><br>
+ </function><br>
+<br>
<function name="TextureParameterf" offset="assign"><br>
<param name="texture" type="GLuint" /><br>
<param name="pname" type="GLenum" /><br>
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c<br>
index cfb6297..73e7f4b 100644<br>
--- a/src/mesa/main/teximage.c<br>
+++ b/src/mesa/main/teximage.c<br>
@@ -2729,14 +2729,13 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,<br>
*/<br>
static GLboolean<br>
copytexsubimage_error_check(<u></u>struct gl_context *ctx, GLuint dimensions,<br>
+ struct gl_texture_object *texObj,<br>
</blockquote>
<br></div></div>
can texObj be const-qualified?<br>
<br>
<br>
I'm stopping with reviewing here at patch 27 for now.<span class=""><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
GLenum target, GLint level,<br>
GLint xoffset, GLint yoffset, GLint zoffset,<br>
- GLint width, GLint height)<br>
+ GLint width, GLint height, bool dsa)<br>
{<br>
- struct gl_texture_object *texObj;<br>
struct gl_texture_image *texImage;<br>
<br>
-<br>
/* Check that the source buffer is complete */<br>
if (_mesa_is_user_fbo(ctx-><u></u>ReadBuffer)) {<br>
if (ctx->ReadBuffer->_Status == 0) {<br>
@@ -2744,36 +2743,39 @@ copytexsubimage_error_check(<u></u>struct gl_context *ctx, GLuint dimensions,<br>
}<br>
if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {<br>
_mesa_error(ctx, GL_INVALID_FRAMEBUFFER_<u></u>OPERATION_EXT,<br>
- "glCopyTexImage%dD(invalid readbuffer)", dimensions);<br>
+ "glCopyTex%sSubImage%dD(<u></u>invalid readbuffer)",<br>
+ dsa ? "ture" : "", dimensions);<br>
</blockquote>
<br></span>
Again, a local var storing the function name would be cleaner, imho.<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">
return GL_TRUE;<br>
}<br>
<br>
if (ctx->ReadBuffer->Visual.<u></u>samples > 0) {<br>
- _mesa_error(ctx, GL_INVALID_OPERATION,<br>
- "glCopyTexSubImage%dD(<u></u>multisample FBO)",<br>
- dimensions);<br>
- return GL_TRUE;<br>
+ _mesa_error(ctx, GL_INVALID_OPERATION,<br>
+ "glCopyTex%sSubImage%dD(<u></u>multisample FBO)", dsa ? "ture" : "",<br>
+ dimensions);<br>
+ return GL_TRUE;<br>
}<br>
}<br>
<br>
/* check target (proxies not allowed) */<br>
- if (!legal_texsubimage_target(<u></u>ctx, dimensions, target, false)) {<br>
- _mesa_error(ctx, GL_INVALID_ENUM, "glCopyTexImage%uD(target=%s)"<u></u>,<br>
- dimensions, _mesa_lookup_enum_by_nr(<u></u>target));<br>
+ if (!legal_texsubimage_target(<u></u>ctx, dimensions, target, dsa)) {<br>
+ _mesa_error(ctx, GL_INVALID_ENUM, "glCopyTex%sSubImage%uD(<u></u>target=%s)",<br>
+ dsa ? "ture" : "", dimensions,<br>
+ _mesa_lookup_enum_by_nr(<u></u>target));<br>
return GL_TRUE;<br>
}<br>
<br>
/* Check level */<br>
if (level < 0 || level >= _mesa_max_texture_levels(ctx, target)) {<br>
_mesa_error(ctx, GL_INVALID_VALUE,<br>
- "glCopyTexSubImage%dD(level=%<u></u>d)", dimensions, level);<br>
+ "glCopyTex%sSubImage%dD(level=<u></u>%d)", dsa ? "ture" : "",<br>
+ dimensions, level);<br>
return GL_TRUE;<br>
}<br>
<br>
- /* Get dest texture object / image pointers */<br>
- texObj = _mesa_get_current_tex_object(<u></u>ctx, target);<br>
+ /* Get dest image pointers */<br>
if (!texObj) {<br>
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage%dD()", dimensions);<br>
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTex%sSubImage%dD()",<br>
+ dsa ? "ture" : "", dimensions);<br>
return GL_TRUE;<br>
}<br>
<br>
@@ -2781,34 +2783,38 @@ copytexsubimage_error_check(<u></u>struct gl_context *ctx, GLuint dimensions,<br>
if (!texImage) {<br>
/* destination image does not exist */<br>
_mesa_error(ctx, GL_INVALID_OPERATION,<br>
- "glCopyTexSubImage%dD(invalid texture image)", dimensions);<br>
+ "glCopyTex%sSubImage%dD(<u></u>invalid texture image)",<br>
+ dsa ? "ture" : "", dimensions);<br>
return GL_TRUE;<br>
}<br>
<br>
if (error_check_subtexture_<u></u>dimensions(ctx, dimensions, texImage,<br>
xoffset, yoffset, zoffset,<br>
- width, height, 1,<br>
- "glCopyTexSubImage")) {<br>
+ width, height, 1, dsa ?<br>
+ "glCompressedTextureSubImage" :<br>
+ "glCompressedTexSubImage")) {<br>
return GL_TRUE;<br>
}<br>
<br>
if (_mesa_is_format_compressed(<u></u>texImage->TexFormat)) {<br>
if (compressedteximage_only_<u></u>format(ctx, texImage->InternalFormat)) {<br>
_mesa_error(ctx, GL_INVALID_OPERATION,<br>
- "glCopyTexSubImage%dD(no compression for format)", dimensions);<br>
+ "glCopyTex%sSubImage%dD(no compression for format)",<br>
+ dsa ? "ture" : "", dimensions);<br>
return GL_TRUE;<br>
}<br>
}<br>
<br>
if (texImage->InternalFormat == GL_YCBCR_MESA) {<br>
- _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexSubImage2D");<br>
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTex%sSubImage2D",<br>
+ dsa ? "ture" : "");<br>
return GL_TRUE;<br>
}<br>
<br>
if (!_mesa_source_buffer_exists(<u></u>ctx, texImage->_BaseFormat)) {<br>
_mesa_error(ctx, GL_INVALID_OPERATION,<br>
- "glCopyTexSubImage%dD(missing readbuffer, format=0x%x)",<br>
- dimensions, texImage->_BaseFormat);<br>
+ "glCopyTex%sSubImage%dD(<u></u>missing readbuffer, format=0x%x)",<br>
+ dsa ? "ture" : "", dimensions, texImage->_BaseFormat);<br>
return GL_TRUE;<br>
}<br>
<br>
@@ -2823,10 +2829,11 @@ copytexsubimage_error_check(<u></u>struct gl_context *ctx, GLuint dimensions,<br>
struct gl_renderbuffer *rb = ctx->ReadBuffer->_<u></u>ColorReadBuffer;<br>
<br>
if (_mesa_is_format_integer_<u></u>color(rb->Format) !=<br>
- _mesa_is_format_integer_color(<u></u>texImage->TexFormat)) {<br>
- _mesa_error(ctx, GL_INVALID_OPERATION,<br>
- "glCopyTexImage%dD(integer vs non-integer)", dimensions);<br>
- return GL_TRUE;<br>
+ _mesa_is_format_integer_color(<u></u>texImage->TexFormat)) {<br>
+ _mesa_error(ctx, GL_INVALID_OPERATION,<br>
+ "glCopyTex%sSubImage%dD(<u></u>integer vs non-integer)",<br>
+ dsa ? "ture" : "", dimensions);<br>
+ return GL_TRUE;<br>
}<br>
}<br>
<br>
@@ -3920,37 +3927,37 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,<br>
x, y, width, height, border);<br>
}<br>
<br>
-<br>
-<br>
/**<br>
- * Implementation for glCopyTexSubImage1/2/3D() functions.<br>
+ * Implementation for glCopyTex(ture)SubImage1/2/3D(<u></u>) functions.<br>
*/<br>
-static void<br>
-copytexsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,<br>
- GLint xoffset, GLint yoffset, GLint zoffset,<br>
- GLint x, GLint y, GLsizei width, GLsizei height)<br>
+void<br>
+_mesa_copy_texture_sub_image(<u></u>struct gl_context *ctx, GLuint dims,<br>
+ struct gl_texture_object *texObj,<br>
+ GLenum target, GLint level,<br>
+ GLint xoffset, GLint yoffset, GLint zoffset,<br>
+ GLint x, GLint y,<br>
+ GLsizei width, GLsizei height,<br>
+ bool dsa )<br>
{<br>
- struct gl_texture_object *texObj;<br>
struct gl_texture_image *texImage;<br>
<br>
FLUSH_VERTICES(ctx, 0);<br>
<br>
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))<br>
- _mesa_debug(ctx, "glCopyTexSubImage%uD %s %d %d %d %d %d %d %d %d\n",<br>
- dims,<br>
+ _mesa_debug(ctx, "glCopyTex%sSubImage%uD %s %d %d %d %d %d %d %d %d\n",<br>
+ dsa ? "ture" : "", dims,<br>
_mesa_lookup_enum_by_nr(<u></u>target),<br>
level, xoffset, yoffset, zoffset, x, y, width, height);<br>
<br>
if (ctx->NewState & NEW_COPY_TEX_STATE)<br>
_mesa_update_state(ctx);<br>
<br>
- if (copytexsubimage_error_check(<u></u>ctx, dims, target, level,<br>
- xoffset, yoffset, zoffset, width, height)) {<br>
+ if (copytexsubimage_error_check(<u></u>ctx, dims, texObj, target, level,<br>
+ xoffset, yoffset, zoffset,<br>
+ width, height, dsa)) {<br>
return;<br>
}<br>
<br>
- texObj = _mesa_get_current_tex_object(<u></u>ctx, target);<br>
-<br>
_mesa_lock_texture(ctx, texObj);<br>
{<br>
texImage = _mesa_select_tex_image(ctx, texObj, target, level);<br>
@@ -3988,13 +3995,19 @@ copytexsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,<br>
_mesa_unlock_texture(ctx, texObj);<br>
}<br>
<br>
-<br>
void GLAPIENTRY<br>
_mesa_CopyTexSubImage1D( GLenum target, GLint level,<br>
GLint xoffset, GLint x, GLint y, GLsizei width )<br>
{<br>
+ struct gl_texture_object* texObj;<br>
GET_CURRENT_CONTEXT(ctx);<br>
- copytexsubimage(ctx, 1, target, level, xoffset, 0, 0, x, y, width, 1);<br>
+<br>
+ texObj = _mesa_get_current_tex_object(<u></u>ctx, target);<br>
+ if (!texObj)<br>
+ return;<br>
+<br>
+ _mesa_copy_texture_sub_image(<u></u>ctx, 1, texObj, target, level, xoffset, 0, 0,<br>
+ x, y, width, 1, false);<br>
}<br>
<br>
<br>
@@ -4004,9 +4017,16 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,<br>
GLint xoffset, GLint yoffset,<br>
GLint x, GLint y, GLsizei width, GLsizei height )<br>
{<br>
+ struct gl_texture_object* texObj;<br>
GET_CURRENT_CONTEXT(ctx);<br>
- copytexsubimage(ctx, 2, target, level, xoffset, yoffset, 0, x, y,<br>
- width, height);<br>
+<br>
+ texObj = _mesa_get_current_tex_object(<u></u>ctx, target);<br>
+ if (!texObj)<br>
+ return;<br>
+<br>
+ _mesa_copy_texture_sub_image(<u></u>ctx, 2, texObj, target, level,<br>
+ xoffset, yoffset, 0,<br>
+ x, y, width, height, false);<br>
}<br>
<br>
<br>
@@ -4016,9 +4036,67 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,<br>
GLint xoffset, GLint yoffset, GLint zoffset,<br>
GLint x, GLint y, GLsizei width, GLsizei height )<br>
{<br>
+ struct gl_texture_object* texObj;<br>
+ GET_CURRENT_CONTEXT(ctx);<br>
+<br>
+ texObj = _mesa_get_current_tex_object(<u></u>ctx, target);<br>
+ if (!texObj)<br>
+ return;<br>
+<br>
+ _mesa_copy_texture_sub_image(<u></u>ctx, 3, texObj, target, level,<br>
+ xoffset, yoffset, zoffset,<br>
+ x, y, width, height, false);<br>
+}<br>
+<br>
+void GLAPIENTRY<br>
+_mesa_CopyTextureSubImage1D( GLuint texture, GLint level,<br>
+ GLint xoffset, GLint x, GLint y, GLsizei width )<br>
+{<br>
+ struct gl_texture_object* texObj;<br>
+ GET_CURRENT_CONTEXT(ctx);<br>
+<br>
+ texObj = _mesa_lookup_texture_err(ctx, texture, "glCopyTextureSubImage1D");<br>
+ if (!texObj)<br>
+ return;<br>
+<br>
+ _mesa_copy_texture_sub_image(<u></u>ctx, 1, texObj, texObj->Target, level,<br>
+ xoffset, 0, 0, x, y, width, 1, true);<br>
+}<br>
+<br>
+void GLAPIENTRY<br>
+_mesa_CopyTextureSubImage2D( GLuint texture, GLint level,<br>
+ GLint xoffset, GLint yoffset,<br>
+ GLint x, GLint y, GLsizei width, GLsizei height )<br>
+{<br>
+ struct gl_texture_object* texObj;<br>
+ GET_CURRENT_CONTEXT(ctx);<br>
+<br>
+ texObj = _mesa_lookup_texture_err(ctx, texture, "glCopyTextureSubImage2D");<br>
+ if (!texObj)<br>
+ return;<br>
+<br>
+ _mesa_copy_texture_sub_image(<u></u>ctx, 2, texObj, texObj->Target, level,<br>
+ xoffset, yoffset, 0,<br>
+ x, y, width, height, true);<br>
+}<br>
+<br>
+<br>
+<br>
+void GLAPIENTRY<br>
+_mesa_CopyTextureSubImage3D( GLuint texture, GLint level,<br>
+ GLint xoffset, GLint yoffset, GLint zoffset,<br>
+ GLint x, GLint y, GLsizei width, GLsizei height )<br>
+{<br>
+ struct gl_texture_object* texObj;<br>
GET_CURRENT_CONTEXT(ctx);<br>
- copytexsubimage(ctx, 3, target, level, xoffset, yoffset, zoffset,<br>
- x, y, width, height);<br>
+<br>
+ texObj = _mesa_lookup_texture_err(ctx, texture, "glCopyTextureSubImage3D");<br>
+ if (!texObj)<br>
+ return;<br>
+<br>
+ _mesa_copy_texture_sub_image(<u></u>ctx, 3, texObj, texObj->Target, level,<br>
+ xoffset, yoffset, zoffset,<br>
+ x, y, width, height, true);<br>
}<br>
<br>
static bool<br>
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h<br>
index c014bd9..913a677 100644<br>
--- a/src/mesa/main/teximage.h<br>
+++ b/src/mesa/main/teximage.h<br>
@@ -165,6 +165,13 @@ _mesa_texture_sub_image( struct gl_context *ctx, GLuint dims,<br>
GLsizei width, GLsizei height, GLsizei depth,<br>
GLenum format, GLenum type, const GLvoid *pixels,<br>
bool dsa );<br>
+extern void<br>
+_mesa_copy_texture_sub_image( struct gl_context *ctx, GLuint dims,<br>
+ struct gl_texture_object *texObj,<br>
+ GLenum target, GLint level,<br>
+ GLint xoffset, GLint yoffset, GLint zoffset,<br>
+ GLint x, GLint y,<br>
+ GLsizei width, GLsizei height, bool dsa );<br>
/*@}*/<br>
<br>
<br>
@@ -269,7 +276,21 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,<br>
GLint xoffset, GLint yoffset, GLint zoffset,<br>
GLint x, GLint y, GLsizei width, GLsizei height );<br>
<br>
+extern void GLAPIENTRY<br>
+_mesa_CopyTextureSubImage1D( GLuint texture, GLint level,<br>
+ GLint xoffset, GLint x, GLint y, GLsizei width );<br>
<br>
+extern void GLAPIENTRY<br>
+_mesa_CopyTextureSubImage2D( GLuint texture, GLint level,<br>
+ GLint xoffset, GLint yoffset,<br>
+ GLint x, GLint y,<br>
+ GLsizei width, GLsizei height );<br>
+<br>
+extern void GLAPIENTRY<br>
+_mesa_CopyTextureSubImage3D( GLuint texture, GLint level,<br>
+ GLint xoffset, GLint yoffset, GLint zoffset,<br>
+ GLint x, GLint y,<br>
+ GLsizei width, GLsizei height );<br>
<br>
extern void GLAPIENTRY<br>
_mesa_ClearTexSubImage( GLuint texture, GLint level,<br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div>