summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--progs/demos/fbo_firecube.c15
-rw-r--r--src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc17
-rw-r--r--src/glx/x11/glx_query.c90
-rw-r--r--src/glx/x11/glxclient.h6
-rw-r--r--src/glx/x11/glxcmds.c55
-rw-r--r--src/glx/x11/glxext.c31
-rw-r--r--src/glx/x11/single2.c4
-rw-r--r--src/mesa/drivers/windows/gdi/wmesa.c7
-rw-r--r--src/mesa/shader/prog_statevars.c43
-rw-r--r--src/mesa/shader/slang/slang_codegen.c15
-rw-r--r--src/mesa/shader/slang/slang_compile.c1
-rw-r--r--src/mesa/shader/slang/slang_emit.c3
13 files changed, 240 insertions, 48 deletions
diff --git a/configure.ac b/configure.ac
index e48137f2abc..15f6068c8e0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1033,6 +1033,7 @@ else
fi
echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
fi
+echo " Use XCB: $enable_xcb"
dnl Libraries
echo ""
diff --git a/progs/demos/fbo_firecube.c b/progs/demos/fbo_firecube.c
index ed87dd133cf..f5ee82a2f11 100644
--- a/progs/demos/fbo_firecube.c
+++ b/progs/demos/fbo_firecube.c
@@ -154,6 +154,7 @@ static GLuint TexObj;
static GLuint MyFB;
static GLuint DepthRB;
static GLboolean WireFrame = GL_FALSE;
+static GLboolean Anim = GL_TRUE;
static GLint texType = 0;
static GLint T0 = 0;
@@ -163,6 +164,11 @@ static GLint Win = 0;
static GLfloat ViewRotX = 20.0, ViewRotY = 30.0, ViewRotZ = 0.0;
static GLfloat CubeRot = 0.0;
+
+static void
+idle(void);
+
+
static void
CheckError(int line)
{
@@ -561,7 +567,7 @@ drawfire(void)
printstring(GLUT_BITMAP_HELVETICA_18, texNames[texType]);
glColor3f(1.0, 0.0, 0.0);
glRasterPos2i(10, 470);
- printstring(GLUT_BITMAP_HELVETICA_10,
+ printstring(GLUT_BITMAP_HELVETICA_10,
"Fire V1.5 Written by David Bucciarelli ([email protected])");
if (help)
@@ -605,7 +611,10 @@ key(unsigned char key, int x, int y)
cleanup();
exit(0);
break;
-
+ case ' ':
+ Anim = !Anim;
+ glutIdleFunc(Anim ? idle : NULL);
+ break;
case 'a':
v += 0.0005;
break;
@@ -1013,7 +1022,7 @@ static void
visible(int vis)
{
if (vis == GLUT_VISIBLE)
- glutIdleFunc(idle);
+ glutIdleFunc(Anim ? idle : NULL);
else
glutIdleFunc(NULL);
}
diff --git a/src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc b/src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc
index 3dc16313fff..ac7ff84fc4a 100644
--- a/src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc
+++ b/src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc
@@ -103,23 +103,22 @@ bezierPatchMesh *bezierPatchMeshMake(int maptype, float umin, float umax, int us
int dimension;
int the_ustride;
int the_vstride;
-
- bezierPatchMesh *ret = (bezierPatchMesh*) malloc(sizeof(bezierPatchMesh));
- assert(ret);
- ret->bpatch = NULL;
- ret->bpatch_normal = NULL;
- ret->bpatch_color = NULL;
- ret->bpatch_texcoord = NULL;
-
if(maptype == GL_MAP2_VERTEX_3) dimension = 3;
else if (maptype==GL_MAP2_VERTEX_4) dimension = 4;
else {
fprintf(stderr, "error in inMap2f, maptype=%i is wrong, maptype,map is invalid\n", maptype);
return NULL;
}
-
+
+ bezierPatchMesh *ret = (bezierPatchMesh*) malloc(sizeof(bezierPatchMesh));
+ assert(ret);
+
+ ret->bpatch_normal = NULL;
+ ret->bpatch_color = NULL;
+ ret->bpatch_texcoord = NULL;
ret->bpatch = bezierPatchMake(umin, vmin, umax, vmax, uorder, vorder, dimension);
+
/*copy the control points there*/
the_ustride = vorder * dimension;
the_vstride = dimension;
diff --git a/src/glx/x11/glx_query.c b/src/glx/x11/glx_query.c
index 56f34951863..2789b841b1b 100644
--- a/src/glx/x11/glx_query.c
+++ b/src/glx/x11/glx_query.c
@@ -31,6 +31,70 @@
#include "glxclient.h"
+#if defined(USE_XCB)
+# include <X11/Xlib-xcb.h>
+# include <xcb/xcb.h>
+# include <xcb/glx.h>
+#endif
+
+#ifdef USE_XCB
+
+/**
+ * Exchange a protocol request for glXQueryServerString.
+ */
+char *
+__glXQueryServerString(Display* dpy,
+ int opcode,
+ CARD32 screen,
+ CARD32 name)
+{
+ xcb_connection_t *c = XGetXCBConnection(dpy);
+ xcb_glx_query_server_string_reply_t* reply =
+ xcb_glx_query_server_string_reply(c,
+ xcb_glx_query_server_string(c,
+ screen,
+ name),
+ NULL);
+
+ /* The spec doesn't mention this, but the Xorg server replies with
+ * a string already terminated with '\0'. */
+ uint32_t len = xcb_glx_query_server_string_string_length(reply);
+ char* buf = Xmalloc(len);
+ memcpy(buf, xcb_glx_query_server_string_string(reply), len);
+ free(reply);
+
+ return buf;
+}
+
+/**
+ * Exchange a protocol request for glGetString.
+ */
+char *
+__glXGetString(Display* dpy,
+ int opcode,
+ CARD32 contextTag,
+ CARD32 name)
+{
+ xcb_connection_t *c = XGetXCBConnection(dpy);
+ xcb_glx_get_string_reply_t* reply =
+ xcb_glx_get_string_reply(c,
+ xcb_glx_get_string(c,
+ contextTag,
+ name),
+ NULL);
+
+ /* The spec doesn't mention this, but the Xorg server replies with
+ * a string already terminated with '\0'. */
+ uint32_t len = xcb_glx_get_string_string_length(reply);
+ char* buf = Xmalloc(len);
+ memcpy(buf, xcb_glx_get_string_string(reply), len);
+ free(reply);
+
+ return buf;
+}
+
+#else
+
/**
* GLX protocol structure for the ficticious "GXLGenericGetString" request.
*
@@ -57,7 +121,7 @@ typedef struct GLXGenericGetString
* Query the Server GLX string.
* This routine will allocate the necessay space for the string.
*/
-char *
+static char *
__glXGetStringFromServer(Display * dpy, int opcode, CARD32 glxCode,
CARD32 for_whom, CARD32 name)
{
@@ -101,3 +165,27 @@ __glXGetStringFromServer(Display * dpy, int opcode, CARD32 glxCode,
return buf;
}
+
+char *
+__glXQueryServerString(Display* dpy,
+ int opcode,
+ CARD32 screen,
+ CARD32 name)
+{
+ return __glXGetStringFromServer(dpy, opcode,
+ X_GLXQueryServerString,
+ screen, name);
+}
+
+char *
+__glXGetString(Display* dpy,
+ int opcode,
+ CARD32 contextTag,
+ CARD32 name)
+{
+ return __glXGetStringFromServer(dpy, opcode, X_GLsop_GetString,
+ contextTag, name);
+}
+
+#endif /* USE_XCB */
+
diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h
index 3b9076bdd72..467b0ebb7f9 100644
--- a/src/glx/x11/glxclient.h
+++ b/src/glx/x11/glxclient.h
@@ -741,8 +741,10 @@ extern void _XSend(Display*, const void*, long);
extern void __glXInitializeVisualConfigFromTags( __GLcontextModes *config,
int count, const INT32 *bp, Bool tagged_only, Bool fbconfig_style_tags );
-extern char * __glXGetStringFromServer( Display * dpy, int opcode,
- CARD32 glxCode, CARD32 for_whom, CARD32 name );
+extern char * __glXQueryServerString(Display* dpy, int opcode,
+ CARD32 screen, CARD32 name);
+extern char * __glXGetString(Display* dpy, int opcode,
+ CARD32 screen, CARD32 name);
extern char *__glXstrdup(const char *str);
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
index 391e0be05e7..1d373ed29d8 100644
--- a/src/glx/x11/glxcmds.c
+++ b/src/glx/x11/glxcmds.c
@@ -44,6 +44,12 @@
#include "xf86dri.h"
#endif
+#if defined(USE_XCB)
+#include <X11/Xlib-xcb.h>
+#include <xcb/xcb.h>
+#include <xcb/glx.h>
+#endif
+
static const char __glXGLXClientVendorName[] = "SGI";
static const char __glXGLXClientVersion[] = "1.4";
@@ -749,8 +755,10 @@ PUBLIC void glXCopyContext(Display *dpy, GLXContext source,
*/
static Bool __glXIsDirect(Display *dpy, GLXContextID contextID)
{
+#if !defined(USE_XCB)
xGLXIsDirectReq *req;
xGLXIsDirectReply reply;
+#endif
CARD8 opcode;
opcode = __glXSetupForCommand(dpy);
@@ -758,6 +766,18 @@ static Bool __glXIsDirect(Display *dpy, GLXContextID contextID)
return GL_FALSE;
}
+#ifdef USE_XCB
+ xcb_connection_t* c = XGetXCBConnection(dpy);
+ xcb_glx_is_direct_reply_t* reply =
+ xcb_glx_is_direct_reply(c,
+ xcb_glx_is_direct(c, contextID),
+ NULL);
+
+ const Bool is_direct = reply->is_direct ? True : False;
+ free(reply);
+
+ return is_direct;
+#else
/* Send the glXIsDirect request */
LockDisplay(dpy);
GetReq(GLXIsDirect,req);
@@ -769,6 +789,7 @@ static Bool __glXIsDirect(Display *dpy, GLXContextID contextID)
SyncHandle();
return reply.isDirect;
+#endif /* USE_XCB */
}
/**
@@ -840,7 +861,6 @@ PUBLIC void glXDestroyGLXPixmap(Display *dpy, GLXPixmap glxpixmap)
PUBLIC void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
{
- xGLXSwapBuffersReq *req;
GLXContext gc;
GLXContextTag tag;
CARD8 opcode;
@@ -871,6 +891,13 @@ PUBLIC void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
tag = 0;
}
+#ifdef USE_XCB
+ xcb_connection_t* c = XGetXCBConnection(dpy);
+ xcb_glx_swap_buffers(c, tag, drawable);
+ xcb_flush(c);
+#else
+ xGLXSwapBuffersReq *req;
+
/* Send the glXSwapBuffers request */
LockDisplay(dpy);
GetReq(GLXSwapBuffers,req);
@@ -881,6 +908,7 @@ PUBLIC void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
UnlockDisplay(dpy);
SyncHandle();
XFlush(dpy);
+#endif /* USE_XCB */
}
@@ -1314,9 +1342,8 @@ PUBLIC const char *glXQueryExtensionsString( Display *dpy, int screen )
if (!psc->effectiveGLXexts) {
if (!psc->serverGLXexts) {
- psc->serverGLXexts = __glXGetStringFromServer(dpy, priv->majorOpcode,
- X_GLXQueryServerString,
- screen, GLX_EXTENSIONS);
+ psc->serverGLXexts =
+ __glXQueryServerString(dpy, priv->majorOpcode, screen, GLX_EXTENSIONS);
}
__glXCalculateUsableExtensions(psc,
@@ -1371,8 +1398,7 @@ PUBLIC const char *glXQueryServerString( Display *dpy, int screen, int name )
}
if ( *str == NULL ) {
- *str = __glXGetStringFromServer(dpy, priv->majorOpcode,
- X_GLXQueryServerString, screen, name);
+ *str = __glXQueryServerString(dpy, priv->majorOpcode, screen, name);
}
return *str;
@@ -1380,9 +1406,18 @@ PUBLIC const char *glXQueryServerString( Display *dpy, int screen, int name )
void __glXClientInfo ( Display *dpy, int opcode )
{
- xGLXClientInfoReq *req;
- int size;
char * ext_str = __glXGetClientGLExtensionString();
+ int size = strlen( ext_str ) + 1;
+
+#ifdef USE_XCB
+ xcb_connection_t *c = XGetXCBConnection(dpy);
+ xcb_glx_client_info(c,
+ GLX_MAJOR_VERSION,
+ GLX_MINOR_VERSION,
+ size,
+ (const uint8_t *)ext_str);
+#else
+ xGLXClientInfoReq *req;
/* Send the glXClientInfo request */
LockDisplay(dpy);
@@ -1392,14 +1427,14 @@ void __glXClientInfo ( Display *dpy, int opcode )
req->major = GLX_MAJOR_VERSION;
req->minor = GLX_MINOR_VERSION;
- size = strlen( ext_str ) + 1;
req->length += (size + 3) >> 2;
req->numbytes = size;
Data(dpy, ext_str, size);
UnlockDisplay(dpy);
SyncHandle();
-
+#endif /* USE_XCB */
+
Xfree( ext_str );
}
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c
index b6bdbd52bb5..be6edf9b193 100644
--- a/src/glx/x11/glxext.c
+++ b/src/glx/x11/glxext.c
@@ -139,7 +139,8 @@ XEXT_GENERATE_FIND_DISPLAY(__glXFindDisplay, __glXExtensionInfo,
** Free the per screen configs data as well as the array of
** __glXScreenConfigs.
*/
- static void FreeScreenConfigs(__GLXdisplayPrivate * priv)
+static void
+FreeScreenConfigs(__GLXdisplayPrivate * priv)
{
__GLXscreenConfigs *psc;
GLint i, screens;
@@ -221,6 +222,25 @@ __glXFreeDisplayPrivate(XExtData * extension)
static Bool
QueryVersion(Display * dpy, int opcode, int *major, int *minor)
{
+#ifdef USE_XCB
+ xcb_connection_t *c = XGetXCBConnection(dpy);
+ xcb_glx_query_version_reply_t* reply =
+ xcb_glx_query_version_reply(c,
+ xcb_glx_query_version(c,
+ GLX_MAJOR_VERSION,
+ GLX_MINOR_VERSION),
+ NULL);
+
+ if(reply->major_version != GLX_MAJOR_VERSION)
+ {
+ free(reply);
+ return GL_FALSE;
+ }
+ *major = reply->major_version;
+ *minor = min(reply->minor_version, GLX_MINOR_VERSION);
+ free(reply);
+ return GL_TRUE;
+#else
xGLXQueryVersionReq *req;
xGLXQueryVersionReply reply;
@@ -245,6 +265,7 @@ QueryVersion(Display * dpy, int opcode, int *major, int *minor)
*major = reply.majorVersion;
*minor = min(reply.minorVersion, GLX_MINOR_VERSION);
return GL_TRUE;
+#endif /* USE_XCB */
}
@@ -529,9 +550,7 @@ getFBConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen)
__GLXscreenConfigs *psc;
psc = priv->screenConfigs + screen;
- psc->serverGLXexts = __glXGetStringFromServer(dpy, priv->majorOpcode,
- X_GLXQueryServerString,
- screen, GLX_EXTENSIONS);
+ psc->serverGLXexts = __glXQueryServerString(dpy, priv->majorOpcode, screen, GLX_EXTENSIONS);
LockDisplay(dpy);
@@ -589,9 +608,7 @@ AllocAndFetchScreenConfigs(Display * dpy, __GLXdisplayPrivate * priv)
memset(psc, 0, screens * sizeof(__GLXscreenConfigs));
priv->screenConfigs = psc;
- priv->serverGLXversion = __glXGetStringFromServer(dpy, priv->majorOpcode,
- X_GLXQueryServerString,
- 0, GLX_VERSION);
+ priv->serverGLXversion = __glXQueryServerString(dpy, priv->majorOpcode, 0, GLX_VERSION);
if (priv->serverGLXversion == NULL) {
FreeScreenConfigs(priv);
return GL_FALSE;
diff --git a/src/glx/x11/single2.c b/src/glx/x11/single2.c
index 83a25052220..0b2d5113cc8 100644
--- a/src/glx/x11/single2.c
+++ b/src/glx/x11/single2.c
@@ -679,9 +679,7 @@ __indirect_glGetString(GLenum name)
*/
(void) __glXFlushRenderBuffer(gc, gc->pc);
- s = (GLubyte *) __glXGetStringFromServer(dpy, gc->majorOpcode,
- X_GLsop_GetString,
- gc->currentContextTag, name);
+ s = (GLubyte *) __glXGetString(dpy, gc->majorOpcode, gc->currentContextTag, name);
if (!s) {
/* Throw data on the floor */
__glXSetError(gc, GL_OUT_OF_MEMORY);
diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c
index 1ddea33e35c..80746950c71 100644
--- a/src/mesa/drivers/windows/gdi/wmesa.c
+++ b/src/mesa/drivers/windows/gdi/wmesa.c
@@ -56,11 +56,13 @@ wmesa_free_framebuffer(HDC hdc)
prev = pwfb;
}
if (pwfb) {
+ struct gl_framebuffer *fb;
if (pwfb == FirstFramebuffer)
FirstFramebuffer = pwfb->next;
else
prev->next = pwfb->next;
- _mesa_unreference_framebuffer(&pwfb->Base);
+ fb = &pwfb->Base;
+ _mesa_unreference_framebuffer(&fb);
}
}
@@ -1503,6 +1505,9 @@ WMesaContext WMesaCreateContext(HDC hDC,
ctx = &c->gl_ctx;
_mesa_initialize_context(ctx, visual, NULL, &functions, (void *)c);
+ /* visual no longer needed - it was copied by _mesa_initialize_context() */
+ _mesa_destroy_visual(visual);
+
_mesa_enable_sw_extensions(ctx);
_mesa_enable_1_3_extensions(ctx);
_mesa_enable_1_4_extensions(ctx);
diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c
index 34c47413506..88fca198351 100644
--- a/src/mesa/shader/prog_statevars.c
+++ b/src/mesa/shader/prog_statevars.c
@@ -631,6 +631,9 @@ append(char *dst, const char *src)
}
+/**
+ * Convert token 'k' to a string, append it only 'dst' string.
+ */
static void
append_token(char *dst, gl_state_index k)
{
@@ -763,11 +766,30 @@ append_token(char *dst, gl_state_index k)
case STATE_LOCAL:
append(dst, "local");
break;
+ /* BEGIN internal state vars */
+ case STATE_INTERNAL:
+ append(dst, "(internal)");
+ break;
case STATE_NORMAL_SCALE:
append(dst, "normalScale");
break;
- case STATE_INTERNAL:
- append(dst, "(internal)");
+ case STATE_TEXRECT_SCALE:
+ append(dst, "texrectScale");
+ break;
+ case STATE_FOG_PARAMS_OPTIMIZED:
+ append(dst, "fogParamsOptimized");
+ break;
+ case STATE_LIGHT_SPOT_DIR_NORMALIZED:
+ append(dst, "lightSpotDirNormalized");
+ break;
+ case STATE_LIGHT_POSITION:
+ append(dst, "lightPosition");
+ break;
+ case STATE_LIGHT_POSITION_NORMALIZED:
+ append(dst, "light.position.normalized");
+ break;
+ case STATE_LIGHT_HALF_VECTOR:
+ append(dst, "lightHalfVector");
break;
case STATE_PT_SCALE:
append(dst, "PTscale");
@@ -818,16 +840,16 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH])
char tmp[30];
append(str, "state.");
- append_token(str, (gl_state_index) state[0]);
+ append_token(str, state[0]);
switch (state[0]) {
case STATE_MATERIAL:
append_face(str, state[1]);
- append_token(str, (gl_state_index) state[2]);
+ append_token(str, state[2]);
break;
case STATE_LIGHT:
append_index(str, state[1]); /* light number [i]. */
- append_token(str, (gl_state_index) state[2]); /* coefficients */
+ append_token(str, state[2]); /* coefficients */
break;
case STATE_LIGHTMODEL_AMBIENT:
append(str, "lightmodel.ambient");
@@ -843,11 +865,11 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH])
case STATE_LIGHTPROD:
append_index(str, state[1]); /* light number [i]. */
append_face(str, state[2]);
- append_token(str, (gl_state_index) state[3]);
+ append_token(str, state[3]);
break;
case STATE_TEXGEN:
append_index(str, state[1]); /* tex unit [i] */
- append_token(str, (gl_state_index) state[2]); /* plane coef */
+ append_token(str, state[2]); /* plane coef */
break;
case STATE_TEXENV_COLOR:
append_index(str, state[1]); /* tex unit [i] */
@@ -869,11 +891,11 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH])
/* state[2] = first row to fetch */
/* state[3] = last row to fetch */
/* state[4] = transpose, inverse or invtrans */
- const gl_state_index mat = (gl_state_index) state[0];
+ const gl_state_index mat = state[0];
const GLuint index = (GLuint) state[1];
const GLuint firstRow = (GLuint) state[2];
const GLuint lastRow = (GLuint) state[3];
- const gl_state_index modifier = (gl_state_index) state[4];
+ const gl_state_index modifier = state[4];
if (index ||
mat == STATE_TEXTURE_MATRIX ||
mat == STATE_PROGRAM_MATRIX)
@@ -901,10 +923,11 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH])
case STATE_VERTEX_PROGRAM:
/* state[1] = {STATE_ENV, STATE_LOCAL} */
/* state[2] = parameter index */
- append_token(str, (gl_state_index) state[1]);
+ append_token(str, state[1]);
append_index(str, state[2]);
break;
case STATE_INTERNAL:
+ append_token(str, state[1]);
break;
default:
_mesa_problem(NULL, "Invalid state in _mesa_program_state_string");
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 8d2655ec517..8abb642a728 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -2028,6 +2028,21 @@ _slang_gen_function_call_name(slang_assemble_ctx *A, const char *name,
return NULL;
}
+ /* type checking to be sure function's return type matches 'dest' type */
+ if (dest) {
+ slang_typeinfo t0;
+
+ slang_typeinfo_construct(&t0);
+ _slang_typeof_operation(A, dest, &t0);
+
+ if (!slang_type_specifier_equal(&t0.spec, &fun->header.type.specifier)) {
+ slang_info_log_error(A->log,
+ "Incompatible type returned by call to '%s'",
+ name);
+ return NULL;
+ }
+ }
+
n = _slang_gen_function_call(A, fun, oper, dest);
if (n && !n->Store && !dest
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index efae4e98fbe..457a6b92c11 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -1391,7 +1391,6 @@ parse_expression(slang_parse_ctx * C, slang_output_ctx * O,
RETURN0;
break;
case OP_METHOD:
- printf("******* begin OP_METHOD\n");
op->type = SLANG_OPER_METHOD;
op->a_obj = parse_identifier(C);
if (op->a_obj == SLANG_ATOM_NULL)
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c
index f31e9b4e6c7..e3cb252a3d7 100644
--- a/src/mesa/shader/slang/slang_emit.c
+++ b/src/mesa/shader/slang/slang_emit.c
@@ -1324,7 +1324,8 @@ emit_copy(slang_emit_info *emitInfo, slang_ir_node *n)
_slang_is_temp(emitInfo->vt, n->Children[1]->Store) &&
(inst->DstReg.File == n->Children[1]->Store->File) &&
(inst->DstReg.Index == n->Children[1]->Store->Index) &&
- !n->Children[0]->Store->IsIndirect) {
+ !n->Children[0]->Store->IsIndirect &&
+ n->Children[0]->Store->Size <= 4) {
/* Peephole optimization:
* The Right-Hand-Side has its results in a temporary place.
* Modify the RHS (and the prev instruction) to store its results