1cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson/* 2cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * (C) Copyright IBM Corporation 2004 3cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * All Rights Reserved. 4cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * 5cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * Permission is hereby granted, free of charge, to any person obtaining a 6cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * copy of this software and associated documentation files (the "Software"), 7cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * to deal in the Software without restriction, including without limitation 8cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * on the rights to use, copy, modify, merge, publish, distribute, sub 9cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * license, and/or sell copies of the Software, and to permit persons to whom 10cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * the Software is furnished to do so, subject to the following conditions: 11cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * 12cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * The above copyright notice and this permission notice (including the next 13cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * paragraph) shall be included in all copies or substantial portions of the 14cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * Software. 15cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * 16cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 19cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 20cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 21cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 22cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * USE OR OTHER DEALINGS IN THE SOFTWARE. 23cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson */ 24cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson 25cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson/** 26cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * \file glx_texture_compression.c 27cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * Contains the routines required to implement GLX protocol for 28cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * ARB_texture_compression and related extensions. 29cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * 30cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * \sa http://oss.sgi.com/projects/ogl-sample/registry/ARB/texture_compression.txt 31cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * 32cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * \author Ian Romanick <idr@us.ibm.com> 33cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson */ 34cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson 35cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson#include "packrender.h" 36cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson#include "packsingle.h" 37f434e07a6ac849cd127d70eee8b3349da7cfb360Ian Romanick#include "indirect.h" 38cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson 39cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson#include <assert.h> 40cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson 41cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson 42cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jacksonvoid 431a1db1746db82efc7f0643508886dfc78a15eb71Paul Berry__indirect_glGetCompressedTexImage(GLenum target, GLint level, 4464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLvoid * img) 45cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson{ 4664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_SINGLE_DECLARE_VARIABLES(); 4764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf xGLXGetTexImageReply reply; 4864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf size_t image_bytes; 4964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf 5064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_SINGLE_LOAD_VARIABLES(); 5164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_SINGLE_BEGIN(X_GLsop_GetCompressedTexImage, 8); 5264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_SINGLE_PUT_LONG(0, target); 5364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_SINGLE_PUT_LONG(4, level); 5464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_SINGLE_READ_XREPLY(); 5564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf 5664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf image_bytes = reply.width; 5764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf assert(image_bytes <= ((4 * reply.length) - 0)); 5864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf assert(image_bytes >= ((4 * reply.length) - 3)); 5964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf 6064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf if (image_bytes != 0) { 6164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf _XRead(dpy, (char *) img, image_bytes); 6264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf if (image_bytes < (4 * reply.length)) { 6364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf _XEatData(dpy, (4 * reply.length) - image_bytes); 6464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 6564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 6664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf 6764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_SINGLE_END(); 68cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson} 69cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson 70cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson 71cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson/** 72cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * Internal function used for \c glCompressedTexImage1D and 73cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * \c glCompressedTexImage2D. 74cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson */ 75cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jacksonstatic void 7664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, KristófCompressedTexImage1D2D(GLenum target, GLint level, 7764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLenum internal_format, 7864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLsizei width, GLsizei height, 7964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLint border, GLsizei image_size, 8064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf const GLvoid * data, CARD32 rop) 81cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson{ 8264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_DECLARE_VARIABLES(); 8364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf 8464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_LOAD_VARIABLES(); 8564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf if (gc->currentDpy == NULL) { 8664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf return; 8764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 8864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf 8964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf if ((target == GL_PROXY_TEXTURE_1D) 9064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf || (target == GL_PROXY_TEXTURE_2D) 9164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf || (target == GL_PROXY_TEXTURE_CUBE_MAP)) { 9264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf compsize = 0; 9364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 9464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf else { 9564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf compsize = image_size; 9664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 9764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf 9864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf cmdlen = __GLX_PAD(__GLX_COMPRESSED_TEXIMAGE_CMD_HDR_SIZE + compsize); 9964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf if (cmdlen <= gc->maxSmallRenderCommandSize) { 10064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_BEGIN_VARIABLE(rop, cmdlen); 10164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(4, target); 10264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(8, level); 10364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(12, internal_format); 10464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(16, width); 10564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(20, height); 10664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(24, border); 10764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(28, image_size); 10864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf if (compsize != 0) { 10964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_CHAR_ARRAY(__GLX_COMPRESSED_TEXIMAGE_CMD_HDR_SIZE, 11064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf data, image_size); 11164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 11264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_END(cmdlen); 11364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 11464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf else { 11564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf assert(compsize != 0); 11664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf 11764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_BEGIN_VARIABLE_LARGE(rop, cmdlen + 4); 11864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(8, target); 11964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(12, level); 12064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(16, internal_format); 12164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(20, width); 12264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(24, height); 12364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(28, border); 12464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(32, image_size); 12564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __glXSendLargeCommand(gc, gc->pc, 12664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_COMPRESSED_TEXIMAGE_CMD_HDR_SIZE + 4, 12764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf data, image_size); 12864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 129cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson} 130cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson 131cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson 132cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson/** 133cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * Internal function used for \c glCompressedTexSubImage1D and 134cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson * \c glCompressedTexSubImage2D. 135cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson */ 136cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jacksonstatic void 13764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, KristófCompressedTexSubImage1D2D(GLenum target, GLint level, 13864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLsizei xoffset, GLsizei yoffset, 13964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLsizei width, GLsizei height, 14064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLenum format, GLsizei image_size, 14164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf const GLvoid * data, CARD32 rop) 142cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson{ 14364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_DECLARE_VARIABLES(); 14464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf 14564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_LOAD_VARIABLES(); 14664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf if (gc->currentDpy == NULL) { 14764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf return; 14864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 14964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf 15064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf if (target == GL_PROXY_TEXTURE_3D) { 15164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf compsize = 0; 15264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 15364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf else { 15464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf compsize = image_size; 15564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 15664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf 15764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf cmdlen = __GLX_PAD(__GLX_COMPRESSED_TEXSUBIMAGE_CMD_HDR_SIZE + compsize); 15864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf if (cmdlen <= gc->maxSmallRenderCommandSize) { 15964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_BEGIN_VARIABLE(rop, cmdlen); 16064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(4, target); 16164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(8, level); 16264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(12, xoffset); 16364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(16, yoffset); 16464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(20, width); 16564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(24, height); 16664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(28, format); 16764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(32, image_size); 16864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf if (compsize != 0) { 16964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_CHAR_ARRAY(__GLX_COMPRESSED_TEXSUBIMAGE_CMD_HDR_SIZE, 17064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf data, image_size); 17164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 17264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_END(cmdlen); 17364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 17464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf else { 17564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf assert(compsize != 0); 17664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf 17764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_BEGIN_VARIABLE_LARGE(rop, cmdlen + 4); 17864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(8, target); 17964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(12, level); 18064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(16, xoffset); 18164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(20, yoffset); 18264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(24, width); 18364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(28, height); 18464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(32, format); 18564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(36, image_size); 18664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __glXSendLargeCommand(gc, gc->pc, 18764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_COMPRESSED_TEXSUBIMAGE_CMD_HDR_SIZE + 4, 18864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf data, image_size); 18964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 190cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson} 191cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson 192cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson 193cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jacksonvoid 1941a1db1746db82efc7f0643508886dfc78a15eb71Paul Berry__indirect_glCompressedTexImage1D(GLenum target, GLint level, 19564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLenum internal_format, GLsizei width, 19664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLint border, GLsizei image_size, 19764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf const GLvoid * data) 198cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson{ 19964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf CompressedTexImage1D2D(target, level, internal_format, width, 0, 20064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf border, image_size, data, 20164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf X_GLrop_CompressedTexImage1D); 202cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson} 203cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson 204cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson 205cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jacksonvoid 2061a1db1746db82efc7f0643508886dfc78a15eb71Paul Berry__indirect_glCompressedTexImage2D(GLenum target, GLint level, 20764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLenum internal_format, 20864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLsizei width, GLsizei height, 20964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLint border, GLsizei image_size, 21064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf const GLvoid * data) 211cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson{ 21264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf CompressedTexImage1D2D(target, level, internal_format, width, height, 21364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf border, image_size, data, 21464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf X_GLrop_CompressedTexImage2D); 215cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson} 216cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson 217cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson 218cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jacksonvoid 2191a1db1746db82efc7f0643508886dfc78a15eb71Paul Berry__indirect_glCompressedTexImage3D(GLenum target, GLint level, 22064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLenum internal_format, 22164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLsizei width, GLsizei height, 22264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLsizei depth, GLint border, 22364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLsizei image_size, const GLvoid * data) 224cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson{ 22564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_DECLARE_VARIABLES(); 22664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf 22764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_LOAD_VARIABLES(); 22864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf if (gc->currentDpy == NULL) { 22964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf return; 23064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 23164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf 23264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf cmdlen = __GLX_PAD(__GLX_COMPRESSED_TEXIMAGE_3D_CMD_HDR_SIZE + image_size); 23364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf if (cmdlen <= gc->maxSmallRenderCommandSize) { 23464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_BEGIN_VARIABLE(X_GLrop_CompressedTexImage3D, cmdlen); 23564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(4, target); 23664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(8, level); 23764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(12, internal_format); 23864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(16, width); 23964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(20, height); 24064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(24, depth); 24164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(28, border); 24264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(32, image_size); 24364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf if (image_size != 0) { 24464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_CHAR_ARRAY(__GLX_COMPRESSED_TEXIMAGE_3D_CMD_HDR_SIZE, 24564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf data, image_size); 24664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 24764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_END(cmdlen); 24864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 24964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf else { 25064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_CompressedTexImage3D, cmdlen + 4); 25164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(8, target); 25264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(12, level); 25364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(16, internal_format); 25464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(20, width); 25564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(24, height); 25664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(28, depth); 25764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(32, border); 25864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(36, image_size); 25964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __glXSendLargeCommand(gc, gc->pc, 26064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_COMPRESSED_TEXIMAGE_3D_CMD_HDR_SIZE + 4, 26164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf data, image_size); 26264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 263cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson} 264cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson 265cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson 266cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jacksonvoid 2671a1db1746db82efc7f0643508886dfc78a15eb71Paul Berry__indirect_glCompressedTexSubImage1D(GLenum target, GLint level, 26864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLint xoffset, 26964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLsizei width, 27064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLenum format, GLsizei image_size, 27164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf const GLvoid * data) 272cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson{ 27364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf CompressedTexSubImage1D2D(target, level, xoffset, 0, width, 0, 27464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf format, image_size, data, 27564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf X_GLrop_CompressedTexSubImage1D); 276cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson} 277cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson 278cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson 279cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jacksonvoid 2801a1db1746db82efc7f0643508886dfc78a15eb71Paul Berry__indirect_glCompressedTexSubImage2D(GLenum target, GLint level, 28164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLint xoffset, GLint yoffset, 28264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLsizei width, GLsizei height, 28364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLenum format, GLsizei image_size, 28464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf const GLvoid * data) 285cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson{ 28664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf CompressedTexSubImage1D2D(target, level, xoffset, yoffset, width, height, 28764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf format, image_size, data, 28864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf X_GLrop_CompressedTexSubImage2D); 289cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson} 290cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson 291cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson 292cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jacksonvoid 2931a1db1746db82efc7f0643508886dfc78a15eb71Paul Berry__indirect_glCompressedTexSubImage3D(GLenum target, GLint level, 29464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLint xoffset, GLint yoffset, 29564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLint zoffset, GLsizei width, 29664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLsizei height, GLsizei depth, 29764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf GLenum format, GLsizei image_size, 29864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf const GLvoid * data) 299cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson{ 30064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_DECLARE_VARIABLES(); 30164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf 30264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_LOAD_VARIABLES(); 30364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf if (gc->currentDpy == NULL) { 30464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf return; 30564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 30664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf 30764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf cmdlen = __GLX_PAD(__GLX_COMPRESSED_TEXSUBIMAGE_3D_CMD_HDR_SIZE 30864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf + image_size); 30964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf if (cmdlen <= gc->maxSmallRenderCommandSize) { 31064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_BEGIN_VARIABLE(X_GLrop_CompressedTexSubImage3D, cmdlen); 31164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(4, target); 31264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(8, level); 31364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(12, xoffset); 31464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(16, yoffset); 31564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(20, zoffset); 31664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(24, width); 31764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(28, height); 31864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(32, depth); 31964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(36, format); 32064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(40, image_size); 32164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf if (image_size != 0) { 32264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_CHAR_ARRAY(__GLX_COMPRESSED_TEXSUBIMAGE_3D_CMD_HDR_SIZE, 32364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf data, image_size); 32464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 32564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_END(cmdlen); 32664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 32764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf else { 32864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_BEGIN_VARIABLE_LARGE(X_GLrop_CompressedTexSubImage3D, cmdlen + 4); 32964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(8, target); 33064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(12, level); 33164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(16, xoffset); 33264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(20, yoffset); 33364d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(24, zoffset); 33464d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(28, width); 33564d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(32, height); 33664d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(36, depth); 33764d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(40, format); 33864d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_PUT_LONG(44, image_size); 33964d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __glXSendLargeCommand(gc, gc->pc, 34064d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf __GLX_COMPRESSED_TEXSUBIMAGE_3D_CMD_HDR_SIZE + 4, 34164d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf data, image_size); 34264d1c10e6c471b81da383b9900d2fc98a7e873d0RALOVICH, Kristóf } 343cb3610e37c4c0a40520441b8515d044dabcc8854Adam Jackson} 344