mesa.git
10 years agotargets/vdpau: use version script to limit the exported symbols
Emil Velikov [Fri, 4 Apr 2014 22:59:30 +0000 (23:59 +0100)]
targets/vdpau: use version script to limit the exported symbols

Using export-symbols-regex is the least desirable method of restricting
the exported symbols, as is completely messes up with the symbol table.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agotargets/omx: drop the version from the omx targets
Emil Velikov [Sat, 5 Apr 2014 17:09:59 +0000 (18:09 +0100)]
targets/omx: drop the version from the omx targets

Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agotargets/omx: use version script to limit amount of exported symbols
Emil Velikov [Fri, 4 Apr 2014 22:53:13 +0000 (23:53 +0100)]
targets/omx: use version script to limit amount of exported symbols

Using export-symbols-regex is the least desirable method of restricting
the exported symbols, as is completely messes up with the symbol table.

radeon_drm_winsys_create is not needed, avoid exporting it.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agotargets/dri: use a single version script to restict exported symbols
Emil Velikov [Fri, 4 Apr 2014 22:52:21 +0000 (23:52 +0100)]
targets/dri: use a single version script to restict exported symbols

Rather than having multiple (almost) identical version scripts use
a single one.

Cc: Christian König <christian.koenig@amd.com>
Acked-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agotargets/xvmc: limit the amount of exported symbols
Emil Velikov [Fri, 4 Apr 2014 22:46:13 +0000 (23:46 +0100)]
targets/xvmc: limit the amount of exported symbols

In the presence of LLVM the final library exports every symbol from
the llvm namespace. Resolve this by using a version script (w/o the
version/name tag).

Considering that there are only ~25 symbols, explicitly list them
to minimize the chances of rogue symbols sneaking in.

Drop the *winsys_create functions as they were only meant for
gl-vdpau interop.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agotargets/osmesa: hide osmesa_create_screen
Emil Velikov [Fri, 4 Apr 2014 17:32:38 +0000 (18:32 +0100)]
targets/osmesa: hide osmesa_create_screen

The symbol is not meant to be exported, and its presence was
only a side effect due to the missing visibility flags.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agotargets/pipe-loader: drop driver_descriptor symbol from swrast
Emil Velikov [Fri, 4 Apr 2014 14:45:08 +0000 (15:45 +0100)]
targets/pipe-loader: drop driver_descriptor symbol from swrast

The symbol is used for hardware only drivers. For swrast the
loader uses swrast_create_screen. Add VISIBILITY_CFLAGS while
we're here.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agomesa: add extra null checks in vbo_rebase_prims()
Juha-Pekka Heikkila [Sun, 27 Apr 2014 20:04:58 +0000 (23:04 +0300)]
mesa: add extra null checks in vbo_rebase_prims()

v2 [idr]: Move declarations before code to prevent MSVC build breaks.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: add missing null checks in _tnl_register_fastpath()
Juha-Pekka Heikkila [Sun, 27 Apr 2014 20:04:57 +0000 (23:04 +0300)]
mesa: add missing null checks in _tnl_register_fastpath()

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add _mesa_error_no_memory for logging out-of-memory messages
Ian Romanick [Tue, 4 Mar 2014 13:39:37 +0000 (15:39 +0200)]
mesa: Add _mesa_error_no_memory for logging out-of-memory messages

This can be called from locations that don't have a context pointer
handy.  This patch also adds enough infrastructure so that the unit
tests for the GLSL compiler and the stand-alone compiler will build and
function.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
10 years agoglsl: make static constant variables "static const"
Chia-I Wu [Tue, 22 Apr 2014 08:58:16 +0000 (16:58 +0800)]
glsl: make static constant variables "static const"

This allows them to be moved to .rodata, and allow us to be sure that they
will not be modified.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
10 years agodocs: update 10.2 release notes
Petri Latvala [Wed, 23 Apr 2014 08:08:55 +0000 (11:08 +0300)]
docs: update 10.2 release notes

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Enable INTEL_performance_query for Gen5+.
Petri Latvala [Wed, 23 Apr 2014 08:08:54 +0000 (11:08 +0300)]
i965: Enable INTEL_performance_query for Gen5+.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Implement INTEL_performance_query.
Petri Latvala [Wed, 23 Apr 2014 08:08:53 +0000 (11:08 +0300)]
mesa: Implement INTEL_performance_query.

Using the existing driver hooks made for AMD_performance_monitor, implement
INTEL_performance_query functions.

v2: Whitespace changes.
v3: Whitespace changes, add a _mesa_warning()

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add core support for the GL_INTEL_performance_query extension.
Petri Latvala [Wed, 23 Apr 2014 08:08:52 +0000 (11:08 +0300)]
mesa: Add core support for the GL_INTEL_performance_query extension.

Like AMD_performance_monitor, this extension provides an interface for
applications (and OpenGL-based tools) to access GPU performance
counters. Since the exact performance counters available vary between
vendors and hardware generations, the extension provides an API the
application can use to get the names, types, and minimum/maximum
values of all available counters.

Applications create performance queries based on available query
types, and begin/end measurement collection. Multiple queries can be
measuring simultaneously.

v2: Whitespace changes
v3: src/mapi/glapi/gen/gl_API.xml: Also expose the functions to GLES2.
v4: Whitespace changes, static_dispatch="false" for all functions, fix
    dispatch_sanity test for GLES2 functions

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add INTEL_performance_query enums to tests/enum_strings.cpp
Petri Latvala [Wed, 23 Apr 2014 08:08:51 +0000 (11:08 +0300)]
mesa: Add INTEL_performance_query enums to tests/enum_strings.cpp

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoRegenerate gl_mangle.h.
Petri Latvala [Wed, 23 Apr 2014 08:08:50 +0000 (11:08 +0300)]
Regenerate gl_mangle.h.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agodocs: update ARB_buffer_storage for nouveau
Ilia Mirkin [Thu, 1 May 2014 02:08:33 +0000 (22:08 -0400)]
docs: update ARB_buffer_storage for nouveau

10 years agonouveau: add ARB_buffer_storage support
Ilia Mirkin [Wed, 30 Apr 2014 20:45:16 +0000 (16:45 -0400)]
nouveau: add ARB_buffer_storage support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonouveau: remove cb_dirty, it's never used
Ilia Mirkin [Wed, 30 Apr 2014 06:08:52 +0000 (02:08 -0400)]
nouveau: remove cb_dirty, it's never used

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonvc0: treat non-linear 2DRect textures the same as 2D
Ilia Mirkin [Wed, 30 Apr 2014 01:51:42 +0000 (21:51 -0400)]
nvc0: treat non-linear 2DRect textures the same as 2D

This fixes textureGather(2DRect) piglit tests, and does not appear to
have any adverse effects.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agomesa/st: enable carry/borrow lowering pass
Ilia Mirkin [Tue, 29 Apr 2014 03:13:37 +0000 (23:13 -0400)]
mesa/st: enable carry/borrow lowering pass

This handles the last of the ARB_gs5 instructions currently present in
mesa.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agoglsl: add lowering passes for carry/borrow
Ilia Mirkin [Tue, 29 Apr 2014 03:13:08 +0000 (23:13 -0400)]
glsl: add lowering passes for carry/borrow

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agomesa: Eliminate gl_shader_program::InternalSeparateShader
Ian Romanick [Thu, 27 Mar 2014 17:29:30 +0000 (10:29 -0700)]
mesa: Eliminate gl_shader_program::InternalSeparateShader

This was a work-around to allow linking a program with only a fragment
shader in a GLES context.  Now that we have GL_EXT_separate_shader_objects
in GLES contexts, we can just use that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agomesa: Enable GL_EXT_separate_shader_objects for OpenGL ES
Ian Romanick [Wed, 26 Mar 2014 20:11:44 +0000 (13:11 -0700)]
mesa: Enable GL_EXT_separate_shader_objects for OpenGL ES

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglsl: Sort the list of extensions
Ian Romanick [Wed, 26 Mar 2014 18:43:32 +0000 (11:43 -0700)]
glsl: Sort the list of extensions

ARB, OES, then everything else.  If there's ever a KHR shading language
extension, it should go between ARB and OES.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Eric Anholt <eric@anholt.net>
10 years agomesa: Remove support for desktop OpenGL GL_EXT_separate_shader_objects
Ian Romanick [Wed, 26 Mar 2014 18:25:16 +0000 (11:25 -0700)]
mesa: Remove support for desktop OpenGL GL_EXT_separate_shader_objects

I don't know of any applications that actually use it.  Now that Mesa
supports GL_ARB_separate_shader_objects in all drivers, this extension
is just cruft.

The entrypoints for the extension remain in the XML.  This is done so
that a new libGL will continue to provide dispatch support for old
drivers that try to expose this extension.

Future patches will add OpenGL ES GL_EXT_separate_shader_objects, but
that's a different thing.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agomesa/sso: Enable GL_ARB_separate_shader_objects by default
Ian Romanick [Sat, 29 Jun 2013 02:39:28 +0000 (19:39 -0700)]
mesa/sso: Enable GL_ARB_separate_shader_objects by default

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agosso: Add display list support for ARB_separate_shader_objects new functions
Ian Romanick [Tue, 29 Apr 2014 23:24:24 +0000 (16:24 -0700)]
sso: Add display list support for ARB_separate_shader_objects new functions

With this patch, the piglit arb_separate_shader_object-dlist test
passes.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agolinker: Modify cross_validate_outputs_to_inputs to match using explicit locations
Ian Romanick [Wed, 2 Oct 2013 19:39:29 +0000 (12:39 -0700)]
linker: Modify cross_validate_outputs_to_inputs to match using explicit locations

This will be used for GL_ARB_separate_shader_objects.  That extension
not only allows separable shaders to rendezvous by location, but it also
allows traditionally linked shaders to rendezvous by location.  The spec
says:

    36. How does the behavior of input/output interface matching differ
        between separable programs and non-separable programs?

        RESOLVED: The rules for matching individual variables or block
        members between stages are identical for separable and
        non-separable programs, with one exception -- matching variables
        of different type with the same location, as discussed in issue
        34, applies only to separable programs.

        However, the ability to enforce matching requirements differs
        between program types.  In non-separable programs, both sides of
        an interface are contained in the same linked program.  In this
        case, if the linker detects a mismatch, it will generate a link
        error.

v2: Make sure consumer_inputs_with_locations is initialized when
consumer is NULL.  Noticed by Chia-I.

v3: Rebase on removal of ir_variable::user_location.

v4: Replace a (stale) FINISHME with some good explanation comments from
Eric.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agolinker: Sort shader I/O variables into a canonical order
Ian Romanick [Tue, 11 Feb 2014 23:38:23 +0000 (15:38 -0800)]
linker: Sort shader I/O variables into a canonical order

v2: Rebase on removal of ir_variable::user_location.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agolinker: Allow geometry shader without vertex shader for separable programs
Ian Romanick [Fri, 24 Jan 2014 02:26:29 +0000 (18:26 -0800)]
linker: Allow geometry shader without vertex shader for separable programs

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agolinker: Assign varying locations for separable programs
Ian Romanick [Fri, 14 Feb 2014 20:10:27 +0000 (12:10 -0800)]
linker: Assign varying locations for separable programs

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agolinker: Allow consumer stage or producer stage to be NULL
Ian Romanick [Fri, 14 Feb 2014 20:08:53 +0000 (12:08 -0800)]
linker: Allow consumer stage or producer stage to be NULL

When linking a separable program that contains only a fragment shader,
the producer will be NULL.  Similar cases will exist with geometry
shaders and, eventually, tessellation shaders.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agolinker: Refactor code that gets an input matching an output
Ian Romanick [Thu, 3 Oct 2013 01:01:13 +0000 (18:01 -0700)]
linker: Refactor code that gets an input matching an output

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Exit when the shader IR contains an interface block instance
Ian Romanick [Wed, 2 Oct 2013 22:57:03 +0000 (15:57 -0700)]
glsl: Exit when the shader IR contains an interface block instance

While writing the link_varyings::single_interface_input test, I
discovered that populate_consumer_input_sets assumes that all shader
interface blocks have been lowered to discrete variables.  Since there
is a pass that does this, it is a reasonable assumption.  It was,
however, non-obvious.  Make the code fail when it encounters such a
thing, and add a test to verify that behavior.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl/tests: Add first simple tests of populate_consumer_input_sets
Ian Romanick [Wed, 2 Oct 2013 22:44:14 +0000 (15:44 -0700)]
glsl/tests: Add first simple tests of populate_consumer_input_sets

Four initial tests:

* Create an IR list with a single input variable and verify that
  variable is the only thing in the hash tables.

* Same as the previous test, but use a built-in variable
  (gl_ClipDistance) with an explicit location set.

* Create an IR list with a single input variable from an interface block
  and verify that variable is the only thing in the hash tables.

* Create an IR list with a single input variable and a single input
  variable from an interface block.  Verify that each is the only thing
  in the proper hash tables.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agolinker: Refactor code that builds hash tables of varyings during linking
Ian Romanick [Wed, 2 Oct 2013 22:39:45 +0000 (15:39 -0700)]
linker: Refactor code that builds hash tables of varyings during linking

I want to make some changes to this code, but first I want to make some
unit tests for it... so that I can capture the pre- and
post-invariants.  Pulling the code out into its own function in a
non-anonymous namespace enables that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agometa: Fix saving the program pipeline state
Ian Romanick [Wed, 26 Mar 2014 01:34:31 +0000 (18:34 -0700)]
meta: Fix saving the program pipeline state

This code was broken in some odd ways before.  Too much state was being
saved, it was being restored in the wrong order, and in the wrong way.
The biggest problem was that the pipeline object was restored before
restoring the programs attached to the default pipeline.

Fixes a regression in the glean texgen test.

v3: Fairly significant re-write.  I think it's much cleaner now, and it
avoids a bug with some meta ops that use shaders (reported by Chia-I).

v4: Check Pipeline.Current against NULL instead of Pipeline.Default.
Suggested by Chia-I.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chia-I Wu <olv@lunarg.com>
10 years agomesa/sso: Refactor new function _mesa_bind_pipeline
Ian Romanick [Wed, 26 Mar 2014 01:19:42 +0000 (18:19 -0700)]
mesa/sso: Refactor new function _mesa_bind_pipeline

Pull most of the guts out of _mesa_BindPipeline into a new utility
function that can be use elsewhere (e.g., meta).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agolinker: Make lower_packed_varyings work with explicit locations
Ian Romanick [Sun, 27 Apr 2014 21:16:48 +0000 (14:16 -0700)]
linker: Make lower_packed_varyings work with explicit locations

Don't do anything with variables that have explicitly assigned
locations.  This is also how built-in varyings are handled.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglsl: Remove varying "base" parameters
Ian Romanick [Sun, 27 Apr 2014 00:45:35 +0000 (17:45 -0700)]
glsl: Remove varying "base" parameters

In February 2013 Paul unified the values used for shader stage outputs
and shader stage inputs.  See commits 8a076c5f0^..eed6baf76.  Since that
time, the location_base parameters are always VARYING_SLOT_VAR0.
Instead of passing that around, just hard code it.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglsl: Constify parameter to a couple varying_matches methods
Ian Romanick [Thu, 13 Feb 2014 00:35:57 +0000 (16:35 -0800)]
glsl: Constify parameter to a couple varying_matches methods

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoclover: Add a stub implementation of clCreateImage() v3
Tom Stellard [Wed, 30 Apr 2014 19:57:24 +0000 (12:57 -0700)]
clover: Add a stub implementation of clCreateImage() v3

Now that we are uisng the OpenCL 1.2 headers, applications expect all
the OpenCL 1.2 functions to be implemented.

This fixes linking errors with the piglit CL tests.

v2:
  - Use c++ features
  - Fix error code handling

v3:
  - Move <iostream> into api/util.hpp
  - Fix indentation

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agodocs: Add missing ARB_gpu_shader5 subfeature to GL3.txt
Chris Forbes [Fri, 2 May 2014 05:09:13 +0000 (17:09 +1200)]
docs: Add missing ARB_gpu_shader5 subfeature to GL3.txt

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
10 years agodocs: Mark ARB_multi_bind as done
Fredrik Höglund [Mon, 18 Nov 2013 17:53:23 +0000 (18:53 +0100)]
docs: Mark ARB_multi_bind as done

...and update relnotes.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Enable ARB_multi_bind
Fredrik Höglund [Fri, 15 Nov 2013 19:07:30 +0000 (20:07 +0100)]
mesa: Enable ARB_multi_bind

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Implement glBindImageTextures
Fredrik Höglund [Fri, 17 Jan 2014 17:37:06 +0000 (18:37 +0100)]
mesa: Implement glBindImageTextures

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Implement glBindVertexBuffers
Fredrik Höglund [Fri, 15 Nov 2013 19:01:07 +0000 (20:01 +0100)]
mesa: Implement glBindVertexBuffers

v2: Use the user provided offset and stride when the buffer ID is zero.

Reviewed-by: Brian Paul <brianp@vmware.com> (v1)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v1)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v2)
10 years agomesa: Implement glBindBuffersRange
Fredrik Höglund [Fri, 15 Nov 2013 18:57:41 +0000 (19:57 +0100)]
mesa: Implement glBindBuffersRange

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Implement glBindBuffersBase
Fredrik Höglund [Fri, 15 Nov 2013 18:56:07 +0000 (19:56 +0100)]
mesa: Implement glBindBuffersBase

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add _mesa_set_transform_feedback_binding()
Fredrik Höglund [Fri, 15 Nov 2013 18:53:29 +0000 (19:53 +0100)]
mesa: Add _mesa_set_transform_feedback_binding()

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Refactor set_ubo_binding()
Fredrik Höglund [Fri, 15 Nov 2013 18:51:02 +0000 (19:51 +0100)]
mesa: Refactor set_ubo_binding()

Make set_ubo_binding() just update the binding, and move the code
that does validation, flushes the vertices etc. into a new
bind_uniform_buffer() function.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add helper functions for looking up multiple buffers
Fredrik Höglund [Fri, 15 Nov 2013 18:47:20 +0000 (19:47 +0100)]
mesa: Add helper functions for looking up multiple buffers

v2: Document the difference between _mesa_lookup_bufferobj() and
    _mesa_multi_bind_lookup_bufferobj().
v3: Don't create the buffer objects when they don't exist.

Reviewed-by: Brian Paul <brianp@vmware.com> (v2)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v2)
10 years agomesa: Refactor set_atomic_buffer_binding()
Fredrik Höglund [Fri, 15 Nov 2013 18:45:43 +0000 (19:45 +0100)]
mesa: Refactor set_atomic_buffer_binding()

Make set_atomic_buffer_binding() just update the binding, and move
the code that does validation, flushes the vertices etc. into a new
bind_atomic_buffer() function.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Implement glBindTextures
Fredrik Höglund [Fri, 15 Nov 2013 18:43:01 +0000 (19:43 +0100)]
mesa: Implement glBindTextures

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add a texUnit parameter to dd_function_table::BindTexture
Fredrik Höglund [Thu, 23 Jan 2014 13:02:24 +0000 (14:02 +0100)]
mesa: Add a texUnit parameter to dd_function_table::BindTexture

This is for glBindTextures(), since it doesn't change the active
texture unit.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add helper functions for looking up multiple textures
Fredrik Höglund [Fri, 17 Jan 2014 17:35:31 +0000 (18:35 +0100)]
mesa: Add helper functions for looking up multiple textures

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Implement glBindSamplers
Fredrik Höglund [Fri, 15 Nov 2013 18:41:11 +0000 (19:41 +0100)]
mesa: Implement glBindSamplers

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglapi: Add infrastructure for ARB_multi_bind
Fredrik Höglund [Wed, 13 Nov 2013 18:02:10 +0000 (19:02 +0100)]
glapi: Add infrastructure for ARB_multi_bind

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add functions for doing unlocked hash table lookups
Fredrik Höglund [Wed, 13 Nov 2013 17:46:03 +0000 (18:46 +0100)]
mesa: Add functions for doing unlocked hash table lookups

This patch adds functions for locking/unlocking the mutex, along with
_mesa_HashLookupLocked() and _mesa_HashInsertLocked()
that do lookups and insertions without locking the mutex.

These functions will be used by the ARB_multi_bind entry points to
avoid locking/unlocking the mutex for each binding point.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Optimize unbind_texobj_from_texunits()
Fredrik Höglund [Tue, 12 Nov 2013 16:34:35 +0000 (17:34 +0100)]
mesa: Optimize unbind_texobj_from_texunits()

The texture can only be bound to the index that corresponds to its
target, so there is no need to loop over all possible indices
for every unit and checking if the texture is bound to it.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add a _BoundTextures field in gl_texture_unit
Fredrik Höglund [Tue, 12 Nov 2013 16:28:12 +0000 (17:28 +0100)]
mesa: Add a _BoundTextures field in gl_texture_unit

This will be used by glBindTextures() when unbinding textures,
to avoid having to loop over all the targets.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Store the target index in gl_texture_object
Fredrik Höglund [Tue, 12 Nov 2013 16:23:05 +0000 (17:23 +0100)]
mesa: Store the target index in gl_texture_object

This will be used by glBindTextures() so we don't have to look it up
for each texture.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Fix the file comment for intel_image.h
Eric Anholt [Tue, 29 Apr 2014 22:31:16 +0000 (15:31 -0700)]
i965: Fix the file comment for intel_image.h

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Rename intel_regions.h to something more appropriate now.
Eric Anholt [Tue, 29 Apr 2014 22:30:15 +0000 (15:30 -0700)]
i965: Rename intel_regions.h to something more appropriate now.

We had the EGLimage structure laying around in intel_regions.h, but now
it's the only thing left in the file.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Delete the intel_regions.c code.
Eric Anholt [Fri, 25 Apr 2014 20:50:10 +0000 (13:50 -0700)]
i965: Delete the intel_regions.c code.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Drop region usage from DRI2 winsys-allocated buffers.
Eric Anholt [Fri, 25 Apr 2014 20:44:41 +0000 (13:44 -0700)]
i965: Drop region usage from DRI2 winsys-allocated buffers.

v2: Fix bad pointer on unreference (caught by Chad)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoi965: Drop a funny assert about mt pitch.
Eric Anholt [Fri, 25 Apr 2014 22:18:14 +0000 (15:18 -0700)]
i965: Drop a funny assert about mt pitch.

I slipped this in in the region->pitch change from pixels to bytes, but I
don't see any reason for it any more -- the libdrm code doesn't appear to
divide pitch by a cpp.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Fix intel_bufferobj_buffer range for blit drawpixels.
Eric Anholt [Fri, 25 Apr 2014 22:14:47 +0000 (15:14 -0700)]
i965: Fix intel_bufferobj_buffer range for blit drawpixels.

If the stride wasn't width*cpp, we wouldn't track how much of the src is
busy, and allow a subdata into the end to proceed unsynchronized.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Drop use of intel_region from miptrees.
Eric Anholt [Fri, 25 Apr 2014 20:29:41 +0000 (13:29 -0700)]
i965: Drop use of intel_region from miptrees.

Note: region->width/height used to reflect the total_width/height padding
of separate stencil, though mt->total_width didn't.  region->width/height
was being used in EGL images, where the padded value would have been the
wrong one, so I converted them to use rb->Width/Height.

v2: Drop debug printf that slipped in (caught by Ken)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Replace the region in DRIimage with just a BO pointer and stride.
Eric Anholt [Fri, 25 Apr 2014 19:14:34 +0000 (12:14 -0700)]
i965: Replace the region in DRIimage with just a BO pointer and stride.

Regions aren't refcounted safely for multithreaded applications, and
they're not terribly useful wrappers of a BO, so I'm trying to remove
them.

Even the stride I added here could probably be reduced to use of an
existing field in the __DRIimageRec, but I want this to be as mechanical
of a change as possible.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Make intel_set_texture_region just take a BO and pitch.
Eric Anholt [Fri, 25 Apr 2014 20:18:48 +0000 (13:18 -0700)]
i965: Make intel_set_texture_region just take a BO and pitch.

I want to do this to get the region removed from DRI images.  However, it
does mean that we won't share the intel_region between the rb and the
texture for texture_from_pixmap.  I think that's fine.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Stop making a pointless region for DRI2 to just throw it away.
Eric Anholt [Fri, 25 Apr 2014 19:38:01 +0000 (12:38 -0700)]
i965: Stop making a pointless region for DRI2 to just throw it away.

I noticed that we were doing this while changing the DRI3 path to not use
regions, which involved changing the signature of
intel_update_winsys_renderbuffer_miptree() this way.

v2: Replace my comment with Chad's version.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> (v1)
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Drop the global GEM name from regions.
Eric Anholt [Fri, 25 Apr 2014 19:21:11 +0000 (12:21 -0700)]
i965: Drop the global GEM name from regions.

Once a buffer has been named, drm_intel_bo_flink() is just a getter.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Drop the tiling argument to intel_miptree_create_for_bo.
Eric Anholt [Fri, 25 Apr 2014 19:10:57 +0000 (12:10 -0700)]
i965: Drop the tiling argument to intel_miptree_create_for_bo.

The drm function to get the tiling is just a getter storing the two
pointers, so we don't need to go out of our way to avoid it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Drop pointless cast of texObj to intelObj.
Eric Anholt [Fri, 25 Apr 2014 18:47:13 +0000 (11:47 -0700)]
i965: Drop pointless cast of texObj to intelObj.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Move intel_region_get_aligned_offset() to be a miptree function.
Eric Anholt [Fri, 25 Apr 2014 18:36:38 +0000 (11:36 -0700)]
i965: Move intel_region_get_aligned_offset() to be a miptree function.

All the consumers are doing it on a miptree.

v2: fix a silly duplicated dereference (review by Ken)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> (v1)
Reviewed-by: Chad Versace <chad.versace@linux.intel.com> (v1)
10 years agoi965: Move intel_region_get_tile_masks() to be a miptree function.
Eric Anholt [Fri, 25 Apr 2014 18:20:57 +0000 (11:20 -0700)]
i965: Move intel_region_get_tile_masks() to be a miptree function.

All the consumers are doing it on a miptree.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Fix another broken offset-aligned-to-tile test.
Eric Anholt [Fri, 25 Apr 2014 18:19:05 +0000 (11:19 -0700)]
i965: Fix another broken offset-aligned-to-tile test.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Fix offset-aligned-to-tile test in dma_buf import.
Eric Anholt [Fri, 25 Apr 2014 18:17:41 +0000 (11:17 -0700)]
i965: Fix offset-aligned-to-tile test in dma_buf import.

v1 of the patch got pushed, insted of the v2 that I had reviewed.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Reuse intel_miptree_get_tile_offsets().
Eric Anholt [Fri, 25 Apr 2014 18:26:27 +0000 (11:26 -0700)]
i965: Reuse intel_miptree_get_tile_offsets().

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agomesa: move declarations before code in texstore.c
Brian Paul [Thu, 1 May 2014 19:05:19 +0000 (13:05 -0600)]
mesa: move declarations before code in texstore.c

To fix MSVC build.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Fix format of private renderbuffers
Ville Syrjälä [Thu, 24 Apr 2014 11:11:44 +0000 (14:11 +0300)]
i965: Fix format of private renderbuffers

intel_alloc_renderbuffer_storage() will clobber rb->Format which was
already set up by intel_create_renderbuffer(). This causes the driver
to potentially create the depth buffer in the wrong format.

In practice this makes the depth buffer Z24 even if the visual has
depthBits==16.

The incorrect depth buffer format doesn't seem to cause any actual
problems in i965, but it seems like we should fix it anyway. I see
Z16 has been more or less deprecated in the driver except the for
the depthBits==16 case. But if we want to use Z24 even in that
case (not sure it's really legal?) it would look better if the
code made that decision explicitly rather than relying on the
format to get magically overwritten by the renderbuffer code.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
10 years agoi915: Don't advertise Z formats in TextureFormatSupported on gen2
Ville Syrjälä [Thu, 24 Apr 2014 11:11:43 +0000 (14:11 +0300)]
i915: Don't advertise Z formats in TextureFormatSupported on gen2

Gen2 doesn't support texturing from Z formats, so state as much.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
10 years agoi915: Fix format of private renderbuffers
Ville Syrjälä [Thu, 24 Apr 2014 11:11:42 +0000 (14:11 +0300)]
i915: Fix format of private renderbuffers

intel_alloc_renderbuffer_storage() will clobber rb->Format which was
already set up by intel_create_renderbuffer(). This causes the driver
to potentially create the depth buffer in the wrong format.

Long time ago things worked by accident because
_mesa_choose_tex_format() checked for ARB_depth_texture
and thus returned MESA_FORMAT_NONE on gen2 hardware. Somehow
that ended up working when depthBits==16 because the driver
would then pick DEPTH_FRMT_16_FIXED. Not sure how, but things
also seemed to work with depthBits==24.

Things started to go more sideways at:
 commit 6ae473221a53d8bcb584021483c5328797c6b67c
 Author: Eric Anholt <eric@anholt.net>
 Date:   Mon Apr 22 16:04:25 2013 -0700

    intel: Fold the one last function intel_tex_format.c into the caller.

since that caused intel_miptree_create_layout() to divide by zero
when encoutering MESA_FORMAT_NONE (bw==0). So after this
commit things were broken enough that many applications wouldn't even
run.

Things got a bit better at:
 commit c245efe7e8247ba0c845dee7b77e63fdbfc7e1b3
 Author: Eric Anholt <eric@anholt.net>
 Date:   Thu Mar 21 09:50:45 2013 -0700

    mesa: Remove extension checking from ChooseTexFormat.

since now _mesa_choose_tex_format() would return MESA_FORMAT_X8_Z24
for GL_DEPTH_COMPONENT due to i915 erroneosly claiming that
MESA_FORMAT_X8_S24 (and others) are supported texture formats even
on gen2 hardware. So now the the div-by-zero was gone, but now the
driver would pick DEPTH_FRMT_24_FIXED_8_OTHER even when
depthBits==16 which caused rendering problems.

If we prevent rb->Format from getting clobbered for the depth buffer
things work much better. This makes the spinning title text visible
again in chromium-bsu at 16bpp, for example.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
10 years agomesa: Allow FLOAT_32_UNSIGNED_INT_24_8_REV in get_tex_depth_stencil()
Anuj Phogat [Fri, 21 Mar 2014 18:19:42 +0000 (11:19 -0700)]
mesa: Allow FLOAT_32_UNSIGNED_INT_24_8_REV in get_tex_depth_stencil()

Fixes a crash in Khronos OpenGL CTS packed_pixels tests.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add support to unpack depth-stencil texture in to FLOAT_32_UNSIGNED_INT_24_8_REV
Anuj Phogat [Fri, 21 Mar 2014 18:16:00 +0000 (11:16 -0700)]
mesa: Add support to unpack depth-stencil texture in to FLOAT_32_UNSIGNED_INT_24_8_REV

V2: Follow the new naming convention for unpack functions.
    Use double precision for converting Z24 to a float.
V3: Unpack stencil value to most significant byte.
    Use 'struct z32f_x24s8' type.
V4: Unpack stencil value to least significant byte.
    Add a comment to clarify stencil packing.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add new helper function _mesa_unpack_depth_stencil_row()
Anuj Phogat [Fri, 21 Mar 2014 18:05:55 +0000 (11:05 -0700)]
mesa: Add new helper function _mesa_unpack_depth_stencil_row()

This patch makes non-functional changes in the code. New helper
function added here will make it easier to support more data
types in the following patches.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Remove redundant if checks in _mesa_texstore_xx_xx() functions
Anuj Phogat [Thu, 20 Mar 2014 19:16:40 +0000 (12:16 -0700)]
mesa: Remove redundant if checks in _mesa_texstore_xx_xx() functions

This patch contains non-functional changes. Assertion checks made
earlier in the functions make the if checks redundant. So, remove
the if checks and unindent the code in if block.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Allow srcFormat=GL_DEPTH_STENCIL in _mesa_texstore_xx_xx() functions
Anuj Phogat [Fri, 21 Mar 2014 20:07:13 +0000 (13:07 -0700)]
mesa: Allow srcFormat=GL_DEPTH_STENCIL in _mesa_texstore_xx_xx() functions

_mesa_texstore_z24_s8() and _mesa_texstore_z32f_x24s8() are capable of
handling GL_DEPTH_STENCIL format. So, allow it in both the functions.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add missing types in _mesa_texstore_xx_xx() functions
Anuj Phogat [Fri, 21 Mar 2014 19:55:19 +0000 (12:55 -0700)]
mesa: Add missing types in _mesa_texstore_xx_xx() functions

Depth-stencil teture targets are allowed to use source data of type
GL_UNSIGNED_INT_24_8_EXT and GL_FLOAT_32_UNSIGNED_INT_24_8_REV.

Fixes few crashes in Khronos OpenGL CTS packed_pixels tests.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Fix crash in do_blit_readpixels()
Anuj Phogat [Wed, 19 Mar 2014 18:55:50 +0000 (11:55 -0700)]
i965: Fix crash in do_blit_readpixels()

Fixes a crash in Khronos CTS packed_pixels tests.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add error condition for format=STENCIL_INDEX in glGetTexImage()
Anuj Phogat [Tue, 18 Mar 2014 23:52:24 +0000 (16:52 -0700)]
mesa: Add error condition for format=STENCIL_INDEX in glGetTexImage()

From OpenGL 4.0 spec, page 306:
   "Calling GetTexImage with a format of STENCIL_INDEX
    causes the error INVALID_ENUM."

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add entry for extension ARB_texture_stencil8
Anuj Phogat [Tue, 18 Mar 2014 23:49:03 +0000 (16:49 -0700)]
mesa: Add entry for extension ARB_texture_stencil8

V2: Alphabetize the new entry

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Apply the link error conditions to GL_ARB_fragment_coord_conventions
Anuj Phogat [Mon, 10 Feb 2014 22:12:40 +0000 (14:12 -0800)]
glsl: Apply the link error conditions to GL_ARB_fragment_coord_conventions

Link error conditions added in previous patch are equally applicable
to GL_ARB_fragment_coord_conventions implementation. Extension's spec
says:
   "If gl_FragCoord is redeclared in any fragment shader in a program,
    it must be redeclared in all the fragment shaders in that program
    that have a static use of gl_FragCoord. All redeclarations of
    gl_FragCoord in all fragment shaders in a single program must have
    the same set of qualifiers."

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Link error if fs defines conflicting qualifiers for gl_FragCoord
Anuj Phogat [Wed, 5 Feb 2014 23:01:58 +0000 (15:01 -0800)]
glsl: Link error if fs defines conflicting qualifiers for gl_FragCoord

GLSL 1.50 spec says:
   "If gl_FragCoord is redeclared in any fragment shader in a program,
    it must be redeclared in all the fragment shaders in that
    program that have a static use gl_FragCoord. All redeclarations of
    gl_FragCoord in all fragment shaders in a single program must
    have the same set of qualifiers."

This patch causes the shader link to fail if we have multiple fragment
shaders with conflicting layout qualifiers for gl_FragCoord.

V2: Restructure the code and add conditions to correctly handle the
    following case:

fragment shader 1:
layout(origin_upper_left) in vec4 gl_FragCoord;
void main()
{
    foo();
    gl_FragColor = gl_FragData;
}

fragment shader 2:
layout(pixel_center_integer) in vec4 gl_FragCoord;
void foo()
{
}

V3:
Allow linking in the following case:
fragment shader 1:
void main()
{
    foo();
    gl_FragColor = gl_FragCoord;
}

fragment shader 2:
in vec4 gl_FragCoord;
void foo()
{
   ...
}

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Compile error if fs uses gl_FragCoord before first redeclaration
Anuj Phogat [Fri, 21 Feb 2014 02:32:25 +0000 (18:32 -0800)]
glsl: Compile error if fs uses gl_FragCoord before first redeclaration

Section 4.3.8.1, page 39 of GLSL 1.50 spec says:
  "Within any shader, the first redeclarations of gl_FragCoord
   must appear before any use of gl_FragCoord."

GLSL compiler should generate an error in following case:

vec4 p = gl_FragCoord;
layout(origin_upper_left) in vec4 gl_FragCoord;

void main()
{
}

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Compile error if fs defines conflicting qualifiers for gl_FragCoord
Anuj Phogat [Tue, 4 Feb 2014 18:38:18 +0000 (10:38 -0800)]
glsl: Compile error if fs defines conflicting qualifiers for gl_FragCoord

GLSL 1.50 spec says:
   "If gl_FragCoord is redeclared in any fragment shader in a program,
    it must be redeclared in all the fragment shaders in that
    program that have a static use gl_FragCoord. All redeclarations of
    gl_FragCoord in all fragment shaders in a single program must
    have the same set of qualifiers."

This patch makes the glsl compiler to generate an error if we have a
fragment shader defined with conflicting layout qualifier declarations
for gl_FragCoord. For example:

layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
layout(pixel_center_integer) in vec4 gl_FragCoord;

void main()
{
}

V2: Some code refactoring for better readability.
    Add compiler error conditions for redeclarations like:

layout(origin_upper_left) in vec4 gl_FragCoord;
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;

and

in vec4 gl_FragCoord;
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;

V3: Simplify function is_conflicting_fragcoord_redeclaration()
V4: Check for null pointer before doing strcmp(var->name, "gl_FragCoord").

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Use location VERT_ATTRIB_GENERIC0 for vertex attribute 0
Anuj Phogat [Sat, 29 Mar 2014 00:44:59 +0000 (17:44 -0700)]
mesa: Use location VERT_ATTRIB_GENERIC0 for vertex attribute 0

In OpenGL 3.1 attribute 0 becomes non-magic, just like in
OpenGL ES 2.0. Earlier versions of OpenGL used attribute 0
exclusively for vertex position.

V2: Add a utility function _mesa_attr_zero_aliases_vertex() in
    varray.h

Fixes 4 Khronos OpenGL CTS failures:
glGetVertexAttrib
depth24_basic
depth24_precision
rgb8_rgba8_rgb

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>