mesa.git
12 years agoi965: Use linker-assigned sampler IDs in instruction encoding.
Kenneth Graunke [Fri, 24 Aug 2012 08:22:58 +0000 (01:22 -0700)]
i965: Use linker-assigned sampler IDs in instruction encoding.

When assigning uniform locations, the linker assigns each sampler
uniform a sequential numerical ID.  gl_shader_program::SamplerUnits maps
these sampler variable IDs to the actual texture units they reference
(specified via glUniform1i).

Previously, we encoded this mapping in the SEND instruction encoding:
the "sampler" was the texture unit number, and the binding table index
was SURF_INDEX_TEXTURE(the texture unit number).  This unfortunately
meant that whenever the application changed the value of a sampler
uniform, we had to recompile the shader to change the SEND instructions.

This was horrible for the game Cogs, which repeatedly switches between
using texture unit 0 and 1.  It also made fragment shader precompiles
useless: we'd do the precompile at glLinkShader() time, before the
application called glUniform1i to set the sampler values.  As soon as
it did that, we'd have to recompile, wasting time and space in the
program cache.

This patch encodes the SamplerUnits indirection in the binding table,
sampler state, and sampler default color tables.  Instead of baking the
texture unit number into the shader, we bake in the sampler variable ID
assigned by the linker.  Since those never change, we don't need to
recompile programs on uniform changes.

This does mean that the tables now depend on the linked shader program
being used for rendering, rather than simply representing all available
texture units.  This could cause an increase in state emission.

Another plus is that the sampler state and sampler default color tables
are now compact: we only emit as many entries as there are sampler
uniforms, with no holes in the table since the new sampler IDs are
sequential.  Previously we had to emit a full 16 entries every time,
since the tables tracked the state of all active texture units.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Add a "sampler state index" parameter to update_sampler_state().
Kenneth Graunke [Fri, 24 Aug 2012 08:12:53 +0000 (01:12 -0700)]
i965: Add a "sampler state index" parameter to update_sampler_state().

This represents the index into the sampler state table or sampler
default color table (the two are identical).

Right now, this is still the texture unit, but that will change shortly.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Un-hardcode WM binding table from update_texture_surface.
Kenneth Graunke [Tue, 14 Aug 2012 22:45:52 +0000 (15:45 -0700)]
i965: Un-hardcode WM binding table from update_texture_surface.

Currently, we mirror the VS and WM binding tables' texture entries.
That may not continue to be true, so in preparation, pass in the binding
table and surface index as arguments.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965/vs: Rename "sampler" to "texunit" in texturing code.
Kenneth Graunke [Tue, 21 Aug 2012 19:16:46 +0000 (12:16 -0700)]
i965/vs: Rename "sampler" to "texunit" in texturing code.

The number we're passing around is actually the ID of the texture unit,
as opposed to the numerical value our of sampler uniforms.  Calling it
"texunit" clarifies this slightly.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965/fs: Rename "sampler" to "texunit" in texturing code.
Kenneth Graunke [Tue, 21 Aug 2012 18:41:07 +0000 (11:41 -0700)]
i965/fs: Rename "sampler" to "texunit" in texturing code.

The number we're passing around is actually the ID of the texture unit,
as opposed to the numerical value our of sampler uniforms.  Calling it
"texunit" clarifies this slightly.

Don't bother renaming fs_instruction::sampler.  Although it's currently
the texture unit, this series will change that.  No need for the churn.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965/fs: Remove unused 'sampler' parameter in emit_texture_genX().
Kenneth Graunke [Tue, 21 Aug 2012 18:45:09 +0000 (11:45 -0700)]
i965/fs: Remove unused 'sampler' parameter in emit_texture_genX().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Set SWIZZLE_NOOP for unused texture units in the program keys.
Kenneth Graunke [Tue, 14 Aug 2012 18:05:55 +0000 (11:05 -0700)]
i965: Set SWIZZLE_NOOP for unused texture units in the program keys.

Previously, we left the swizzle key field as zero for unused texture
units.  The precompile sets all of them to SWIZZLE_NOOP, which meant
that we mismatched almost every time.

Since either works equally well, change it to SWIZZLE_NOOP to match
the precompiles.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Remove four and a half year old TODO comments about samplers.
Kenneth Graunke [Wed, 22 Aug 2012 06:25:50 +0000 (23:25 -0700)]
i965: Remove four and a half year old TODO comments about samplers.

I can't actually understand what these mean, and they seem to
essentially say "we should simplify things", which is a nice goal but
not very specific.

Presumably things got cleaned up at some point.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Fix brw_link_shader to return false rather than NULL.
Kenneth Graunke [Tue, 21 Aug 2012 18:39:49 +0000 (11:39 -0700)]
i965: Fix brw_link_shader to return false rather than NULL.

Fixes brw_shader.cpp:101:9: warning: converting to non-pointer type
'GLboolean {aka unsigned char}' from NULL [-Wconversion-null]

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-with-great-enthusiasm-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by Eric Anholt <eric@anholt.net>

12 years agomesa/es: Validate glGetBufferParameteriv pname in Mesa code rather than the ES wrapper
Ian Romanick [Fri, 27 Jul 2012 14:16:41 +0000 (07:16 -0700)]
mesa/es: Validate glGetBufferParameteriv pname in Mesa code rather than the ES wrapper

v2: Add proper core-profile and GLES3 filtering.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agomesa/es: Validate glMapBuffer access in Mesa code rather than the ES wrapper
Ian Romanick [Wed, 25 Jul 2012 23:17:25 +0000 (16:17 -0700)]
mesa/es: Validate glMapBuffer access in Mesa code rather than the ES wrapper

v2: Add proper core-profile and GLES3 filtering.

v3: *Really* add proper core-profile and GLES3 filtering based on review
feedback from Eric Anholt.  It looks like previously there was some
rebase / merge fail.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agomesa/es: Validate glBufferData usage in Mesa code rather than the ES wrapper
Ian Romanick [Wed, 25 Jul 2012 23:08:12 +0000 (16:08 -0700)]
mesa/es: Validate glBufferData usage in Mesa code rather than the ES wrapper

v2: Add proper core-profile and GLES3 filtering based on review feedback
from Eric Anholt.  It looks like previously there was some rebase /
merge fail.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agomesa/es: Validate buffer object targets in Mesa code rather than the ES wrapper
Ian Romanick [Wed, 25 Jul 2012 22:29:48 +0000 (15:29 -0700)]
mesa/es: Validate buffer object targets in Mesa code rather than the ES wrapper

v2: Add proper core-profile and GLES3 filtering.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agomesa/es: Validate VertexPointer types in Mesa code rather than the ES wrapper
Ian Romanick [Wed, 25 Jul 2012 22:19:31 +0000 (15:19 -0700)]
mesa/es: Validate VertexPointer types in Mesa code rather than the ES wrapper

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa/es: Remove redundant vertex pointer size validation
Ian Romanick [Wed, 25 Jul 2012 22:15:11 +0000 (15:15 -0700)]
mesa/es: Remove redundant vertex pointer size validation

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa/es: Validate TexCoordPointer size in Mesa code rather than the ES wrapper
Ian Romanick [Wed, 25 Jul 2012 22:13:51 +0000 (15:13 -0700)]
mesa/es: Validate TexCoordPointer size in Mesa code rather than the ES wrapper

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa/es: Validate TexCoordPointer types in Mesa code rather than the ES wrapper
Ian Romanick [Wed, 25 Jul 2012 22:13:00 +0000 (15:13 -0700)]
mesa/es: Validate TexCoordPointer types in Mesa code rather than the ES wrapper

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa/es: Validate NormalPointer types in Mesa code rather than the ES wrapper
Ian Romanick [Wed, 25 Jul 2012 22:10:21 +0000 (15:10 -0700)]
mesa/es: Validate NormalPointer types in Mesa code rather than the ES wrapper

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa/es: Validate ColorPointer size in Mesa code rather than the ES wrapper
Ian Romanick [Wed, 25 Jul 2012 21:58:36 +0000 (14:58 -0700)]
mesa/es: Validate ColorPointer size in Mesa code rather than the ES wrapper

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa/es: Validate ColorPointer types in Mesa code rather than the ES wrapper
Ian Romanick [Wed, 25 Jul 2012 21:53:01 +0000 (14:53 -0700)]
mesa/es: Validate ColorPointer types in Mesa code rather than the ES wrapper

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa/es: Remove redundant vertex attrib pointer type validation
Ian Romanick [Wed, 25 Jul 2012 21:48:17 +0000 (14:48 -0700)]
mesa/es: Remove redundant vertex attrib pointer type validation

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa/es: Remove redundant vertex attrib pointer size validation
Ian Romanick [Wed, 25 Jul 2012 21:34:53 +0000 (14:34 -0700)]
mesa/es: Remove redundant vertex attrib pointer size validation

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa/es: Disallow BGRA vertex arrays in ES or ES2 contexts
Ian Romanick [Wed, 25 Jul 2012 21:46:54 +0000 (14:46 -0700)]
mesa/es: Disallow BGRA vertex arrays in ES or ES2 contexts

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa: Rearrange array type checking, filter more types in ES
Ian Romanick [Wed, 25 Jul 2012 21:40:18 +0000 (14:40 -0700)]
mesa: Rearrange array type checking, filter more types in ES

v2: Fix handling of GL_INT and GL_UNSIGNED_INT types pre-ES3.0, and fix
handling of GL_INT_2_10_10_10_REV and GL_UNSIGNED_INT_2_10_10_10_REV in
ES3.0.  Based on review comments by Ken Graunke.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agomesa: Refactor element type checking into its own function
Ian Romanick [Wed, 25 Jul 2012 14:24:58 +0000 (07:24 -0700)]
mesa: Refactor element type checking into its own function

This consolidates the tests and makes the emitted error message
consistent.

v2: Rename _mesa_valid_element_type to valid_elements_type.  Log the
enum string instead of the hex value in error messages.  Based on review
comments from Brian Paul and Ken Graunke.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agowgl: update some comments
Brian Paul [Fri, 24 Aug 2012 17:45:05 +0000 (11:45 -0600)]
wgl: update some comments

12 years agost/mesa: don't do (generic) compression of 1D or 1D_ARRAY textures
Brian Paul [Fri, 24 Aug 2012 14:44:47 +0000 (08:44 -0600)]
st/mesa: don't do (generic) compression of 1D or 1D_ARRAY textures

As with the previous commit for core Mesa.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
12 years agomesa: add generic compressed -> uncompressed format helper
Brian Paul [Fri, 24 Aug 2012 14:43:42 +0000 (08:43 -0600)]
mesa: add generic compressed -> uncompressed format helper

_mesa_generic_compressed_format_to_uncompressed_format() probably wins the
prize for longest function name in Mesa.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
12 years agomesa: don't try (generic) compression of 1D and 1D_ARRAY textures
Brian Paul [Fri, 24 Aug 2012 14:38:46 +0000 (08:38 -0600)]
mesa: don't try (generic) compression of 1D and 1D_ARRAY textures

See comments in the code for details.

Note: we only need to special-case the generic compressed formats since
specific texture formats are error-checked earlier to see if the compression
format is compatible with the texture type.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
12 years agomesa: add texture target field to ChooseTextureFormat() driver hook
Brian Paul [Fri, 24 Aug 2012 14:31:37 +0000 (08:31 -0600)]
mesa: add texture target field to ChooseTextureFormat() driver hook

This will let us choose the actual hardware format depending on the
type of texture.

v2: fixup radeon, nouveau, intel and swrast drivers too

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoxlib: remove texture compression hackery
Brian Paul [Fri, 24 Aug 2012 14:37:40 +0000 (08:37 -0600)]
xlib: remove texture compression hackery

I think this was left-over debug code from long ago.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agost/mesa: clean up use of 'target' variable in st_context_teximage()
Brian Paul [Fri, 24 Aug 2012 13:20:58 +0000 (07:20 -0600)]
st/mesa: clean up use of 'target' variable in st_context_teximage()

'target' was used both as a parameter of type st_texture_type and then
re-used for GL_TEXTURE_x targets.  Rename the function parameter and
add a new local 'GLenum target'.

And remove an extraneous break statement.

12 years agoautomake: convert vgapi
Matt Turner [Wed, 22 Aug 2012 23:57:38 +0000 (16:57 -0700)]
automake: convert vgapi

12 years agobuild: Check for bison-generated file before bailing because of no bison
Matt Turner [Wed, 22 Aug 2012 22:08:01 +0000 (15:08 -0700)]
build: Check for bison-generated file before bailing because of no bison

.y/.c was a typo.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoMove _mesa_dl* functions into dlopen.h and inline them
Matt Turner [Wed, 22 Aug 2012 19:45:48 +0000 (12:45 -0700)]
Move _mesa_dl* functions into dlopen.h and inline them

No point in having an extra function call for inlinable functions.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
12 years agomesa/dlopen: use HAVE_DLOPEN instead of _GNU_SOURCE
Tapani Pälli [Thu, 16 Aug 2012 10:59:12 +0000 (13:59 +0300)]
mesa/dlopen: use HAVE_DLOPEN instead of _GNU_SOURCE

Patches changes mesa to use 'HAVE_DLOPEN' defined by configure and Android.mk
instead of _GNU_SOURCE for detecting dlopen capability. This makes dlopen to
work also on Android where _GNU_SOURCE is not defined.

[mattst88] v2: HAVE_DLOPEN is sufficient for including dlfcn.h, remove
       mingw/blrts checks around dlfcn.h inclusion.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
12 years agobuild: Only add links to .so files if we're building them
Matt Turner [Wed, 22 Aug 2012 18:51:31 +0000 (11:51 -0700)]
build: Only add links to .so files if we're building them

Xlib-GLX and OSMesa support static building.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=53962
12 years agobuild: Add libOSMesa.so.$(VERSION) link to libdir
Matt Turner [Wed, 22 Aug 2012 18:47:28 +0000 (11:47 -0700)]
build: Add libOSMesa.so.$(VERSION) link to libdir

12 years agobuild: Replace OSMESA_VERSION with generic VERSION_NUMBER
Matt Turner [Wed, 22 Aug 2012 18:43:05 +0000 (11:43 -0700)]
build: Replace OSMESA_VERSION with generic VERSION_NUMBER

Can be used by other modules.

12 years agobuild: Order AC_CONFIG_FILES list
Matt Turner [Wed, 22 Aug 2012 17:01:42 +0000 (10:01 -0700)]
build: Order AC_CONFIG_FILES list

Makefiles before .pc files before directories. Alphabetize files of the
same type.

12 years agobuild: Only build libmesa.la when needed
Matt Turner [Wed, 22 Aug 2012 05:26:52 +0000 (22:26 -0700)]
build: Only build libmesa.la when needed

Namely, for Xlib-GLX, OSMesa, or test programs.

12 years agobuild: Remove duplicate DRI automake conditionals
Matt Turner [Wed, 22 Aug 2012 05:06:17 +0000 (22:06 -0700)]
build: Remove duplicate DRI automake conditionals

12 years agobuild: Remove GLU_DIRS
Matt Turner [Mon, 20 Aug 2012 21:04:40 +0000 (14:04 -0700)]
build: Remove GLU_DIRS

12 years agobuild: Only generate dispatch assembly code that will be built
Matt Turner [Tue, 21 Aug 2012 22:09:14 +0000 (15:09 -0700)]
build: Only generate dispatch assembly code that will be built

12 years agoi965: don't clear resolve map when doing fast depth clears.
Paul Berry [Wed, 22 Aug 2012 15:02:39 +0000 (08:02 -0700)]
i965: don't clear resolve map when doing fast depth clears.

Previously, when performing a fast depth clear, we would also clear
the miptree's resolve map.  This destroyed important information,
since the resolve map contains information about needed resolves for
all levels and layers of the miptree, whereas a depth clear only
applies to a single level/layer combination at a time.  As a result,
resolves would sometimes fail to occur, leading to incorrect
rendering.

Fixes rendering artifacts with shadow maps in Unigine Heaven and
Unigine Sanctuary.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50270

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
12 years agoi965/HiZ: remove assertion from intel_resolve_map_set().
Paul Berry [Wed, 22 Aug 2012 15:01:58 +0000 (08:01 -0700)]
i965/HiZ: remove assertion from intel_resolve_map_set().

There are three possible resolve map states for each (level, layer) of
a depth miptree: "needs HiZ resolve", "needs depth resolve", and
"needs neither".  When HiZ was first implemented on i965, any attempt
to directly transition between "needs HiZ resolve" and "needs depth
resolve" without passing through the "needs neither" state would have
been a bug indicating that a necessary resolve hadn't been performed.
Accordingly, intel_resolve_map_set() contained an assertion to verify
that no such direct transition happened.

However, now that we support fast depth clears, there is a valid
transition from the "needs HiZ resolve" to the "needs depth resolve"
state.  When doing a fast depth clear, the old state of the buffer is
irrelevant, since we are completely replacing it with the clear value,
so it is not necessary to do any resolves before clearing--we can
transition, if necessary, directly from the "needs HiZ resolve" state
to the "needs depth resolve" state.

To avoid spurious assertions in this valid case, this patch just
removes the assertion.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
12 years agoradeonsi: remove old tilling handling
Christian König [Thu, 23 Aug 2012 15:59:51 +0000 (17:59 +0200)]
radeonsi: remove old tilling handling

Just use the functionality provided by the surface manager instead.

This fixes just another bunch of piglit tests.

Signed-off-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
12 years agomesa/es: Validate glCreateShader targets in Mesa code rather than the ES wrapper
Ian Romanick [Wed, 25 Jul 2012 03:17:18 +0000 (20:17 -0700)]
mesa/es: Validate glCreateShader targets in Mesa code rather than the ES wrapper

v2: Add proper core-profile filtering.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa/es: Validate glGetProgramiv pnames in Mesa code rather than the ES wrapper
Ian Romanick [Wed, 25 Jul 2012 03:13:39 +0000 (20:13 -0700)]
mesa/es: Validate glGetProgramiv pnames in Mesa code rather than the ES wrapper

v2: Add proper core-profile and GLES3 filtering.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Filter glGetProgramiv pnames based on available extensions
Ian Romanick [Wed, 25 Jul 2012 03:06:25 +0000 (20:06 -0700)]
mesa: Filter glGetProgramiv pnames based on available extensions

Previously you could always glGetProgramiv one of the transform feedback
or geometry shader enums even if the extension wasn't supported.

In addtion, this reverts part of bda6ad27.  I think the hunks involving
GL_PROGRAM_BINARY_LENGTH_OES were spurious.  Mesa has no support for any
other part of GL_OES_get_program_binary.

v2: Remove redundant return in get_programiv based on review feedback
from Matt Turner.

v3: Correctly handle UBO related enums.

v4: Emit the bad enum in the _mesa_error call based on review feedback
from Brian Paul.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoswrast: implement cubical depth texture sampling
Brian Paul [Fri, 24 Aug 2012 03:26:32 +0000 (21:26 -0600)]
swrast: implement cubical depth texture sampling

Fixes a few more failures in the piglit copyteximage test.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoclover: Accept CL_MEM_READ_WRITE flag
Blaž Tomažič [Thu, 23 Aug 2012 10:15:15 +0000 (12:15 +0200)]
clover: Accept CL_MEM_READ_WRITE flag

Fix API functions for memory objects to accept CL_MEM_READ_WRITE flag.

Signed-off-by: Blaž Tomažič <blaz.tomazic@gmail.com>
[ Francisco Jerez: Drop incorrect change in clCreateSubBuffer. ]

12 years agoradeon/llvm: Cleanup R600Instructions.td
Tom Stellard [Fri, 24 Aug 2012 13:58:11 +0000 (13:58 +0000)]
radeon/llvm: Cleanup R600Instructions.td

12 years agomain: fix ES compile breakage
Brian Paul [Fri, 24 Aug 2012 12:40:06 +0000 (06:40 -0600)]
main: fix ES compile breakage

12 years agomesa/swrast: fix GL_TEXTURE_2D_ARRAY texture fetches for dxt formats
Brian Paul [Thu, 23 Aug 2012 03:23:53 +0000 (21:23 -0600)]
mesa/swrast: fix GL_TEXTURE_2D_ARRAY texture fetches for dxt formats

As with the previous commit.

This fixes the last crash in the piglit copyteximage test but there's
still some failures.

12 years agomesa/swrast: fix GL_TEXTURE_2D_ARRAY texture fetches for latc/rgtc formats
Brian Paul [Thu, 23 Aug 2012 03:22:00 +0000 (21:22 -0600)]
mesa/swrast: fix GL_TEXTURE_2D_ARRAY texture fetches for latc/rgtc formats

Fix-up the texel fetch functions so that they handle 3D coords (as used for
array textures) and remove the "f_2d" part from their names.

Helps fix swrast crashes in piglit's copyteximage test.  More to come.

12 years agomesa: code movement in teximage.c
Brian Paul [Wed, 22 Aug 2012 02:22:27 +0000 (20:22 -0600)]
mesa: code movement in teximage.c

To get rid of a forward declaration.

12 years agomesa: consolidate glTexImage and glCompressedTexImage code
Brian Paul [Wed, 22 Aug 2012 02:22:27 +0000 (20:22 -0600)]
mesa: consolidate glTexImage and glCompressedTexImage code

There was a lot of similar or duplicated code before.
To minimize this patch's size, use a forward declaration for
compressed_texture_error_check().  Move the function in the next patch.

12 years agomesa: make glTexImage, glCompressedTexImage proxy code more alike
Brian Paul [Wed, 22 Aug 2012 02:22:27 +0000 (20:22 -0600)]
mesa: make glTexImage, glCompressedTexImage proxy code more alike

Next up, we can combine the teximage() and compressed_teximage() functions.

12 years agomesa: rename texpal.[ch] to texcompress_cpal.[ch]
Brian Paul [Wed, 22 Aug 2012 02:22:27 +0000 (20:22 -0600)]
mesa: rename texpal.[ch] to texcompress_cpal.[ch]

To be consistent with other files related to texture compression.

12 years agomesa: s/GLuint/gl_format/ in _mesa_compressed_format_to_glenum()
Brian Paul [Wed, 22 Aug 2012 02:22:27 +0000 (20:22 -0600)]
mesa: s/GLuint/gl_format/ in _mesa_compressed_format_to_glenum()

No real change here, just use the right type.

12 years agomesa: new _mesa_num_tex_faces() helper
Brian Paul [Wed, 22 Aug 2012 02:22:27 +0000 (20:22 -0600)]
mesa: new _mesa_num_tex_faces() helper

Not a real big help now, but will be useful for the
GL_ARB_texture_cube_map_array extension in the future.

12 years agomesa: make _mesa_get_proxy_tex_image() static
Brian Paul [Wed, 22 Aug 2012 02:22:27 +0000 (20:22 -0600)]
mesa: make _mesa_get_proxy_tex_image() static

It's not used by any other file.

12 years agomesa: don't clear proxy image fields when regular GL error is generated
Brian Paul [Wed, 22 Aug 2012 02:22:27 +0000 (20:22 -0600)]
mesa: don't clear proxy image fields when regular GL error is generated

If a proxy texture call generates a regular GL error, we should not
clear the proxy image's width/height/depth/format fields.  Use a new
PROXY_ERROR token to distinguish proxy errors from regular GL errors.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
12 years agomesa: fix glTexImage proxy texture error generation
Brian Paul [Wed, 22 Aug 2012 02:22:27 +0000 (20:22 -0600)]
mesa: fix glTexImage proxy texture error generation

When calling glTexImage() with a proxy target most error conditions should
generate a GL error.  We were erroneously doing the proxy-error behaviour
(where we zeroed-out the image's width/height/depth/format fields) in too
many places.

There's another issue with proxy textures, but that'll be fixed in the
next patch.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
12 years agodraw: Fix regression in draw_set_sampler(_views).
José Fonseca [Fri, 24 Aug 2012 10:27:22 +0000 (11:27 +0100)]
draw: Fix regression in draw_set_sampler(_views).

draw->samplers(_views) now has PIPE_SHADER_TYPES elements, instead of
PIPE_MAX_SAMPLERS as before.

Also, shader_stage must be less than PIPE_SHADER_TYPES to prevent buffer
overflow.

Trivial.

12 years agobuild: don't leave git_sha1.h.tmp after build/install
Vadim Girlin [Fri, 24 Aug 2012 07:16:14 +0000 (11:16 +0400)]
build: don't leave git_sha1.h.tmp after build/install

Fixes "`main/git_sha1.h.tmp': Permission denied" build error.
See https://bugs.freedesktop.org/show_bug.cgi?id=52064

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoradeon/llvm: Set End of Program bit on RAT instructions
Tom Stellard [Thu, 23 Aug 2012 21:51:48 +0000 (21:51 +0000)]
radeon/llvm: Set End of Program bit on RAT instructions

This code was accidently dropped during the MCCodeEmitter conversion.

12 years agoradeon/llvm: Use correct instruction for moving immediates
Tom Stellard [Thu, 23 Aug 2012 21:22:48 +0000 (21:22 +0000)]
radeon/llvm: Use correct instruction for moving immediates

This should fix an assertion failure that was happening in some compute
shaders.

12 years agoradeon/llvm: Fix some coding style issues
Tom Stellard [Thu, 23 Aug 2012 21:00:13 +0000 (21:00 +0000)]
radeon/llvm: Fix some coding style issues

12 years agoradeon/llvm: Pull changes from external version of the backend
Tom Stellard [Thu, 23 Aug 2012 19:28:50 +0000 (19:28 +0000)]
radeon/llvm: Pull changes from external version of the backend

12 years agoradeon/llvm: Simplify the convert to ISA pass
Tom Stellard [Thu, 23 Aug 2012 19:27:48 +0000 (19:27 +0000)]
radeon/llvm: Simplify the convert to ISA pass

12 years agoradeon/llvm: Make sure to use the Text section in the AsmPrinter
Tom Stellard [Thu, 23 Aug 2012 19:15:39 +0000 (19:15 +0000)]
radeon/llvm: Make sure to use the Text section in the AsmPrinter

12 years agobuild: Fix installation of GLES2 headers
Matt Turner [Thu, 23 Aug 2012 20:29:48 +0000 (13:29 -0700)]
build: Fix installation of GLES2 headers

Reported-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Tested-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
12 years agobuild: Fix GLES linkage with libglapi
Matt Turner [Thu, 23 Aug 2012 20:48:36 +0000 (13:48 -0700)]
build: Fix GLES linkage with libglapi

Reported-by: Ian Romanick <idr@freedesktop.org>
12 years agoi965/msaa: Add sample-alpha-to-coverage support for multiple render targets
Anuj Phogat [Wed, 1 Aug 2012 23:32:06 +0000 (16:32 -0700)]
i965/msaa: Add sample-alpha-to-coverage support for multiple render targets

Render Target Write message should include source zero alpha value when
sample-alpha-to-coverage is enabled for an FBO with  multiple render targets.
Source zero alpha value is used as fragment coverage for all the render
targets.

This patch makes piglit tests draw-buffers-alpha-to-coverage and
alpha-to-coverage-no-draw-buffer-zero to pass on Sandybridge. No
regressions are observed with piglit all.tests.

V2: Revert all the changes made in emit_color_write() function to
include src0 alpha for targets > 0. Now handling this case in a if
block.

V3: Correctly calculate the instruction length for buffer zero.
Properly handle the case of dual_src_blend when alpha-to-coverage
is enabled.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agoglsl/linker: Avoid buffer over-run in parcel_out_uniform_storage::visit_field
Stéphane Marchesin [Wed, 15 Aug 2012 00:15:54 +0000 (17:15 -0700)]
glsl/linker: Avoid buffer over-run in parcel_out_uniform_storage::visit_field

When too may uniforms are used, the error will be caught in
check_resources (src/glsl/linker.cpp).

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Benoit Jacob <bjacob@mozilla.com>
12 years agomesa/es: Validate glCompressedTexSubImage internalFormat in Mesa code rather than...
Ian Romanick [Fri, 27 Jul 2012 14:13:03 +0000 (07:13 -0700)]
mesa/es: Validate glCompressedTexSubImage internalFormat in Mesa code rather than the ES wrapper

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
12 years agomesa/es: Validate glCompressedTexImage internalFormat in Mesa code rather than the...
Ian Romanick [Fri, 27 Jul 2012 14:09:30 +0000 (07:09 -0700)]
mesa/es: Validate glCompressedTexImage internalFormat in Mesa code rather than the ES wrapper

v2: Add proper core-profile filtering.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
12 years agomesa/es: Validate glCopyTexImage internalFormat in Mesa code rather than the ES wrapper
Ian Romanick [Fri, 27 Jul 2012 13:45:54 +0000 (06:45 -0700)]
mesa/es: Validate glCopyTexImage internalFormat in Mesa code rather than the ES wrapper

v2: Add GLES3 filtering.  I'm not 100% sure this is correct.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
12 years agomesa/es: Validate glTexSubImage format and type in Mesa code rather than the ES wrapper
Ian Romanick [Fri, 27 Jul 2012 13:40:26 +0000 (06:40 -0700)]
mesa/es: Validate glTexSubImage format and type in Mesa code rather than the ES wrapper

v2: Add proper GLES3 filtering.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
12 years agomesa/es: Validate glTexImage format, type, and internalFormat in Mesa code rather...
Ian Romanick [Fri, 27 Jul 2012 02:18:58 +0000 (19:18 -0700)]
mesa/es: Validate glTexImage format, type, and internalFormat in Mesa code rather than the ES wrapper

v2: Add proper GLES3 filtering.

v3: Collapse ALPHA, LUMINANCE, and LUMINANCE_ALPHA cases per review
comment from Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
12 years agomesa/es: Validate glTexImage border in Mesa code rather than the ES wrapper
Ian Romanick [Fri, 27 Jul 2012 01:46:23 +0000 (18:46 -0700)]
mesa/es: Validate glTexImage border in Mesa code rather than the ES wrapper

Also validate glCopyTexImage border.  This fixes a bug in the APIspec.
Previously glTexImage3DOES could be passed a non-zero border without error.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
12 years agomesa: Generate an error when glCopyTexImage border is invalid
Ian Romanick [Fri, 27 Jul 2012 01:43:26 +0000 (18:43 -0700)]
mesa: Generate an error when glCopyTexImage border is invalid

NOTE: This is a candidate for stable release branches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
12 years agomesa/es: Add support for GL_APPLE_texture_max_level
Ian Romanick [Wed, 15 Aug 2012 16:57:50 +0000 (09:57 -0700)]
mesa/es: Add support for GL_APPLE_texture_max_level

This is desktop OpenGL functionality that has always existed.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
12 years agomesa/es: Validate glGetTexParameter pnames in Mesa code rather than the ES wrapper
Ian Romanick [Fri, 27 Jul 2012 01:15:40 +0000 (18:15 -0700)]
mesa/es: Validate glGetTexParameter pnames in Mesa code rather than the ES wrapper

This also adds a missing extension (and API) check around
GL_TEXTURE_CROP_RECT_OES.

v2: Add proper core-profile and GLES3 filtering.  GL_TEXTURE_MAX_LEVEL
is (incorrectly) accepted in ES contexts.  A future patch will add
GL_APPLE_texture_max_level, and meta really needs this.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
12 years agomesa/es: Validate glTexParameter pnames in Mesa code rather than the ES wrapper
Ian Romanick [Fri, 27 Jul 2012 01:04:50 +0000 (18:04 -0700)]
mesa/es: Validate glTexParameter pnames in Mesa code rather than the ES wrapper

This also adds a missing extension (and API) check around
GL_TEXTURE_CROP_RECT_OES.

v2: Add proper core-profile, GLES1, and GLES3 filtering.  GL_TEXTURE_MAX_LEVEL
is (incorrectly) accepted in ES contexts.  A future patch will add
GL_APPLE_texture_max_level, and meta really needs this.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
12 years agomesa/es: Remove redundant glBindTexture target validation
Ian Romanick [Fri, 27 Jul 2012 00:49:55 +0000 (17:49 -0700)]
mesa/es: Remove redundant glBindTexture target validation

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
12 years agomesa: Filter glBindTexture targets based on supported features.
Ian Romanick [Fri, 27 Jul 2012 00:41:43 +0000 (17:41 -0700)]
mesa: Filter glBindTexture targets based on supported features.

Fixed the piglit test arb_texture_buffer_object-negative-unsupported.

NOTE: This is a candidate for stable release branches.

v2: Add proper core-profile and GLES3 filtering.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
12 years agomesa/es: Validate tex image targets in Mesa code rather than the ES wrapper
Ian Romanick [Thu, 26 Jul 2012 17:39:45 +0000 (10:39 -0700)]
mesa/es: Validate tex image targets in Mesa code rather than the ES wrapper

This should take care of all the TexImage, TexSubImage, CopyTexImage,
CompressedTexImage3DOES, and CopyTexSubImage type paths.

v2: Add proper core-profile and GLES3 filtering.

v3: Squash the CompressedTexImage3DOES patch per review comment from
Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
12 years agomesa/es: Validate EGLImageTargetTexture2DOES target in Mesa code rather than the...
Ian Romanick [Wed, 25 Jul 2012 23:13:33 +0000 (16:13 -0700)]
mesa/es: Validate EGLImageTargetTexture2DOES target in Mesa code rather than the ES wrapper

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
12 years agomesa/es: Validate glTexParameter targets in Mesa code rather than the ES wrapper
Ian Romanick [Wed, 25 Jul 2012 23:03:44 +0000 (16:03 -0700)]
mesa/es: Validate glTexParameter targets in Mesa code rather than the ES wrapper

Ditto for glGetTexParameter targets.

v2: Add proper core-profile and GLES3 filtering.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
12 years agomesa/es: Validate GL_TEXTURE_WRAP param in Mesa code rather than the ES wrapper
Ian Romanick [Mon, 3 Oct 2011 20:03:47 +0000 (13:03 -0700)]
mesa/es: Validate GL_TEXTURE_WRAP param in Mesa code rather than the ES wrapper

v2: Add proper core-profile filtering.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
12 years agomesa: Refactor validate_texture_wrap_mode to use a switch-statement
Ian Romanick [Mon, 3 Oct 2011 19:46:23 +0000 (12:46 -0700)]
mesa: Refactor validate_texture_wrap_mode to use a switch-statement

This makes the next couple changes a little easier.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
12 years agometa: Don't modify GL_GENERATE_MIPMAP state when it doesn't exist
Ian Romanick [Thu, 23 Aug 2012 01:53:42 +0000 (18:53 -0700)]
meta: Don't modify GL_GENERATE_MIPMAP state when it doesn't exist

This is a bit of a hack.  _mesa_meta_GenerateMipmap shouldn't even be
used in contexts where GL_GENERATE_MIPMAP doesn't exist (i.e., core
profile and ES2) because it uses fixed-function, and fixed-function
doesn't exist there either!

A GLSL-based _mesa_meta_GenerateMipmap should be available soon.  When
that is available, this patch will be irrelevant and should be reverted.

v2: Change (ctx->API != API_OPENGLES2 && ctx->API != API_OPENGL_CORE) to
(ctx->API == API_OPENGL || ctx->API == API_OPENGLES) based on review
comment from Brian Paul.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agobuild/glsl: fix android build v2
Tapani Pälli [Fri, 17 Aug 2012 07:32:53 +0000 (10:32 +0300)]
build/glsl: fix android build v2

Commit 77a3efc6b907943903190b385fdf107c4acfcdca broke android build that
sets its own value for GLSL_SRCDIR before including Makefile.sources.
Patch moves overriding the value after include, this works as GLSL_SRCDIR
variable gets expanded only later.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
12 years agoautomake: convert es1api
Matt Turner [Tue, 21 Aug 2012 21:36:44 +0000 (14:36 -0700)]
automake: convert es1api

12 years agoautomake: convert es2api
Matt Turner [Tue, 21 Aug 2012 21:52:59 +0000 (14:52 -0700)]
automake: convert es2api

12 years agost/dri: pass config options to the state tracker
Vadim Girlin [Thu, 12 Apr 2012 00:30:57 +0000 (04:30 +0400)]
st/dri: pass config options to the state tracker

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
12 years agost/mesa: accept and handle configuration options from st/dri
Vadim Girlin [Thu, 12 Apr 2012 00:30:03 +0000 (04:30 +0400)]
st/mesa: accept and handle configuration options from st/dri

Currently there is a single option - force_glsl_extensions_warn.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>