aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-05-23 19:36:09 +0200
committermarha <marha@users.sourceforge.net>2014-05-23 19:38:24 +0200
commit63bfcd0be46413dda8c22b914d12f66ea5d5c66d (patch)
tree252bfea78ff3ccfabedc3b84c8a7331c74e902cd /mesalib/src
parent55cf29d7f748b814a2b8eb016fbf15635d56aa53 (diff)
downloadvcxsrv-63bfcd0be46413dda8c22b914d12f66ea5d5c66d.tar.gz
vcxsrv-63bfcd0be46413dda8c22b914d12f66ea5d5c66d.tar.bz2
vcxsrv-63bfcd0be46413dda8c22b914d12f66ea5d5c66d.zip
libX11 mesa xserver pixman git update 23 May 2014
xserver commit db2e708f31a162c6c66643d3559dd5f3e21ee06b libX11 commit e3dc0d17339e61eaf0b51b8907510984e3bf23cb pixman commit 9cd283b2eb8279824406bfd47b020d21fc00cf82 mesa commit 404387ecd72a4a9ace8c1fa6895823aabfd759ad
Diffstat (limited to 'mesalib/src')
-rw-r--r--mesalib/src/gallium/Automake.inc8
-rw-r--r--mesalib/src/mapi/glapi/Makefile.am4
-rw-r--r--mesalib/src/mapi/glapi/Makefile.sources4
-rw-r--r--mesalib/src/mapi/glapi/gen/glX_proto_send.py3
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_gentable.py2
-rw-r--r--mesalib/src/mesa/Makefile.am2
-rw-r--r--mesalib/src/mesa/SConscript1
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c106
-rw-r--r--mesalib/src/mesa/drivers/common/meta.h10
-rw-r--r--mesalib/src/mesa/drivers/common/meta_blit.c52
-rw-r--r--mesalib/src/mesa/drivers/dri/Makefile.am2
-rw-r--r--mesalib/src/mesa/main/compiler.h6
-rw-r--r--mesalib/src/mesa/main/cpuinfo.c2
-rw-r--r--mesalib/src/mesa/main/cpuinfo.h2
-rw-r--r--mesalib/src/mesa/main/fbobject.c6
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_array.c6
-rw-r--r--mesalib/src/mesa/x86/common_x86.c25
-rw-r--r--mesalib/src/mesa/x86/common_x86_features.h4
18 files changed, 155 insertions, 90 deletions
diff --git a/mesalib/src/gallium/Automake.inc b/mesalib/src/gallium/Automake.inc
index 4519c161c..70921ecd8 100644
--- a/mesalib/src/gallium/Automake.inc
+++ b/mesalib/src/gallium/Automake.inc
@@ -56,7 +56,9 @@ GALLIUM_DRI_LINKER_FLAGS = \
-shrext .so \
-module \
-avoid-version \
+if HAVE_LD_VERSION_SCRIPT
-Wl,--version-script=$(top_srcdir)/src/gallium/targets/dri.sym \
+endif
$(GC_SECTIONS)
GALLIUM_VDPAU_LINKER_FLAGS = \
@@ -64,7 +66,9 @@ GALLIUM_VDPAU_LINKER_FLAGS = \
-module \
-no-undefined \
-version-number $(VDPAU_MAJOR):$(VDPAU_MINOR) \
+if HAVE_LD_VERSION_SCRIPT
-Wl,--version-script=$(top_srcdir)/src/gallium/targets/vdpau.sym \
+endif
$(GC_SECTIONS) \
$(LD_NO_UNDEFINED)
@@ -73,7 +77,9 @@ GALLIUM_XVMC_LINKER_FLAGS = \
-module \
-no-undefined \
-version-number $(XVMC_MAJOR):$(XVMC_MINOR) \
+if HAVE_LD_VERSION_SCRIPT
-Wl,--version-script=$(top_srcdir)/src/gallium/targets/xvmc.sym \
+endif
$(GC_SECTIONS) \
$(LD_NO_UNDEFINED)
@@ -82,7 +88,9 @@ GALLIUM_OMX_LINKER_FLAGS = \
-module \
-no-undefined \
-avoid-version \
+if HAVE_LD_VERSION_SCRIPT
-Wl,--version-script=$(top_srcdir)/src/gallium/targets/omx.sym \
+endif
$(GC_SECTIONS) \
$(LD_NO_UNDEFINED)
diff --git a/mesalib/src/mapi/glapi/Makefile.am b/mesalib/src/mapi/glapi/Makefile.am
index e425bacea..cadcd69d6 100644
--- a/mesalib/src/mapi/glapi/Makefile.am
+++ b/mesalib/src/mapi/glapi/Makefile.am
@@ -48,13 +48,13 @@ if HAVE_SHARED_GLAPI
AM_CPPFLAGS += \
-DMAPI_MODE_BRIDGE \
-DMAPI_ABI_HEADER=\"glapi/glapi_mapi_tmp.h\"
-glapi_GLAPI_sources =
+glapi_GLAPI_sources = $(GLAPI_UTIL_SOURCES)
glapi_ASM_sources =
glapi_MAPI_sources = $(MAPI_BRIDGE_FILES)
else
AM_CPPFLAGS += \
-DMAPI_MODE_UTIL
-glapi_GLAPI_sources = $(GLAPI_SOURCES)
+glapi_GLAPI_sources = $(GLAPI_SOURCES) $(GLAPI_UTIL_SOURCES)
glapi_ASM_sources = $(GLAPI_ASM_SOURCES)
glapi_MAPI_sources = $(MAPI_UTIL_FILES)
endif
diff --git a/mesalib/src/mapi/glapi/Makefile.sources b/mesalib/src/mapi/glapi/Makefile.sources
index 04fef6c9e..aae41a88d 100644
--- a/mesalib/src/mapi/glapi/Makefile.sources
+++ b/mesalib/src/mapi/glapi/Makefile.sources
@@ -1,9 +1,11 @@
# src/mapi/glapi/Makefile.sources
+GLAPI_UTIL_SOURCES = \
+ glapi_gentable.c
+
GLAPI_SOURCES = \
glapi_dispatch.c \
glapi_entrypoint.c \
- glapi_gentable.c \
glapi_getproc.c \
glapi_nop.c \
glapi.c \
diff --git a/mesalib/src/mapi/glapi/gen/glX_proto_send.py b/mesalib/src/mapi/glapi/gen/glX_proto_send.py
index a98f63e99..1419a7cc1 100644
--- a/mesalib/src/mapi/glapi/gen/glX_proto_send.py
+++ b/mesalib/src/mapi/glapi/gen/glX_proto_send.py
@@ -947,6 +947,7 @@ class PrintGlxProtoInit_c(gl_XML.gl_print_base):
#include "glapi.h"
#include <assert.h>
+#ifndef GLX_USE_APPLEGL
/**
* No-op function used to initialize functions that have no GLX protocol
@@ -984,6 +985,8 @@ struct _glapi_table * __glXNewIndirectAPI( void )
print """
return (struct _glapi_table *) table;
}
+
+#endif
"""
return
diff --git a/mesalib/src/mapi/glapi/gen/gl_gentable.py b/mesalib/src/mapi/glapi/gen/gl_gentable.py
index 35dddc7a0..d45a5e0ff 100644
--- a/mesalib/src/mapi/glapi/gen/gl_gentable.py
+++ b/mesalib/src/mapi/glapi/gen/gl_gentable.py
@@ -113,7 +113,7 @@ __glapi_gentable_set_remaining_noop(struct _glapi_table *disp) {
struct _glapi_table *
_glapi_create_table_from_handle(void *handle, const char *symbol_prefix) {
- struct _glapi_table *disp = calloc(1, sizeof(struct _glapi_table));
+ struct _glapi_table *disp = calloc(1, _glapi_get_dispatch_table_size() * sizeof(_glapi_proc));
char symboln[512];
if(!disp)
diff --git a/mesalib/src/mesa/Makefile.am b/mesalib/src/mesa/Makefile.am
index 0fdc8f315..88eeff9ee 100644
--- a/mesalib/src/mesa/Makefile.am
+++ b/mesalib/src/mesa/Makefile.am
@@ -25,7 +25,7 @@ if HAVE_X11_DRIVER
SUBDIRS += drivers/x11
endif
-if HAVE_DRI
+if HAVE_DRICOMMON
SUBDIRS += drivers/dri
endif
diff --git a/mesalib/src/mesa/SConscript b/mesalib/src/mesa/SConscript
index cd959be65..f56578672 100644
--- a/mesalib/src/mesa/SConscript
+++ b/mesalib/src/mesa/SConscript
@@ -392,6 +392,7 @@ if (env['gcc'] or env['clang']) and \
'USE_X86_64_ASM',
])
mesa_sources += [
+ 'x86/common_x86.c',
'x86-64/x86-64.c',
'x86-64/xform4.S',
]
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index 3ef3f7971..fec0d2be5 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -242,10 +242,25 @@ _mesa_meta_setup_blit_shader(struct gl_context *ctx,
GLenum target,
struct blit_shader_table *table)
{
- const char *vs_source;
- char *fs_source;
+ char *vs_source, *fs_source;
void *const mem_ctx = ralloc_context(NULL);
struct blit_shader *shader = choose_blit_shader(target, table);
+ const char *vs_input, *vs_output, *fs_input, *vs_preprocess, *fs_preprocess;
+
+ if (ctx->Const.GLSLVersion < 130) {
+ vs_preprocess = "";
+ vs_input = "attribute";
+ vs_output = "varying";
+ fs_preprocess = "#extension GL_EXT_texture_array : enable";
+ fs_input = "varying";
+ } else {
+ vs_preprocess = "#version 130";
+ vs_input = "in";
+ vs_output = "out";
+ fs_preprocess = "#version 130";
+ fs_input = "in";
+ shader->func = "texture";
+ }
assert(shader != NULL);
@@ -254,57 +269,30 @@ _mesa_meta_setup_blit_shader(struct gl_context *ctx,
return;
}
- if (ctx->Const.GLSLVersion < 130) {
- vs_source =
- "attribute vec2 position;\n"
- "attribute vec4 textureCoords;\n"
- "varying vec4 texCoords;\n"
- "void main()\n"
- "{\n"
- " texCoords = textureCoords;\n"
- " gl_Position = vec4(position, 0.0, 1.0);\n"
- "}\n";
-
- fs_source = ralloc_asprintf(mem_ctx,
- "#extension GL_EXT_texture_array : enable\n"
- "#extension GL_ARB_texture_cube_map_array: enable\n"
- "uniform %s texSampler;\n"
- "varying vec4 texCoords;\n"
- "void main()\n"
- "{\n"
- " gl_FragColor = %s(texSampler, %s);\n"
- " gl_FragDepth = gl_FragColor.x;\n"
- "}\n",
- shader->type,
- shader->func, shader->texcoords);
- }
- else {
- vs_source = ralloc_asprintf(mem_ctx,
- "#version 130\n"
- "in vec2 position;\n"
- "in vec4 textureCoords;\n"
- "out vec4 texCoords;\n"
- "void main()\n"
- "{\n"
- " texCoords = textureCoords;\n"
- " gl_Position = vec4(position, 0.0, 1.0);\n"
- "}\n");
- fs_source = ralloc_asprintf(mem_ctx,
- "#version 130\n"
- "#extension GL_ARB_texture_cube_map_array: enable\n"
- "uniform %s texSampler;\n"
- "in vec4 texCoords;\n"
- "out vec4 out_color;\n"
- "\n"
- "void main()\n"
- "{\n"
- " out_color = texture(texSampler, %s);\n"
- " gl_FragDepth = out_color.x;\n"
- "}\n",
- shader->type,
- shader->texcoords);
- }
-
+ vs_source = ralloc_asprintf(mem_ctx,
+ "%s\n"
+ "%s vec2 position;\n"
+ "%s vec4 textureCoords;\n"
+ "%s vec4 texCoords;\n"
+ "void main()\n"
+ "{\n"
+ " texCoords = textureCoords;\n"
+ " gl_Position = vec4(position, 0.0, 1.0);\n"
+ "}\n",
+ vs_preprocess, vs_input, vs_input, vs_output);
+
+ fs_source = ralloc_asprintf(mem_ctx,
+ "%s\n"
+ "#extension GL_ARB_texture_cube_map_array: enable\n"
+ "uniform %s texSampler;\n"
+ "%s vec4 texCoords;\n"
+ "void main()\n"
+ "{\n"
+ " gl_FragColor = %s(texSampler, %s);\n"
+ " gl_FragDepth = gl_FragColor.x;\n"
+ "}\n",
+ fs_preprocess, shader->type, fs_input,
+ shader->func, shader->texcoords);
_mesa_meta_compile_and_link_program(ctx, vs_source, fs_source,
ralloc_asprintf(mem_ctx, "%s blit",
@@ -2860,13 +2848,13 @@ copytexsubimage_using_blit_framebuffer(struct gl_context *ctx, GLuint dims,
* are too strict for CopyTexImage. We know meta will be fine with format
* changes.
*/
- _mesa_meta_BlitFramebuffer(ctx, x, y,
- x + width, y + height,
- xoffset, yoffset,
- xoffset + width, yoffset + height,
- mask, GL_NEAREST);
+ mask = _mesa_meta_BlitFramebuffer(ctx, x, y,
+ x + width, y + height,
+ xoffset, yoffset,
+ xoffset + width, yoffset + height,
+ mask, GL_NEAREST);
ctx->Meta->Blit.no_ctsi_fallback = false;
- success = true;
+ success = mask == 0x0;
out:
_mesa_lock_texture(ctx, texObj);
diff --git a/mesalib/src/mesa/drivers/common/meta.h b/mesalib/src/mesa/drivers/common/meta.h
index 2186a39f8..007f1040b 100644
--- a/mesalib/src/mesa/drivers/common/meta.h
+++ b/mesalib/src/mesa/drivers/common/meta.h
@@ -422,13 +422,21 @@ _mesa_meta_setup_sampler(struct gl_context *ctx,
const struct gl_texture_object *texObj,
GLenum target, GLenum filter, GLuint srcLevel);
-extern void
+extern GLbitfield
_mesa_meta_BlitFramebuffer(struct gl_context *ctx,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter);
extern void
+_mesa_meta_and_swrast_BlitFramebuffer(struct gl_context *ctx,
+ GLint srcX0, GLint srcY0,
+ GLint srcX1, GLint srcY1,
+ GLint dstX0, GLint dstY0,
+ GLint dstX1, GLint dstY1,
+ GLbitfield mask, GLenum filter);
+
+extern void
_mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers);
extern void
diff --git a/mesalib/src/mesa/drivers/common/meta_blit.c b/mesalib/src/mesa/drivers/common/meta_blit.c
index e5a0a9ad0..707269dd6 100644
--- a/mesalib/src/mesa/drivers/common/meta_blit.c
+++ b/mesalib/src/mesa/drivers/common/meta_blit.c
@@ -325,10 +325,15 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx,
struct gl_renderbuffer *src_rb,
GLenum target)
{
+ unsigned texcoord_size;
+
/* target = GL_TEXTURE_RECTANGLE is not supported in GLES 3.0 */
assert(_mesa_is_desktop_gl(ctx) || target == GL_TEXTURE_2D);
- _mesa_meta_setup_vertex_objects(&blit->VAO, &blit->VBO, true, 2, 2, 0);
+ texcoord_size = 2 + (src_rb->Depth > 1 ? 1 : 0);
+
+ _mesa_meta_setup_vertex_objects(&blit->VAO, &blit->VBO, true,
+ 2, texcoord_size, 0);
if (target == GL_TEXTURE_2D_MULTISAMPLE ||
target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) {
@@ -533,12 +538,16 @@ blitframebuffer_texture(struct gl_context *ctx,
verts[0].tex[0] = s0;
verts[0].tex[1] = t0;
+ verts[0].tex[2] = readAtt->Zoffset;
verts[1].tex[0] = s1;
verts[1].tex[1] = t0;
+ verts[1].tex[2] = readAtt->Zoffset;
verts[2].tex[0] = s1;
verts[2].tex[1] = t1;
+ verts[2].tex[2] = readAtt->Zoffset;
verts[3].tex[0] = s0;
verts[3].tex[1] = t1;
+ verts[3].tex[2] = readAtt->Zoffset;
_mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
}
@@ -644,7 +653,7 @@ _mesa_meta_setup_sampler(struct gl_context *ctx,
* Meta implementation of ctx->Driver.BlitFramebuffer() in terms
* of texture mapping and polygon rendering.
*/
-void
+GLbitfield
_mesa_meta_BlitFramebuffer(struct gl_context *ctx,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
@@ -669,7 +678,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
/* Multisample texture blit support requires texture multisample. */
if (ctx->ReadBuffer->Visual.samples > 0 &&
!ctx->Extensions.ARB_texture_multisample) {
- goto fallback;
+ return mask;
}
/* Clip a copy of the blit coordinates. If these differ from the input
@@ -678,7 +687,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
if (!_mesa_clip_blit(ctx, &clip.srcX0, &clip.srcY0, &clip.srcX1, &clip.srcY1,
&clip.dstX0, &clip.dstY0, &clip.dstX1, &clip.dstY1)) {
/* clipped/scissored everything away */
- return;
+ return 0;
}
/* Only scissor affects blit, but we're doing to set a custom scissor if
@@ -705,10 +714,6 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
filter, dstFlipX, dstFlipY,
use_glsl_version, false)) {
mask &= ~GL_COLOR_BUFFER_BIT;
- if (mask == 0x0) {
- _mesa_meta_end(ctx);
- return;
- }
}
}
@@ -718,10 +723,6 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
filter, dstFlipX, dstFlipY,
use_glsl_version, true)) {
mask &= ~GL_DEPTH_BUFFER_BIT;
- if (mask == 0x0) {
- _mesa_meta_end(ctx);
- return;
- }
}
}
@@ -731,11 +732,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
_mesa_meta_end(ctx);
-fallback:
- if (mask && !ctx->Meta->Blit.no_ctsi_fallback) {
- _swrast_BlitFramebuffer(ctx, srcX0, srcY0, srcX1, srcY1,
- dstX0, dstY0, dstX1, dstY1, mask, filter);
- }
+ return mask;
}
void
@@ -753,3 +750,24 @@ _mesa_meta_glsl_blit_cleanup(struct blit_state *blit)
_mesa_DeleteTextures(1, &blit->depthTex.TexObj);
blit->depthTex.TexObj = 0;
}
+
+void
+_mesa_meta_and_swrast_BlitFramebuffer(struct gl_context *ctx,
+ GLint srcX0, GLint srcY0,
+ GLint srcX1, GLint srcY1,
+ GLint dstX0, GLint dstY0,
+ GLint dstX1, GLint dstY1,
+ GLbitfield mask, GLenum filter)
+{
+ mask = _mesa_meta_BlitFramebuffer(ctx,
+ srcX0, srcY0, srcX1, srcY1,
+ dstX0, dstY0, dstX1, dstY1,
+ mask, filter);
+ if (mask == 0x0)
+ return;
+
+ _swrast_BlitFramebuffer(ctx,
+ srcX0, srcY0, srcX1, srcY1,
+ dstX0, dstY0, dstX1, dstY1,
+ mask, filter);
+}
diff --git a/mesalib/src/mesa/drivers/dri/Makefile.am b/mesalib/src/mesa/drivers/dri/Makefile.am
index e8076120d..70039f9ad 100644
--- a/mesalib/src/mesa/drivers/dri/Makefile.am
+++ b/mesalib/src/mesa/drivers/dri/Makefile.am
@@ -52,7 +52,7 @@ nodist_EXTRA_mesa_dri_drivers_la_SOURCES = dummy.cpp
mesa_dri_drivers_la_SOURCES =
mesa_dri_drivers_la_LDFLAGS = \
-module -avoid-version -shared -shrext .so \
- -Wl,-Bsymbolic \
+ $(BSYMBOLIC) \
$(GC_SECTIONS) \
$()
mesa_dri_drivers_la_LIBADD = \
diff --git a/mesalib/src/mesa/main/compiler.h b/mesalib/src/mesa/main/compiler.h
index 97075f58e..600691724 100644
--- a/mesalib/src/mesa/main/compiler.h
+++ b/mesalib/src/mesa/main/compiler.h
@@ -264,6 +264,12 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
#define unreachable()
#endif
+/*
+ * A trick to suppress uninitialized variable warning without generating any
+ * code
+ */
+#define uninitialized_var(x) x = x
+
#if (__GNUC__ >= 3)
#define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a)))
#else
diff --git a/mesalib/src/mesa/main/cpuinfo.c b/mesalib/src/mesa/main/cpuinfo.c
index 8d482a6ac..0755d6b21 100644
--- a/mesalib/src/mesa/main/cpuinfo.c
+++ b/mesalib/src/mesa/main/cpuinfo.c
@@ -34,7 +34,7 @@
void
_mesa_get_cpu_features(void)
{
-#ifdef USE_X86_ASM
+#if defined USE_X86_ASM || defined USE_X86_64_ASM
_mesa_get_x86_features();
#endif
}
diff --git a/mesalib/src/mesa/main/cpuinfo.h b/mesalib/src/mesa/main/cpuinfo.h
index 367888905..57925e82b 100644
--- a/mesalib/src/mesa/main/cpuinfo.h
+++ b/mesalib/src/mesa/main/cpuinfo.h
@@ -27,7 +27,7 @@
#define CPUINFO_H
-#if defined(USE_X86_ASM)
+#if defined USE_X86_ASM || defined USE_X86_64_ASM
#include "x86/common_x86_asm.h"
#endif
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index 97538bc7b..ae3a418cd 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -500,6 +500,12 @@ _mesa_framebuffer_renderbuffer(struct gl_context *ctx,
}
else {
remove_attachment(ctx, att);
+ if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
+ /* detach stencil (depth was detached above) */
+ att = get_attachment(ctx, fb, GL_STENCIL_ATTACHMENT_EXT);
+ assert(att);
+ remove_attachment(ctx, att);
+ }
}
invalidate_framebuffer(fb);
diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c
index 07ce08fef..9c161ccca 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_array.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_array.c
@@ -581,9 +581,9 @@ vbo_handle_primitive_restart(struct gl_context *ctx,
{
struct vbo_context *vbo = vbo_context(ctx);
- if ((ib != NULL) &&
- ctx->Const.PrimitiveRestartInSoftware &&
- ctx->Array._PrimitiveRestart) {
+ if (ctx->Const.PrimitiveRestartInSoftware &&
+ ctx->Array._PrimitiveRestart &&
+ (ib != NULL)) {
/* Handle primitive restart in software */
vbo_sw_primitive_restart(ctx, prim, nr_prims, ib, NULL);
} else {
diff --git a/mesalib/src/mesa/x86/common_x86.c b/mesalib/src/mesa/x86/common_x86.c
index 3c1adc916..261f49170 100644
--- a/mesalib/src/mesa/x86/common_x86.c
+++ b/mesalib/src/mesa/x86/common_x86.c
@@ -47,6 +47,13 @@
#include <sys/sysctl.h>
#include <machine/cpu.h>
#endif
+#if defined(USE_X86_64_ASM)
+#include <cpuid.h>
+#if !defined(bit_SSE4_1) && defined(bit_SSE41)
+/* XXX: clang defines bit_SSE41 instead of bit_SSE4_1 */
+#define bit_SSE4_1 bit_SSE41
+#endif
+#endif
#include "main/imports.h"
#include "common_x86_asm.h"
@@ -223,7 +230,7 @@ _mesa_get_x86_features(void)
_mesa_debug(NULL, "CPUID not detected\n");
}
else {
- GLuint cpu_features;
+ GLuint cpu_features, cpu_features_ecx;
GLuint cpu_ext_features;
GLuint cpu_ext_info;
char cpu_vendor[13];
@@ -238,6 +245,7 @@ _mesa_get_x86_features(void)
/* get cpu features */
cpu_features = _mesa_x86_cpuid_edx(1);
+ cpu_features_ecx = _mesa_x86_cpuid_ecx(1);
if (cpu_features & X86_CPU_FPU)
_mesa_x86_cpu_features |= X86_FEATURE_FPU;
@@ -254,6 +262,8 @@ _mesa_get_x86_features(void)
_mesa_x86_cpu_features |= X86_FEATURE_XMM;
if (cpu_features & X86_CPU_XMM2)
_mesa_x86_cpu_features |= X86_FEATURE_XMM2;
+ if (cpu_features_ecx & X86_CPU_SSE4_1)
+ _mesa_x86_cpu_features |= X86_FEATURE_SSE4_1;
#endif
/* query extended cpu features */
@@ -330,7 +340,18 @@ _mesa_get_x86_features(void)
}
#endif
-#endif /* USE_X86_ASM */
+#elif defined(USE_X86_64_ASM)
+ unsigned int uninitialized_var(eax), uninitialized_var(ebx),
+ uninitialized_var(ecx), uninitialized_var(edx);
+
+ /* Always available on x86-64. */
+ _mesa_x86_cpu_features |= X86_FEATURE_XMM | X86_FEATURE_XMM2;
+
+ __get_cpuid(1, &eax, &ebx, &ecx, &edx);
+
+ if (ecx & bit_SSE4_1)
+ _mesa_x86_cpu_features |= X86_FEATURE_SSE4_1;
+#endif /* USE_X86_64_ASM */
(void) detection_debug;
}
diff --git a/mesalib/src/mesa/x86/common_x86_features.h b/mesalib/src/mesa/x86/common_x86_features.h
index 862548440..66f2cf651 100644
--- a/mesalib/src/mesa/x86/common_x86_features.h
+++ b/mesalib/src/mesa/x86/common_x86_features.h
@@ -43,6 +43,7 @@
#define X86_FEATURE_XMM2 (1<<6)
#define X86_FEATURE_3DNOWEXT (1<<7)
#define X86_FEATURE_3DNOW (1<<8)
+#define X86_FEATURE_SSE4_1 (1<<9)
/* standard X86 CPU features */
#define X86_CPU_FPU (1<<0)
@@ -50,6 +51,8 @@
#define X86_CPU_MMX (1<<23)
#define X86_CPU_XMM (1<<25)
#define X86_CPU_XMM2 (1<<26)
+/* ECX. */
+#define X86_CPU_SSE4_1 (1<<19)
/* extended X86 CPU features */
#define X86_CPUEXT_MMX_EXT (1<<22)
@@ -62,6 +65,7 @@
#define cpu_has_xmm2 (_mesa_x86_cpu_features & X86_FEATURE_XMM2)
#define cpu_has_3dnow (_mesa_x86_cpu_features & X86_FEATURE_3DNOW)
#define cpu_has_3dnowext (_mesa_x86_cpu_features & X86_FEATURE_3DNOWEXT)
+#define cpu_has_sse4_1 (_mesa_x86_cpu_features & X86_FEATURE_SSE4_1)
#endif