diff options
author | marha <marha@users.sourceforge.net> | 2014-11-29 12:40:08 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-11-29 12:40:08 +0100 |
commit | a1011d63ffb5cc4f41bf0f4622ee3f1493d419d9 (patch) | |
tree | 3875aa5d80808dfe3c52035a4148384d7090fb8a /mesalib/src/mesa | |
parent | d6d5581d5fba846c8476ad4d593da662306765d7 (diff) | |
download | vcxsrv-a1011d63ffb5cc4f41bf0f4622ee3f1493d419d9.tar.gz vcxsrv-a1011d63ffb5cc4f41bf0f4622ee3f1493d419d9.tar.bz2 vcxsrv-a1011d63ffb5cc4f41bf0f4622ee3f1493d419d9.zip |
fontconfig libX11 libxcb libxcb/xcb-proto mesa xserver xkbcomp xkeyboard-config git update 29 Nov 2014
xserver commit c52a2b1ebad56820af932dfbc871701a8b04fd9c
libxcb commit bbca7b82f803fa13fd30a2891ec06f2a213a28c2
libxcb/xcb-proto commit 691d2b97e5989d6d7006304d81bd8fa128477ca1
xkeyboard-config commit b664d7fb8aab9b0f834dd9c81d273c7809561b34
libX11 commit f3831dde6972e4da9e018c6a5f4013d8756a5e78
xkbcomp commit 1e8ee9d0aad072f04186df84752f5636340574e0
fontconfig commit b732bf057f4b3ec3bac539803005e9c42d056b2a
mesa commit 67c498086d0858a94d53ebb6921cfda847250368
Diffstat (limited to 'mesalib/src/mesa')
44 files changed, 782 insertions, 1256 deletions
diff --git a/mesalib/src/mesa/Android.libmesa_dricore.mk b/mesalib/src/mesa/Android.libmesa_dricore.mk index 1e6d94872..2ab593d3c 100644 --- a/mesalib/src/mesa/Android.libmesa_dricore.mk +++ b/mesalib/src/mesa/Android.libmesa_dricore.mk @@ -51,10 +51,16 @@ endif # MESA_ENABLE_ASM ifeq ($(ARCH_X86_HAVE_SSE4_1),true) LOCAL_SRC_FILES += \ - $(SRCDIR)main/streaming-load-memcpy.c + $(SRCDIR)main/streaming-load-memcpy.c \ + $(SRCDIR)main/sse_minmax.c LOCAL_CFLAGS := -msse4.1 endif +ifeq ($(ARCH_X86_HAVE_SSE4_1),true) +LOCAL_CFLAGS += \ + -DUSE_SSE41 +endif + LOCAL_C_INCLUDES := \ $(call intermediates-dir-for STATIC_LIBRARIES,libmesa_program,,) \ $(MESA_TOP)/src \ diff --git a/mesalib/src/mesa/Android.libmesa_st_mesa.mk b/mesalib/src/mesa/Android.libmesa_st_mesa.mk index 8b8d652a3..618d6bfb2 100644 --- a/mesalib/src/mesa/Android.libmesa_st_mesa.mk +++ b/mesalib/src/mesa/Android.libmesa_st_mesa.mk @@ -48,6 +48,11 @@ ifeq ($(TARGET_ARCH),x86) endif # x86 endif # MESA_ENABLE_ASM +ifeq ($(ARCH_X86_HAVE_SSE4_1),true) +LOCAL_CFLAGS := \ + -DUSE_SSE41 +endif + LOCAL_C_INCLUDES := \ $(call intermediates-dir-for STATIC_LIBRARIES,libmesa_program,,) \ $(MESA_TOP)/src/gallium/auxiliary \ diff --git a/mesalib/src/mesa/Makefile.am b/mesalib/src/mesa/Makefile.am index e71bccbbe..932db4fb8 100644 --- a/mesalib/src/mesa/Makefile.am +++ b/mesalib/src/mesa/Makefile.am @@ -151,7 +151,8 @@ libmesagallium_la_LIBADD = \ $(ARCH_LIBS) libmesa_sse41_la_SOURCES = \ - main/streaming-load-memcpy.c + main/streaming-load-memcpy.c \ + main/sse_minmax.c libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) -msse4.1 pkgconfigdir = $(libdir)/pkgconfig diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c index 6c78928ee..d6e875fcf 100644 --- a/mesalib/src/mesa/drivers/dri/common/dri_util.c +++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c @@ -376,19 +376,17 @@ driCreateContextAttribs(__DRIscreen *screen, int api, return NULL; } - /* The EGL_KHR_create_context spec says: + /* The latest version of EGL_KHR_create_context spec says: * - * "Flags are only defined for OpenGL context creation, and specifying - * a flags value other than zero for other types of contexts, - * including OpenGL ES contexts, will generate an error." + * "If the EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR flag bit is set in + * EGL_CONTEXT_FLAGS_KHR, then a <debug context> will be created. + * [...] This bit is supported for OpenGL and OpenGL ES contexts. * - * The GLX_EXT_create_context_es2_profile specification doesn't say - * anything specific about this case. However, none of the known flags - * have any meaning in an ES context, so this seems safe. + * None of the other flags have any meaning in an ES context, so this seems safe. */ if (mesa_api != API_OPENGL_COMPAT && mesa_api != API_OPENGL_CORE - && flags != 0) { + && (flags & ~__DRI_CTX_FLAG_DEBUG)) { *error = __DRI_CTX_ERROR_BAD_FLAG; return NULL; } @@ -569,6 +567,12 @@ static int driUnbindContext(__DRIcontext *pcp) if (pcp == NULL) return GL_FALSE; + /* + ** Call driUnbindContext before checking for valid drawables + ** to handle surfaceless contexts properly. + */ + pcp->driScreenPriv->driver->UnbindContext(pcp); + pdp = pcp->driDrawablePriv; prp = pcp->driReadablePriv; @@ -576,8 +580,6 @@ static int driUnbindContext(__DRIcontext *pcp) if (!pdp && !prp) return GL_TRUE; - pcp->driScreenPriv->driver->UnbindContext(pcp); - assert(pdp); if (pdp->refcount == 0) { /* ERROR!!! */ diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h b/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h index b73a6620c..4e5a7217e 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h @@ -340,3 +340,21 @@ DRI_CONF_SECTION_BEGIN \ DRI_CONF_OPT_BEGIN(device_id, string, def) \ DRI_CONF_DESC(en,gettext("Define the graphic device to use if possible")) \ DRI_CONF_OPT_END + +/** + * \brief Gallium-Nine specific configuration options + */ + +#define DRI_CONF_SECTION_NINE \ +DRI_CONF_SECTION_BEGIN \ + DRI_CONF_DESC(en,gettext("Gallium Nine")) + +#define DRI_CONF_NINE_THROTTLE(def) \ +DRI_CONF_OPT_BEGIN(throttle_value, int, def) \ + DRI_CONF_DESC(en,gettext("Define the throttling value. -1 for no throttling, -2 for default (usually 2), 0 for glfinish behaviour")) \ +DRI_CONF_OPT_END + +#define DRI_CONF_NINE_THREADSUBMIT(def) \ +DRI_CONF_OPT_BEGIN_B(thread_submit, def) \ + DRI_CONF_DESC(en,gettext("Use an additional thread to submit buffers.")) \ +DRI_CONF_OPT_END diff --git a/mesalib/src/mesa/drivers/windows/gdi/mesa.def b/mesalib/src/mesa/drivers/windows/gdi/mesa.def index 92736b368..a52207b63 100644 --- a/mesalib/src/mesa/drivers/windows/gdi/mesa.def +++ b/mesalib/src/mesa/drivers/windows/gdi/mesa.def @@ -1,6 +1,3 @@ -; DO NOT EDIT - This file generated automatically by mesadef.py script -;DESCRIPTION 'Mesa (OpenGL work-alike) for Win32' -VERSION 6.5 ; ; Module definition file for Mesa (OPENGL32.DLL) ; @@ -27,15 +24,23 @@ VERSION 6.5 ; points are compiled with dllexport declspec. ; EXPORTS - glNewList - glEndList - glCallList - glCallLists - glDeleteLists - glGenLists - glListBase + glAccum + glAlphaFunc + glAreTexturesResident + glArrayElement glBegin + glBindTexture glBitmap + glBlendFunc + glCallList + glCallLists + glClear + glClearAccum + glClearColor + glClearDepth + glClearIndex + glClearStencil + glClipPlane glColor3b glColor3bv glColor3d @@ -68,9 +73,88 @@ EXPORTS glColor4uiv glColor4us glColor4usv + glColorMask + glColorMaterial + glColorPointer + glCopyPixels + glCopyTexImage1D + glCopyTexImage2D + glCopyTexSubImage1D + glCopyTexSubImage2D + glCullFace + glDeleteLists + glDeleteTextures + glDepthFunc + glDepthMask + glDepthRange + glDisable + glDisableClientState + glDrawArrays + glDrawBuffer + glDrawElements + glDrawPixels glEdgeFlag + glEdgeFlagPointer glEdgeFlagv + glEnable + glEnableClientState glEnd + glEndList + glEvalCoord1d + glEvalCoord1dv + glEvalCoord1f + glEvalCoord1fv + glEvalCoord2d + glEvalCoord2dv + glEvalCoord2f + glEvalCoord2fv + glEvalMesh1 + glEvalMesh2 + glEvalPoint1 + glEvalPoint2 + glFeedbackBuffer + glFinish + glFlush + glFogf + glFogfv + glFogi + glFogiv + glFrontFace + glFrustum + glGenLists + glGenTextures + glGetBooleanv + glGetClipPlane + glGetDoublev + glGetError + glGetFloatv + glGetIntegerv + glGetLightfv + glGetLightiv + glGetMapdv + glGetMapfv + glGetMapiv + glGetMaterialfv + glGetMaterialiv + glGetPixelMapfv + glGetPixelMapuiv + glGetPixelMapusv + glGetPointerv + glGetPolygonStipple + glGetString + glGetTexEnvfv + glGetTexEnviv + glGetTexGendv + glGetTexGenfv + glGetTexGeniv + glGetTexImage + glGetTexLevelParameterfv + glGetTexLevelParameteriv + glGetTexParameterfv + glGetTexParameteriv + glHint + glIndexMask + glIndexPointer glIndexd glIndexdv glIndexf @@ -79,6 +163,45 @@ EXPORTS glIndexiv glIndexs glIndexsv + glIndexub + glIndexubv + glInitNames + glInterleavedArrays + glIsEnabled + glIsList + glIsTexture + glLightModelf + glLightModelfv + glLightModeli + glLightModeliv + glLightf + glLightfv + glLighti + glLightiv + glLineStipple + glLineWidth + glListBase + glLoadIdentity + glLoadMatrixd + glLoadMatrixf + glLoadName + glLogicOp + glMap1d + glMap1f + glMap2d + glMap2f + glMapGrid1d + glMapGrid1f + glMapGrid2d + glMapGrid2f + glMaterialf + glMaterialfv + glMateriali + glMaterialiv + glMatrixMode + glMultMatrixd + glMultMatrixf + glNewList glNormal3b glNormal3bv glNormal3d @@ -89,6 +212,30 @@ EXPORTS glNormal3iv glNormal3s glNormal3sv + glNormalPointer + glOrtho + glPassThrough + glPixelMapfv + glPixelMapuiv + glPixelMapusv + glPixelStoref + glPixelStorei + glPixelTransferf + glPixelTransferi + glPixelZoom + glPointSize + glPolygonMode + glPolygonOffset + glPolygonStipple + glPopAttrib + glPopClientAttrib + glPopMatrix + glPopName + glPrioritizeTextures + glPushAttrib + glPushClientAttrib + glPushMatrix + glPushName glRasterPos2d glRasterPos2dv glRasterPos2f @@ -113,6 +260,8 @@ EXPORTS glRasterPos4iv glRasterPos4s glRasterPos4sv + glReadBuffer + glReadPixels glRectd glRectdv glRectf @@ -121,6 +270,17 @@ EXPORTS glRectiv glRects glRectsv + glRenderMode + glRotated + glRotatef + glScaled + glScalef + glScissor + glSelectBuffer + glShadeModel + glStencilFunc + glStencilMask + glStencilOp glTexCoord1d glTexCoord1dv glTexCoord1f @@ -153,6 +313,27 @@ EXPORTS glTexCoord4iv glTexCoord4s glTexCoord4sv + glTexCoordPointer + glTexEnvf + glTexEnvfv + glTexEnvi + glTexEnviv + glTexGend + glTexGendv + glTexGenf + glTexGenfv + glTexGeni + glTexGeniv + glTexImage1D + glTexImage2D + glTexParameterf + glTexParameterfv + glTexParameteri + glTexParameteriv + glTexSubImage1D + glTexSubImage2D + glTranslated + glTranslatef glVertex2d glVertex2dv glVertex2f @@ -177,643 +358,8 @@ EXPORTS glVertex4iv glVertex4s glVertex4sv - glClipPlane - glColorMaterial - glCullFace - glFogf - glFogfv - glFogi - glFogiv - glFrontFace - glHint - glLightf - glLightfv - glLighti - glLightiv - glLightModelf - glLightModelfv - glLightModeli - glLightModeliv - glLineStipple - glLineWidth - glMaterialf - glMaterialfv - glMateriali - glMaterialiv - glPointSize - glPolygonMode - glPolygonStipple - glScissor - glShadeModel - glTexParameterf - glTexParameterfv - glTexParameteri - glTexParameteriv - glTexImage1D - glTexImage2D - glTexEnvf - glTexEnvfv - glTexEnvi - glTexEnviv - glTexGend - glTexGendv - glTexGenf - glTexGenfv - glTexGeni - glTexGeniv - glFeedbackBuffer - glSelectBuffer - glRenderMode - glInitNames - glLoadName - glPassThrough - glPopName - glPushName - glDrawBuffer - glClear - glClearAccum - glClearIndex - glClearColor - glClearStencil - glClearDepth - glStencilMask - glColorMask - glDepthMask - glIndexMask - glAccum - glDisable - glEnable - glFinish - glFlush - glPopAttrib - glPushAttrib - glMap1d - glMap1f - glMap2d - glMap2f - glMapGrid1d - glMapGrid1f - glMapGrid2d - glMapGrid2f - glEvalCoord1d - glEvalCoord1dv - glEvalCoord1f - glEvalCoord1fv - glEvalCoord2d - glEvalCoord2dv - glEvalCoord2f - glEvalCoord2fv - glEvalMesh1 - glEvalPoint1 - glEvalMesh2 - glEvalPoint2 - glAlphaFunc - glBlendFunc - glLogicOp - glStencilFunc - glStencilOp - glDepthFunc - glPixelZoom - glPixelTransferf - glPixelTransferi - glPixelStoref - glPixelStorei - glPixelMapfv - glPixelMapuiv - glPixelMapusv - glReadBuffer - glCopyPixels - glReadPixels - glDrawPixels - glGetBooleanv - glGetClipPlane - glGetDoublev - glGetError - glGetFloatv - glGetIntegerv - glGetLightfv - glGetLightiv - glGetMapdv - glGetMapfv - glGetMapiv - glGetMaterialfv - glGetMaterialiv - glGetPixelMapfv - glGetPixelMapuiv - glGetPixelMapusv - glGetPolygonStipple - glGetString - glGetTexEnvfv - glGetTexEnviv - glGetTexGendv - glGetTexGenfv - glGetTexGeniv - glGetTexImage - glGetTexParameterfv - glGetTexParameteriv - glGetTexLevelParameterfv - glGetTexLevelParameteriv - glIsEnabled - glIsList - glDepthRange - glFrustum - glLoadIdentity - glLoadMatrixf - glLoadMatrixd - glMatrixMode - glMultMatrixf - glMultMatrixd - glOrtho - glPopMatrix - glPushMatrix - glRotated - glRotatef - glScaled - glScalef - glTranslated - glTranslatef - glViewport - glArrayElement - glColorPointer - glDisableClientState - glDrawArrays - glDrawElements - glEdgeFlagPointer - glEnableClientState - glGetPointerv - glIndexPointer - glInterleavedArrays - glNormalPointer - glTexCoordPointer glVertexPointer - glPolygonOffset - glCopyTexImage1D - glCopyTexImage2D - glCopyTexSubImage1D - glCopyTexSubImage2D - glTexSubImage1D - glTexSubImage2D - glAreTexturesResident - glBindTexture - glDeleteTextures - glGenTextures - glIsTexture - glPrioritizeTextures - glIndexub - glIndexubv - glPopClientAttrib - glPushClientAttrib - glBlendColor - glBlendEquation - glDrawRangeElements - glColorTable - glColorTableParameterfv - glColorTableParameteriv - glCopyColorTable - glGetColorTable - glGetColorTableParameterfv - glGetColorTableParameteriv - glColorSubTable - glCopyColorSubTable - glConvolutionFilter1D - glConvolutionFilter2D - glConvolutionParameterf - glConvolutionParameterfv - glConvolutionParameteri - glConvolutionParameteriv - glCopyConvolutionFilter1D - glCopyConvolutionFilter2D - glGetConvolutionFilter - glGetConvolutionParameterfv - glGetConvolutionParameteriv - glGetSeparableFilter - glSeparableFilter2D - glGetHistogram - glGetHistogramParameterfv - glGetHistogramParameteriv - glGetMinmax - glGetMinmaxParameterfv - glGetMinmaxParameteriv - glHistogram - glMinmax - glResetHistogram - glResetMinmax - glTexImage3D - glTexSubImage3D - glCopyTexSubImage3D - glActiveTextureARB - glClientActiveTextureARB - glMultiTexCoord1dARB - glMultiTexCoord1dvARB - glMultiTexCoord1fARB - glMultiTexCoord1fvARB - glMultiTexCoord1iARB - glMultiTexCoord1ivARB - glMultiTexCoord1sARB - glMultiTexCoord1svARB - glMultiTexCoord2dARB - glMultiTexCoord2dvARB - glMultiTexCoord2fARB - glMultiTexCoord2fvARB - glMultiTexCoord2iARB - glMultiTexCoord2ivARB - glMultiTexCoord2sARB - glMultiTexCoord2svARB - glMultiTexCoord3dARB - glMultiTexCoord3dvARB - glMultiTexCoord3fARB - glMultiTexCoord3fvARB - glMultiTexCoord3iARB - glMultiTexCoord3ivARB - glMultiTexCoord3sARB - glMultiTexCoord3svARB - glMultiTexCoord4dARB - glMultiTexCoord4dvARB - glMultiTexCoord4fARB - glMultiTexCoord4fvARB - glMultiTexCoord4iARB - glMultiTexCoord4ivARB - glMultiTexCoord4sARB - glMultiTexCoord4svARB - glLoadTransposeMatrixfARB - glLoadTransposeMatrixdARB - glMultTransposeMatrixfARB - glMultTransposeMatrixdARB - glSampleCoverageARB - glCompressedTexImage3DARB - glCompressedTexImage2DARB - glCompressedTexImage1DARB - glCompressedTexSubImage3DARB - glCompressedTexSubImage2DARB - glCompressedTexSubImage1DARB - glGetCompressedTexImageARB - glActiveTexture - glClientActiveTexture - glMultiTexCoord1d - glMultiTexCoord1dv - glMultiTexCoord1f - glMultiTexCoord1fv - glMultiTexCoord1i - glMultiTexCoord1iv - glMultiTexCoord1s - glMultiTexCoord1sv - glMultiTexCoord2d - glMultiTexCoord2dv - glMultiTexCoord2f - glMultiTexCoord2fv - glMultiTexCoord2i - glMultiTexCoord2iv - glMultiTexCoord2s - glMultiTexCoord2sv - glMultiTexCoord3d - glMultiTexCoord3dv - glMultiTexCoord3f - glMultiTexCoord3fv - glMultiTexCoord3i - glMultiTexCoord3iv - glMultiTexCoord3s - glMultiTexCoord3sv - glMultiTexCoord4d - glMultiTexCoord4dv - glMultiTexCoord4f - glMultiTexCoord4fv - glMultiTexCoord4i - glMultiTexCoord4iv - glMultiTexCoord4s - glMultiTexCoord4sv - glLoadTransposeMatrixf - glLoadTransposeMatrixd - glMultTransposeMatrixf - glMultTransposeMatrixd - glSampleCoverage - glCompressedTexImage3D - glCompressedTexImage2D - glCompressedTexImage1D - glCompressedTexSubImage3D - glCompressedTexSubImage2D - glCompressedTexSubImage1D - glGetCompressedTexImage - glBlendColorEXT - glPolygonOffsetEXT - glTexImage3DEXT - glTexSubImage3DEXT - glTexSubImage1DEXT - glTexSubImage2DEXT - glCopyTexImage1DEXT - glCopyTexImage2DEXT - glCopyTexSubImage1DEXT - glCopyTexSubImage2DEXT - glCopyTexSubImage3DEXT - glAreTexturesResidentEXT - glBindTextureEXT - glDeleteTexturesEXT - glGenTexturesEXT - glIsTextureEXT - glPrioritizeTexturesEXT - glArrayElementEXT - glColorPointerEXT - glDrawArraysEXT - glEdgeFlagPointerEXT - glGetPointervEXT - glIndexPointerEXT - glNormalPointerEXT - glTexCoordPointerEXT - glVertexPointerEXT - glBlendEquationEXT - glPointParameterfEXT - glPointParameterfvEXT - glPointParameterfARB - glPointParameterfvARB - glColorTableEXT - glGetColorTableEXT - glGetColorTableParameterivEXT - glGetColorTableParameterfvEXT - glLockArraysEXT - glUnlockArraysEXT - glDrawRangeElementsEXT - glSecondaryColor3bEXT - glSecondaryColor3bvEXT - glSecondaryColor3dEXT - glSecondaryColor3dvEXT - glSecondaryColor3fEXT - glSecondaryColor3fvEXT - glSecondaryColor3iEXT - glSecondaryColor3ivEXT - glSecondaryColor3sEXT - glSecondaryColor3svEXT - glSecondaryColor3ubEXT - glSecondaryColor3ubvEXT - glSecondaryColor3uiEXT - glSecondaryColor3uivEXT - glSecondaryColor3usEXT - glSecondaryColor3usvEXT - glSecondaryColorPointerEXT - glMultiDrawArraysEXT - glMultiDrawElementsEXT - glFogCoordfEXT - glFogCoordfvEXT - glFogCoorddEXT - glFogCoorddvEXT - glFogCoordPointerEXT - glBlendFuncSeparateEXT - glWindowPos2dMESA - glWindowPos2dvMESA - glWindowPos2fMESA - glWindowPos2fvMESA - glWindowPos2iMESA - glWindowPos2ivMESA - glWindowPos2sMESA - glWindowPos2svMESA - glWindowPos3dMESA - glWindowPos3dvMESA - glWindowPos3fMESA - glWindowPos3fvMESA - glWindowPos3iMESA - glWindowPos3ivMESA - glWindowPos3sMESA - glWindowPos3svMESA - glWindowPos4dMESA - glWindowPos4dvMESA - glWindowPos4fMESA - glWindowPos4fvMESA - glWindowPos4iMESA - glWindowPos4ivMESA - glWindowPos4sMESA - glWindowPos4svMESA - glWindowPos2dARB - glWindowPos2fARB - glWindowPos2iARB - glWindowPos2sARB - glWindowPos2dvARB - glWindowPos2fvARB - glWindowPos2ivARB - glWindowPos2svARB - glWindowPos3dARB - glWindowPos3fARB - glWindowPos3iARB - glWindowPos3sARB - glWindowPos3dvARB - glWindowPos3fvARB - glWindowPos3ivARB - glWindowPos3svARB - glAreProgramsResidentNV - glBindProgramNV - glDeleteProgramsNV - glExecuteProgramNV - glGenProgramsNV - glGetProgramParameterdvNV - glGetProgramParameterfvNV - glGetProgramivNV - glGetProgramStringNV - glGetTrackMatrixivNV - glGetVertexAttribdvNV - glGetVertexAttribfvNV - glGetVertexAttribivNV - glGetVertexAttribPointervNV - glIsProgramNV - glLoadProgramNV - glProgramParameter4dNV - glProgramParameter4dvNV - glProgramParameter4fNV - glProgramParameter4fvNV - glProgramParameters4dvNV - glProgramParameters4fvNV - glRequestResidentProgramsNV - glTrackMatrixNV - glVertexAttribPointerNV - glVertexAttrib1dNV - glVertexAttrib1dvNV - glVertexAttrib1fNV - glVertexAttrib1fvNV - glVertexAttrib1sNV - glVertexAttrib1svNV - glVertexAttrib2dNV - glVertexAttrib2dvNV - glVertexAttrib2fNV - glVertexAttrib2fvNV - glVertexAttrib2sNV - glVertexAttrib2svNV - glVertexAttrib3dNV - glVertexAttrib3dvNV - glVertexAttrib3fNV - glVertexAttrib3fvNV - glVertexAttrib3sNV - glVertexAttrib3svNV - glVertexAttrib4dNV - glVertexAttrib4dvNV - glVertexAttrib4fNV - glVertexAttrib4fvNV - glVertexAttrib4sNV - glVertexAttrib4svNV - glVertexAttrib4ubNV - glVertexAttrib4ubvNV - glVertexAttribs1dvNV - glVertexAttribs1fvNV - glVertexAttribs1svNV - glVertexAttribs2dvNV - glVertexAttribs2fvNV - glVertexAttribs2svNV - glVertexAttribs3dvNV - glVertexAttribs3fvNV - glVertexAttribs3svNV - glVertexAttribs4dvNV - glVertexAttribs4fvNV - glVertexAttribs4svNV - glVertexAttribs4ubvNV - glPointParameteriNV - glPointParameterivNV - glFogCoordf - glFogCoordfv - glFogCoordd - glFogCoorddv - glFogCoordPointer - glMultiDrawArrays - glMultiDrawElements - glPointParameterf - glPointParameterfv - glPointParameteri - glPointParameteriv - glSecondaryColor3b - glSecondaryColor3bv - glSecondaryColor3d - glSecondaryColor3dv - glSecondaryColor3f - glSecondaryColor3fv - glSecondaryColor3i - glSecondaryColor3iv - glSecondaryColor3s - glSecondaryColor3sv - glSecondaryColor3ub - glSecondaryColor3ubv - glSecondaryColor3ui - glSecondaryColor3uiv - glSecondaryColor3us - glSecondaryColor3usv - glSecondaryColorPointer - glWindowPos2d - glWindowPos2dv - glWindowPos2f - glWindowPos2fv - glWindowPos2i - glWindowPos2iv - glWindowPos2s - glWindowPos2sv - glWindowPos3d - glWindowPos3dv - glWindowPos3f - glWindowPos3fv - glWindowPos3i - glWindowPos3iv - glWindowPos3s - glWindowPos3sv - glVertexAttrib1sARB - glVertexAttrib1fARB - glVertexAttrib1dARB - glVertexAttrib2sARB - glVertexAttrib2fARB - glVertexAttrib2dARB - glVertexAttrib3sARB - glVertexAttrib3fARB - glVertexAttrib3dARB - glVertexAttrib4sARB - glVertexAttrib4fARB - glVertexAttrib4dARB - glVertexAttrib4NubARB - glVertexAttrib1svARB - glVertexAttrib1fvARB - glVertexAttrib1dvARB - glVertexAttrib2svARB - glVertexAttrib2fvARB - glVertexAttrib2dvARB - glVertexAttrib3svARB - glVertexAttrib3fvARB - glVertexAttrib3dvARB - glVertexAttrib4bvARB - glVertexAttrib4svARB - glVertexAttrib4ivARB - glVertexAttrib4ubvARB - glVertexAttrib4usvARB - glVertexAttrib4uivARB - glVertexAttrib4fvARB - glVertexAttrib4dvARB - glVertexAttrib4NbvARB - glVertexAttrib4NsvARB - glVertexAttrib4NivARB - glVertexAttrib4NubvARB - glVertexAttrib4NusvARB - glVertexAttrib4NuivARB - glVertexAttribPointerARB - glEnableVertexAttribArrayARB - glDisableVertexAttribArrayARB - glProgramStringARB - glBindProgramARB - glDeleteProgramsARB - glGenProgramsARB - glIsProgramARB - glProgramEnvParameter4dARB - glProgramEnvParameter4dvARB - glProgramEnvParameter4fARB - glProgramEnvParameter4fvARB - glProgramLocalParameter4dARB - glProgramLocalParameter4dvARB - glProgramLocalParameter4fARB - glProgramLocalParameter4fvARB - glGetProgramEnvParameterdvARB - glGetProgramEnvParameterfvARB - glGetProgramLocalParameterdvARB - glGetProgramLocalParameterfvARB - glGetProgramivARB - glGetProgramStringARB - glGetVertexAttribdvARB - glGetVertexAttribfvARB - glGetVertexAttribivARB - glGetVertexAttribPointervARB - glProgramNamedParameter4fNV - glProgramNamedParameter4dNV - glProgramNamedParameter4fvNV - glProgramNamedParameter4dvNV - glGetProgramNamedParameterfvNV - glGetProgramNamedParameterdvNV - glBindBufferARB - glBufferDataARB - glBufferSubDataARB - glDeleteBuffersARB - glGenBuffersARB - glGetBufferParameterivARB - glGetBufferPointervARB - glGetBufferSubDataARB - glIsBufferARB - glMapBufferARB - glUnmapBufferARB - glGenQueriesARB - glDeleteQueriesARB - glIsQueryARB - glBeginQueryARB - glEndQueryARB - glGetQueryivARB - glGetQueryObjectivARB - glGetQueryObjectuivARB - glBindBuffer - glBufferData - glBufferSubData - glDeleteBuffers - glGenBuffers - glGetBufferParameteriv - glGetBufferPointerv - glGetBufferSubData - glIsBuffer - glMapBuffer - glUnmapBuffer - glGenQueries - glDeleteQueries - glIsQuery - glBeginQuery - glEndQuery - glGetQueryiv - glGetQueryObjectiv - glGetQueryObjectuiv -; -; WGL API + glViewport wglChoosePixelFormat wglCopyContext wglCreateContext @@ -837,4 +383,3 @@ EXPORTS wglUseFontBitmapsW wglUseFontOutlinesA wglUseFontOutlinesW - wglGetExtensionsStringARB diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c index 9b80600de..bf4fa3ea8 100644 --- a/mesalib/src/mesa/main/api_validate.c +++ b/mesalib/src/mesa/main/api_validate.c @@ -55,52 +55,6 @@ index_bytes(GLenum type, GLsizei count) /** - * Find the max index in the given element/index buffer - */ -GLuint -_mesa_max_buffer_index(struct gl_context *ctx, GLuint count, GLenum type, - const void *indices, - struct gl_buffer_object *elementBuf) -{ - const GLubyte *map = NULL; - GLuint max = 0; - GLuint i; - - if (_mesa_is_bufferobj(elementBuf)) { - /* elements are in a user-defined buffer object. need to map it */ - map = ctx->Driver.MapBufferRange(ctx, 0, elementBuf->Size, - GL_MAP_READ_BIT, elementBuf, - MAP_INTERNAL); - /* Actual address is the sum of pointers */ - indices = (const GLvoid *) ADD_POINTERS(map, (const GLubyte *) indices); - } - - if (type == GL_UNSIGNED_INT) { - for (i = 0; i < count; i++) - if (((GLuint *) indices)[i] > max) - max = ((GLuint *) indices)[i]; - } - else if (type == GL_UNSIGNED_SHORT) { - for (i = 0; i < count; i++) - if (((GLushort *) indices)[i] > max) - max = ((GLushort *) indices)[i]; - } - else { - ASSERT(type == GL_UNSIGNED_BYTE); - for (i = 0; i < count; i++) - if (((GLubyte *) indices)[i] > max) - max = ((GLubyte *) indices)[i]; - } - - if (map) { - ctx->Driver.UnmapBuffer(ctx, elementBuf, MAP_INTERNAL); - } - - return max; -} - - -/** * Check if OK to draw arrays/elements. */ static GLboolean @@ -749,17 +703,17 @@ _mesa_validate_DrawTransformFeedback(struct gl_context *ctx, return GL_FALSE; } - if (!obj->EndedAnytime) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawTransformFeedback*"); - return GL_FALSE; - } - if (stream >= ctx->Const.MaxVertexStreams) { _mesa_error(ctx, GL_INVALID_VALUE, "glDrawTransformFeedbackStream*(index>=MaxVertexStream)"); return GL_FALSE; } + if (!obj->EndedAnytime) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawTransformFeedback*"); + return GL_FALSE; + } + if (numInstances <= 0) { if (numInstances < 0) _mesa_error(ctx, GL_INVALID_VALUE, diff --git a/mesalib/src/mesa/main/api_validate.h b/mesalib/src/mesa/main/api_validate.h index 8238df16c..0bb91c675 100644 --- a/mesalib/src/mesa/main/api_validate.h +++ b/mesalib/src/mesa/main/api_validate.h @@ -35,12 +35,6 @@ struct gl_context; struct gl_transform_feedback_object; -extern GLuint -_mesa_max_buffer_index(struct gl_context *ctx, GLuint count, GLenum type, - const void *indices, - struct gl_buffer_object *elementBuf); - - extern bool _mesa_is_valid_prim_mode(struct gl_context *ctx, GLenum mode); diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c index 5345339f6..4684615a8 100644 --- a/mesalib/src/mesa/main/attrib.c +++ b/mesalib/src/mesa/main/attrib.c @@ -1345,7 +1345,8 @@ _mesa_PopAttrib(void) if (xform->DepthClamp != ctx->Transform.DepthClamp) _mesa_set_enable(ctx, GL_DEPTH_CLAMP, ctx->Transform.DepthClamp); - _mesa_ClipControl(xform->ClipOrigin, xform->ClipDepthMode); + if (ctx->Extensions.ARB_clip_control) + _mesa_ClipControl(xform->ClipOrigin, xform->ClipDepthMode); } break; case GL_TEXTURE_BIT: diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index 25b9bfc4c..400c158a7 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -719,6 +719,9 @@ _mesa_init_constants(struct gl_constants *consts, gl_api api) /** GL_ARB_gpu_shader5 */ consts->MinFragmentInterpolationOffset = MIN_FRAGMENT_INTERPOLATION_OFFSET; consts->MaxFragmentInterpolationOffset = MAX_FRAGMENT_INTERPOLATION_OFFSET; + + /** GL_KHR_context_flush_control */ + consts->ContextReleaseBehavior = GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH; } @@ -729,6 +732,8 @@ _mesa_init_constants(struct gl_constants *consts, gl_api api) static void check_context_limits(struct gl_context *ctx) { + (void) ctx; + /* check that we don't exceed the size of various bitfields */ assert(VARYING_SLOT_MAX <= (8 * sizeof(ctx->VertexProgram._Current->Base.OutputsWritten))); @@ -1622,9 +1627,11 @@ _mesa_make_current( struct gl_context *newCtx, } if (curCtx && - (curCtx->WinSysDrawBuffer || curCtx->WinSysReadBuffer) && + (curCtx->WinSysDrawBuffer || curCtx->WinSysReadBuffer) && /* make sure this context is valid for flushing */ - curCtx != newCtx) + curCtx != newCtx && + curCtx->Const.ContextReleaseBehavior == + GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH) _mesa_flush(curCtx); /* We used to call _glapi_check_multithread() here. Now do it in drivers */ diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c index 25171f0ee..7d622bb16 100644 --- a/mesalib/src/mesa/main/errors.c +++ b/mesalib/src/mesa/main/errors.c @@ -676,22 +676,41 @@ debug_pop_group(struct gl_debug_state *debug) /** - * Return debug state for the context. The debug state will be allocated - * and initialized upon the first call. + * Lock and return debug state for the context. The debug state will be + * allocated and initialized upon the first call. When NULL is returned, the + * debug state is not locked. */ static struct gl_debug_state * -_mesa_get_debug_state(struct gl_context *ctx) +_mesa_lock_debug_state(struct gl_context *ctx) { + mtx_lock(&ctx->DebugMutex); + if (!ctx->Debug) { ctx->Debug = debug_create(); if (!ctx->Debug) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "allocating debug state"); + GET_CURRENT_CONTEXT(cur); + mtx_unlock(&ctx->DebugMutex); + + /* + * This function may be called from other threads. When that is the + * case, we cannot record this OOM error. + */ + if (ctx == cur) + _mesa_error(ctx, GL_OUT_OF_MEMORY, "allocating debug state"); + + return NULL; } } return ctx->Debug; } +static void +_mesa_unlock_debug_state(struct gl_context *ctx) +{ + mtx_unlock(&ctx->DebugMutex); +} + /** * Set the integer debug state specified by \p pname. This can be called from * _mesa_set_enable for example. @@ -699,7 +718,7 @@ _mesa_get_debug_state(struct gl_context *ctx) bool _mesa_set_debug_state_int(struct gl_context *ctx, GLenum pname, GLint val) { - struct gl_debug_state *debug = _mesa_get_debug_state(ctx); + struct gl_debug_state *debug = _mesa_lock_debug_state(ctx); if (!debug) return false; @@ -716,6 +735,8 @@ _mesa_set_debug_state_int(struct gl_context *ctx, GLenum pname, GLint val) break; } + _mesa_unlock_debug_state(ctx); + return true; } @@ -729,9 +750,12 @@ _mesa_get_debug_state_int(struct gl_context *ctx, GLenum pname) struct gl_debug_state *debug; GLint val; + mtx_lock(&ctx->DebugMutex); debug = ctx->Debug; - if (!debug) + if (!debug) { + mtx_unlock(&ctx->DebugMutex); return 0; + } switch (pname) { case GL_DEBUG_OUTPUT: @@ -756,6 +780,8 @@ _mesa_get_debug_state_int(struct gl_context *ctx, GLenum pname) break; } + mtx_unlock(&ctx->DebugMutex); + return val; } @@ -769,9 +795,12 @@ _mesa_get_debug_state_ptr(struct gl_context *ctx, GLenum pname) struct gl_debug_state *debug; void *val; + mtx_lock(&ctx->DebugMutex); debug = ctx->Debug; - if (!debug) + if (!debug) { + mtx_unlock(&ctx->DebugMutex); return NULL; + } switch (pname) { case GL_DEBUG_CALLBACK_FUNCTION_ARB: @@ -786,9 +815,49 @@ _mesa_get_debug_state_ptr(struct gl_context *ctx, GLenum pname) break; } + mtx_unlock(&ctx->DebugMutex); + return val; } +/** + * Insert a debug message. The mutex is assumed to be locked, and will be + * unlocked by this call. + */ +static void +log_msg_locked_and_unlock(struct gl_context *ctx, + enum mesa_debug_source source, + enum mesa_debug_type type, GLuint id, + enum mesa_debug_severity severity, + GLint len, const char *buf) +{ + struct gl_debug_state *debug = ctx->Debug; + + if (!debug_is_message_enabled(debug, source, type, id, severity)) { + _mesa_unlock_debug_state(ctx); + return; + } + + if (ctx->Debug->Callback) { + GLenum gl_source = debug_source_enums[source]; + GLenum gl_type = debug_type_enums[type]; + GLenum gl_severity = debug_severity_enums[severity]; + GLDEBUGPROC callback = ctx->Debug->Callback; + const void *data = ctx->Debug->CallbackData; + + /* + * When ctx->Debug->SyncOutput is GL_FALSE, the client is prepared for + * unsynchronous calls. When it is GL_TRUE, we will not spawn threads. + * In either case, we can call the callback unlocked. + */ + _mesa_unlock_debug_state(ctx); + callback(gl_source, gl_type, id, gl_severity, len, buf, data); + } + else { + debug_log_message(ctx->Debug, source, type, id, severity, len, buf); + _mesa_unlock_debug_state(ctx); + } +} /** * Log a client or driver debug message. @@ -798,24 +867,12 @@ log_msg(struct gl_context *ctx, enum mesa_debug_source source, enum mesa_debug_type type, GLuint id, enum mesa_debug_severity severity, GLint len, const char *buf) { - struct gl_debug_state *debug = _mesa_get_debug_state(ctx); + struct gl_debug_state *debug = _mesa_lock_debug_state(ctx); if (!debug) return; - if (!debug_is_message_enabled(debug, source, type, id, severity)) - return; - - if (debug->Callback) { - GLenum gl_type = debug_type_enums[type]; - GLenum gl_severity = debug_severity_enums[severity]; - - debug->Callback(debug_source_enums[source], gl_type, id, gl_severity, - len, buf, debug->CallbackData); - return; - } - - debug_log_message(debug, source, type, id, severity, len, buf); + log_msg_locked_and_unlock(ctx, source, type, id, severity, len, buf); } @@ -956,7 +1013,7 @@ _mesa_GetDebugMessageLog(GLuint count, GLsizei logSize, GLenum *sources, return 0; } - debug = _mesa_get_debug_state(ctx); + debug = _mesa_lock_debug_state(ctx); if (!debug) return 0; @@ -991,6 +1048,8 @@ _mesa_GetDebugMessageLog(GLuint count, GLsizei logSize, GLenum *sources, debug_delete_messages(debug, 1); } + _mesa_unlock_debug_state(ctx); + return ret; } @@ -1027,7 +1086,7 @@ _mesa_DebugMessageControl(GLenum gl_source, GLenum gl_type, return; } - debug = _mesa_get_debug_state(ctx); + debug = _mesa_lock_debug_state(ctx); if (!debug) return; @@ -1039,6 +1098,8 @@ _mesa_DebugMessageControl(GLenum gl_source, GLenum gl_type, else { debug_set_message_enable_all(debug, source, type, severity, enabled); } + + _mesa_unlock_debug_state(ctx); } @@ -1046,10 +1107,11 @@ void GLAPIENTRY _mesa_DebugMessageCallback(GLDEBUGPROC callback, const void *userParam) { GET_CURRENT_CONTEXT(ctx); - struct gl_debug_state *debug = _mesa_get_debug_state(ctx); + struct gl_debug_state *debug = _mesa_lock_debug_state(ctx); if (debug) { debug->Callback = callback; debug->CallbackData = userParam; + _mesa_unlock_debug_state(ctx); } } @@ -1059,18 +1121,10 @@ _mesa_PushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message) { GET_CURRENT_CONTEXT(ctx); - struct gl_debug_state *debug = _mesa_get_debug_state(ctx); const char *callerstr = "glPushDebugGroup"; + struct gl_debug_state *debug; struct gl_debug_message *emptySlot; - if (!debug) - return; - - if (debug->GroupStackDepth >= MAX_DEBUG_GROUP_STACK_DEPTH-1) { - _mesa_error(ctx, GL_STACK_OVERFLOW, "%s", callerstr); - return; - } - switch(source) { case GL_DEBUG_SOURCE_APPLICATION: case GL_DEBUG_SOURCE_THIRD_PARTY: @@ -1086,10 +1140,15 @@ _mesa_PushDebugGroup(GLenum source, GLuint id, GLsizei length, if (!validate_length(ctx, callerstr, length)) return; /* GL_INVALID_VALUE */ - log_msg(ctx, gl_enum_to_debug_source(source), - MESA_DEBUG_TYPE_PUSH_GROUP, id, - MESA_DEBUG_SEVERITY_NOTIFICATION, length, - message); + debug = _mesa_lock_debug_state(ctx); + if (!debug) + return; + + if (debug->GroupStackDepth >= MAX_DEBUG_GROUP_STACK_DEPTH-1) { + _mesa_unlock_debug_state(ctx); + _mesa_error(ctx, GL_STACK_OVERFLOW, "%s", callerstr); + return; + } /* pop reuses the message details from push so we store this */ emptySlot = debug_get_group_message(debug); @@ -1101,6 +1160,12 @@ _mesa_PushDebugGroup(GLenum source, GLuint id, GLsizei length, length, message); debug_push_group(debug); + + log_msg_locked_and_unlock(ctx, + gl_enum_to_debug_source(source), + MESA_DEBUG_TYPE_PUSH_GROUP, id, + MESA_DEBUG_SEVERITY_NOTIFICATION, length, + message); } @@ -1108,35 +1173,43 @@ void GLAPIENTRY _mesa_PopDebugGroup(void) { GET_CURRENT_CONTEXT(ctx); - struct gl_debug_state *debug = _mesa_get_debug_state(ctx); const char *callerstr = "glPopDebugGroup"; - struct gl_debug_message *gdmessage; + struct gl_debug_state *debug; + struct gl_debug_message *gdmessage, msg; + debug = _mesa_lock_debug_state(ctx); if (!debug) return; if (debug->GroupStackDepth <= 0) { + _mesa_unlock_debug_state(ctx); _mesa_error(ctx, GL_STACK_UNDERFLOW, "%s", callerstr); return; } debug_pop_group(debug); + /* make a shallow copy */ gdmessage = debug_get_group_message(debug); - log_msg(ctx, gdmessage->source, - gl_enum_to_debug_type(GL_DEBUG_TYPE_POP_GROUP), - gdmessage->id, - gl_enum_to_debug_severity(GL_DEBUG_SEVERITY_NOTIFICATION), - gdmessage->length, gdmessage->message); - - debug_message_clear(gdmessage); + msg = *gdmessage; + gdmessage->message = NULL; + gdmessage->length = 0; + + log_msg_locked_and_unlock(ctx, + msg.source, + gl_enum_to_debug_type(GL_DEBUG_TYPE_POP_GROUP), + msg.id, + gl_enum_to_debug_severity(GL_DEBUG_SEVERITY_NOTIFICATION), + msg.length, msg.message); + + debug_message_clear(&msg); } void _mesa_init_errors(struct gl_context *ctx) { - /* no-op */ + mtx_init(&ctx->DebugMutex, mtx_plain); } @@ -1148,6 +1221,8 @@ _mesa_free_errors_data(struct gl_context *ctx) /* set to NULL just in case it is used before context is completely gone. */ ctx->Debug = NULL; } + + mtx_destroy(&ctx->DebugMutex); } @@ -1362,6 +1437,8 @@ _mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... ) debug_get_id(&error_msg_id); do_output = should_output(ctx, error, fmtString); + + mtx_lock(&ctx->DebugMutex); if (ctx->Debug) { do_log = debug_is_message_enabled(ctx->Debug, MESA_DEBUG_SOURCE_API, @@ -1372,6 +1449,7 @@ _mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... ) else { do_log = GL_FALSE; } + mtx_unlock(&ctx->DebugMutex); if (do_output || do_log) { char s[MAX_DEBUG_MESSAGE_LENGTH], s2[MAX_DEBUG_MESSAGE_LENGTH]; diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index 15d66a744..0df04c2e6 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -320,6 +320,7 @@ static const struct extension extension_table[] = { /* KHR extensions */ { "GL_KHR_debug", o(dummy_true), GL, 2012 }, + { "GL_KHR_context_flush_control", o(dummy_true), GL | ES2, 2014 }, /* Vendor extensions */ { "GL_3DFX_texture_compression_FXT1", o(TDFX_texture_compression_FXT1), GL, 1999 }, diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py index aa9f282d8..09a61acc1 100644 --- a/mesalib/src/mesa/main/get_hash_params.py +++ b/mesalib/src/mesa/main/get_hash_params.py @@ -318,6 +318,9 @@ descriptor=[ [ "PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL", "CONST(MAX_PERFQUERY_COUNTER_NAME_LENGTH), extra_INTEL_performance_query" ], [ "PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL", "CONST(MAX_PERFQUERY_COUNTER_DESC_LENGTH), extra_INTEL_performance_query" ], [ "PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL", "CONST(PERFQUERY_HAVE_GPA_EXTENDED_COUNTERS), extra_INTEL_performance_query" ], + +# GL_KHR_context_flush_control + [ "CONTEXT_RELEASE_BEHAVIOR", "CONTEXT_ENUM(Const.ContextReleaseBehavior), NO_EXTRA" ], ]}, # GLES3 is not a typo. @@ -624,7 +627,7 @@ descriptor=[ # == GL_CURRENT_MATRIX_NV [ "CURRENT_MATRIX_ARB", "LOC_CUSTOM, TYPE_MATRIX, 0, extra_ARB_vertex_program_ARB_fragment_program" ], # == GL_CURRENT_MATRIX_NV - [ "TRANSPOSE_CURRENT_MATRIX_ARB", "LOC_CUSTOM, TYPE_MATRIX, 0, extra_ARB_vertex_program_ARB_fragment_program" ], + [ "TRANSPOSE_CURRENT_MATRIX_ARB", "LOC_CUSTOM, TYPE_MATRIX_T, 0, extra_ARB_vertex_program_ARB_fragment_program" ], # == GL_PROGRAM_ERROR_POSITION_NV [ "PROGRAM_ERROR_POSITION_ARB", "CONTEXT_INT(Program.ErrorPos), extra_ARB_vertex_program_ARB_fragment_program" ], diff --git a/mesalib/src/mesa/main/imports.c b/mesalib/src/mesa/main/imports.c index b8c754815..4f5a2d11f 100644 --- a/mesalib/src/mesa/main/imports.c +++ b/mesalib/src/mesa/main/imports.c @@ -499,25 +499,6 @@ _mesa_strdup( const char *s ) } } -/** Wrapper around strtof() */ -float -_mesa_strtof( const char *s, char **end ) -{ -#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \ - !defined(ANDROID) && !defined(__HAIKU__) && !defined(__UCLIBC__) && \ - !defined(__NetBSD__) - static locale_t loc = NULL; - if (!loc) { - loc = newlocale(LC_CTYPE_MASK, "C", NULL); - } - return strtof_l(s, end, loc); -#elif defined(_ISOC99_SOURCE) || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600) - return strtof(s, end); -#else - return (float)strtod(s, end); -#endif -} - /** Compute simple checksum/hash for a string */ unsigned int _mesa_str_checksum(const char *str) diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h index 436d1651a..0fcba4fb9 100644 --- a/mesalib/src/mesa/main/imports.h +++ b/mesalib/src/mesa/main/imports.h @@ -540,9 +540,6 @@ _mesa_half_is_negative(GLhalfARB h) extern char * _mesa_strdup( const char *s ); -extern float -_mesa_strtof( const char *s, char **end ); - extern unsigned int _mesa_str_checksum(const char *str); diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index e1f1f1dde..7389baa1d 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -2843,6 +2843,7 @@ struct gl_shader_program /* post-link info: */ unsigned NumUserUniformStorage; + unsigned NumHiddenUniforms; struct gl_uniform_storage *UniformStorage; /** @@ -3680,6 +3681,9 @@ struct gl_constants GLboolean FakeSWMSAA; + /** GL_KHR_context_flush_control */ + GLenum ContextReleaseBehavior; + struct gl_shader_compiler_options ShaderCompilerOptions[MESA_SHADER_STAGES]; }; @@ -4390,6 +4394,7 @@ struct gl_context GLuint ErrorDebugCount; /* GL_ARB_debug_output/GL_KHR_debug */ + mtx_t DebugMutex; struct gl_debug_state *Debug; GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */ diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index 2be9092c1..66578204f 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -565,13 +565,15 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param *params = _mesa_longest_attribute_name_length(shProg); return; case GL_ACTIVE_UNIFORMS: - *params = shProg->NumUserUniformStorage; + *params = shProg->NumUserUniformStorage - shProg->NumHiddenUniforms; return; case GL_ACTIVE_UNIFORM_MAX_LENGTH: { unsigned i; GLint max_len = 0; + const unsigned num_uniforms = + shProg->NumUserUniformStorage - shProg->NumHiddenUniforms; - for (i = 0; i < shProg->NumUserUniformStorage; i++) { + for (i = 0; i < num_uniforms; i++) { /* Add one for the terminating NUL character for a non-array, and * 4 for the "[0]" and the NUL for an array. */ diff --git a/mesalib/src/mesa/main/sse_minmax.c b/mesalib/src/mesa/main/sse_minmax.c new file mode 100644 index 000000000..222ac1454 --- /dev/null +++ b/mesalib/src/mesa/main/sse_minmax.c @@ -0,0 +1,97 @@ +/* + * Copyright © 2014 Timothy Arceri + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Author: + * Timothy Arceri <t_arceri@yahoo.com.au> + * + */ + +#ifdef __SSE4_1__ +#include "main/sse_minmax.h" +#include <smmintrin.h> +#include <stdint.h> + +void +_mesa_uint_array_min_max(const unsigned *ui_indices, unsigned *min_index, + unsigned *max_index, const unsigned count) +{ + unsigned max_ui = 0; + unsigned min_ui = ~0U; + unsigned i = 0; + unsigned aligned_count = count; + + /* handle the first few values without SSE until the pointer is aligned */ + while (((uintptr_t)ui_indices & 15) && aligned_count) { + if (*ui_indices > max_ui) + max_ui = *ui_indices; + if (*ui_indices < min_ui) + min_ui = *ui_indices; + + aligned_count--; + ui_indices++; + } + + /* TODO: The actual threshold for SSE begin useful may be higher than 8. + * Some careful microbenchmarks and measurement are required to + * find the actual tipping point. + */ + if (aligned_count >= 8) { + unsigned max_arr[4] __attribute__ ((aligned (16))); + unsigned min_arr[4] __attribute__ ((aligned (16))); + unsigned vec_count; + __m128i max_ui4 = _mm_setzero_si128(); + __m128i min_ui4 = _mm_set1_epi32(~0U); + __m128i ui_indices4; + __m128i *ui_indices_ptr; + + vec_count = aligned_count & ~0x3; + ui_indices_ptr = (__m128i *)ui_indices; + for (i = 0; i < vec_count / 4; i++) { + ui_indices4 = _mm_load_si128(&ui_indices_ptr[i]); + max_ui4 = _mm_max_epu32(ui_indices4, max_ui4); + min_ui4 = _mm_min_epu32(ui_indices4, min_ui4); + } + + _mm_store_si128((__m128i *)max_arr, max_ui4); + _mm_store_si128((__m128i *)min_arr, min_ui4); + + for (i = 0; i < 4; i++) { + if (max_arr[i] > max_ui) + max_ui = max_arr[i]; + if (min_arr[i] < min_ui) + min_ui = min_arr[i]; + } + i = vec_count; + } + + for (; i < aligned_count; i++) { + if (ui_indices[i] > max_ui) + max_ui = ui_indices[i]; + if (ui_indices[i] < min_ui) + min_ui = ui_indices[i]; + } + + *min_index = min_ui; + *max_index = max_ui; +} + +#endif diff --git a/mesalib/src/mesa/main/sse_minmax.h b/mesalib/src/mesa/main/sse_minmax.h new file mode 100644 index 000000000..953c4e9eb --- /dev/null +++ b/mesalib/src/mesa/main/sse_minmax.h @@ -0,0 +1,30 @@ +/* + * Copyright © 2014 Timothy Arceri + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Author: + * Timothy Arceri <t_arceri@yahoo.com.au> + * + */ + +void +_mesa_uint_array_min_max(const unsigned *ui_indices, unsigned *min_index, + unsigned *max_index, const unsigned count); diff --git a/mesalib/src/mesa/main/streaming-load-memcpy.c b/mesalib/src/mesa/main/streaming-load-memcpy.c index 8427149c5..d7147afdc 100644 --- a/mesalib/src/mesa/main/streaming-load-memcpy.c +++ b/mesalib/src/mesa/main/streaming-load-memcpy.c @@ -26,7 +26,6 @@ * */ -#ifdef __SSE4_1__ #include "main/macros.h" #include "main/streaming-load-memcpy.h" #include <smmintrin.h> @@ -84,5 +83,3 @@ _mesa_streaming_load_memcpy(void *restrict dst, void *restrict src, size_t len) memcpy(d, s, len); } } - -#endif diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c index 832e66128..ec16af9d2 100644 --- a/mesalib/src/mesa/main/texformat.c +++ b/mesalib/src/mesa/main/texformat.c @@ -155,12 +155,14 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, case GL_ALPHA4: case GL_ALPHA8: RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM8); + RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_UNORM); break; case GL_ALPHA12: case GL_ALPHA16: RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM16); RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM8); + RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_UNORM); break; /* Luminance formats */ @@ -224,6 +226,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, case GL_COMPRESSED_ALPHA_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM8); + RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_UNORM); break; case GL_COMPRESSED_LUMINANCE_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_L_UNORM8); diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index f913e42d3..f858cef50 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -1667,8 +1667,10 @@ texstore_rgba_integer(TEXSTORE_PARAMS) assert(is_array && !normalized); - if (!is_array) + if (!is_array) { + free(tmp_row); return GL_FALSE; + } invert_swizzle(dst2rgba, rgba2dst); compute_component_mapping(GL_RGBA, baseInternalFormat, base2rgba); diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp index fcb14c4e2..32870d0c4 100644 --- a/mesalib/src/mesa/main/uniform_query.cpp +++ b/mesalib/src/mesa/main/uniform_query.cpp @@ -176,46 +176,13 @@ validate_uniform_parameters(struct gl_context *ctx, struct gl_shader_program *shProg, GLint location, GLsizei count, unsigned *array_index, - const char *caller, - bool negative_one_is_not_valid) + const char *caller) { - if (!shProg || !shProg->LinkStatus) { + if (shProg == NULL) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(program not linked)", caller); return NULL; } - if (location == -1) { - /* For glGetUniform, page 264 (page 278 of the PDF) of the OpenGL 2.1 - * spec says: - * - * "The error INVALID_OPERATION is generated if program has not been - * linked successfully, or if location is not a valid location for - * program." - * - * For glUniform, page 82 (page 96 of the PDF) of the OpenGL 2.1 spec - * says: - * - * "If the value of location is -1, the Uniform* commands will - * silently ignore the data passed in, and the current uniform - * values will not be changed." - * - * Allowing -1 for the location parameter of glUniform allows - * applications to avoid error paths in the case that, for example, some - * uniform variable is removed by the compiler / linker after - * optimization. In this case, the new value of the uniform is dropped - * on the floor. For the case of glGetUniform, there is nothing - * sensible to do for a location of -1. - * - * The negative_one_is_not_valid flag selects between the two behaviors. - */ - if (negative_one_is_not_valid) { - _mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)", - caller, location); - } - - return NULL; - } - /* From page 12 (page 26 of the PDF) of the OpenGL 2.1 spec: * * "If a negative number is provided where an argument of type sizei or @@ -226,10 +193,26 @@ validate_uniform_parameters(struct gl_context *ctx, return NULL; } - /* Check that the given location is in bounds of uniform remap table. */ - if (location >= (GLint) shProg->NumUniformRemapTable) { - _mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)", - caller, location); + /* Check that the given location is in bounds of uniform remap table. + * Unlinked programs will have NumUniformRemapTable == 0, so we can take + * the shProg->LinkStatus check out of the main path. + */ + if (unlikely(location >= (GLint) shProg->NumUniformRemapTable)) { + if (!shProg->LinkStatus) + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(program not linked)", + caller); + else + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)", + caller, location); + + return NULL; + } + + if (location == -1) { + if (!shProg->LinkStatus) + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(program not linked)", + caller); + return NULL; } @@ -269,27 +252,30 @@ validate_uniform_parameters(struct gl_context *ctx, struct gl_uniform_storage *const uni = shProg->UniformRemapTable[location]; - if (uni->array_elements == 0 && count > 1) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "%s(count > 1 for non-array, location=%d)", - caller, location); - return NULL; - } + if (uni->array_elements == 0) { + if (count > 1) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "%s(count > 1 for non-array, location=%d)", + caller, location); + return NULL; + } - /* The array index specified by the uniform location is just the uniform - * location minus the base location of of the uniform. - */ - *array_index = location - uni->remap_location; + assert((location - uni->remap_location) == 0); + *array_index = 0; + } else { + /* The array index specified by the uniform location is just the uniform + * location minus the base location of of the uniform. + */ + *array_index = location - uni->remap_location; - /* If the uniform is an array, check that array_index is in bounds. - * If not an array, check that array_index is zero. - * array_index is unsigned so no need to check for less than zero. - */ - const unsigned limit = MAX2(uni->array_elements, 1); - if (*array_index >= limit) { - _mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)", - caller, location); - return NULL; + /* If the uniform is an array, check that array_index is in bounds. + * array_index is unsigned so no need to check for less than zero. + */ + if (*array_index >= uni->array_elements) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)", + caller, location); + return NULL; + } } return uni; } @@ -308,9 +294,39 @@ _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location, struct gl_uniform_storage *const uni = validate_uniform_parameters(ctx, shProg, location, 1, - &offset, "glGetUniform", true); - if (uni == NULL) + &offset, "glGetUniform"); + if (uni == NULL) { + /* For glGetUniform, page 264 (page 278 of the PDF) of the OpenGL 2.1 + * spec says: + * + * "The error INVALID_OPERATION is generated if program has not been + * linked successfully, or if location is not a valid location for + * program." + * + * For glUniform, page 82 (page 96 of the PDF) of the OpenGL 2.1 spec + * says: + * + * "If the value of location is -1, the Uniform* commands will + * silently ignore the data passed in, and the current uniform + * values will not be changed." + * + * Allowing -1 for the location parameter of glUniform allows + * applications to avoid error paths in the case that, for example, some + * uniform variable is removed by the compiler / linker after + * optimization. In this case, the new value of the uniform is dropped + * on the floor. For the case of glGetUniform, there is nothing + * sensible to do for a location of -1. + * + * If the location was -1, validate_unfirom_parameters will return NULL + * without raising an error. Raise the error here. + */ + if (location == -1) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetUniform(location=%d)", + location); + } + return; + } { unsigned elements = (uni->type->is_sampler()) @@ -342,8 +358,7 @@ _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location, */ if (returnType == uni->type->base_type || ((returnType == GLSL_TYPE_INT - || returnType == GLSL_TYPE_UINT - || returnType == GLSL_TYPE_SAMPLER) + || returnType == GLSL_TYPE_UINT) && (uni->type->base_type == GLSL_TYPE_INT || uni->type->base_type == GLSL_TYPE_UINT @@ -583,93 +598,22 @@ _mesa_propagate_uniforms_to_driver_storage(struct gl_uniform_storage *uni, extern "C" void _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, GLint location, GLsizei count, - const GLvoid *values, GLenum type) + const GLvoid *values, + enum glsl_base_type basicType, + unsigned src_components) { unsigned offset; - unsigned components; - unsigned src_components; - enum glsl_base_type basicType; struct gl_uniform_storage *const uni = validate_uniform_parameters(ctx, shProg, location, count, - &offset, "glUniform", false); + &offset, "glUniform"); if (uni == NULL) return; /* Verify that the types are compatible. */ - switch (type) { - case GL_FLOAT: - basicType = GLSL_TYPE_FLOAT; - src_components = 1; - break; - case GL_FLOAT_VEC2: - basicType = GLSL_TYPE_FLOAT; - src_components = 2; - break; - case GL_FLOAT_VEC3: - basicType = GLSL_TYPE_FLOAT; - src_components = 3; - break; - case GL_FLOAT_VEC4: - basicType = GLSL_TYPE_FLOAT; - src_components = 4; - break; - case GL_UNSIGNED_INT: - basicType = GLSL_TYPE_UINT; - src_components = 1; - break; - case GL_UNSIGNED_INT_VEC2: - basicType = GLSL_TYPE_UINT; - src_components = 2; - break; - case GL_UNSIGNED_INT_VEC3: - basicType = GLSL_TYPE_UINT; - src_components = 3; - break; - case GL_UNSIGNED_INT_VEC4: - basicType = GLSL_TYPE_UINT; - src_components = 4; - break; - case GL_INT: - basicType = GLSL_TYPE_INT; - src_components = 1; - break; - case GL_INT_VEC2: - basicType = GLSL_TYPE_INT; - src_components = 2; - break; - case GL_INT_VEC3: - basicType = GLSL_TYPE_INT; - src_components = 3; - break; - case GL_INT_VEC4: - basicType = GLSL_TYPE_INT; - src_components = 4; - break; - case GL_BOOL: - case GL_BOOL_VEC2: - case GL_BOOL_VEC3: - case GL_BOOL_VEC4: - case GL_FLOAT_MAT2: - case GL_FLOAT_MAT2x3: - case GL_FLOAT_MAT2x4: - case GL_FLOAT_MAT3x2: - case GL_FLOAT_MAT3: - case GL_FLOAT_MAT3x4: - case GL_FLOAT_MAT4x2: - case GL_FLOAT_MAT4x3: - case GL_FLOAT_MAT4: - default: - _mesa_problem(NULL, "Invalid type in %s", __func__); - return; - } - - if (uni->type->is_sampler()) { - components = 1; - } else { - components = uni->type->vector_elements; - } + const unsigned components = uni->type->is_sampler() + ? 1 : uni->type->vector_elements; bool match; switch (uni->type->base_type) { @@ -690,7 +634,7 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, return; } - if (ctx->_Shader->Flags & GLSL_UNIFORMS) { + if (unlikely(ctx->_Shader->Flags & GLSL_UNIFORMS)) { log_uniform(values, basicType, components, 1, count, false, shProg, location, uni); } @@ -713,9 +657,7 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, * GL_INVALID_VALUE error and ignore the command. */ if (uni->type->is_sampler()) { - int i; - - for (i = 0; i < count; i++) { + for (int i = 0; i < count; i++) { const unsigned texUnit = ((unsigned *) values)[i]; /* check that the sampler (tex unit index) is legal */ @@ -730,9 +672,7 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, } if (uni->type->is_image()) { - int i; - - for (i = 0; i < count; i++) { + for (int i = 0; i < count; i++) { const int unit = ((GLint *) values)[i]; /* check that the image unit is legal */ @@ -772,9 +712,8 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, (const union gl_constant_value *) values; union gl_constant_value *dst = &uni->storage[components * offset]; const unsigned elems = components * count; - unsigned i; - for (i = 0; i < elems; i++) { + for (unsigned i = 0; i < elems; i++) { if (basicType == GLSL_TYPE_FLOAT) { dst[i].i = src[i].f != 0.0f ? ctx->Const.UniformBooleanTrue : 0; } else { @@ -791,19 +730,16 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, * the changes through. */ if (uni->type->is_sampler()) { - int i; - bool flushed = false; - for (i = 0; i < MESA_SHADER_STAGES; i++) { + for (int i = 0; i < MESA_SHADER_STAGES; i++) { struct gl_shader *const sh = shProg->_LinkedShaders[i]; - int j; /* If the shader stage doesn't use the sampler uniform, skip this. */ if (sh == NULL || !uni->sampler[i].active) continue; - for (j = 0; j < count; j++) { + for (int j = 0; j < count; j++) { sh->SamplerUnits[uni->sampler[i].index + offset + j] = ((unsigned *) values)[j]; } @@ -845,13 +781,11 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, * uniforms to image units present in the shader data structure. */ if (uni->type->is_image()) { - int i, j; - - for (i = 0; i < MESA_SHADER_STAGES; i++) { + for (int i = 0; i < MESA_SHADER_STAGES; i++) { if (uni->image[i].active) { struct gl_shader *sh = shProg->_LinkedShaders[i]; - for (j = 0; j < count; j++) + for (int j = 0; j < count; j++) sh->ImageUnits[uni->image[i].index + offset + j] = ((GLint *) values)[j]; } @@ -878,7 +812,7 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg, struct gl_uniform_storage *const uni = validate_uniform_parameters(ctx, shProg, location, count, - &offset, "glUniformMatrix", false); + &offset, "glUniformMatrix"); if (uni == NULL) return; @@ -902,17 +836,17 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg, } /* GL_INVALID_VALUE is generated if `transpose' is not GL_FALSE. - * http://www.khronos.org/opengles/sdk/docs/man/xhtml/glUniform.xml */ - if (ctx->API == API_OPENGLES - || (ctx->API == API_OPENGLES2 && ctx->Version < 30)) { - if (transpose) { + * http://www.khronos.org/opengles/sdk/docs/man/xhtml/glUniform.xml + */ + if (transpose) { + if (ctx->API == API_OPENGLES2 && ctx->Version < 30) { _mesa_error(ctx, GL_INVALID_VALUE, "glUniformMatrix(matrix transpose is not GL_FALSE)"); return; } } - if (ctx->_Shader->Flags & GLSL_UNIFORMS) { + if (unlikely(ctx->_Shader->Flags & GLSL_UNIFORMS)) { log_uniform(values, GLSL_TYPE_FLOAT, components, vectors, count, bool(transpose), shProg, location, uni); } diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c index c30710772..d2d70e7f7 100644 --- a/mesalib/src/mesa/main/uniforms.c +++ b/mesalib/src/mesa/main/uniforms.c @@ -151,7 +151,7 @@ void GLAPIENTRY _mesa_Uniform1f(GLint location, GLfloat v0) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GL_FLOAT); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GLSL_TYPE_FLOAT, 1); } void GLAPIENTRY @@ -161,7 +161,7 @@ _mesa_Uniform2f(GLint location, GLfloat v0, GLfloat v1) GLfloat v[2]; v[0] = v0; v[1] = v1; - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_FLOAT_VEC2); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_FLOAT, 2); } void GLAPIENTRY @@ -172,7 +172,7 @@ _mesa_Uniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) v[0] = v0; v[1] = v1; v[2] = v2; - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_FLOAT_VEC3); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_FLOAT, 3); } void GLAPIENTRY @@ -185,14 +185,14 @@ _mesa_Uniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, v[1] = v1; v[2] = v2; v[3] = v3; - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_FLOAT_VEC4); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_FLOAT, 4); } void GLAPIENTRY _mesa_Uniform1i(GLint location, GLint v0) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GL_INT); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GLSL_TYPE_INT, 1); } void GLAPIENTRY @@ -202,7 +202,7 @@ _mesa_Uniform2i(GLint location, GLint v0, GLint v1) GLint v[2]; v[0] = v0; v[1] = v1; - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_INT_VEC2); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_INT, 2); } void GLAPIENTRY @@ -213,7 +213,7 @@ _mesa_Uniform3i(GLint location, GLint v0, GLint v1, GLint v2) v[0] = v0; v[1] = v1; v[2] = v2; - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_INT_VEC3); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_INT, 3); } void GLAPIENTRY @@ -225,63 +225,63 @@ _mesa_Uniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) v[1] = v1; v[2] = v2; v[3] = v3; - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_INT_VEC4); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_INT, 4); } void GLAPIENTRY _mesa_Uniform1fv(GLint location, GLsizei count, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_FLOAT); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_FLOAT, 1); } void GLAPIENTRY _mesa_Uniform2fv(GLint location, GLsizei count, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_FLOAT_VEC2); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_FLOAT, 2); } void GLAPIENTRY _mesa_Uniform3fv(GLint location, GLsizei count, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_FLOAT_VEC3); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_FLOAT, 3); } void GLAPIENTRY _mesa_Uniform4fv(GLint location, GLsizei count, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_FLOAT_VEC4); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_FLOAT, 4); } void GLAPIENTRY _mesa_Uniform1iv(GLint location, GLsizei count, const GLint * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_INT); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_INT, 1); } void GLAPIENTRY _mesa_Uniform2iv(GLint location, GLsizei count, const GLint * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_INT_VEC2); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_INT, 2); } void GLAPIENTRY _mesa_Uniform3iv(GLint location, GLsizei count, const GLint * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_INT_VEC3); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_INT, 3); } void GLAPIENTRY _mesa_Uniform4iv(GLint location, GLsizei count, const GLint * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_INT_VEC4); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_INT, 4); } /** Same as above with direct state access **/ @@ -292,7 +292,7 @@ _mesa_ProgramUniform1f(GLuint program, GLint location, GLfloat v0) struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform1f"); - _mesa_uniform(ctx, shProg, location, 1, &v0, GL_FLOAT); + _mesa_uniform(ctx, shProg, location, 1, &v0, GLSL_TYPE_FLOAT, 1); } void GLAPIENTRY @@ -304,7 +304,7 @@ _mesa_ProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1) v[0] = v0; v[1] = v1; shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2f"); - _mesa_uniform(ctx, shProg, location, 1, v, GL_FLOAT_VEC2); + _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_FLOAT, 2); } void GLAPIENTRY @@ -318,7 +318,7 @@ _mesa_ProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, v[1] = v1; v[2] = v2; shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3f"); - _mesa_uniform(ctx, shProg, location, 1, v, GL_FLOAT_VEC3); + _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_FLOAT, 3); } void GLAPIENTRY @@ -333,7 +333,7 @@ _mesa_ProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, v[2] = v2; v[3] = v3; shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4f"); - _mesa_uniform(ctx, shProg, location, 1, v, GL_FLOAT_VEC4); + _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_FLOAT, 4); } void GLAPIENTRY @@ -343,7 +343,7 @@ _mesa_ProgramUniform1i(GLuint program, GLint location, GLint v0) struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform1i"); - _mesa_uniform(ctx, shProg, location, 1, &v0, GL_INT); + _mesa_uniform(ctx, shProg, location, 1, &v0, GLSL_TYPE_INT, 1); } void GLAPIENTRY @@ -355,7 +355,7 @@ _mesa_ProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1) v[0] = v0; v[1] = v1; shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2i"); - _mesa_uniform(ctx, shProg, location, 1, v, GL_INT_VEC2); + _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_INT, 2); } void GLAPIENTRY @@ -369,7 +369,7 @@ _mesa_ProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, v[1] = v1; v[2] = v2; shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3i"); - _mesa_uniform(ctx, shProg, location, 1, v, GL_INT_VEC3); + _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_INT, 3); } void GLAPIENTRY @@ -384,7 +384,7 @@ _mesa_ProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, v[2] = v2; v[3] = v3; shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4i"); - _mesa_uniform(ctx, shProg, location, 1, v, GL_INT_VEC4); + _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_INT, 4); } void GLAPIENTRY @@ -395,7 +395,7 @@ _mesa_ProgramUniform1fv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform1fv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_FLOAT); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_FLOAT, 1); } void GLAPIENTRY @@ -406,7 +406,7 @@ _mesa_ProgramUniform2fv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2fv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_FLOAT_VEC2); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_FLOAT, 2); } void GLAPIENTRY @@ -417,7 +417,7 @@ _mesa_ProgramUniform3fv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3fv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_FLOAT_VEC3); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_FLOAT, 3); } void GLAPIENTRY @@ -428,7 +428,7 @@ _mesa_ProgramUniform4fv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4fv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_FLOAT_VEC4); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_FLOAT, 4); } void GLAPIENTRY @@ -439,7 +439,7 @@ _mesa_ProgramUniform1iv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform1iv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_INT); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_INT, 1); } void GLAPIENTRY @@ -450,7 +450,7 @@ _mesa_ProgramUniform2iv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2iv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_INT_VEC2); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_INT, 2); } void GLAPIENTRY @@ -461,7 +461,7 @@ _mesa_ProgramUniform3iv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3iv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_INT_VEC3); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_INT, 3); } void GLAPIENTRY @@ -472,7 +472,7 @@ _mesa_ProgramUniform4iv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4iv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_INT_VEC4); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_INT, 4); } @@ -481,7 +481,7 @@ void GLAPIENTRY _mesa_Uniform1ui(GLint location, GLuint v0) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GL_UNSIGNED_INT); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GLSL_TYPE_UINT, 1); } void GLAPIENTRY @@ -491,7 +491,7 @@ _mesa_Uniform2ui(GLint location, GLuint v0, GLuint v1) GLuint v[2]; v[0] = v0; v[1] = v1; - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_UNSIGNED_INT_VEC2); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_UINT, 2); } void GLAPIENTRY @@ -502,7 +502,7 @@ _mesa_Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) v[0] = v0; v[1] = v1; v[2] = v2; - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_UNSIGNED_INT_VEC3); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_UINT, 3); } void GLAPIENTRY @@ -514,35 +514,35 @@ _mesa_Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) v[1] = v1; v[2] = v2; v[3] = v3; - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_UNSIGNED_INT_VEC4); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_UINT, 4); } void GLAPIENTRY _mesa_Uniform1uiv(GLint location, GLsizei count, const GLuint *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_UNSIGNED_INT); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_UINT, 1); } void GLAPIENTRY _mesa_Uniform2uiv(GLint location, GLsizei count, const GLuint *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_UNSIGNED_INT_VEC2); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_UINT, 2); } void GLAPIENTRY _mesa_Uniform3uiv(GLint location, GLsizei count, const GLuint *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_UNSIGNED_INT_VEC3); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_UINT, 3); } void GLAPIENTRY _mesa_Uniform4uiv(GLint location, GLsizei count, const GLuint *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_UNSIGNED_INT_VEC4); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_UINT, 4); } @@ -583,7 +583,7 @@ _mesa_ProgramUniform1ui(GLuint program, GLint location, GLuint v0) struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform1ui"); - _mesa_uniform(ctx, shProg, location, 1, &v0, GL_UNSIGNED_INT); + _mesa_uniform(ctx, shProg, location, 1, &v0, GLSL_TYPE_UINT, 1); } void GLAPIENTRY @@ -596,7 +596,7 @@ _mesa_ProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1) v[1] = v1; shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2ui"); - _mesa_uniform(ctx, shProg, location, 1, v, GL_UNSIGNED_INT_VEC2); + _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_UINT, 2); } void GLAPIENTRY @@ -611,7 +611,7 @@ _mesa_ProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, v[2] = v2; shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3ui"); - _mesa_uniform(ctx, shProg, location, 1, v, GL_UNSIGNED_INT_VEC3); + _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_UINT, 3); } void GLAPIENTRY @@ -626,7 +626,7 @@ _mesa_ProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, v[2] = v2; v[3] = v3; shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4ui"); - _mesa_uniform(ctx, shProg, location, 1, v, GL_UNSIGNED_INT_VEC4); + _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_UINT, 4); } void GLAPIENTRY @@ -637,7 +637,7 @@ _mesa_ProgramUniform1uiv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform1uiv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_UNSIGNED_INT); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_UINT, 1); } void GLAPIENTRY @@ -648,7 +648,7 @@ _mesa_ProgramUniform2uiv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2uiv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_UNSIGNED_INT_VEC2); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_UINT, 2); } void GLAPIENTRY @@ -659,7 +659,7 @@ _mesa_ProgramUniform3uiv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3uiv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_UNSIGNED_INT_VEC3); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_UINT, 3); } void GLAPIENTRY @@ -670,7 +670,7 @@ _mesa_ProgramUniform4uiv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4uiv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_UNSIGNED_INT_VEC4); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_UINT, 4); } @@ -1208,7 +1208,7 @@ _mesa_GetActiveUniformName(GLuint program, GLuint uniformIndex, struct gl_shader_program *shProg; if (!ctx->Extensions.ARB_uniform_buffer_object) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetActiveUniformBlockiv"); + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetActiveUniformName"); return; } diff --git a/mesalib/src/mesa/main/uniforms.h b/mesalib/src/mesa/main/uniforms.h index 6575a52f4..0a9ee7de9 100644 --- a/mesalib/src/mesa/main/uniforms.h +++ b/mesalib/src/mesa/main/uniforms.h @@ -265,7 +265,9 @@ _mesa_get_uniform_location(struct gl_shader_program *shProg, void _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shader_program, GLint location, GLsizei count, - const GLvoid *values, GLenum type); + const GLvoid *values, + enum glsl_base_type basicType, + unsigned src_components); void _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg, diff --git a/mesalib/src/mesa/main/viewport.c b/mesalib/src/mesa/main/viewport.c index d6a9e290a..0adce9c78 100644 --- a/mesalib/src/mesa/main/viewport.c +++ b/mesalib/src/mesa/main/viewport.c @@ -459,15 +459,14 @@ _mesa_ClipControl(GLenum origin, GLenum depth) ctx->Transform.ClipDepthMode == depth) return; - FLUSH_VERTICES(ctx, 0); + /* Affects transform state and the viewport transform */ + FLUSH_VERTICES(ctx, _NEW_TRANSFORM | _NEW_VIEWPORT); if (ctx->Transform.ClipOrigin != origin) { ctx->Transform.ClipOrigin = origin; /* Affects the winding order of the front face. */ ctx->NewState |= _NEW_POLYGON; - /* Affects the y component of the viewport transform. */ - ctx->NewState |= _NEW_VIEWPORT; if (ctx->Driver.FrontFace) ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace); @@ -476,9 +475,6 @@ _mesa_ClipControl(GLenum origin, GLenum depth) if (ctx->Transform.ClipDepthMode != depth) { ctx->Transform.ClipDepthMode = depth; - /* Affects the z part of the viewpoint transform. */ - ctx->NewState |= _NEW_VIEWPORT; - if (ctx->Driver.DepthRange) ctx->Driver.DepthRange(ctx); } diff --git a/mesalib/src/mesa/program/prog_execute.c b/mesalib/src/mesa/program/prog_execute.c index fcc9ed518..650c40f2a 100644 --- a/mesalib/src/mesa/program/prog_execute.c +++ b/mesalib/src/mesa/program/prog_execute.c @@ -1119,77 +1119,6 @@ _mesa_execute_program(struct gl_context * ctx, break; case OPCODE_NOP: break; - case OPCODE_PK2H: /* pack two 16-bit floats in one 32-bit float */ - { - GLfloat a[4]; - GLuint result[4]; - GLhalfNV hx, hy; - fetch_vector4(&inst->SrcReg[0], machine, a); - hx = _mesa_float_to_half(a[0]); - hy = _mesa_float_to_half(a[1]); - result[0] = - result[1] = - result[2] = - result[3] = hx | (hy << 16); - store_vector4ui(inst, machine, result); - } - break; - case OPCODE_PK2US: /* pack two GLushorts into one 32-bit float */ - { - GLfloat a[4]; - GLuint result[4], usx, usy; - fetch_vector4(&inst->SrcReg[0], machine, a); - a[0] = CLAMP(a[0], 0.0F, 1.0F); - a[1] = CLAMP(a[1], 0.0F, 1.0F); - usx = F_TO_I(a[0] * 65535.0F); - usy = F_TO_I(a[1] * 65535.0F); - result[0] = - result[1] = - result[2] = - result[3] = usx | (usy << 16); - store_vector4ui(inst, machine, result); - } - break; - case OPCODE_PK4B: /* pack four GLbytes into one 32-bit float */ - { - GLfloat a[4]; - GLuint result[4], ubx, uby, ubz, ubw; - fetch_vector4(&inst->SrcReg[0], machine, a); - a[0] = CLAMP(a[0], -128.0F / 127.0F, 1.0F); - a[1] = CLAMP(a[1], -128.0F / 127.0F, 1.0F); - a[2] = CLAMP(a[2], -128.0F / 127.0F, 1.0F); - a[3] = CLAMP(a[3], -128.0F / 127.0F, 1.0F); - ubx = F_TO_I(127.0F * a[0] + 128.0F); - uby = F_TO_I(127.0F * a[1] + 128.0F); - ubz = F_TO_I(127.0F * a[2] + 128.0F); - ubw = F_TO_I(127.0F * a[3] + 128.0F); - result[0] = - result[1] = - result[2] = - result[3] = ubx | (uby << 8) | (ubz << 16) | (ubw << 24); - store_vector4ui(inst, machine, result); - } - break; - case OPCODE_PK4UB: /* pack four GLubytes into one 32-bit float */ - { - GLfloat a[4]; - GLuint result[4], ubx, uby, ubz, ubw; - fetch_vector4(&inst->SrcReg[0], machine, a); - a[0] = CLAMP(a[0], 0.0F, 1.0F); - a[1] = CLAMP(a[1], 0.0F, 1.0F); - a[2] = CLAMP(a[2], 0.0F, 1.0F); - a[3] = CLAMP(a[3], 0.0F, 1.0F); - ubx = F_TO_I(255.0F * a[0]); - uby = F_TO_I(255.0F * a[1]); - ubz = F_TO_I(255.0F * a[2]); - ubw = F_TO_I(255.0F * a[3]); - result[0] = - result[1] = - result[2] = - result[3] = ubx | (uby << 8) | (ubz << 16) | (ubw << 24); - store_vector4ui(inst, machine, result); - } - break; case OPCODE_POW: { GLfloat a[4], b[4], result[4]; @@ -1224,20 +1153,6 @@ _mesa_execute_program(struct gl_context * ctx, pc = machine->CallStack[--machine->StackDepth] - 1; } break; - case OPCODE_RFL: /* reflection vector */ - { - GLfloat axis[4], dir[4], result[4], tmpX, tmpW; - fetch_vector4(&inst->SrcReg[0], machine, axis); - fetch_vector4(&inst->SrcReg[1], machine, dir); - tmpW = DOT3(axis, axis); - tmpX = (2.0F * DOT3(axis, dir)) / tmpW; - result[0] = tmpX * axis[0] - dir[0]; - result[1] = tmpX * axis[1] - dir[1]; - result[2] = tmpX * axis[2] - dir[2]; - /* result[3] is never written! XXX enforce in parser! */ - store_vector4(inst, machine, result); - } - break; case OPCODE_RSQ: /* 1 / sqrt() */ { GLfloat a[4], result[4]; @@ -1279,12 +1194,6 @@ _mesa_execute_program(struct gl_context * ctx, } } break; - case OPCODE_SFL: /* set false, operands ignored */ - { - static const GLfloat result[4] = { 0.0F, 0.0F, 0.0F, 0.0F }; - store_vector4(inst, machine, result); - } - break; case OPCODE_SGE: /* set on greater or equal */ { GLfloat a[4], b[4], result[4]; @@ -1395,12 +1304,6 @@ _mesa_execute_program(struct gl_context * ctx, store_vector4(inst, machine, result); } break; - case OPCODE_STR: /* set true, operands ignored */ - { - static const GLfloat result[4] = { 1.0F, 1.0F, 1.0F, 1.0F }; - store_vector4(inst, machine, result); - } - break; case OPCODE_SUB: { GLfloat a[4], b[4], result[4]; @@ -1574,52 +1477,6 @@ _mesa_execute_program(struct gl_context * ctx, store_vector4(inst, machine, result); } break; - case OPCODE_UP2H: /* unpack two 16-bit floats */ - { - const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine); - GLfloat result[4]; - GLushort hx, hy; - hx = raw & 0xffff; - hy = raw >> 16; - result[0] = result[2] = _mesa_half_to_float(hx); - result[1] = result[3] = _mesa_half_to_float(hy); - store_vector4(inst, machine, result); - } - break; - case OPCODE_UP2US: /* unpack two GLushorts */ - { - const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine); - GLfloat result[4]; - GLushort usx, usy; - usx = raw & 0xffff; - usy = raw >> 16; - result[0] = result[2] = usx * (1.0f / 65535.0f); - result[1] = result[3] = usy * (1.0f / 65535.0f); - store_vector4(inst, machine, result); - } - break; - case OPCODE_UP4B: /* unpack four GLbytes */ - { - const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine); - GLfloat result[4]; - result[0] = (((raw >> 0) & 0xff) - 128) / 127.0F; - result[1] = (((raw >> 8) & 0xff) - 128) / 127.0F; - result[2] = (((raw >> 16) & 0xff) - 128) / 127.0F; - result[3] = (((raw >> 24) & 0xff) - 128) / 127.0F; - store_vector4(inst, machine, result); - } - break; - case OPCODE_UP4UB: /* unpack four GLubytes */ - { - const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine); - GLfloat result[4]; - result[0] = ((raw >> 0) & 0xff) / 255.0F; - result[1] = ((raw >> 8) & 0xff) / 255.0F; - result[2] = ((raw >> 16) & 0xff) / 255.0F; - result[3] = ((raw >> 24) & 0xff) / 255.0F; - store_vector4(inst, machine, result); - } - break; case OPCODE_XPD: /* cross product */ { GLfloat a[4], b[4], result[4]; @@ -1637,19 +1494,6 @@ _mesa_execute_program(struct gl_context * ctx, } } break; - case OPCODE_X2D: /* 2-D matrix transform */ - { - GLfloat a[4], b[4], c[4], result[4]; - fetch_vector4(&inst->SrcReg[0], machine, a); - fetch_vector4(&inst->SrcReg[1], machine, b); - fetch_vector4(&inst->SrcReg[2], machine, c); - result[0] = a[0] + b[0] * c[0] + b[1] * c[1]; - result[1] = a[1] + b[0] * c[2] + b[1] * c[3]; - result[2] = a[2] + b[0] * c[0] + b[1] * c[1]; - result[3] = a[3] + b[0] * c[2] + b[1] * c[3]; - store_vector4(inst, machine, result); - } - break; case OPCODE_END: return GL_TRUE; default: diff --git a/mesalib/src/mesa/program/prog_instruction.c b/mesalib/src/mesa/program/prog_instruction.c index e2eadc36c..976024e3c 100644 --- a/mesalib/src/mesa/program/prog_instruction.c +++ b/mesalib/src/mesa/program/prog_instruction.c @@ -191,18 +191,12 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = { { OPCODE_NOISE2, "NOISE2", 1, 1 }, { OPCODE_NOISE3, "NOISE3", 1, 1 }, { OPCODE_NOISE4, "NOISE4", 1, 1 }, - { OPCODE_PK2H, "PK2H", 1, 1 }, - { OPCODE_PK2US, "PK2US", 1, 1 }, - { OPCODE_PK4B, "PK4B", 1, 1 }, - { OPCODE_PK4UB, "PK4UB", 1, 1 }, { OPCODE_POW, "POW", 2, 1 }, { OPCODE_RCP, "RCP", 1, 1 }, { OPCODE_RET, "RET", 0, 0 }, - { OPCODE_RFL, "RFL", 1, 1 }, { OPCODE_RSQ, "RSQ", 1, 1 }, { OPCODE_SCS, "SCS", 1, 1 }, { OPCODE_SEQ, "SEQ", 2, 1 }, - { OPCODE_SFL, "SFL", 0, 1 }, { OPCODE_SGE, "SGE", 2, 1 }, { OPCODE_SGT, "SGT", 2, 1 }, { OPCODE_SIN, "SIN", 1, 1 }, @@ -210,7 +204,6 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = { { OPCODE_SLT, "SLT", 2, 1 }, { OPCODE_SNE, "SNE", 2, 1 }, { OPCODE_SSG, "SSG", 1, 1 }, - { OPCODE_STR, "STR", 0, 1 }, { OPCODE_SUB, "SUB", 2, 1 }, { OPCODE_SWZ, "SWZ", 1, 1 }, { OPCODE_TEX, "TEX", 1, 1 }, @@ -220,11 +213,6 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = { { OPCODE_TXP, "TXP", 1, 1 }, { OPCODE_TXP_NV, "TXP_NV", 1, 1 }, { OPCODE_TRUNC, "TRUNC", 1, 1 }, - { OPCODE_UP2H, "UP2H", 1, 1 }, - { OPCODE_UP2US, "UP2US", 1, 1 }, - { OPCODE_UP4B, "UP4B", 1, 1 }, - { OPCODE_UP4UB, "UP4UB", 1, 1 }, - { OPCODE_X2D, "X2D", 3, 1 }, { OPCODE_XPD, "XPD", 2, 1 } }; diff --git a/mesalib/src/mesa/program/prog_instruction.h b/mesalib/src/mesa/program/prog_instruction.h index b9604e50d..de7880499 100644 --- a/mesalib/src/mesa/program/prog_instruction.h +++ b/mesalib/src/mesa/program/prog_instruction.h @@ -187,18 +187,12 @@ typedef enum prog_opcode { OPCODE_NOISE2, /* X */ OPCODE_NOISE3, /* X */ OPCODE_NOISE4, /* X */ - OPCODE_PK2H, /* X */ - OPCODE_PK2US, /* X */ - OPCODE_PK4B, /* X */ - OPCODE_PK4UB, /* X */ OPCODE_POW, /* X X X X */ OPCODE_RCP, /* X X X X X */ OPCODE_RET, /* 2 2 opt */ - OPCODE_RFL, /* X */ OPCODE_RSQ, /* X X X X X */ OPCODE_SCS, /* X X */ OPCODE_SEQ, /* 2 X X */ - OPCODE_SFL, /* 2 X */ OPCODE_SGE, /* X X X X X */ OPCODE_SGT, /* 2 X X */ OPCODE_SIN, /* X 2 X X */ @@ -206,7 +200,6 @@ typedef enum prog_opcode { OPCODE_SLT, /* X X X X X */ OPCODE_SNE, /* 2 X X */ OPCODE_SSG, /* 2 X */ - OPCODE_STR, /* 2 X */ OPCODE_SUB, /* X X 1.1 X X */ OPCODE_SWZ, /* X X X */ OPCODE_TEX, /* X 3 X X */ @@ -216,11 +209,6 @@ typedef enum prog_opcode { OPCODE_TXP, /* X X */ OPCODE_TXP_NV, /* 3 X */ OPCODE_TRUNC, /* X */ - OPCODE_UP2H, /* X */ - OPCODE_UP2US, /* X */ - OPCODE_UP4B, /* X */ - OPCODE_UP4UB, /* X */ - OPCODE_X2D, /* X */ OPCODE_XPD, /* X X */ MAX_OPCODE } gl_inst_opcode; diff --git a/mesalib/src/mesa/program/program_lexer.l b/mesalib/src/mesa/program/program_lexer.l index d5dbcf347..2fcd71f22 100644 --- a/mesalib/src/mesa/program/program_lexer.l +++ b/mesalib/src/mesa/program/program_lexer.l @@ -28,6 +28,7 @@ #include "program/symbol_table.h" #include "program/program_parser.h" #include "program/program_parse.tab.h" +#include "util/strtod.h" #define require_ARB_vp (yyextra->mode == ARB_vertex) #define require_ARB_fp (yyextra->mode == ARB_fragment) @@ -216,26 +217,19 @@ MIN{sz}{cc}{sat} { return_opcode( 1, BIN_OP, MIN, 3); } MOV{sz}{cc}{sat} { return_opcode( 1, VECTOR_OP, MOV, 3); } MUL{sz}{cc}{sat} { return_opcode( 1, BIN_OP, MUL, 3); } -PK2H { return_opcode(require_NV_fp, VECTOR_OP, PK2H, 4); } -PK2US { return_opcode(require_NV_fp, VECTOR_OP, PK2US, 5); } -PK4B { return_opcode(require_NV_fp, VECTOR_OP, PK4B, 4); } -PK4UB { return_opcode(require_NV_fp, VECTOR_OP, PK4UB, 5); } POW{szf}{cc}{sat} { return_opcode( 1, BINSC_OP, POW, 3); } RCP{szf}{cc}{sat} { return_opcode( 1, SCALAR_OP, RCP, 3); } -RFL{szf}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, RFL, 3); } RSQ{szf}{cc}{sat} { return_opcode( 1, SCALAR_OP, RSQ, 3); } SCS{sat} { return_opcode(require_ARB_fp, SCALAR_OP, SCS, 3); } SEQ{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, SEQ, 3); } -SFL{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, SFL, 3); } SGE{sz}{cc}{sat} { return_opcode( 1, BIN_OP, SGE, 3); } SGT{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, SGT, 3); } SIN{szf}{cc}{sat} { return_opcode(require_ARB_fp, SCALAR_OP, SIN, 3); } SLE{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, SLE, 3); } SLT{sz}{cc}{sat} { return_opcode( 1, BIN_OP, SLT, 3); } SNE{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, SNE, 3); } -STR{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, STR, 3); } SUB{sz}{cc}{sat} { return_opcode( 1, BIN_OP, SUB, 3); } SWZ{sat} { return_opcode( 1, SWZ, SWZ, 3); } @@ -244,12 +238,6 @@ TXB{cc}{sat} { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, 3); } TXD{cc}{sat} { return_opcode(require_NV_fp, TXD_OP, TXD, 3); } TXP{cc}{sat} { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, 3); } -UP2H{cc}{sat} { return_opcode(require_NV_fp, SCALAR_OP, UP2H, 4); } -UP2US{cc}{sat} { return_opcode(require_NV_fp, SCALAR_OP, UP2US, 5); } -UP4B{cc}{sat} { return_opcode(require_NV_fp, SCALAR_OP, UP4B, 4); } -UP4UB{cc}{sat} { return_opcode(require_NV_fp, SCALAR_OP, UP4UB, 5); } - -X2D{szf}{cc}{sat} { return_opcode(require_NV_fp, TRI_OP, X2D, 3); } XPD{sat} { return_opcode( 1, BIN_OP, XPD, 3); } vertex { return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); } diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c index 50209788b..606f19a18 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c @@ -72,7 +72,7 @@ static void update_raster_state( struct st_context *st ) { raster->front_ccw = (ctx->Polygon.FrontFace == GL_CCW); - /* _NEW_VIEWPORT */ + /* _NEW_TRANSFORM */ if (ctx->Transform.ClipOrigin == GL_UPPER_LEFT) { raster->front_ccw ^= 1; } @@ -246,13 +246,10 @@ static void update_raster_state( struct st_context *st ) raster->half_pixel_center = 1; if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) raster->bottom_edge_rule = 1; - /* _NEW_VIEWPORT */ + /* _NEW_TRANSFORM */ if (ctx->Transform.ClipOrigin == GL_UPPER_LEFT) raster->bottom_edge_rule ^= 1; - /* _NEW_VIEWPORT */ - raster->clip_halfz = (ctx->Transform.ClipDepthMode == GL_ZERO_TO_ONE); - /* ST_NEW_RASTERIZER */ raster->rasterizer_discard = ctx->RasterDiscard; @@ -267,6 +264,7 @@ static void update_raster_state( struct st_context *st ) /* _NEW_TRANSFORM */ raster->depth_clip = !ctx->Transform.DepthClamp; raster->clip_plane_enable = ctx->Transform.ClipPlanesEnabled; + raster->clip_halfz = (ctx->Transform.ClipDepthMode == GL_ZERO_TO_ONE); cso_set_rasterizer(st->cso_context, raster); } @@ -283,8 +281,7 @@ const struct st_tracked_state st_update_rasterizer = { _NEW_PROGRAM | _NEW_SCISSOR | _NEW_FRAG_CLAMP | - _NEW_TRANSFORM | - _NEW_VIEWPORT), /* mesa state dependencies*/ + _NEW_TRANSFORM), /* mesa state dependencies*/ (ST_NEW_VERTEX_PROGRAM | ST_NEW_RASTERIZER), /* state tracker dependencies */ }, diff --git a/mesalib/src/mesa/state_tracker/st_atom_viewport.c b/mesalib/src/mesa/state_tracker/st_atom_viewport.c index 5b992084b..efa056e10 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_viewport.c +++ b/mesalib/src/mesa/state_tracker/st_atom_viewport.c @@ -70,12 +70,10 @@ update_viewport( struct st_context *st ) st->state.viewport[i].scale[0] = scale[0]; st->state.viewport[i].scale[1] = scale[1] * yScale; st->state.viewport[i].scale[2] = scale[2]; - st->state.viewport[i].scale[3] = 1.0; st->state.viewport[i].translate[0] = translate[0]; st->state.viewport[i].translate[1] = translate[1] * yScale + yBias; st->state.viewport[i].translate[2] = translate[2]; - st->state.viewport[i].translate[3] = 0.0; } cso_set_viewport(st->cso_context, &st->state.viewport[0]); diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c index e3ba5a88f..2107ab167 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c +++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c @@ -504,11 +504,9 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, vp.scale[0] = 0.5f * width; vp.scale[1] = height * (invert ? -0.5f : 0.5f); vp.scale[2] = 0.5f; - vp.scale[3] = 1.0f; vp.translate[0] = 0.5f * width; vp.translate[1] = 0.5f * height; vp.translate[2] = 0.5f; - vp.translate[3] = 0.0f; cso_set_viewport(cso, &vp); } @@ -769,7 +767,8 @@ st_Bitmap(struct gl_context *ctx, GLint x, GLint y, const uint semantic_indexes[] = { 0, 0, 0 }; st->bitmap.vs = util_make_vertex_passthrough_shader(st->pipe, 3, semantic_names, - semantic_indexes); + semantic_indexes, + FALSE); } if (UseBitmapCache && accum_bitmap(ctx, x, y, width, height, unpack, bitmap)) diff --git a/mesalib/src/mesa/state_tracker/st_cb_clear.c b/mesalib/src/mesa/state_tracker/st_cb_clear.c index 2c1414e48..45dea594e 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_clear.c +++ b/mesalib/src/mesa/state_tracker/st_cb_clear.c @@ -88,6 +88,14 @@ st_destroy_clear(struct st_context *st) cso_delete_vertex_shader(st->cso_context, st->clear.vs); st->clear.vs = NULL; } + if (st->clear.vs_layered) { + cso_delete_vertex_shader(st->cso_context, st->clear.vs_layered); + st->clear.vs_layered = NULL; + } + if (st->clear.gs_layered) { + cso_delete_geometry_shader(st->cso_context, st->clear.gs_layered); + st->clear.gs_layered = NULL; + } } @@ -123,10 +131,12 @@ set_vertex_shader(struct st_context *st) const uint semantic_indexes[] = { 0, 0 }; st->clear.vs = util_make_vertex_passthrough_shader(st->pipe, 2, semantic_names, - semantic_indexes); + semantic_indexes, + FALSE); } cso_set_vertex_shader_handle(st->cso_context, st->clear.vs); + cso_set_geometry_shader_handle(st->cso_context, NULL); } @@ -135,18 +145,25 @@ set_vertex_shader_layered(struct st_context *st) { struct pipe_context *pipe = st->pipe; - if (!pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_INSTANCEID) || - !pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_VS_LAYER_VIEWPORT)) { - assert(!"Got layered clear, but the VS layer output is unsupported"); + if (!pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_INSTANCEID)) { + assert(!"Got layered clear, but VS instancing is unsupported"); set_vertex_shader(st); return; } if (!st->clear.vs_layered) { - st->clear.vs_layered = util_make_layered_clear_vertex_shader(pipe); + bool vs_layer = + pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_VS_LAYER_VIEWPORT); + if (vs_layer) { + st->clear.vs_layered = util_make_layered_clear_vertex_shader(pipe); + } else { + st->clear.vs_layered = util_make_layered_clear_helper_vertex_shader(pipe); + st->clear.gs_layered = util_make_layered_clear_geometry_shader(pipe); + } } cso_set_vertex_shader_handle(st->cso_context, st->clear.vs_layered); + cso_set_geometry_shader_handle(st->cso_context, st->clear.gs_layered); } @@ -323,16 +340,13 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers) vp.scale[0] = 0.5f * fb_width; vp.scale[1] = fb_height * (invert ? -0.5f : 0.5f); vp.scale[2] = 0.5f; - vp.scale[3] = 1.0f; vp.translate[0] = 0.5f * fb_width; vp.translate[1] = 0.5f * fb_height; vp.translate[2] = 0.5f; - vp.translate[3] = 0.0f; cso_set_viewport(st->cso_context, &vp); } set_fragment_shader(st); - cso_set_geometry_shader_handle(st->cso_context, NULL); if (num_layers > 1) set_vertex_shader_layered(st); diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c index 5ae092b94..939fc2065 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c @@ -776,11 +776,9 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, vp.scale[0] = 0.5f * w; vp.scale[1] = -0.5f * h; vp.scale[2] = 0.5f; - vp.scale[3] = 1.0f; vp.translate[0] = 0.5f * w; vp.translate[1] = 0.5f * h; vp.translate[2] = 0.5f; - vp.translate[3] = 0.0f; cso_set_viewport(cso, &vp); } diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawtex.c b/mesalib/src/mesa/state_tracker/st_cb_drawtex.c index f997e6b00..d057ff62a 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawtex.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawtex.c @@ -91,7 +91,7 @@ lookup_shader(struct pipe_context *pipe, util_make_vertex_passthrough_shader(pipe, num_attribs, semantic_names, - semantic_indexes); + semantic_indexes, FALSE); NumCachedShaders++; return CachedShaders[i].handle; @@ -258,11 +258,9 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, vp.scale[0] = 0.5f * width; vp.scale[1] = height * (invert ? -0.5f : 0.5f); vp.scale[2] = 1.0f; - vp.scale[3] = 1.0f; vp.translate[0] = 0.5f * width; vp.translate[1] = 0.5f * height; vp.translate[2] = 0.0f; - vp.translate[3] = 0.0f; cso_set_viewport(cso, &vp); } diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h index 58f14f954..15f9df492 100644 --- a/mesalib/src/mesa/state_tracker/st_context.h +++ b/mesalib/src/mesa/state_tracker/st_context.h @@ -181,6 +181,7 @@ struct st_context void *vs; void *fs; void *vs_layered; + void *gs_layered; } clear; /** used for anything using util_draw_vertex_buffer */ diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index aff3ddebe..bdfab8b41 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -241,8 +241,7 @@ void st_init_limits(struct pipe_screen *screen, if (options->EmitNoLoops) options->MaxUnrollIterations = MIN2(screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_INSTRUCTIONS), 65536); - else - options->MaxUnrollIterations = 255; /* SM3 limit */ + options->LowerClipDistance = true; } diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index a4e2c8da5..8e91c4b61 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -4022,6 +4022,7 @@ get_pixel_transfer_visitor(struct st_fragment_program *fp, newinst = v->emit(NULL, inst->op, inst->dst, src_regs[0], src_regs[1], src_regs[2]); newinst->tex_target = inst->tex_target; + newinst->sampler_array_size = inst->sampler_array_size; } /* Make modifications to fragment program info. */ @@ -4101,6 +4102,7 @@ get_bitmap_visitor(struct st_fragment_program *fp, newinst = v->emit(NULL, inst->op, inst->dst, src_regs[0], src_regs[1], src_regs[2]); newinst->tex_target = inst->tex_target; + newinst->sampler_array_size = inst->sampler_array_size; } /* Make modifications to fragment program info. */ @@ -4524,8 +4526,10 @@ compile_tgsi_instruction(struct st_translate *t, inst->saturate, clamp_dst_color_output); - for (i = 0; i < num_src; i++) + for (i = 0; i < num_src; i++) { + assert(inst->src[i].file != PROGRAM_UNDEFINED); src[i] = translate_src(t, &inst->src[i]); + } switch(inst->op) { case TGSI_OPCODE_BGNLOOP: @@ -4555,6 +4559,7 @@ compile_tgsi_instruction(struct st_translate *t, case TGSI_OPCODE_TG4: case TGSI_OPCODE_LODQ: src[num_src] = t->samplers[inst->sampler.index]; + assert(src[num_src].File != TGSI_FILE_NULL); if (inst->sampler.reladdr) src[num_src] = ureg_src_indirect(src[num_src], ureg_src(t->address[2])); @@ -4721,7 +4726,8 @@ emit_wpos(struct st_context *st, } else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT)) { /* the driver supports lower-left origin, need to invert Y */ - ureg_property_fs_coord_origin(ureg, TGSI_FS_COORD_ORIGIN_LOWER_LEFT); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_ORIGIN, + TGSI_FS_COORD_ORIGIN_LOWER_LEFT); invert = TRUE; } else @@ -4731,7 +4737,8 @@ emit_wpos(struct st_context *st, /* Fragment shader wants origin in lower-left */ if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT)) /* the driver supports lower-left origin */ - ureg_property_fs_coord_origin(ureg, TGSI_FS_COORD_ORIGIN_LOWER_LEFT); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_ORIGIN, + TGSI_FS_COORD_ORIGIN_LOWER_LEFT); else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT)) /* the driver supports upper-left origin, need to invert Y */ invert = TRUE; @@ -4744,7 +4751,8 @@ emit_wpos(struct st_context *st, if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER)) { /* the driver supports pixel center integer */ adjY[1] = 1.0f; - ureg_property_fs_coord_pixel_center(ureg, TGSI_FS_COORD_PIXEL_CENTER_INTEGER); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_PIXEL_CENTER, + TGSI_FS_COORD_PIXEL_CENTER_INTEGER); } else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER)) { /* the driver supports pixel center half integer, need to bias X,Y */ @@ -4763,7 +4771,8 @@ emit_wpos(struct st_context *st, else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER)) { /* the driver supports pixel center integer, need to bias X,Y */ adjX = adjY[0] = adjY[1] = 0.5f; - ureg_property_fs_coord_pixel_center(ureg, TGSI_FS_COORD_PIXEL_CENTER_INTEGER); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_PIXEL_CENTER, + TGSI_FS_COORD_PIXEL_CENTER_INTEGER); } else assert(0); diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c index df6de737f..606d67891 100644 --- a/mesalib/src/mesa/state_tracker/st_manager.c +++ b/mesalib/src/mesa/state_tracker/st_manager.c @@ -452,7 +452,8 @@ st_framebuffer_create(struct st_context *st, st_pipe_format_to_mesa_format(srgb_format) != MESA_FORMAT_NONE && screen->is_format_supported(screen, srgb_format, PIPE_TEXTURE_2D, stfbi->visual->samples, - PIPE_BIND_RENDER_TARGET)) + (PIPE_BIND_DISPLAY_TARGET | + PIPE_BIND_RENDER_TARGET))) mode.sRGBCapable = GL_TRUE; } diff --git a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c index 26a5f51c7..2c9d9a523 100644 --- a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -891,7 +891,8 @@ emit_wpos(struct st_context *st, } else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT)) { /* the driver supports lower-left origin, need to invert Y */ - ureg_property_fs_coord_origin(ureg, TGSI_FS_COORD_ORIGIN_LOWER_LEFT); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_ORIGIN, + TGSI_FS_COORD_ORIGIN_LOWER_LEFT); invert = TRUE; } else @@ -901,7 +902,8 @@ emit_wpos(struct st_context *st, /* Fragment shader wants origin in lower-left */ if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT)) /* the driver supports lower-left origin */ - ureg_property_fs_coord_origin(ureg, TGSI_FS_COORD_ORIGIN_LOWER_LEFT); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_ORIGIN, + TGSI_FS_COORD_ORIGIN_LOWER_LEFT); else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT)) /* the driver supports upper-left origin, need to invert Y */ invert = TRUE; @@ -914,7 +916,8 @@ emit_wpos(struct st_context *st, if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER)) { /* the driver supports pixel center integer */ adjY[1] = 1.0f; - ureg_property_fs_coord_pixel_center(ureg, TGSI_FS_COORD_PIXEL_CENTER_INTEGER); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_PIXEL_CENTER, + TGSI_FS_COORD_PIXEL_CENTER_INTEGER); } else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER)) { /* the driver supports pixel center half integer, need to bias X,Y */ @@ -933,7 +936,8 @@ emit_wpos(struct st_context *st, else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER)) { /* the driver supports pixel center integer, need to bias X,Y */ adjX = adjY[0] = adjY[1] = 0.5f; - ureg_property_fs_coord_pixel_center(ureg, TGSI_FS_COORD_PIXEL_CENTER_INTEGER); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_PIXEL_CENTER, + TGSI_FS_COORD_PIXEL_CENTER_INTEGER); } else assert(0); diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c index 926086bf8..737c2694e 100644 --- a/mesalib/src/mesa/state_tracker/st_program.c +++ b/mesalib/src/mesa/state_tracker/st_program.c @@ -742,21 +742,25 @@ st_translate_fragment_program(struct st_context *st, debug_printf("\n"); } if (write_all == GL_TRUE) - ureg_property_fs_color0_writes_all_cbufs(ureg, 1); + ureg_property(ureg, TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS, 1); if (stfp->Base.FragDepthLayout != FRAG_DEPTH_LAYOUT_NONE) { switch (stfp->Base.FragDepthLayout) { case FRAG_DEPTH_LAYOUT_ANY: - ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_ANY); + ureg_property(ureg, TGSI_PROPERTY_FS_DEPTH_LAYOUT, + TGSI_FS_DEPTH_LAYOUT_ANY); break; case FRAG_DEPTH_LAYOUT_GREATER: - ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_GREATER); + ureg_property(ureg, TGSI_PROPERTY_FS_DEPTH_LAYOUT, + TGSI_FS_DEPTH_LAYOUT_GREATER); break; case FRAG_DEPTH_LAYOUT_LESS: - ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_LESS); + ureg_property(ureg, TGSI_PROPERTY_FS_DEPTH_LAYOUT, + TGSI_FS_DEPTH_LAYOUT_LESS); break; case FRAG_DEPTH_LAYOUT_UNCHANGED: - ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_UNCHANGED); + ureg_property(ureg, TGSI_PROPERTY_FS_DEPTH_LAYOUT, + TGSI_FS_DEPTH_LAYOUT_UNCHANGED); break; default: assert(0); @@ -1122,10 +1126,11 @@ st_translate_geometry_program(struct st_context *st, stgp->tgsi.tokens = NULL; } - ureg_property_gs_input_prim(ureg, stgp->Base.InputType); - ureg_property_gs_output_prim(ureg, stgp->Base.OutputType); - ureg_property_gs_max_vertices(ureg, stgp->Base.VerticesOut); - ureg_property_gs_invocations(ureg, stgp->Base.Invocations); + ureg_property(ureg, TGSI_PROPERTY_GS_INPUT_PRIM, stgp->Base.InputType); + ureg_property(ureg, TGSI_PROPERTY_GS_OUTPUT_PRIM, stgp->Base.OutputType); + ureg_property(ureg, TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES, + stgp->Base.VerticesOut); + ureg_property(ureg, TGSI_PROPERTY_GS_INVOCATIONS, stgp->Base.Invocations); if (stgp->glsl_to_tgsi) st_translate_program(st->ctx, diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c index 045dbb506..e623b361a 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_array.c +++ b/mesalib/src/mesa/vbo/vbo_exec_array.c @@ -36,6 +36,8 @@ #include "main/enums.h" #include "main/macros.h" #include "main/transformfeedback.h" +#include "main/sse_minmax.h" +#include "x86/common_x86_asm.h" #include "vbo_context.h" @@ -119,10 +121,16 @@ vbo_get_minmax_index(struct gl_context *ctx, } } else { - for (i = 0; i < count; i++) { - if (ui_indices[i] > max_ui) max_ui = ui_indices[i]; - if (ui_indices[i] < min_ui) min_ui = ui_indices[i]; +#if defined(USE_SSE41) + if (cpu_has_sse4_1) { + _mesa_uint_array_min_max(ui_indices, &min_ui, &max_ui, count); } + else +#endif + for (i = 0; i < count; i++) { + if (ui_indices[i] > max_ui) max_ui = ui_indices[i]; + if (ui_indices[i] < min_ui) min_ui = ui_indices[i]; + } } *min_index = min_ui; *max_index = max_ui; diff --git a/mesalib/src/mesa/x86/common_x86_features.h b/mesalib/src/mesa/x86/common_x86_features.h index 66f2cf651..65634aa5d 100644 --- a/mesalib/src/mesa/x86/common_x86_features.h +++ b/mesalib/src/mesa/x86/common_x86_features.h @@ -59,13 +59,39 @@ #define X86_CPUEXT_3DNOW_EXT (1<<30) #define X86_CPUEXT_3DNOW (1<<31) +#ifdef __MMX__ +#define cpu_has_mmx 1 +#else #define cpu_has_mmx (_mesa_x86_cpu_features & X86_FEATURE_MMX) +#endif + #define cpu_has_mmxext (_mesa_x86_cpu_features & X86_FEATURE_MMXEXT) + +#ifdef __SSE__ +#define cpu_has_xmm 1 +#else #define cpu_has_xmm (_mesa_x86_cpu_features & X86_FEATURE_XMM) +#endif + +#ifdef __SSE2__ +#define cpu_has_xmm2 1 +#else #define cpu_has_xmm2 (_mesa_x86_cpu_features & X86_FEATURE_XMM2) +#endif + +#ifdef __3dNOW__ +#define cpu_has_3dnow 1 +#else #define cpu_has_3dnow (_mesa_x86_cpu_features & X86_FEATURE_3DNOW) +#endif + #define cpu_has_3dnowext (_mesa_x86_cpu_features & X86_FEATURE_3DNOWEXT) + +#ifdef __SSE4_1__ +#define cpu_has_sse4_1 1 +#else #define cpu_has_sse4_1 (_mesa_x86_cpu_features & X86_FEATURE_SSE4_1) +#endif #endif |