diff options
author | marha <marha@users.sourceforge.net> | 2011-08-31 10:31:32 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-08-31 10:31:32 +0200 |
commit | d14fe6598b87092374b1be6eb655153d270c3066 (patch) | |
tree | 77c5d19db06d8ca77ac717a5e579aa346f9cfb13 /mesalib/src/mesa | |
parent | 82ce0534a7bc89f1ed93b4b952b30ceb3d94210d (diff) | |
download | vcxsrv-d14fe6598b87092374b1be6eb655153d270c3066.tar.gz vcxsrv-d14fe6598b87092374b1be6eb655153d270c3066.tar.bz2 vcxsrv-d14fe6598b87092374b1be6eb655153d270c3066.zip |
mesa git update 31 aug 2011
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r-- | mesalib/src/mesa/Android.mk | 35 | ||||
-rw-r--r-- | mesalib/src/mesa/Makefile.mgw | 216 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/dri/Android.mk | 62 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/dri/Makefile.defines | 21 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/dri/common/Android.mk | 41 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/dri/common/Makefile.sources | 19 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/dri/swrast/Makefile | 1 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/windows/gdi/wgl.c | 23 | ||||
-rw-r--r-- | mesalib/src/mesa/main/state.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/uniforms.c | 137 | ||||
-rw-r--r-- | mesalib/src/mesa/program/prog_parameter.h | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/tnl/t_draw.c | 9 |
12 files changed, 251 insertions, 317 deletions
diff --git a/mesalib/src/mesa/Android.mk b/mesalib/src/mesa/Android.mk index 67808d491..f21ba3aa0 100644 --- a/mesalib/src/mesa/Android.mk +++ b/mesalib/src/mesa/Android.mk @@ -25,6 +25,12 @@ LOCAL_PATH := $(call my-dir) +# Import the following variables: +# MESA_CXX_SOURCES +# MESA_GALLIUM_CXX_SOURCES +# MESA_GALLIUM_SOURCES +# MESA_SOURCES +# X86_SOURCES include $(LOCAL_PATH)/sources.mak common_CFLAGS := \ @@ -83,6 +89,35 @@ include $(BUILD_STATIC_LIBRARY) endif # MESA_BUILD_GALLIUM # --------------------------------------- +# Build libmesa_dricore for DRI modules +# --------------------------------------- + +ifeq ($(strip $(MESA_BUILD_CLASSIC)),true) + +include $(CLEAR_VARS) + +LOCAL_MODULE := libmesa_dricore +LOCAL_MODULE_CLASS := STATIC_LIBRARIES + +LOCAL_CFLAGS := \ + $(common_CFLAGS) \ + -DFEATURE_GL=1 + +LOCAL_C_INCLUDES := \ + $(common_C_INCLUDES) + +LOCAL_SRC_FILES := \ + $(MESA_SOURCES) \ + $(MESA_CXX_SOURCES) \ + $(common_ASM) + +include $(LOCAL_PATH)/Android.gen.mk +include $(MESA_COMMON_MK) +include $(BUILD_STATIC_LIBRARY) + +endif # MESA_BUILD_CLASSIC + +# --------------------------------------- # Build libmesa_glsl_utils # # It is used to avoid circular dependency between core mesa and glsl. diff --git a/mesalib/src/mesa/Makefile.mgw b/mesalib/src/mesa/Makefile.mgw deleted file mode 100644 index 23ceaca01..000000000 --- a/mesalib/src/mesa/Makefile.mgw +++ /dev/null @@ -1,216 +0,0 @@ -# Mesa 3-D graphics library -# Version: 7.0 -# -# Copyright (C) 1999-2003 Brian Paul All Rights Reserved. -# -# 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 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 -# BRIAN PAUL 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. - -# MinGW core makefile v1.4 for Mesa -# -# Copyright (C) 2002 - Daniel Borca -# Email : dborca@users.sourceforge.net -# Web : http://www.geocities.com/dborca - -# MinGW core-gl makefile updated for Mesa 7.0 -# -# updated : by Heromyth, on 2007-7-21 -# Email : zxpmyth@yahoo.com.cn -# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work. -# The others havn't been tested yet. -# 2) The generated DLLs are *not* compatible with the ones built -# with the other compilers like VC8, especially for GLUT. -# 3) Although more tests are needed, it can be used individually! - - -# -# Available options: -# -# Environment variables: -# CFLAGS -# -# GLIDE path to Glide3 SDK; used with FX. -# default = $(TOP)/glide3 -# FX=1 build for 3dfx Glide3. Note that this disables -# compilation of most WMesa code and requires fxMesa. -# As a consequence, you'll need the Win32 Glide3 -# library to build any application. -# default = no -# X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow). -# default = no -# -# Targets: -# all: build GL -# clean: remove object files -# - - -.PHONY: all clean -.INTERMEDIATE: x86/gen_matypes.exe -.SUFFIXES: .rc .res - -# Set this to the prefix of your build tools, i.e. mingw32- -TOOLS_PREFIX = mingw32- - -LIB_NAME = opengl32 - -DLL_EXT = .dll -IMP_EXT = .a -LIB_PRE = lib -STRIP = -s - -AR = ar -ARFLAGS = crus -DLLTOOL = dlltool - -TOP = ../.. -GLIDE ?= $(TOP)/glide3 -LIBDIR = $(TOP)/lib - -GL_DLL = $(LIB_NAME)$(DLL_EXT) -GL_IMP = $(LIB_PRE)$(LIB_NAME)$(IMP_EXT) - -MESA_LIB = libmesa.a -CC = $(TOOLS_PREFIX)gcc - -LDLIBS = -lgdi32 -luser32 -liberty -LDFLAGS = $(STRIP) -shared -fPIC -Wl,--kill-at - -CFLAGS += -DBUILD_GL32 -D_DLL -DMESA_MINWARN -CFLAGS += -DNDEBUG -DUSE_EXTERNAL_DXTN_LIB=1 - -ifeq ($(FX),1) - CFLAGS += -I$(GLIDE)/include -DFX - LDLIBS += -L$(GLIDE)/lib -lglide3x - GL_DEF = drivers/windows/fx/fxopengl.def - GL_RES = drivers/windows/fx/fx.rc -else - GL_DEF = $(LIB_NAME).def -endif - - - -UNLINK = del $(subst /,\,$(1)) -ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) -UNLINK = $(RM) $(1) -endif -ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),) -UNLINK = $(RM) $(1) -endif - -include sources.mak - -CFLAGS += $(INCLUDE_DIRS) - -ifeq ($(X86),1) -CFLAGS += -DUSE_X86_ASM -CFLAGS += -DUSE_MMX_ASM -CFLAGS += -DUSE_SSE_ASM -CFLAGS += -DUSE_3DNOW_ASM -X86_SOURCES += $(X86_API) -else -X86_SOURCES = -endif - -ifeq ($(FX),1) -DRIVER_SOURCES = \ - $(GLIDE_DRIVER_SOURCES) \ - drivers/windows/fx/fxwgl.c -else -DRIVER_SOURCES = \ - drivers/windows/gdi/wmesa.c \ - drivers/windows/gdi/wgl.c -endif - -SOURCES = $(MESA_SOURCES) $(GLAPI_SOURCES) $(X86_SOURCES) $(DRIVER_SOURCES) - -OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) - -X86_OBJECTS = $(addsuffix .o,$(basename $(X86_SOURCES))) - -RESOURCE = $(GL_RES:.rc=.res) - -.c.o: - $(CC) -o $@ $(CFLAGS) -c $< -.s.o: - $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $< - -.rc.res: - windres -o $@ -Irc -Ocoff $< - - -all: $(LIBDIR) $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP) - -$(LIBDIR): - mkdir -p $(LIBDIR) - -$(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS) $(RESOURCE) - $(CC) $(LDFLAGS) -o $(LIBDIR)/$(GL_DLL) $^ $(LDLIBS) - $(DLLTOOL) --as=as --dllname $(LIB_NAME) --output-def $(LIBDIR)/$(GL_DEF) $^ - $(DLLTOOL) --as=as -k --dllname $(LIB_NAME) --output-lib $(LIBDIR)/$(GL_IMP) --def $(LIBDIR)/$(GL_DEF) - - -$(X86_OBJECTS): x86/matypes.h - -x86/matypes.h: x86/gen_matypes.exe - $(subst /,\,$< > $@) - -x86/gen_matypes.exe: x86/gen_matypes.c - $(CC) -o $@ $(CFLAGS) -s $< - -# [dBorca] -# glapi_x86.S needs some adjustments -# in order to generate correct entrypoints -# Trick: change the following condition to -# be always false if you need C entrypoints -# with USE_X86_ASM (useful for trace/debug) -ifeq (1,1) -x86/glapi_x86.o: x86/glapi_x86.S - $(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $< -else -glapi/glapi_dispatch.o: glapi/glapi_dispatch.c - $(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $< -glapi/glapi.o: glapi/glapi.c - $(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $< -endif - -# [dBorca] -# if we want codegen, we have to stdcall -tnl/t_vtx_x86_gcc.o: tnl/t_vtx_x86_gcc.S - $(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $< - -clean: - -$(call UNLINK,glapi/*.o) - -$(call UNLINK,main/*.o) - -$(call UNLINK,math/*.o) - -$(call UNLINK,vbo/*.o) - -$(call UNLINK,program/*.o) - -$(call UNLINK,slang/*.o) - -$(call UNLINK,sparc/*.o) - -$(call UNLINK,ppc/*.o) - -$(call UNLINK,swrast/*.o) - -$(call UNLINK,swrast_setup/*.o) - -$(call UNLINK,tnl/*.o) - -$(call UNLINK,x86/*.o) - -$(call UNLINK,x86/rtasm/*.o) - -$(call UNLINK,x86-64/*.o) - -$(call UNLINK,drivers/common/*.o) - -$(call UNLINK,drivers/glide/*.o) - -$(call UNLINK,drivers/windows/fx/*.o) - -$(call UNLINK,drivers/windows/fx/*.res) - -$(call UNLINK,drivers/windows/gdi/*.o) - -$(call UNLINK,drivers/windows/icd/*.o) diff --git a/mesalib/src/mesa/drivers/dri/Android.mk b/mesalib/src/mesa/drivers/dri/Android.mk new file mode 100644 index 000000000..b8ccd0c1b --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/Android.mk @@ -0,0 +1,62 @@ +# +# Copyright (C) 2011 Intel Corporation +# +# 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 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. +# + +LOCAL_PATH := $(call my-dir) + +# Import mesa_dri_common_INCLUDES. +include $(LOCAL_PATH)/common/Makefile.sources + +#----------------------------------------------- +# Variables common to all DRI drivers + +MESA_DRI_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/dri +MESA_DRI_MODULE_UNSTRIPPED_PATH := $(TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)/dri + +MESA_DRI_C_INCLUDES := \ + $(addprefix $(MESA_TOP)/, $(mesa_dri_common_INCLUDES)) \ + $(DRM_TOP) \ + $(DRM_TOP)/include/drm \ + external/expat/lib + +MESA_DRI_WHOLE_STATIC_LIBRARIES := \ + libmesa_glsl \ + libmesa_dri_common \ + libmesa_dricore + +MESA_DRI_SHARED_LIBRARIES := \ + libcutils \ + libdl \ + libdrm \ + libexpat \ + libglapi \ + liblog + +#----------------------------------------------- +# Build drivers and libmesa_dri_common + +SUBDIRS := common + +ifneq ($(filter i965, $(MESA_GPU_DRIVERS)),) + SUBDIRS += i965 +endif + +include $(foreach d, $(SUBDIRS), $(LOCAL_PATH)/$(d)/Android.mk) diff --git a/mesalib/src/mesa/drivers/dri/Makefile.defines b/mesalib/src/mesa/drivers/dri/Makefile.defines index 19b6de8b8..6ff8df5c0 100644 --- a/mesalib/src/mesa/drivers/dri/Makefile.defines +++ b/mesalib/src/mesa/drivers/dri/Makefile.defines @@ -1,15 +1,13 @@ # -*-makefile-*- +# Import mesa_dri_common_* +include ../common/Makefile.sources + COMMON_GALLIUM_SOURCES = \ - ../common/utils.c \ - ../common/vblank.c \ - ../common/dri_util.c \ - ../common/xmlconfig.c + $(addprefix ../common/, $(mesa_dri_common_gallium_SOURCES)) -COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \ - ../../common/driverfuncs.c \ - ../common/texmem.c \ - ../common/drirenderbuffer.c +COMMON_SOURCES = \ + $(addprefix ../common/, $(mesa_dri_common_SOURCES)) INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES) @@ -21,13 +19,8 @@ OBJECTS = $(C_SOURCES:.c=.o) \ ### Include directories SHARED_INCLUDES = \ -I. \ - -I$(TOP)/src/mesa/drivers/dri/common \ -Iserver \ - -I$(TOP)/include \ - -I$(TOP)/src/mapi \ - -I$(TOP)/src/mesa \ - -I$(TOP)/src/egl/main \ - -I$(TOP)/src/egl/drivers/dri \ + $(addprefix -I$(TOP)/, $(mesa_dri_common_INCLUDES)) \ $(LIBDRM_CFLAGS) INCLUDES += $(API_DEFINES) diff --git a/mesalib/src/mesa/drivers/dri/common/Android.mk b/mesalib/src/mesa/drivers/dri/common/Android.mk new file mode 100644 index 000000000..76464a153 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/Android.mk @@ -0,0 +1,41 @@ +# +# Mesa 3-D graphics library +# +# Copyright (C) 2011 Intel Corporation +# +# 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 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. +# + +# +# Build libmesa_dri_common +# + +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +include $(LOCAL_PATH)/Makefile.sources + +LOCAL_MODULE := libmesa_dri_common +LOCAL_MODULE_CLASS := STATIC_LIBRARIES + +LOCAL_C_INCLUDES := $(MESA_DRI_C_INCLUDES) +LOCAL_SRC_FILES := $(mesa_dri_common_SOURCES) + +include $(MESA_COMMON_MK) +include $(BUILD_STATIC_LIBRARY) diff --git a/mesalib/src/mesa/drivers/dri/common/Makefile.sources b/mesalib/src/mesa/drivers/dri/common/Makefile.sources new file mode 100644 index 000000000..3432dda45 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/Makefile.sources @@ -0,0 +1,19 @@ +mesa_dri_common_gallium_SOURCES := \ + utils.c \ + vblank.c \ + dri_util.c \ + xmlconfig.c + +mesa_dri_common_SOURCES := \ + $(mesa_dri_common_gallium_SOURCES) \ + texmem.c \ + drirenderbuffer.c + +# Paths are relative to MESA_TOP. +mesa_dri_common_INCLUDES := \ + include \ + src/egl/drivers/dri \ + src/egl/main \ + src/mapi \ + src/mesa \ + src/mesa/drivers/dri/common diff --git a/mesalib/src/mesa/drivers/dri/swrast/Makefile b/mesalib/src/mesa/drivers/dri/swrast/Makefile index 4cb99fd0e..509fa28b6 100644 --- a/mesalib/src/mesa/drivers/dri/swrast/Makefile +++ b/mesalib/src/mesa/drivers/dri/swrast/Makefile @@ -20,7 +20,6 @@ C_SOURCES = \ ASM_SOURCES = SWRAST_COMMON_SOURCES = \ - ../../common/driverfuncs.c \ ../common/utils.c \ ../common/drisw_util.c diff --git a/mesalib/src/mesa/drivers/windows/gdi/wgl.c b/mesalib/src/mesa/drivers/windows/gdi/wgl.c index bf4ca9c90..33baabee6 100644 --- a/mesalib/src/mesa/drivers/windows/gdi/wgl.c +++ b/mesalib/src/mesa/drivers/windows/gdi/wgl.c @@ -29,31 +29,8 @@ */ -/* We're essentially building part of GDI here, so define this so that - * we get the right export linkage. */ -#ifdef __MINGW32__ - -#include <stdarg.h> -#include <windef.h> -#include <wincon.h> -#include <winbase.h> - -# if defined(BUILD_GL32) -# define WINGDIAPI __declspec(dllexport) -# else -# define __W32API_USE_DLLIMPORT__ -# endif - -#include <wingdi.h> -#include "GL/mesa_wgl.h" -#include <stdlib.h> - -#else - -#define _GDI32_ #include <windows.h> -#endif #include "main/config.h" #include "glapi/glapi.h" #include "GL/wmesa.h" /* protos for wmesa* functions */ diff --git a/mesalib/src/mesa/main/state.c b/mesalib/src/mesa/main/state.c index 7ad50bcad..457a730de 100644 --- a/mesalib/src/mesa/main/state.c +++ b/mesalib/src/mesa/main/state.c @@ -631,7 +631,7 @@ _mesa_update_state_locked( struct gl_context *ctx ) if (new_state & (_NEW_BUFFERS | _NEW_VIEWPORT)) update_viewport_matrix(ctx); - if (new_state & _NEW_MULTISAMPLE) + if (new_state & (_NEW_MULTISAMPLE | _NEW_BUFFERS)) update_multisample( ctx ); if (new_state & _NEW_COLOR) diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c index cda840fe2..fe1ce6d7b 100644 --- a/mesalib/src/mesa/main/uniforms.c +++ b/mesalib/src/mesa/main/uniforms.c @@ -55,17 +55,24 @@ static GLenum base_uniform_type(GLenum type) { switch (type) { -#if 0 /* not needed, for now */ case GL_BOOL: case GL_BOOL_VEC2: case GL_BOOL_VEC3: case GL_BOOL_VEC4: return GL_BOOL; -#endif case GL_FLOAT: case GL_FLOAT_VEC2: case GL_FLOAT_VEC3: case GL_FLOAT_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: return GL_FLOAT; case GL_UNSIGNED_INT: case GL_UNSIGNED_INT_VEC2: @@ -408,8 +415,12 @@ get_uniform(struct gl_context *ctx, GLuint program, GLint location, else { const struct gl_program_parameter *p = &prog->Parameters->Parameters[paramPos]; + gl_constant_value (*values)[4]; GLint rows, cols, i, j, k; GLsizei numBytes; + GLenum storage_type; + + values = prog->Parameters->ParameterValues + paramPos + offset; get_uniform_rows_cols(p, &rows, &cols); @@ -421,62 +432,72 @@ get_uniform(struct gl_context *ctx, GLuint program, GLint location, return; } - switch (returnType) { - case GL_FLOAT: - { - GLfloat *params = (GLfloat *) paramsOut; - k = 0; - for (i = 0; i < rows; i++) { - const int base = paramPos + offset + i; - for (j = 0; j < cols; j++ ) { - params[k++] = prog->Parameters->ParameterValues[base][j].f; - } - } - } - break; - case GL_DOUBLE: - { - GLfloat *params = (GLfloat *) paramsOut; - k = 0; - for (i = 0; i < rows; i++) { - const int base = paramPos + offset + i; - for (j = 0; j < cols; j++ ) { - params[k++] = (GLdouble) - prog->Parameters->ParameterValues[base][j].f; - } - } - } - break; - case GL_INT: - { - GLint *params = (GLint *) paramsOut; - k = 0; - for (i = 0; i < rows; i++) { - const int base = paramPos + offset + i; - for (j = 0; j < cols; j++ ) { - params[k++] = ctx->Const.NativeIntegers ? - prog->Parameters->ParameterValues[base][j].i : - (GLint) prog->Parameters->ParameterValues[base][j].f; - } - } - } - break; - case GL_UNSIGNED_INT: - { - GLuint *params = (GLuint *) paramsOut; - k = 0; - for (i = 0; i < rows; i++) { - const int base = paramPos + offset + i; - for (j = 0; j < cols; j++ ) { - params[k++] = ctx->Const.NativeIntegers ? - prog->Parameters->ParameterValues[base][j].u : - (GLuint) prog->Parameters->ParameterValues[base][j].f; - } - } - } - break; - default: - _mesa_problem(ctx, "bad returnType in get_uniform()"); + if (ctx->Const.NativeIntegers) { + storage_type = base_uniform_type(p->DataType); + } else { + storage_type = GL_FLOAT; + } + + k = 0; + for (i = 0; i < rows; i++) { + for (j = 0; j < cols; j++ ) { + void *out = (char *)paramsOut + 4 * k; + + switch (returnType) { + case GL_FLOAT: + switch (storage_type) { + case GL_FLOAT: + *(float *)out = values[i][j].f; + break; + case GL_INT: + case GL_BOOL: /* boolean is just an integer 1 or 0. */ + *(float *)out = values[i][j].i; + break; + case GL_UNSIGNED_INT: + *(float *)out = values[i][j].u; + break; + } + break; + + case GL_INT: + case GL_UNSIGNED_INT: + switch (storage_type) { + case GL_FLOAT: + /* While the GL 3.2 core spec doesn't explicitly + * state how conversion of float uniforms to integer + * values works, in section 6.2 "State Tables" on + * page 267 it says: + * + * "Unless otherwise specified, when floating + * point state is returned as integer values or + * integer state is returned as floating-point + * values it is converted in the fashion + * described in section 6.1.2" + * + * That section, on page 248, says: + * + * "If GetIntegerv or GetInteger64v are called, + * a floating-point value is rounded to the + * nearest integer..." + */ + *(int *)out = IROUND(values[i][j].f); + break; + + case GL_INT: + case GL_UNSIGNED_INT: + case GL_BOOL: + /* type conversions for these to int/uint are just + * copying the data. + */ + *(int *)out = values[i][j].i; + break; + break; + } + break; + } + + k++; + } } } } diff --git a/mesalib/src/mesa/program/prog_parameter.h b/mesalib/src/mesa/program/prog_parameter.h index 1a5ed3439..4c2773a62 100644 --- a/mesalib/src/mesa/program/prog_parameter.h +++ b/mesalib/src/mesa/program/prog_parameter.h @@ -53,7 +53,7 @@ typedef union gl_constant_value { GLfloat f; - GLboolean b; + GLint b; GLint i; GLuint u; } gl_constant_value; diff --git a/mesalib/src/mesa/tnl/t_draw.c b/mesalib/src/mesa/tnl/t_draw.c index 86af4b7cf..03424d7a4 100644 --- a/mesalib/src/mesa/tnl/t_draw.c +++ b/mesalib/src/mesa/tnl/t_draw.c @@ -26,6 +26,7 @@ */ #include "main/glheader.h" +#include "main/bufferobj.h" #include "main/condrender.h" #include "main/context.h" #include "main/imports.h" @@ -339,14 +340,15 @@ static void bind_indices( struct gl_context *ctx, TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; GLuint i; - void *ptr; + const void *ptr; if (!ib) { VB->Elts = NULL; return; } - if (ib->obj->Name && !ib->obj->Pointer) { + if (_mesa_is_bufferobj(ib->obj) && !_mesa_bufferobj_mapped(ib->obj)) { + /* if the buffer object isn't mapped yet, map it now */ unsigned map_size; switch (ib->type) { @@ -370,7 +372,8 @@ static void bind_indices( struct gl_context *ctx, GL_MAP_READ_BIT, ib->obj); assert(ib->obj->Pointer); } else { - ptr = ib->ptr; + /* user-space elements, or buffer already mapped */ + ptr = ADD_POINTERS(ib->obj->Pointer, ib->ptr); } if (ib->type == GL_UNSIGNED_INT && VB->Primitive[0].basevertex == 0) { |