mirror of
https://github.com/X11Libre/xserver.git
synced 2026-11-05 03:45:42 +00:00
glx: use rpcbuf reply path in GetCompressedTexImage / GetProgramString
Convert the GetCompressedTexImage (indirect_texture_compression.c) and GetProgramString (indirect_program.c) handlers, including their swapped variants, to the rpcbuf reply path. The image/string payload is a raw byte stream (x_rpcbuf_write_binary_pad()); X_SEND_REPLY_WITH_RPCBUF() derives the length and swaps the header, and the width field is swapped via X_REPLY_FIELD_CARD32() (keyed on client->swapped). This removes the __GLX_BEGIN_REPLY/__GLX_SEND_HEADER/__GLX_SEND_VOID_ARRAY macros and the explicit do_swap handling of the reply. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
548e3e5349
commit
1fced9e85f
2 changed files with 21 additions and 42 deletions
|
|
@ -66,7 +66,7 @@ DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte * pc,
|
|||
GLenum pname;
|
||||
GLint compsize = 0;
|
||||
char *answer = NULL, answerBuffer[200];
|
||||
xGLXSingleReply reply = { 0, };
|
||||
xGLXGetTexImageReply reply = { 0 };
|
||||
|
||||
if (do_swap) {
|
||||
target = (GLenum) bswap_32(*(int *) (pc + 0));
|
||||
|
|
@ -89,24 +89,14 @@ DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte * pc,
|
|||
get_program_string(target, pname, (GLubyte *) answer);
|
||||
}
|
||||
|
||||
if (__glXErrorOccured()) {
|
||||
__GLX_BEGIN_REPLY(0);
|
||||
if (do_swap)
|
||||
__GLX_SWAP_REPLY_HEADER();
|
||||
__GLX_SEND_HEADER();
|
||||
}
|
||||
else {
|
||||
__GLX_BEGIN_REPLY(compsize);
|
||||
((xGLXGetTexImageReply *) &reply)->width = compsize;
|
||||
if (do_swap) {
|
||||
__GLX_SWAP_REPLY_HEADER();
|
||||
swapl(&((xGLXGetTexImageReply *) &reply)->width);
|
||||
}
|
||||
__GLX_SEND_HEADER();
|
||||
__GLX_SEND_VOID_ARRAY(compsize);
|
||||
x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE };
|
||||
if (!__glXErrorOccured()) {
|
||||
reply.width = compsize;
|
||||
X_REPLY_FIELD_CARD32(width);
|
||||
x_rpcbuf_write_binary_pad(&rpcbuf, answer, compsize);
|
||||
}
|
||||
|
||||
error = Success;
|
||||
error = X_SEND_REPLY_WITH_RPCBUF(client, reply, rpcbuf);
|
||||
}
|
||||
|
||||
return error;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ __glXDisp_GetCompressedTexImage(struct __GLXclientStateRec *cl, GLbyte * pc)
|
|||
const GLint level = *(GLint *) (pc + 4);
|
||||
GLint compsize = 0;
|
||||
char *answer = NULL, answerBuffer[200];
|
||||
xGLXSingleReply reply = { 0, };
|
||||
xGLXGetTexImageReply reply = { 0 };
|
||||
|
||||
glGetTexLevelParameteriv(target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE,
|
||||
&compsize);
|
||||
|
|
@ -63,18 +63,14 @@ __glXDisp_GetCompressedTexImage(struct __GLXclientStateRec *cl, GLbyte * pc)
|
|||
GetCompressedTexImageARB(target, level, answer);
|
||||
}
|
||||
|
||||
if (__glXErrorOccured()) {
|
||||
__GLX_BEGIN_REPLY(0);
|
||||
__GLX_SEND_HEADER();
|
||||
}
|
||||
else {
|
||||
__GLX_BEGIN_REPLY(compsize);
|
||||
((xGLXGetTexImageReply *) &reply)->width = compsize;
|
||||
__GLX_SEND_HEADER();
|
||||
__GLX_SEND_VOID_ARRAY(compsize);
|
||||
x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE };
|
||||
if (!__glXErrorOccured()) {
|
||||
reply.width = compsize;
|
||||
X_REPLY_FIELD_CARD32(width);
|
||||
x_rpcbuf_write_binary_pad(&rpcbuf, answer, compsize);
|
||||
}
|
||||
|
||||
error = Success;
|
||||
error = X_SEND_REPLY_WITH_RPCBUF(client, reply, rpcbuf);
|
||||
}
|
||||
|
||||
return error;
|
||||
|
|
@ -97,7 +93,7 @@ __glXDispSwap_GetCompressedTexImage(struct __GLXclientStateRec *cl, GLbyte * pc)
|
|||
const GLint level = (GLint) bswap_32(*(int *) (pc + 4));
|
||||
GLint compsize = 0;
|
||||
char *answer = NULL, answerBuffer[200];
|
||||
xGLXSingleReply reply = { 0, };
|
||||
xGLXGetTexImageReply reply = { 0 };
|
||||
|
||||
glGetTexLevelParameteriv(target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE,
|
||||
&compsize);
|
||||
|
|
@ -110,21 +106,14 @@ __glXDispSwap_GetCompressedTexImage(struct __GLXclientStateRec *cl, GLbyte * pc)
|
|||
GetCompressedTexImageARB(target, level, answer);
|
||||
}
|
||||
|
||||
if (__glXErrorOccured()) {
|
||||
__GLX_BEGIN_REPLY(0);
|
||||
__GLX_SWAP_REPLY_HEADER();
|
||||
__GLX_SEND_HEADER();
|
||||
}
|
||||
else {
|
||||
__GLX_BEGIN_REPLY(compsize);
|
||||
((xGLXGetTexImageReply *) &reply)->width = compsize;
|
||||
__GLX_SWAP_REPLY_HEADER();
|
||||
swapl(&((xGLXGetTexImageReply *) &reply)->width);
|
||||
__GLX_SEND_HEADER();
|
||||
__GLX_SEND_VOID_ARRAY(compsize);
|
||||
x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE };
|
||||
if (!__glXErrorOccured()) {
|
||||
reply.width = compsize;
|
||||
X_REPLY_FIELD_CARD32(width);
|
||||
x_rpcbuf_write_binary_pad(&rpcbuf, answer, compsize);
|
||||
}
|
||||
|
||||
error = Success;
|
||||
error = X_SEND_REPLY_WITH_RPCBUF(client, reply, rpcbuf);
|
||||
}
|
||||
|
||||
return error;
|
||||
|
|
|
|||
Loading…
Reference in a new issue