aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-04-30 23:26:47 +0200
committermarha <marha@users.sourceforge.net>2015-04-30 23:29:47 +0200
commit055e5645a789d2822d3c4e5a3bc81ff6a969ff31 (patch)
tree8a923f19c3586f9341114be6c81784ab9018aef8 /mesalib/src/mesa
parent0f7871ff824bcf064db3ab6bdfe26645ba6c8087 (diff)
parenta71d524ecad48837e0124a03124bc05f59a48be7 (diff)
downloadvcxsrv-055e5645a789d2822d3c4e5a3bc81ff6a969ff31.tar.gz
vcxsrv-055e5645a789d2822d3c4e5a3bc81ff6a969ff31.tar.bz2
vcxsrv-055e5645a789d2822d3c4e5a3bc81ff6a969ff31.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/Android.gen.mk23
-rw-r--r--mesalib/src/mesa/Android.libmesa_dricore.mk15
-rw-r--r--mesalib/src/mesa/Android.libmesa_glsl_utils.mk10
-rw-r--r--mesalib/src/mesa/Android.libmesa_st_mesa.mk9
-rw-r--r--mesalib/src/mesa/Android.mesa_gen_matypes.mk1
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c1
-rw-r--r--mesalib/src/mesa/drivers/dri/Android.mk11
-rw-r--r--mesalib/src/mesa/drivers/dri/common/Android.mk38
-rw-r--r--mesalib/src/mesa/drivers/dri/common/drirc4
-rw-r--r--mesalib/src/mesa/main/compiler.h5
-rw-r--r--mesalib/src/mesa/main/context.c6
-rw-r--r--mesalib/src/mesa/main/extensions.c2
-rw-r--r--mesalib/src/mesa/main/fbobject.c9
-rw-r--r--mesalib/src/mesa/main/ffvertex_prog.c2
-rw-r--r--mesalib/src/mesa/main/formats.c2
-rwxr-xr-xmesalib/src/mesa/main/macros.h5
-rw-r--r--mesalib/src/mesa/main/mtypes.h13
-rw-r--r--mesalib/src/mesa/main/shader_query.cpp56
-rw-r--r--mesalib/src/mesa/main/shaderapi.c9
-rw-r--r--mesalib/src/mesa/main/texgetimage.c54
-rw-r--r--mesalib/src/mesa/main/teximage.c7
-rw-r--r--mesalib/src/mesa/main/texobj.c1
-rw-r--r--mesalib/src/mesa/main/texturebarrier.c6
-rw-r--r--mesalib/src/mesa/main/uniform_query.cpp20
-rw-r--r--mesalib/src/mesa/main/version.c63
-rw-r--r--mesalib/src/mesa/math/m_matrix.c2
-rw-r--r--mesalib/src/mesa/program/Android.mk14
-rw-r--r--mesalib/src/mesa/program/hash_table.h4
-rw-r--r--mesalib/src/mesa/program/prog_cache.c2
-rw-r--r--mesalib/src/mesa/program/prog_to_nir.c25
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_texture.c14
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_flush.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c9
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c19
-rw-r--r--mesalib/src/mesa/swrast/s_texcombine.c2
-rw-r--r--mesalib/src/mesa/tnl/t_vertex.h2
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_api.c2
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_draw.c2
39 files changed, 317 insertions, 156 deletions
diff --git a/mesalib/src/mesa/Android.gen.mk b/mesalib/src/mesa/Android.gen.mk
index caae2c107..cc979547e 100644
--- a/mesalib/src/mesa/Android.gen.mk
+++ b/mesalib/src/mesa/Android.gen.mk
@@ -27,13 +27,16 @@ ifeq ($(LOCAL_MODULE_CLASS),)
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
endif
-intermediates := $(call local-intermediates-dir)
+intermediates := $(call local-generated-sources-dir)
# This is the list of auto-generated files: sources and headers
sources := \
main/enums.c \
main/api_exec.c \
main/dispatch.h \
+ main/format_pack.c \
+ main/format_unpack.c \
+ main/format_info.h \
main/remap_helper.h \
main/get_hash.h
@@ -124,3 +127,21 @@ format_info_deps := \
$(intermediates)/main/format_info.h: $(format_info_deps)
@$(MESA_PYTHON2) $(FORMAT_INFO) $< > $@
+
+FORMAT_PACK := $(LOCAL_PATH)/main/format_pack.py
+format_pack_deps := \
+ $(LOCAL_PATH)/main/formats.csv \
+ $(LOCAL_PATH)/main/format_parser.py \
+ $(FORMAT_PACK)
+
+$(intermediates)/main/format_pack.c: $(format_pack_deps)
+ $(hide) $(MESA_PYTHON2) $(FORMAT_PACK) $< > $@
+
+FORMAT_UNPACK := $(LOCAL_PATH)/main/format_unpack.py
+format_unpack_deps := \
+ $(LOCAL_PATH)/main/formats.csv \
+ $(LOCAL_PATH)/main/format_parser.py \
+ $(FORMAT_UNPACK)
+
+$(intermediates)/main/format_unpack.c: $(format_unpack_deps)
+ $(hide) $(MESA_PYTHON2) $(FORMAT_UNPACK) $< > $@
diff --git a/mesalib/src/mesa/Android.libmesa_dricore.mk b/mesalib/src/mesa/Android.libmesa_dricore.mk
index e4a52677c..2e308b837 100644
--- a/mesalib/src/mesa/Android.libmesa_dricore.mk
+++ b/mesalib/src/mesa/Android.libmesa_dricore.mk
@@ -49,21 +49,18 @@ endif # MESA_ENABLE_ASM
ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
LOCAL_SRC_FILES += \
- $(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 += \
+ main/streaming-load-memcpy.c \
+ mesa/main/sse_minmax.c
+LOCAL_CFLAGS := \
+ -msse4.1 \
-DUSE_SSE41
endif
LOCAL_C_INCLUDES := \
- $(call intermediates-dir-for STATIC_LIBRARIES,libmesa_program,,) \
- $(MESA_TOP)/src \
$(MESA_TOP)/src/mapi \
+ $(MESA_TOP)/src/mesa/main \
$(MESA_TOP)/src/glsl \
+ $(MESA_TOP)/src/gallium/include \
$(MESA_TOP)/src/gallium/auxiliary
LOCAL_WHOLE_STATIC_LIBRARIES := \
diff --git a/mesalib/src/mesa/Android.libmesa_glsl_utils.mk b/mesalib/src/mesa/Android.libmesa_glsl_utils.mk
index a9f6ff59a..3497377af 100644
--- a/mesalib/src/mesa/Android.libmesa_glsl_utils.mk
+++ b/mesalib/src/mesa/Android.libmesa_glsl_utils.mk
@@ -36,9 +36,10 @@ include $(CLEAR_VARS)
LOCAL_MODULE := libmesa_glsl_utils
LOCAL_C_INCLUDES := \
- $(MESA_TOP)/src \
$(MESA_TOP)/src/glsl \
- $(MESA_TOP)/src/mapi
+ $(MESA_TOP)/src/mapi \
+ $(MESA_TOP)/src/gallium/include \
+ $(MESA_TOP)/src/gallium/auxiliary
LOCAL_SRC_FILES := \
main/imports.c \
@@ -59,9 +60,10 @@ LOCAL_IS_HOST_MODULE := true
LOCAL_CFLAGS := -D_POSIX_C_SOURCE=199309L
LOCAL_C_INCLUDES := \
- $(MESA_TOP)/src \
$(MESA_TOP)/src/glsl \
- $(MESA_TOP)/src/mapi
+ $(MESA_TOP)/src/mapi \
+ $(MESA_TOP)/src/gallium/include \
+ $(MESA_TOP)/src/gallium/auxiliary
LOCAL_SRC_FILES := \
main/imports.c \
diff --git a/mesalib/src/mesa/Android.libmesa_st_mesa.mk b/mesalib/src/mesa/Android.libmesa_st_mesa.mk
index a08366d53..b4b7fd977 100644
--- a/mesalib/src/mesa/Android.libmesa_st_mesa.mk
+++ b/mesalib/src/mesa/Android.libmesa_st_mesa.mk
@@ -52,12 +52,11 @@ LOCAL_CFLAGS := \
endif
LOCAL_C_INCLUDES := \
- $(call intermediates-dir-for STATIC_LIBRARIES,libmesa_program,,) \
- $(MESA_TOP)/src/gallium/auxiliary \
- $(MESA_TOP)/src/gallium/include \
- $(MESA_TOP)/src \
+ $(MESA_TOP)/src/mapi \
+ $(MESA_TOP)/src/mesa/main \
$(MESA_TOP)/src/glsl \
- $(MESA_TOP)/src/mapi
+ $(MESA_TOP)/src/gallium/auxiliary \
+ $(MESA_TOP)/src/gallium/include
LOCAL_WHOLE_STATIC_LIBRARIES := \
libmesa_program
diff --git a/mesalib/src/mesa/Android.mesa_gen_matypes.mk b/mesalib/src/mesa/Android.mesa_gen_matypes.mk
index 5521087c4..6e301f904 100644
--- a/mesalib/src/mesa/Android.mesa_gen_matypes.mk
+++ b/mesalib/src/mesa/Android.mesa_gen_matypes.mk
@@ -33,7 +33,6 @@ include $(CLEAR_VARS)
LOCAL_MODULE := mesa_gen_matypes
LOCAL_IS_HOST_MODULE := true
-LOCAL_CFLAGS := -D_POSIX_C_SOURCE=199309L
LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/mapi \
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index cf99d9563..d2ab7b8de 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -41,7 +41,6 @@
#include "main/bufferobj.h"
#include "main/buffers.h"
#include "main/clear.h"
-#include "main/colortab.h"
#include "main/condrender.h"
#include "main/depth.h"
#include "main/enable.h"
diff --git a/mesalib/src/mesa/drivers/dri/Android.mk b/mesalib/src/mesa/drivers/dri/Android.mk
index 935722c53..42bfd77d4 100644
--- a/mesalib/src/mesa/drivers/dri/Android.mk
+++ b/mesalib/src/mesa/drivers/dri/Android.mk
@@ -35,17 +35,17 @@ MESA_DRI_CFLAGS := \
-DHAVE_ANDROID_PLATFORM
MESA_DRI_C_INCLUDES := \
- $(MESA_TOP)/src \
- $(call intermediates-dir-for,STATIC_LIBRARIES,libmesa_dri_common) \
$(addprefix $(MESA_TOP)/, $(mesa_dri_common_INCLUDES)) \
- $(TARGET_OUT_HEADERS)/libdrm \
+ $(MESA_TOP)/src/gallium/include \
+ $(MESA_TOP)/src/gallium/auxiliary \
external/expat/lib
MESA_DRI_WHOLE_STATIC_LIBRARIES := \
libmesa_glsl \
libmesa_megadriver_stub \
libmesa_dri_common \
- libmesa_dricore
+ libmesa_dricore \
+ libmesa_util
MESA_DRI_SHARED_LIBRARIES := \
libcutils \
@@ -55,9 +55,6 @@ MESA_DRI_SHARED_LIBRARIES := \
libglapi \
liblog
-# All DRI modules must add this to LOCAL_GENERATED_SOURCES.
-MESA_DRI_OPTIONS_H := $(call intermediates-dir-for,STATIC_LIBRARIES,libmesa_dri_common)/xmlpool/options.h
-
#-----------------------------------------------
# Build drivers and libmesa_dri_common
diff --git a/mesalib/src/mesa/drivers/dri/common/Android.mk b/mesalib/src/mesa/drivers/dri/common/Android.mk
index b95feb679..a7fcd6d57 100644
--- a/mesalib/src/mesa/drivers/dri/common/Android.mk
+++ b/mesalib/src/mesa/drivers/dri/common/Android.mk
@@ -34,16 +34,24 @@ include $(LOCAL_PATH)/Makefile.sources
LOCAL_MODULE := libmesa_dri_common
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-intermediates := $(call local-intermediates-dir)
+intermediates := $(call local-generated-sources-dir)
LOCAL_C_INCLUDES := \
- $(intermediates) \
$(MESA_DRI_C_INCLUDES)
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates)
+
+# swrast only
+ifeq ($(MESA_GPU_DRIVERS),swrast)
+LOCAL_CFLAGS := -D__NOT_HAVE_DRM_H
+else
+LOCAL_SHARED_LIBRARIES := libdrm
+endif
+
LOCAL_SRC_FILES := $(DRI_COMMON_FILES)
-LOCAL_GENERATED_SOURCES := \
- $(intermediates)/xmlpool/options.h
+MESA_DRI_OPTIONS_H := $(intermediates)/xmlpool/options.h
+LOCAL_GENERATED_SOURCES := $(MESA_DRI_OPTIONS_H)
#
# Generate options.h from gettext translations.
@@ -73,15 +81,14 @@ $(intermediates)/xmlpool/%/LC_MESSAGES/options.mo: $(intermediates)/xmlpool/%.po
mkdir -p $(dir $@)
msgfmt -o $@ $<
-$(intermediates)/xmlpool/options.h: PRIVATE_SCRIPT := $(LOCAL_PATH)/xmlpool/gen_xmlpool.py
-$(intermediates)/xmlpool/options.h: PRIVATE_LOCALEDIR := $(intermediates)/xmlpool
-$(intermediates)/xmlpool/options.h: PRIVATE_TEMPLATE_HEADER := $(LOCAL_PATH)/xmlpool/t_options.h
-$(intermediates)/xmlpool/options.h: PRIVATE_MO_FILES := $(MESA_DRI_OPTIONS_LANGS:%=$(intermediates)/xmlpool/%/LC_MESSAGES/options.mo)
+$(MESA_DRI_OPTIONS_H): PRIVATE_SCRIPT := $(LOCAL_PATH)/xmlpool/gen_xmlpool.py
+$(MESA_DRI_OPTIONS_H): PRIVATE_LOCALEDIR := $(intermediates)/xmlpool
+$(MESA_DRI_OPTIONS_H): PRIVATE_TEMPLATE_HEADER := $(LOCAL_PATH)/xmlpool/t_options.h
+$(MESA_DRI_OPTIONS_H): PRIVATE_MO_FILES := $(MESA_DRI_OPTIONS_LANGS:%=$(intermediates)/xmlpool/%/LC_MESSAGES/options.mo)
.SECONDEXPANSION:
-$(intermediates)/xmlpool/options.h: $$(PRIVATE_SCRIPT) $$(PRIVATE_TEMPLATE_HEADER) $$(PRIVATE_MO_FILES)
- mkdir -p $(dir $@)
- mkdir -p $(PRIVATE_LOCALEDIR)
- $(MESA_PYTHON2) $(PRIVATE_SCRIPT) $(PRIVATE_TEMPLATE_HEADER) \
+$(MESA_DRI_OPTIONS_H): $$(PRIVATE_SCRIPT) $$(PRIVATE_TEMPLATE_HEADER) $$(PRIVATE_MO_FILES)
+ @mkdir -p $(dir $@)
+ $(hide) $(MESA_PYTHON2) $(PRIVATE_SCRIPT) $(PRIVATE_TEMPLATE_HEADER) \
$(PRIVATE_LOCALEDIR) $(MESA_DRI_OPTIONS_LANGS) > $@
include $(MESA_COMMON_MK)
@@ -99,6 +106,13 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES
LOCAL_C_INCLUDES := \
$(MESA_DRI_C_INCLUDES)
+# swrast only
+ifeq ($(MESA_GPU_DRIVERS),swrast)
+LOCAL_CFLAGS := -D__NOT_HAVE_DRM_H
+else
+LOCAL_SHARED_LIBRARIES := libdrm
+endif
+
LOCAL_SRC_FILES := $(megadriver_stub_FILES)
include $(MESA_COMMON_MK)
diff --git a/mesalib/src/mesa/drivers/dri/common/drirc b/mesalib/src/mesa/drivers/dri/common/drirc
index cecd6a953..145e707a6 100644
--- a/mesalib/src/mesa/drivers/dri/common/drirc
+++ b/mesalib/src/mesa/drivers/dri/common/drirc
@@ -91,5 +91,9 @@ TODO: document the other workarounds.
<application name="Dead Island" executable="DeadIslandGame">
<option name="allow_glsl_extension_directive_midshader" value="true" />
</application>
+
+ <application name="Second Life" executable="do-not-directly-run-secondlife-bin">
+ <option name="allow_glsl_extension_directive_midshader" value="true" />
+ </application>
</device>
</driconf>
diff --git a/mesalib/src/mesa/main/compiler.h b/mesalib/src/mesa/main/compiler.h
index 55152fdef..93b4e6f12 100644
--- a/mesalib/src/mesa/main/compiler.h
+++ b/mesalib/src/mesa/main/compiler.h
@@ -60,11 +60,6 @@ extern "C" {
#endif
-/* XXX: Use standard `__func__` instead */
-#ifndef __FUNCTION__
-# define __FUNCTION__ __func__
-#endif
-
/**
* Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN, and CPU_TO_LE32.
* Do not use these unless absolutely necessary!
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index adf64976e..4aaf8b1af 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -894,14 +894,14 @@ update_default_objects(struct gl_context *ctx)
* If there's no current OpenGL context for the calling thread, we can
* print a message to stderr.
*
- * \param name the name of the OpenGL function, without the "gl" prefix
+ * \param name the name of the OpenGL function
*/
static void
nop_handler(const char *name)
{
GET_CURRENT_CONTEXT(ctx);
if (ctx) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "gl%s(invalid call)", name);
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid call)", name);
}
#if defined(DEBUG)
else if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) {
@@ -936,7 +936,7 @@ alloc_dispatch_table(void)
{
/* Find the larger of Mesa's dispatch table and libGL's dispatch table.
* In practice, this'll be the same for stand-alone Mesa. But for DRI
- * Mesa we do this to accomodate different versions of libGL and various
+ * Mesa we do this to accommodate different versions of libGL and various
* DRI drivers.
*/
GLint numEntries = MAX2(_glapi_get_dispatch_table_size(), _gloffset_COUNT);
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index 861b15006..9be8993b0 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -186,6 +186,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_texture_rectangle", o(NV_texture_rectangle), GL, 2004 },
{ "GL_ARB_texture_rgb10_a2ui", o(ARB_texture_rgb10_a2ui), GL, 2009 },
{ "GL_ARB_texture_rg", o(ARB_texture_rg), GL, 2008 },
+ { "GL_ARB_texture_stencil8", o(ARB_texture_stencil8), GL, 2013 },
{ "GL_ARB_texture_storage", o(dummy_true), GL, 2011 },
{ "GL_ARB_texture_storage_multisample", o(ARB_texture_multisample), GL, 2012 },
{ "GL_ARB_texture_view", o(ARB_texture_view), GL, 2012 },
@@ -297,6 +298,7 @@ static const struct extension extension_table[] = {
{ "GL_OES_depth_texture", o(ARB_depth_texture), ES2, 2006 },
{ "GL_OES_depth_texture_cube_map", o(OES_depth_texture_cube_map), ES2, 2012 },
{ "GL_OES_draw_texture", o(OES_draw_texture), ES1, 2004 },
+ { "GL_OES_EGL_sync", o(dummy_true), ES1 | ES2, 2010 },
/* FIXME: Mesa expects GL_OES_EGL_image to be available in OpenGL contexts. */
{ "GL_OES_EGL_image", o(OES_EGL_image), GL | ES1 | ES2, 2006 },
{ "GL_OES_EGL_image_external", o(OES_EGL_image_external), ES1 | ES2, 2010 },
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index 8032585ab..27cf97f17 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -813,8 +813,10 @@ test_attachment_completeness(const struct gl_context *ctx, GLenum format,
if (ctx->Extensions.ARB_depth_texture &&
baseFormat == GL_DEPTH_STENCIL) {
/* OK */
- }
- else {
+ } else if (ctx->Extensions.ARB_texture_stencil8 &&
+ baseFormat == GL_STENCIL_INDEX) {
+ /* OK */
+ } else {
/* no such thing as stencil-only textures */
att_incomplete("illegal stencil texture");
att->Complete = GL_FALSE;
@@ -978,7 +980,8 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
if (!is_format_color_renderable(ctx, attFormat,
texImg->InternalFormat) &&
- !is_legal_depth_format(ctx, f)) {
+ !is_legal_depth_format(ctx, f) &&
+ f != GL_STENCIL_INDEX) {
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
fbo_incomplete(ctx, "texture attachment incomplete", -1);
return;
diff --git a/mesalib/src/mesa/main/ffvertex_prog.c b/mesalib/src/mesa/main/ffvertex_prog.c
index edf7e3390..7fdd9bab6 100644
--- a/mesalib/src/mesa/main/ffvertex_prog.c
+++ b/mesalib/src/mesa/main/ffvertex_prog.c
@@ -1657,7 +1657,7 @@ _mesa_get_fixed_func_vertex_program(struct gl_context *ctx)
struct gl_vertex_program *prog;
struct state_key key;
- /* Grab all the relevent state and put it in a single structure:
+ /* Grab all the relevant state and put it in a single structure:
*/
make_state_key(ctx, &key);
diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c
index 2bc8bcad9..8af44e905 100644
--- a/mesalib/src/mesa/main/formats.c
+++ b/mesalib/src/mesa/main/formats.c
@@ -811,7 +811,7 @@ _mesa_format_image_size(mesa_format format, GLsizei width,
/**
* Same as _mesa_format_image_size() but returns a 64-bit value to
- * accomodate very large textures.
+ * accommodate very large textures.
*/
uint64_t
_mesa_format_image_size64(mesa_format format, GLsizei width,
diff --git a/mesalib/src/mesa/main/macros.h b/mesalib/src/mesa/main/macros.h
index 5680b2ee1..2a5731f8c 100755
--- a/mesalib/src/mesa/main/macros.h
+++ b/mesalib/src/mesa/main/macros.h
@@ -31,6 +31,7 @@
#ifndef MACROS_H
#define MACROS_H
+#include "util/macros.h"
#include "util/u_math.h"
#include "imports.h"
@@ -800,10 +801,6 @@ DIFFERENT_SIGNS(GLfloat x, GLfloat y)
}
-/** Compute ceiling of integer quotient of A divided by B. */
-#define DIV_ROUND_UP( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )
-
-
/** casts to silence warnings with some compilers */
#define ENUM_TO_INT(E) ((GLint)(E))
#define ENUM_TO_FLOAT(E) ((GLfloat)(GLint)(E))
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 1c751cfff..fb4143086 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2365,16 +2365,6 @@ struct gl_ati_fragment_shader_state
};
-/** Set by #pragma directives */
-struct gl_sl_pragmas
-{
- GLboolean IgnoreOptimize; /**< ignore #pragma optimize(on/off) ? */
- GLboolean IgnoreDebug; /**< ignore #pragma debug(on/off) ? */
- GLboolean Optimize; /**< defaults on */
- GLboolean Debug; /**< defaults off */
-};
-
-
/**
* A GLSL vertex or fragment shader object.
*/
@@ -2397,7 +2387,6 @@ struct gl_shader
struct gl_program *Program; /**< Post-compile assembly code */
GLchar *InfoLog;
- struct gl_sl_pragmas Pragmas;
unsigned Version; /**< GLSL version used for linking */
@@ -2903,8 +2892,6 @@ struct gl_shader_compiler_options
*/
GLboolean OptimizeForAOS;
- struct gl_sl_pragmas DefaultPragmas; /**< Default #pragma settings */
-
const struct nir_shader_compiler_options *NirOptions;
};
diff --git a/mesalib/src/mesa/main/shader_query.cpp b/mesalib/src/mesa/main/shader_query.cpp
index b5f1d082c..d2ca49b43 100644
--- a/mesalib/src/mesa/main/shader_query.cpp
+++ b/mesalib/src/mesa/main/shader_query.cpp
@@ -291,7 +291,6 @@ _mesa_GetAttribLocation(GLhandleARB program, const GLcharARB * name)
return (loc >= 0) ? loc : -1;
}
-
unsigned
_mesa_count_active_attribs(struct gl_shader_program *shProg)
{
@@ -300,19 +299,15 @@ _mesa_count_active_attribs(struct gl_shader_program *shProg)
return 0;
}
- exec_list *const ir = shProg->_LinkedShaders[MESA_SHADER_VERTEX]->ir;
- unsigned i = 0;
-
- foreach_in_list(ir_instruction, node, ir) {
- const ir_variable *const var = node->as_variable();
-
- if (!is_active_attrib(var))
- continue;
-
- i++;
+ struct gl_program_resource *res = shProg->ProgramResourceList;
+ unsigned count = 0;
+ for (unsigned j = 0; j < shProg->NumProgramResourceList; j++, res++) {
+ if (res->Type == GL_PROGRAM_INPUT &&
+ res->StageReferences & (1 << MESA_SHADER_VERTEX) &&
+ is_active_attrib(RESOURCE_VAR(res)))
+ count++;
}
-
- return i;
+ return count;
}
@@ -324,20 +319,16 @@ _mesa_longest_attribute_name_length(struct gl_shader_program *shProg)
return 0;
}
- exec_list *const ir = shProg->_LinkedShaders[MESA_SHADER_VERTEX]->ir;
+ struct gl_program_resource *res = shProg->ProgramResourceList;
size_t longest = 0;
+ for (unsigned j = 0; j < shProg->NumProgramResourceList; j++, res++) {
+ if (res->Type == GL_PROGRAM_INPUT &&
+ res->StageReferences & (1 << MESA_SHADER_VERTEX)) {
- foreach_in_list(ir_instruction, node, ir) {
- const ir_variable *const var = node->as_variable();
-
- if (var == NULL
- || var->data.mode != ir_var_shader_in
- || var->data.location == -1)
- continue;
-
- const size_t len = strlen(var->name);
- if (len >= longest)
- longest = len + 1;
+ const size_t length = strlen(RESOURCE_VAR(res)->name);
+ if (length >= longest)
+ longest = length + 1;
+ }
}
return longest;
@@ -537,6 +528,7 @@ array_index_of_resource(struct gl_program_resource *res,
return get_matching_index(RESOURCE_VAR(res), name);
default:
assert(!"support for resource type not implemented");
+ return -1;
}
}
@@ -634,7 +626,7 @@ _mesa_program_resource_find_index(struct gl_shader_program *shProg,
case GL_ATOMIC_COUNTER_BUFFER:
if (_mesa_program_resource_index(shProg, res) == index)
return res;
-
+ break;
case GL_TRANSFORM_FEEDBACK_VARYING:
case GL_PROGRAM_INPUT:
case GL_PROGRAM_OUTPUT:
@@ -860,13 +852,23 @@ get_buffer_property(struct gl_shader_program *shProg,
*val = RESOURCE_UBO(res)->UniformBufferSize;
return 1;
case GL_NUM_ACTIVE_VARIABLES:
- *val = RESOURCE_UBO(res)->NumUniforms;
+ *val = 0;
+ for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) {
+ const char *iname = RESOURCE_UBO(res)->Uniforms[i].IndexName;
+ struct gl_program_resource *uni =
+ _mesa_program_resource_find_name(shProg, GL_UNIFORM, iname);
+ if (!uni)
+ continue;
+ (*val)++;
+ }
return 1;
case GL_ACTIVE_VARIABLES:
for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) {
const char *iname = RESOURCE_UBO(res)->Uniforms[i].IndexName;
struct gl_program_resource *uni =
_mesa_program_resource_find_name(shProg, GL_UNIFORM, iname);
+ if (!uni)
+ continue;
*val++ =
_mesa_program_resource_index(shProg, uni);
}
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index 77e2b8745..a04b28711 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -115,9 +115,6 @@ _mesa_init_shader_state(struct gl_context *ctx)
options.MaxUnrollIterations = 32;
options.MaxIfDepth = UINT_MAX;
- /* Default pragma settings */
- options.DefaultPragmas.Optimize = GL_TRUE;
-
for (sh = 0; sh < MESA_SHADER_STAGES; ++sh)
memcpy(&ctx->Const.ShaderCompilerOptions[sh], &options, sizeof(options));
@@ -864,17 +861,11 @@ static void
compile_shader(struct gl_context *ctx, GLuint shaderObj)
{
struct gl_shader *sh;
- struct gl_shader_compiler_options *options;
sh = _mesa_lookup_shader_err(ctx, shaderObj, "glCompileShader");
if (!sh)
return;
- options = &ctx->Const.ShaderCompilerOptions[sh->Stage];
-
- /* set default pragma state for shader */
- sh->Pragmas = options->DefaultPragmas;
-
if (!sh->Source) {
/* If the user called glCompileShader without first calling
* glShaderSource, we should fail to compile, but not raise a GL_ERROR.
diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c
index 255d36559..92b4d6795 100644
--- a/mesalib/src/mesa/main/texgetimage.c
+++ b/mesalib/src/mesa/main/texgetimage.c
@@ -175,6 +175,51 @@ get_tex_depth_stencil(struct gl_context *ctx, GLuint dimensions,
}
}
+/**
+ * glGetTexImage for stencil pixels.
+ */
+static void
+get_tex_stencil(struct gl_context *ctx, GLuint dimensions,
+ GLenum format, GLenum type, GLvoid *pixels,
+ struct gl_texture_image *texImage)
+{
+ const GLint width = texImage->Width;
+ const GLint height = texImage->Height;
+ const GLint depth = texImage->Depth;
+ GLint img, row;
+
+ assert(format == GL_STENCIL_INDEX);
+
+ for (img = 0; img < depth; img++) {
+ GLubyte *srcMap;
+ GLint rowstride;
+
+ /* map src texture buffer */
+ ctx->Driver.MapTextureImage(ctx, texImage, img,
+ 0, 0, width, height, GL_MAP_READ_BIT,
+ &srcMap, &rowstride);
+
+ if (srcMap) {
+ for (row = 0; row < height; row++) {
+ const GLubyte *src = srcMap + row * rowstride;
+ void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
+ width, height, format, type,
+ img, row, 0);
+ _mesa_unpack_ubyte_stencil_row(texImage->TexFormat,
+ width,
+ (const GLuint *) src,
+ dest);
+ }
+
+ ctx->Driver.UnmapTextureImage(ctx, texImage, img);
+ }
+ else {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage");
+ break;
+ }
+ }
+}
+
/**
* glGetTexImage for YCbCr pixels.
@@ -285,7 +330,7 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint dimensions,
}
/* Depending on the base format involved we may need to apply a rebase
- * tranaform (for example: if we download to a Luminance format we want
+ * transform (for example: if we download to a Luminance format we want
* G=0 and B=0).
*/
if (baseFormat == GL_LUMINANCE ||
@@ -388,7 +433,7 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions,
}
/* Depending on the base format involved we may need to apply a rebase
- * tranaform (for example: if we download to a Luminance format we want
+ * transform (for example: if we download to a Luminance format we want
* G=0 and B=0).
*/
if (texImage->_BaseFormat == GL_LUMINANCE ||
@@ -684,6 +729,9 @@ _mesa_GetTexImage_sw(struct gl_context *ctx,
else if (format == GL_DEPTH_STENCIL_EXT) {
get_tex_depth_stencil(ctx, dimensions, format, type, pixels, texImage);
}
+ else if (format == GL_STENCIL_INDEX) {
+ get_tex_stencil(ctx, dimensions, format, type, pixels, texImage);
+ }
else if (format == GL_YCBCR_MESA) {
get_tex_ycbcr(ctx, dimensions, format, type, pixels, texImage);
}
@@ -879,7 +927,7 @@ getteximage_error_check(struct gl_context *ctx,
"glGetTex%sImage(format mismatch)", suffix);
return GL_TRUE;
}
- else if (_mesa_is_enum_format_integer(format) !=
+ else if (!_mesa_is_stencil_format(format) && _mesa_is_enum_format_integer(format) !=
_mesa_is_format_integer(texImage->TexFormat)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glGetTex%sImage(format mismatch)", suffix);
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 8d9d7cfc1..7bc1da7f8 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -1997,7 +1997,8 @@ _mesa_legal_texture_base_format_for_target(struct gl_context *ctx,
const char *caller)
{
if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT
- || _mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_STENCIL) {
+ || _mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_STENCIL
+ || _mesa_base_tex_format(ctx, internalFormat) == GL_STENCIL_INDEX) {
/* Section 3.8.3 (Texture Image Specification) of the OpenGL 3.3 Core
* Profile spec says:
*
@@ -3319,7 +3320,9 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims,
if (!sizeOK) {
_mesa_error(ctx, GL_OUT_OF_MEMORY,
- "glTexImage%uD(image too large)", dims);
+ "glTexImage%uD(image too large: %d x %d x %d, %s format)",
+ dims, width, height, depth,
+ _mesa_lookup_enum_by_nr(internalFormat));
return;
}
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index e018ab910..c563f1e74 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -30,7 +30,6 @@
#include <stdio.h>
#include "bufferobj.h"
-#include "colortab.h"
#include "context.h"
#include "enums.h"
#include "fbobject.h"
diff --git a/mesalib/src/mesa/main/texturebarrier.c b/mesalib/src/mesa/main/texturebarrier.c
index 08ff56150..d879eed57 100644
--- a/mesalib/src/mesa/main/texturebarrier.c
+++ b/mesalib/src/mesa/main/texturebarrier.c
@@ -49,5 +49,11 @@ _mesa_TextureBarrierNV(void)
{
GET_CURRENT_CONTEXT(ctx);
+ if (!ctx->Extensions.NV_texture_barrier) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glTextureBarrier(not supported)");
+ return;
+ }
+
ctx->Driver.TextureBarrier(ctx);
}
diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp
index 4e77b3284..3e857ed10 100644
--- a/mesalib/src/mesa/main/uniform_query.cpp
+++ b/mesalib/src/mesa/main/uniform_query.cpp
@@ -129,14 +129,26 @@ _mesa_GetActiveUniformsiv(GLuint program,
res_prop = resource_prop_from_uniform_prop(pname);
+ /* We need to first verify that each entry exists as active uniform. If
+ * not, generate error and do not cause any other side effects.
+ *
+ * In the case of and error condition, Page 16 (section 2.3.1 Errors)
+ * of the OpenGL 4.5 spec says:
+ *
+ * "If the generating command modifies values through a pointer argu-
+ * ment, no change is made to these values."
+ */
for (int i = 0; i < uniformCount; i++) {
- res = _mesa_program_resource_find_index(shProg, GL_UNIFORM,
- uniformIndices[i]);
- if (!res) {
+ if (!_mesa_program_resource_find_index(shProg, GL_UNIFORM,
+ uniformIndices[i])) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniformsiv(index)");
- break;
+ return;
}
+ }
+ for (int i = 0; i < uniformCount; i++) {
+ res = _mesa_program_resource_find_index(shProg, GL_UNIFORM,
+ uniformIndices[i]);
if (!_mesa_program_resource_prop(shProg, res, uniformIndices[i],
res_prop, &params[i],
"glGetActiveUniformsiv"))
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index 5df5a2922..c561ab3cb 100644
--- a/mesalib/src/mesa/main/version.c
+++ b/mesalib/src/mesa/main/version.c
@@ -295,7 +295,51 @@ compute_version(const struct gl_extensions *extensions,
extensions->EXT_texture_swizzle);
/* ARB_sampler_objects is always enabled in mesa */
- if (ver_3_3) {
+ const GLboolean ver_4_0 = (ver_3_3 &&
+ consts->GLSLVersion >= 400 &&
+ extensions->ARB_draw_buffers_blend &&
+ extensions->ARB_draw_indirect &&
+ extensions->ARB_gpu_shader5 &&
+ extensions->ARB_gpu_shader_fp64 &&
+ extensions->ARB_sample_shading &&
+ 0/*extensions->ARB_shader_subroutine*/ &&
+ extensions->ARB_tessellation_shader &&
+ extensions->ARB_texture_buffer_object_rgb32 &&
+ extensions->ARB_texture_cube_map_array &&
+ extensions->ARB_texture_query_lod &&
+ extensions->ARB_transform_feedback2 &&
+ extensions->ARB_transform_feedback3);
+ const GLboolean ver_4_1 = (ver_4_0 &&
+ consts->GLSLVersion >= 410 &&
+ extensions->ARB_ES2_compatibility &&
+ extensions->ARB_shader_precision &&
+ 0/*extensions->ARB_vertex_attrib_64bit*/ &&
+ extensions->ARB_viewport_array);
+ const GLboolean ver_4_2 = (ver_4_1 &&
+ consts->GLSLVersion >= 420 &&
+ extensions->ARB_base_instance &&
+ extensions->ARB_conservative_depth &&
+ extensions->ARB_internalformat_query &&
+ extensions->ARB_shader_atomic_counters &&
+ extensions->ARB_shader_image_load_store &&
+ extensions->ARB_shading_language_420pack &&
+ extensions->ARB_shading_language_packing &&
+ extensions->ARB_texture_compression_bptc &&
+ extensions->ARB_transform_feedback_instanced);
+
+ if (ver_4_2) {
+ major = 4;
+ minor = 2;
+ }
+ else if (ver_4_1) {
+ major = 4;
+ minor = 1;
+ }
+ else if (ver_4_0) {
+ major = 4;
+ minor = 0;
+ }
+ else if (ver_3_3) {
major = 3;
minor = 3;
}
@@ -439,6 +483,23 @@ _mesa_compute_version(struct gl_context *ctx)
ctx->Version = _mesa_get_version(&ctx->Extensions, &ctx->Const, ctx->API);
+ /* Make sure that the GLSL version lines up with the GL version. In some
+ * cases it can be too high, e.g. if an extension is missing.
+ */
+ if (ctx->API == API_OPENGL_CORE) {
+ switch (ctx->Version) {
+ case 31:
+ ctx->Const.GLSLVersion = 140;
+ break;
+ case 32:
+ ctx->Const.GLSLVersion = 150;
+ break;
+ default:
+ ctx->Const.GLSLVersion = ctx->Version * 10;
+ break;
+ }
+ }
+
switch (ctx->API) {
case API_OPENGL_COMPAT:
case API_OPENGL_CORE:
diff --git a/mesalib/src/mesa/math/m_matrix.c b/mesalib/src/mesa/math/m_matrix.c
index 0475a7ab2..ecf564c00 100644
--- a/mesalib/src/mesa/math/m_matrix.c
+++ b/mesalib/src/mesa/math/m_matrix.c
@@ -50,7 +50,7 @@
/*@{*/
#define MAT_FLAG_IDENTITY 0 /**< is an identity matrix flag.
* (Not actually used - the identity
- * matrix is identified by the absense
+ * matrix is identified by the absence
* of all other flags.)
*/
#define MAT_FLAG_GENERAL 0x1 /**< is a general matrix flag */
diff --git a/mesalib/src/mesa/program/Android.mk b/mesalib/src/mesa/program/Android.mk
index a237b65bc..ccb0fa5f3 100644
--- a/mesalib/src/mesa/program/Android.mk
+++ b/mesalib/src/mesa/program/Android.mk
@@ -44,8 +44,9 @@ include $(CLEAR_VARS)
LOCAL_MODULE := libmesa_program
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+LOCAL_STATIC_LIBRARIES := libmesa_glsl
-intermediates := $(call local-intermediates-dir)
+intermediates := $(call local-generated-sources-dir)
# TODO(chadv): In Makefile.sources, move these vars to a different list so we can
# remove this kludge.
@@ -55,7 +56,8 @@ generated_sources_basenames := \
program_parse.tab.h
LOCAL_SRC_FILES := \
- $(filter-out $(generated_sources_basenames),$(subst program/,,$(PROGRAM_FILES)))
+ $(filter-out $(generated_sources_basenames),$(subst program/,,$(PROGRAM_FILES))) \
+ $(subst program/,,$(PROGRAM_NIR_FILES))
LOCAL_GENERATED_SOURCES := \
$(addprefix $(intermediates)/program/,$(generated_sources_basenames))
@@ -70,11 +72,13 @@ $(intermediates)/program/lex.yy.c: $(LOCAL_PATH)/program_lexer.l
$(local-l-to-c)
LOCAL_C_INCLUDES := \
- $(intermediates) \
- $(MESA_TOP)/src \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/mesa \
- $(MESA_TOP)/src/glsl
+ $(MESA_TOP)/src/glsl \
+ $(MESA_TOP)/src/gallium/auxiliary \
+ $(MESA_TOP)/src/gallium/include
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates)
include $(MESA_COMMON_MK)
include $(BUILD_STATIC_LIBRARY)
diff --git a/mesalib/src/mesa/program/hash_table.h b/mesalib/src/mesa/program/hash_table.h
index 6122b1f8a..bfd56513a 100644
--- a/mesalib/src/mesa/program/hash_table.h
+++ b/mesalib/src/mesa/program/hash_table.h
@@ -117,8 +117,8 @@ extern void hash_table_insert(struct hash_table *ht, void *data,
* Add an element to a hash table with replacement
*
* \return
- * 1 if it did replace the the value (in which case the old key is kept), 0 if
- * it did not replace the value (in which case the new key is kept).
+ * 1 if it did replace the value (in which case the old key is kept), 0 if it
+ * did not replace the value (in which case the new key is kept).
*
* \warning
* If \c key is already in the hash table, \c data will \b replace the most
diff --git a/mesalib/src/mesa/program/prog_cache.c b/mesalib/src/mesa/program/prog_cache.c
index 34609f056..ed93af7f1 100644
--- a/mesalib/src/mesa/program/prog_cache.c
+++ b/mesalib/src/mesa/program/prog_cache.c
@@ -77,7 +77,7 @@ hash_key(const void *key, GLuint key_size)
/**
- * Rebuild/expand the hash table to accomodate more entries
+ * Rebuild/expand the hash table to accommodate more entries
*/
static void
rehash(struct gl_program_cache *cache)
diff --git a/mesalib/src/mesa/program/prog_to_nir.c b/mesalib/src/mesa/program/prog_to_nir.c
index c738f5073..ff3d9f3be 100644
--- a/mesalib/src/mesa/program/prog_to_nir.c
+++ b/mesalib/src/mesa/program/prog_to_nir.c
@@ -222,12 +222,23 @@ ptn_get_src(struct ptn_compile *c, const struct prog_src_register *prog_src)
}
nir_ssa_def *def;
- if (!HAS_EXTENDED_SWIZZLE(prog_src->Swizzle)) {
+ if (!HAS_EXTENDED_SWIZZLE(prog_src->Swizzle) &&
+ (prog_src->Negate == NEGATE_NONE || prog_src->Negate == NEGATE_XYZW)) {
+ /* The simple non-SWZ case. */
for (int i = 0; i < 4; i++)
src.swizzle[i] = GET_SWZ(prog_src->Swizzle, i);
def = nir_fmov_alu(b, src, 4);
+
+ if (prog_src->Abs)
+ def = nir_fabs(b, def);
+
+ if (prog_src->Negate)
+ def = nir_fneg(b, def);
} else {
+ /* The SWZ instruction allows per-component zero/one swizzles, and also
+ * per-component negation.
+ */
nir_ssa_def *chans[4];
for (int i = 0; i < 4; i++) {
int swizzle = GET_SWZ(prog_src->Swizzle, i);
@@ -246,16 +257,16 @@ ptn_get_src(struct ptn_compile *c, const struct prog_src_register *prog_src)
chans[i] = &mov->dest.dest.ssa;
}
+
+ if (prog_src->Abs)
+ chans[i] = nir_fabs(b, chans[i]);
+
+ if (prog_src->Negate & (1 << i))
+ chans[i] = nir_fneg(b, chans[i]);
}
def = nir_vec4(b, chans[0], chans[1], chans[2], chans[3]);
}
- if (prog_src->Abs)
- def = nir_fabs(b, def);
-
- if (prog_src->Negate)
- def = nir_fneg(b, def);
-
return def;
}
diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c
index eff28fc6f..04ba86448 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c
@@ -287,16 +287,22 @@ st_get_texture_sampler_view_from_stobj(struct st_context *st,
enum pipe_format format)
{
struct pipe_sampler_view **sv;
-
+ const struct st_texture_image *firstImage;
if (!stObj || !stObj->pt) {
return NULL;
}
sv = st_texture_get_sampler_view(st, stObj);
- if (stObj->base.StencilSampling &&
- util_format_is_depth_and_stencil(format))
- format = util_format_stencil_only(format);
+ if (util_format_is_depth_and_stencil(format)) {
+ if (stObj->base.StencilSampling)
+ format = util_format_stencil_only(format);
+ else {
+ firstImage = st_texture_image_const(_mesa_base_tex_image(&stObj->base));
+ if (firstImage->base._BaseFormat == GL_STENCIL_INDEX)
+ format = util_format_stencil_only(format);
+ }
+ }
/* if sampler view has changed dereference it */
if (*sv) {
diff --git a/mesalib/src/mesa/state_tracker/st_cb_flush.c b/mesalib/src/mesa/state_tracker/st_cb_flush.c
index 6df430049..ca51eeee3 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_flush.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_flush.c
@@ -152,7 +152,7 @@ void st_init_flush_functions(struct dd_function_table *functions)
* Finish() is identical to Flush() in all cases - no differences in
* rendering or ReadPixels are visible if we opt not to wait here.
*
- * Only set this up on windows to avoid suprise elsewhere.
+ * Only set this up on Windows to avoid surprise elsewhere.
*/
#ifdef PIPE_OS_WINDOWS
functions->Finish = st_glFlush;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index bdf236e82..7ea3846ff 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -950,7 +950,7 @@ st_GetTexImage(struct gl_context * ctx,
/* XXX Fallback to _mesa_GetTexImage_sw for depth-stencil formats
* due to an incomplete stencil blit implementation in some drivers. */
- if (format == GL_DEPTH_STENCIL) {
+ if (format == GL_DEPTH_STENCIL || format == GL_STENCIL_INDEX) {
goto fallback;
}
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index bc20f7323..82e4a3009 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -650,12 +650,15 @@ void st_init_extensions(struct pipe_screen *screen,
ARRAY_SIZE(vertex_mapping), PIPE_BUFFER,
PIPE_BIND_VERTEX_BUFFER);
+ if (extensions->ARB_stencil_texturing)
+ extensions->ARB_texture_stencil8 = GL_TRUE;
+
/* Figure out GLSL support. */
glsl_feature_level = screen->get_param(screen, PIPE_CAP_GLSL_FEATURE_LEVEL);
consts->GLSLVersion = glsl_feature_level;
- if (glsl_feature_level >= 330)
- consts->GLSLVersion = 330;
+ if (glsl_feature_level >= 410)
+ consts->GLSLVersion = 410;
_mesa_override_glsl_version(consts);
@@ -666,6 +669,8 @@ void st_init_extensions(struct pipe_screen *screen,
if (glsl_feature_level >= 400)
extensions->ARB_gpu_shader5 = GL_TRUE;
+ if (glsl_feature_level >= 410)
+ extensions->ARB_shader_precision = GL_TRUE;
/* This extension needs full OpenGL 3.2, but we don't know if that's
* supported at this point. Only check the GLSL version. */
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index 72dbf3bd4..181465dd8 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -1942,11 +1942,6 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLenum target,
GLint internalFormat,
GLenum format, GLenum type)
{
- const boolean want_renderable =
- internalFormat == 3 || internalFormat == 4 ||
- internalFormat == GL_RGB || internalFormat == GL_RGBA ||
- internalFormat == GL_RGB8 || internalFormat == GL_RGBA8 ||
- internalFormat == GL_BGRA;
struct st_context *st = st_context(ctx);
enum pipe_format pFormat;
unsigned bindings;
@@ -1962,15 +1957,17 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLenum target,
}
/* GL textures may wind up being render targets, but we don't know
- * that in advance. Specify potential render target flags now.
+ * that in advance. Specify potential render target flags now for formats
+ * that we know should always be renderable.
*/
bindings = PIPE_BIND_SAMPLER_VIEW;
- if (want_renderable) {
- if (_mesa_is_depth_or_stencil_format(internalFormat))
- bindings |= PIPE_BIND_DEPTH_STENCIL;
- else
+ if (_mesa_is_depth_or_stencil_format(internalFormat))
+ bindings |= PIPE_BIND_DEPTH_STENCIL;
+ else if (internalFormat == 3 || internalFormat == 4 ||
+ internalFormat == GL_RGB || internalFormat == GL_RGBA ||
+ internalFormat == GL_RGB8 || internalFormat == GL_RGBA8 ||
+ internalFormat == GL_BGRA)
bindings |= PIPE_BIND_RENDER_TARGET;
- }
/* GLES allows the driver to choose any format which matches
* the format+type combo, because GLES only supports unsized internal
diff --git a/mesalib/src/mesa/swrast/s_texcombine.c b/mesalib/src/mesa/swrast/s_texcombine.c
index 0adb8e5ba..453bd3636 100644
--- a/mesalib/src/mesa/swrast/s_texcombine.c
+++ b/mesalib/src/mesa/swrast/s_texcombine.c
@@ -645,7 +645,7 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span )
/*
* Must do all texture sampling before combining in order to
- * accomodate GL_ARB_texture_env_crossbar.
+ * accommodate GL_ARB_texture_env_crossbar.
*/
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
diff --git a/mesalib/src/mesa/tnl/t_vertex.h b/mesalib/src/mesa/tnl/t_vertex.h
index 36d8a969e..a84b299e5 100644
--- a/mesalib/src/mesa/tnl/t_vertex.h
+++ b/mesalib/src/mesa/tnl/t_vertex.h
@@ -40,7 +40,7 @@ struct tnl_clipspace;
/* It will probably be necessary to allow drivers to specify new
- * emit-styles to cover all the wierd and wacky things out there.
+ * emit-styles to cover all the weird and wacky things out there.
*/
enum tnl_attr_format {
EMIT_1F,
diff --git a/mesalib/src/mesa/vbo/vbo_exec_api.c b/mesalib/src/mesa/vbo/vbo_exec_api.c
index 859078f12..48680ec88 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_api.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_api.c
@@ -685,7 +685,7 @@ static void GLAPIENTRY vbo_exec_Begin( GLenum mode )
return;
}
- /* Heuristic: attempt to isolate attributes occuring outside
+ /* Heuristic: attempt to isolate attributes occurring outside
* begin/end pairs.
*/
if (exec->vtx.vertex_size && !exec->vtx.attrsz[0])
diff --git a/mesalib/src/mesa/vbo/vbo_save_draw.c b/mesalib/src/mesa/vbo/vbo_save_draw.c
index 74e266d19..de744e0c7 100644
--- a/mesalib/src/mesa/vbo/vbo_save_draw.c
+++ b/mesalib/src/mesa/vbo/vbo_save_draw.c
@@ -278,7 +278,7 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data)
goto end;
}
else if (save->replay_flags) {
- /* Various degnerate cases: translate into immediate mode
+ /* Various degenerate cases: translate into immediate mode
* calls rather than trying to execute in place.
*/
vbo_save_loopback_vertex_list( ctx, node );