mesa.git
11 years agoi965: Initialize the maximum number of GS threads on Haswell.
Kenneth Graunke [Fri, 2 Aug 2013 07:01:41 +0000 (00:01 -0700)]
i965: Initialize the maximum number of GS threads on Haswell.

We'll need proper values for max_gs_threads when we eventually support
geometry shaders.  Also, we initialize it for every other platform.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Disallow interpolation qualifiers on non-input/output variables.
Kenneth Graunke [Fri, 2 Aug 2013 08:28:58 +0000 (01:28 -0700)]
glsl: Disallow interpolation qualifiers on non-input/output variables.

Commit 2548092ad8015 switched the sense of interpolation qualifier
checks in order to permit them on geometry shader in/out variables.

In doing so, it accidentally allowed interpolation qualifiers to be
applied to ordinary variables and function parameters.

Fixes a regression in Piglit's local-smooth-01.frag.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Fix NULL pointer dereferences when linking fails.
Kenneth Graunke [Fri, 2 Aug 2013 07:35:05 +0000 (00:35 -0700)]
glsl: Fix NULL pointer dereferences when linking fails.

Commit 7cfefe6965d50 introduced a check for whether linked->Type equals
GL_GEOMETRY_SHADER.  However, linked may be NULL due to an earlier error
condition.

Since the entire function after the error path is (or should be) guarded
by linked != NULL checks, we may as well just return early and remove
the checks.

Fixes crashes in 9 Piglit tests.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agodocs: Document UVD (2.2 and 3.0) video decoding support in mesa 9.2
Andreas Boll [Fri, 2 Aug 2013 09:22:23 +0000 (11:22 +0200)]
docs: Document UVD (2.2 and 3.0) video decoding support in mesa 9.2

Cc: "9.2" mesa-stable@lists.freedesktop.org
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodocs: Document that i965 Gen6+ requires Kernel 3.6 or later
Andreas Boll [Fri, 2 Aug 2013 09:22:09 +0000 (11:22 +0200)]
docs: Document that i965 Gen6+ requires Kernel 3.6 or later

Cc: "9.2" mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agodocs: Update some out of date sourcetree information
Timothy Arceri [Fri, 2 Aug 2013 11:57:50 +0000 (21:57 +1000)]
docs: Update some out of date sourcetree information

Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
11 years agor600g: honour semantic index in fragment color exports
Christoph Bumiller [Thu, 1 Aug 2013 18:56:21 +0000 (20:56 +0200)]
r600g: honour semantic index in fragment color exports

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
11 years agodocs: Add md5sums to 9.1.5 release notes
Andreas Boll [Fri, 2 Aug 2013 07:58:34 +0000 (09:58 +0200)]
docs: Add md5sums to 9.1.5 release notes

11 years agodocs: Fix a typo in the 9.1.6 release notes
Andreas Boll [Fri, 2 Aug 2013 07:42:03 +0000 (09:42 +0200)]
docs: Fix a typo in the 9.1.6 release notes

11 years agoi965: enable image external sampling for imported dma-buffers
Topi Pohjolainen [Mon, 12 Nov 2012 11:38:08 +0000 (13:38 +0200)]
i965: enable image external sampling for imported dma-buffers

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoegl/dri2: support for creating images out of dma buffers
Topi Pohjolainen [Fri, 22 Mar 2013 13:58:05 +0000 (15:58 +0200)]
egl/dri2: support for creating images out of dma buffers

v2:
   - upon success close the given file descriptors

v3:
   - use specific entry for dma buffers instead of the basic for
     primes, and enable the extension based on the availability
     of the hook

v4 (Chad):
   - use ARRAY_SIZE
   - improve the comment about the number of file descriptors
   - in case of invalid format report EGL_BAD_ATTRIBUTE instead
     of EGL_BAD_MATCH
   - take into account specific error set by the driver.

v5:
   - fix error handling

v6 (Chad):
   - fix invalid plane count checking

v7 (Chad):
   - fix indentation and reset loop counter before checking
     for excess attributes

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agointel: restrict dma-buf-import images to external sampling only
Topi Pohjolainen [Tue, 18 Jun 2013 10:47:43 +0000 (13:47 +0300)]
intel: restrict dma-buf-import images to external sampling only

Memory originating outside mesa stack is meant to be for reading
only. In addition, the restrictions imposed by the image external
extension should apply. For example, users shouldn't be allowed
to generare mip-trees based on these images.

v2 (Chad): document using full extension names, fix the comment
           style itself and emit description of error

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoegl: definitions for EXT_image_dma_buf_import
Topi Pohjolainen [Fri, 22 Mar 2013 12:31:01 +0000 (14:31 +0200)]
egl: definitions for EXT_image_dma_buf_import

As specified in:

http://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_image_dma_buf_import.txt

Checking for the valid fourcc values is left for drivers avoiding
dependency to drm header files here.

v2: enforce EGL_NO_CONTEXT

v3: declare the extension as EGL (not GLES)

v4: do not update eglext.h manually but rely on update from
    Khronos instead

v5: (Eric) report invalid context as EGL_BAD_PARAMETER instead of as
    EGL_BAD_CONTEXT

v6: (Chad) fix the checking for valid hints. Before all values were
    rejected.

v7: (Chad) comment style change from

    /**
     * Multi-
     * line

    into

    /* Multi-
     * line

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agodri: propagate extra dma_buf import attributes to the drivers
Topi Pohjolainen [Tue, 26 Mar 2013 13:14:20 +0000 (15:14 +0200)]
dri: propagate extra dma_buf import attributes to the drivers

v2: do not break ABI, but instead introduce new entry point for
    dma buffers and bump up the dri-interface version to eight

v3 (Chad): allow the hook to specify an error originating from the
           driver. For now only unsupported format is considered.
           I thought about rejecting the hints also as they are
           addressing only YUV sampling which is not supported at
           the moment but then thought against it as the spec is
           not saying one way or the other.

v4 (Eric, Chad): restrict to rgb formatted only

v5: rebased on top of i915/i965 split

v6 (Chad): document using full extension name

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agointel: set dri image dimensions even when creating out of primes
Topi Pohjolainen [Wed, 17 Apr 2013 10:11:16 +0000 (13:11 +0300)]
intel: set dri image dimensions even when creating out of primes

Otherwise 'intel_set_texture_image_region()' won't have enough
details to work with.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agointel: refactor planar format lookup
Topi Pohjolainen [Fri, 28 Dec 2012 10:22:54 +0000 (12:22 +0200)]
intel: refactor planar format lookup

v2 (Eric): refactor both occurences, not just one

v3 (Chad): replace 0 by NULL

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agointel: do not create renderbuffers out of planar images
Topi Pohjolainen [Wed, 27 Mar 2013 13:32:21 +0000 (15:32 +0200)]
intel: do not create renderbuffers out of planar images

v2 (Chad): emit 'GL_INVALID_OPERATION' and description of error

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agointel: allow packed prime buffers to be treated normally
Topi Pohjolainen [Thu, 25 Apr 2013 11:33:09 +0000 (14:33 +0300)]
intel: allow packed prime buffers to be treated normally

v2:
   - fix earlier rebase error breaking bisect
     (loaderPriv -> loaderPrivate)

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomain: Warn that geometry shader support is experimental.
Paul Berry [Mon, 29 Jul 2013 04:48:55 +0000 (21:48 -0700)]
main: Warn that geometry shader support is experimental.

Geometry shader support in the Mesa front end is still fairly
preliminary.  Many features are untested, and the following things are
known not to work:

- The gl_in interface block
- The gl_ClipDistance input
- Transform feedback of geometry shader outputs
- Constants that are new in GLSL 1.50 (e.g. gl_MaxGeometryInputComponents)

This isn't a problem, since no back-end drivers currently enable
geometry shaders.  However, to make sure no one gets the wrong
impression, emit a nasty warning to let the user know that geometry
shader support isn't complete.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Implement rules for geometry shader input sizes.
Paul Berry [Wed, 31 Jul 2013 04:13:48 +0000 (21:13 -0700)]
glsl: Implement rules for geometry shader input sizes.

Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec
contains some tricky rules for how the sizes of geometry shader input
arrays are related to the input layout specification.  In essence,
those rules boil down to the following:

- If an input array declaration does not specify a size, and it
  follows an input layout declaration, it is sized according to the
  input layout.

- If an input layout declaration follows an input array declaration
  that didn't specify a size, the input array declaration is given a
  size at the time the input layout declaration appears.

- All input layout declarations and input array sizes must ultimately
  match.  Inconsistencies are reported as soon as they are detected,
  at compile time if the inconsistency is within one compilation unit,
  otherwise at link time.

- At least one compilation unit must contain an input layout
  declaration.

(Note: the geom_array_resize_visitor class was contributed by Bryan
Cain <bryancain3@gmail.com>.)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Allow geometry shader input instance arrays to be unsized.
Paul Berry [Wed, 24 Jul 2013 21:57:24 +0000 (14:57 -0700)]
glsl: Allow geometry shader input instance arrays to be unsized.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Permit non-ubo input interface arrays to use non-const indexing.
Paul Berry [Mon, 22 Jul 2013 18:44:24 +0000 (11:44 -0700)]
glsl: Permit non-ubo input interface arrays to use non-const indexing.

From the GLSL ES 3.00 spec:

    "All indexes used to index a uniform block array must be constant
    integral expressions."

Similar text exists in GLSL specs since 1.50.

When we implemented this, the only type of interface block supported
by Mesa was uniform blocks, so we required all indexes used to index
any interface block to be constant integral expressions.

Now that we are adding interface block support for GLSL 1.50, we need
a more specific check.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Cross-validate GS layout qualifiers while intrastage linking.
Eric Anholt [Thu, 13 Jun 2013 01:12:40 +0000 (18:12 -0700)]
glsl: Cross-validate GS layout qualifiers while intrastage linking.

This gets piglit's geometry-basic test running.

TODO: Still need to validate that the GS layout qualifiers don't get used
in places they shouldn't (like an interface block, or a particular shader
input or output)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Export the compiler's GS layout qualifiers to the gl_shader.
Eric Anholt [Thu, 13 Jun 2013 00:21:44 +0000 (17:21 -0700)]
glsl: Export the compiler's GS layout qualifiers to the gl_shader.

Next step is to validate them at link time.

v2 (Paul Berry <stereotype441@gmail.com>): Don't attempt to export the
layout qualifiers in the event of a compile error, since some of them
are set up by ast_to_hir(), and ast_to_hir() isn't guaranteed to have
run in the event of a compile error.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
v3 (Paul Berry <stereotype441@gmail.com>): Use PRIM_UNKNOWN to
represent "not set in this shader".

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Parse the GLSL 1.50 GS layout qualifiers.
Eric Anholt [Wed, 12 Jun 2013 21:03:49 +0000 (14:03 -0700)]
glsl: Parse the GLSL 1.50 GS layout qualifiers.

Limited semantic checking (compatibility between declarations, checking
that they're in the right shader target, etc.) is done.

v2: Remove stray debug printfs.

v3 (Paul Berry <stereotype441@gmail.com>): Process input layout
qualifiers at ast_to_hir time rather than at parse time, since certain
error conditions depend on the relative ordering between input layout
qualifiers, declarations, and calls to .length().

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Make sure that we don't put too many bitfields in ast_type_qualifier.
Eric Anholt [Wed, 12 Jun 2013 20:46:57 +0000 (13:46 -0700)]
glsl: Make sure that we don't put too many bitfields in ast_type_qualifier.

We do some tests of qualifiers using a union containing an int and the
struct full of bitfields, so make sure the bitfields don't spill
outside the int.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomain: Fix delete_shader_cb() for geometry shaders
Paul Berry [Mon, 17 Jun 2013 03:18:59 +0000 (06:18 +0300)]
main: Fix delete_shader_cb() for geometry shaders

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl/linker: Fail to link geometry shader without vertex shader.
Fabian Bieler [Fri, 24 May 2013 21:26:54 +0000 (23:26 +0200)]
glsl/linker: Fail to link geometry shader without vertex shader.

From section 2.15 (Geometry Shaders) the OpenGL 3.2 spec:

    A program object that includes a geometry shader must also include
    a vertex shader; otherwise a link error will occur.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Validate the drawing primitive against the geometry shader input primitive...
Fabian Bieler [Sat, 25 May 2013 10:39:46 +0000 (12:39 +0200)]
mesa: Validate the drawing primitive against the geometry shader input primitive type.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa/shaderapi: Allow 0 GEOMETRY_VERTICES_OUT.
Fabian Bieler [Wed, 29 May 2013 22:17:42 +0000 (00:17 +0200)]
mesa/shaderapi: Allow 0 GEOMETRY_VERTICES_OUT.

ARB_geometry_shader4 spec Errors:
"The error INVALID_VALUE is generated by ProgramParameteriARB if <pname>
is GEOMETRY_VERTICES_OUT_ARB and <value> is negative."

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Properly pack GS output varyings
Paul Berry [Wed, 10 Apr 2013 23:32:40 +0000 (16:32 -0700)]
glsl: Properly pack GS output varyings

In geometry shaders, outputs are consumed at the time of a call to
EmitVertex() (as opposed to all other shader types, where outputs are
consumed when the shader exits).  Therefore, when packing geometry
shader output varyings using lower_packed_varyings, we need to do the
packing at the time of the EmitVertex() call.

This patch accomplishes that by adding a new visitor class,
lower_packed_varyings_gs_splicer, which is responsible for splicing
the varying packing code into place wherever EmitVertex() is found.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: Modify varying packing to use a temporary exec_list.
Paul Berry [Wed, 10 Apr 2013 21:25:13 +0000 (14:25 -0700)]
glsl: Modify varying packing to use a temporary exec_list.

This patch modifies lower_packed_varyings to store the packing code it
generates in a temporary exec_list, and then splice that list into the
shader's main() function when it's done.  This paves the way for
supporting geometry shader outputs, where we'll have to splice a clone
of the packing code before every call to EmitVertex().

As a side benefit, varying packing code is now emitted in the same
order for inputs and outputs; this should make debug output a little
easier to read.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl/linker: Properly pack GS input varyings.
Paul Berry [Wed, 10 Apr 2013 13:48:42 +0000 (06:48 -0700)]
glsl/linker: Properly pack GS input varyings.

Since geometry shader inputs are arrays (where the array index
indicates which vertex is being examined), varying packing needs to
treat them differently.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl/linker: Properly error check VS-GS linkage.
Paul Berry [Wed, 10 Apr 2013 02:51:41 +0000 (19:51 -0700)]
glsl/linker: Properly error check VS-GS linkage.

From section 4.3.4 (Inputs) of the GLSL 1.50 spec:

    Geometry shader input variables get the per-vertex values written
    out by vertex shader output variables of the same names. Since a
    geometry shader operates on a set of vertices, each input varying
    variable (or input block, see interface blocks below) needs to be
    declared as an array.

Therefore, the element type of each geometry shader input array should
match the type of the corresponding vertex shader output.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Require geometry shader inputs to be arrays.
Paul Berry [Wed, 10 Apr 2013 14:04:33 +0000 (07:04 -0700)]
glsl: Require geometry shader inputs to be arrays.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Copy linked program data for GS.
Paul Berry [Sat, 23 Mar 2013 17:51:53 +0000 (10:51 -0700)]
mesa: Copy linked program data for GS.

The documentation for gl_shader_program.Geom and gl_geometry_program
says that the former is copied to the latter at link time, but this
wasn't happening.  This patch causes _mesa_ir_link_shader() to perform
the copy, and updates comment accordingly.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Refactor copying of linked program data.
Paul Berry [Sat, 23 Mar 2013 17:51:53 +0000 (10:51 -0700)]
mesa: Refactor copying of linked program data.

This patch creates a single function to copy the the UsesClipDistance
flag from gl_shader_program.Vert to gl_vertex_program.  Previously
this logic was duplicated in the i965-specific function
brw_link_shader() and the core mesa function _mesa_ir_link_shader().

This logic will have to be expanded to support geometry shaders, and I
don't want to have to update it in two separate places.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: support compilation of geometry shaders
Bryan Cain [Fri, 15 Feb 2013 15:46:50 +0000 (09:46 -0600)]
glsl: support compilation of geometry shaders

This commit adds all of the parsing and semantics for GLSL 150 style
geometry shaders.

v2 (Paul Berry <stereotype441@gmail.com>): Add a few missing calls to
get_pipeline_stage().  Fix some signed/unsigned comparison warnings.
Fix handling of NULL consumer in assign_varying_locations().

v3 (Bryan Cain <bryancain3@gmail.com>): fix indexing order of 2D
arrays.  Also, allow interpolation qualifiers in geometry shaders.

v4 (Paul Berry <stereotype441@gmail.com>): Eliminate
get_pipeline_stage()--it is no longer needed thanks to 030ca23 (mesa:
renumber shader indices according to their placement in pipeline).
Remove 2D stuff.  Move vertices_per_prim() to ir.h, so that it will be
accessible from outside the linker.  Remove
inject_num_vertices_visitor.  Rework for GLSL 1.50.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
v5 (Paul Berry <stereotype441@gmail.com>): Split out
do_set_program_inouts() argument refactoring to a separate patch.
Move geom_array_resizing_visitor to later in the series.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl/linker: Make separate allocations to track vertex and fragment shaders.
Paul Berry [Wed, 31 Jul 2013 05:38:43 +0000 (22:38 -0700)]
glsl/linker: Make separate allocations to track vertex and fragment shaders.

There's no reason to be clever about this.  By making separate
allocations for vertex and fragment shaders, we'll allow geometry
shaders to be added without introducing any complication.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: add builtins for geometry shaders.
Bryan Cain [Fri, 15 Feb 2013 14:53:20 +0000 (08:53 -0600)]
glsl: add builtins for geometry shaders.

v2 (Paul Berry <stereotype441@gmail.com>): Account for rework of
builtin_variables.cpp.  Use INTERP_QUALIFIER_FLAT for gl_PrimitiveID
so that it will obey provoking vertex conventions.  Convert to GLSL
1.50 style geometry shaders.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
v3 (Paul Berry <stereotype441@gmail.com>): Be less obscure about
setting interpolation field of gl_Primitive variables.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: add ir_emit_vertex and ir_end_primitive instruction types
Bryan Cain [Fri, 15 Feb 2013 15:26:35 +0000 (09:26 -0600)]
glsl: add ir_emit_vertex and ir_end_primitive instruction types

These correspond to the EmitVertex and EndPrimitive functions in GLSL.

v2 (Paul Berry <stereotype441@gmail.com>): Add stub implementations of
new pure visitor functions to i965's vec4_visitor and fs_visitor
classes.

v3 (Paul Berry <stereotype441@gmail.com>): Rename classes to be more
consistent with the names used in the GL spec.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: account for geometry shader texture fetches in update_texture_state
Bryan Cain [Fri, 15 Feb 2013 08:40:12 +0000 (02:40 -0600)]
mesa: account for geometry shader texture fetches in update_texture_state

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomain: Allow for the possibility of GL 3.2 without ARB_geometry_shader4.
Paul Berry [Sun, 28 Jul 2013 16:23:11 +0000 (09:23 -0700)]
main: Allow for the possibility of GL 3.2 without ARB_geometry_shader4.

Previously, we assumed that the only way Mesa would expose geometry
shader support was via the ARB_geometry_shader4 extension.  But this
extension has some extra complications over GL 3.2 (interactions with
compatibility-only features, and link-time initialization of the
constant gl_VerticesIn).  So we want to allow for the possibility of
supporting GL 3.2 (with GLSL 1.50 style geometry shaders) even if
ctx->Extensions.ARB_geometry_shader4 is false.

This patch adds a new function, _mesa_has_geometry_shaders(), which
returns true if either ARB_geometry_shader4 is supported or the GL
version is at least 3.2 desktop.  Since compute_version() only enables
GL 3.2 functionality when GLSL 1.50 support is present, a sufficient
way for a back-end to advertise geometry shader support is to set
ctx->Const.GLSLVersion >= 150.

v2: Remove unnecessary ctx->Const.GeometryShaders150 constant.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomain: Fix geometry shader error messages (missing right paren)
Paul Berry [Mon, 24 Jun 2013 15:50:04 +0000 (08:50 -0700)]
main: Fix geometry shader error messages (missing right paren)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Add EXT_texture_array support for geometry shaders.
Paul Berry [Fri, 28 Jun 2013 20:02:23 +0000 (13:02 -0700)]
glsl: Add EXT_texture_array support for geometry shaders.

We can't just use a ".glsl" file since the Lod variants are only
available in vertex and geometry shaders, while the bias variants are
only available in the fragment shader.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl/linker: Make update_array_sizes apply to just uniforms.
Paul Berry [Mon, 10 Jun 2013 21:01:45 +0000 (14:01 -0700)]
glsl/linker: Make update_array_sizes apply to just uniforms.

Commit 586b4b5 (glsl: Also update implicit sizes of varyings at link
time) extended update_array_sizes() to apply to both uniforms and
shader ins/outs.  However, doing creates problems for geometry
shaders, because update_array_sizes() assumes that variables with
matching names in different parts of the pipeline should have the same
sizes.  With the addition of geometry shaders, this is no longer true
(e.g. both vertex and geometry shaders have a gl_ClipDistance output
variable, but there's no reason these variables should have the same
sizes).

The original reason for commit 586b4b5 (avoid problems with
gl_TexCoord being 0 length) has since been addressed by commit 6f53921
(linker: Ensure that unsized arrays have a size after linking).  So go
ahead and switch update_array_sizes() back to only acting on uniforms.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Modify ir_set_program_inouts to handle geometry shaders.
Paul Berry [Wed, 31 Jul 2013 19:49:49 +0000 (12:49 -0700)]
glsl: Modify ir_set_program_inouts to handle geometry shaders.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: In ir_set_program_inouts, handle indexing outside array/matrix bounds.
Paul Berry [Wed, 31 Jul 2013 18:25:13 +0000 (11:25 -0700)]
glsl: In ir_set_program_inouts, handle indexing outside array/matrix bounds.

According to GLSL, indexing into an array or matrix with an
out-of-range constant results in a compile error.  However, indexing
with an out-of-range value that isn't constant merely results in
undefined results.

Since optimization passes (e.g. loop unrolling) can convert
non-constant array indices into constant array indices, it's possible
that ir_set_program_inouts will encounter a constant array index that
is out of range; if this happens, just mark the whole array as used.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Fallback gracefully if ir_set_program_inouts sees unexpected indexing.
Paul Berry [Wed, 31 Jul 2013 17:57:22 +0000 (10:57 -0700)]
glsl: Fallback gracefully if ir_set_program_inouts sees unexpected indexing.

The code in ir_set_program_inouts that marks just a portion of a
variable as used (rather than the whole variable) only works on a few
kinds of indexing operations:

- Indexing into matrices
- Indexing into arrays of matrices, vectors, or scalars.

Fortunately these are the only kinds of indexing operations that we
expect to see; everything else is either handled by a
previously-executed lowering pass or prohibited by GLSL.

However, that could conceivably change in the future (the GLSL rules
might change, or we might modify the lowering passes).  To avoid
mysterious bugs in the future, let's have ir_set_program_inouts report
an assertion failure if it ever encounters an unexpected kind of
indexing operation (and in release builds, fall back to just marking
the whole variable as used).

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Extract marking functions from ir_set_program_inouts.
Paul Berry [Wed, 31 Jul 2013 17:15:49 +0000 (10:15 -0700)]
glsl: Extract marking functions from ir_set_program_inouts.

This patch extracts the functions mark_whole_variable() and
try_mark_partial_variable() from the ir_set_program_inouts visitor
functions.  This will make the code easier to follow when we add
geometry shader support.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Use count_attribute_slots() in ir_set_program_inouts.
Paul Berry [Wed, 31 Jul 2013 16:43:16 +0000 (09:43 -0700)]
glsl: Use count_attribute_slots() in ir_set_program_inouts.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Expand count_attribute_slots() to cover structs.
Paul Berry [Wed, 31 Jul 2013 15:24:48 +0000 (08:24 -0700)]
glsl: Expand count_attribute_slots() to cover structs.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoMove count_attribute_slots() out of the linker and into glsl_type.
Paul Berry [Wed, 31 Jul 2013 15:15:08 +0000 (08:15 -0700)]
Move count_attribute_slots() out of the linker and into glsl_type.

Our previous justification for leaving this function out of glsl_type
was that it implemented counting rules that were specific to GLSL
1.50.  However, these counting rules also describe the number of
varying slots that Mesa will assign to a varying in the absence of
varying packing.  That's useful to be able to compute from outside of
the linker code (a future patch will use it from
ir_set_program_inouts.cpp).  So go ahead and move it to glsl_type.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Change do_set_program_inouts' is_fragment_shader arg to shader_type.
Paul Berry [Wed, 31 Jul 2013 03:49:56 +0000 (20:49 -0700)]
glsl: Change do_set_program_inouts' is_fragment_shader arg to shader_type.

This will allow us to add geometry shader support without having to
add another boolean argument.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agogallivm: obey clarified shift behavior
Roland Scheidegger [Tue, 30 Jul 2013 19:26:27 +0000 (21:26 +0200)]
gallivm: obey clarified shift behavior

llvm shifts are undefined for shift counts exceeding (or matching) bit width,
so need to apply a mask for the tgsi shift instructions.

v2: only use mask for the tgsi shift instructions, not for the build shift
helpers. None of the internal callers need this behavior, and while llvm can
optimize away the masking for constants there are legitimate cases where it
might not be able to do so even if we know that shift count must be smaller
than type width (currently all such callers do not use the build shift
helpers).

Reviewed-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agotgsi: obey clarified shift behavior
Roland Scheidegger [Tue, 30 Jul 2013 15:16:17 +0000 (17:16 +0200)]
tgsi: obey clarified shift behavior

c shifts are undefined for shift counts exceeding (or matching) bit width,
so need to apply a mask (on x86 it actually would usually probably work as
shifts do masking on int domain shifts - unless some auto-vectorizer would
come along at last as simd domain does not mask the shift count).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallium: clarify shift behavior with shift count >= 32
Roland Scheidegger [Tue, 30 Jul 2013 15:08:01 +0000 (17:08 +0200)]
gallium: clarify shift behavior with shift count >= 32

Previously, nothing was said what happens with shift counts exceeding
bit width of the values to shift. In theory 3 behaviors are possible:
1) undefined (classic c definition)
2) just shift out all bits (so result is zero, or -1 potentially for ashr)
3) mask the shift count to bit width - 1
API's either require 3) or are ok with 1). In particular, GLSL (as well as a
couple uninteresting legacy GL extensions) is happy with undefined, whereas
both OpenCL and d3d10 require 3). Consequently, most hw also implements 3).
So, for simplicity we just specify that 3) is required rather than saying
undefined and then needing state trackers to work around it.
Also while here specify shift count as a vector, not scalar. As far as I
can tell this was a doc bug, neither state trackers nor drivers used scalar
shift count.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agodocs: Add md5sums to 9.1.6 release notes
Carl Worth [Thu, 1 Aug 2013 22:45:04 +0000 (15:45 -0700)]
docs: Add md5sums to 9.1.6 release notes

11 years agodocs: Import 9.1.6 release notes, add news item.
Carl Worth [Thu, 1 Aug 2013 22:12:25 +0000 (15:12 -0700)]
docs: Import 9.1.6 release notes, add news item.

11 years agoi965: Delete the BATCH_LOCALS macro.
Kenneth Graunke [Mon, 8 Jul 2013 02:17:02 +0000 (19:17 -0700)]
i965: Delete the BATCH_LOCALS macro.

This hasn't done anything in a long time, and it's only used in a couple
places...which means we couldn't use it without doing a bunch of work
anyway.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoCorrect clamping of TEXTURE_{MAX, BASE}_LEVEL
Corey Richardson [Wed, 31 Jul 2013 14:46:12 +0000 (10:46 -0400)]
Correct clamping of TEXTURE_{MAX, BASE}_LEVEL

Previously, if TEXTURE_IMMUTABLE_FORMAT was TRUE, the levels were allowed to
be set like usual, but ARB_texture_storage states:

> if TEXTURE_IMMUTABLE_FORMAT is TRUE, then level_base is clamped to the range
> [0, <levels> - 1] and level_max is then clamped to the range [level_base,
> <levels> - 1], where <levels> is the parameter passed the call to
> TexStorage* for the texture object

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Corey Richardson <corey@octayn.net>
11 years agoDe-tab and align comments in gl_texture_object
Corey Richardson [Wed, 31 Jul 2013 14:14:22 +0000 (10:14 -0400)]
De-tab and align comments in gl_texture_object

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Corey Richardson <corey@octayn.net>
11 years agoi965 Gen4/5: clip: Don't mangle flat varyings
Chris Forbes [Sun, 7 Jul 2013 10:22:57 +0000 (22:22 +1200)]
i965 Gen4/5: clip: Don't mangle flat varyings

This patch ensures that integers will pass through unscathed.  Doing
(useless) computations on them is risky, especially when their bit
patterns correspond to values like inf or nan.

[V1-2]: Signed-off-by: Olivier Galibert <galibert at pobox.com>
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965 Gen4/5: clip: Add support for noperspective varyings
Chris Forbes [Sun, 7 Jul 2013 09:42:39 +0000 (21:42 +1200)]
i965 Gen4/5: clip: Add support for noperspective varyings

Adds support for interpolating noperspective varyings linearly in screen
space when clipping.

Based on Olivier Galibert's patch from last year:
http://lists.freedesktop.org/archives/mesa-dev/2012-July/024341.html

At this point all -fixed and -vertex interpolation tests work.

V5: Add brw_clip_compile.has_noperspective_shading rather than another
key flag.
V6: Real bools.

[V1-2]: Signed-off-by: Olivier Galibert <galibert at pobox.com>
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965 Gen4/5: clip: correctly handle flat varyings
Chris Forbes [Sun, 7 Jul 2013 07:47:19 +0000 (19:47 +1200)]
i965 Gen4/5: clip: correctly handle flat varyings

Previously we only gave special treatment to the builtin color varyings.
This patch adds support for arbitrary flat-shaded varyings, which is
required for GLSL 1.30.

Based on Olivier Galibert's patch from last year:
http://lists.freedesktop.org/archives/mesa-dev/2012-July/024340.html

V5: Move key.do_flat_shading to brw_clip_compile.has_flat_shading
V6: Real bools.

[V1-2]: Signed-off-by: Olivier Galibert <galibert at pobox.com>
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965 Gen4/5: Generalize SF interpolation setup for GLSL1.3
Chris Forbes [Sat, 6 Jul 2013 13:53:45 +0000 (01:53 +1200)]
i965 Gen4/5: Generalize SF interpolation setup for GLSL1.3

Previously the SF only handled the builtin color varying specially.
This patch generalizes that support to cover user-defined varyings,
driven by the interpolation mode array set up alongside the VUE map.

Based on the following patches from Olivier Galibert:
- http://lists.freedesktop.org/archives/mesa-dev/2012-July/024335.html
- http://lists.freedesktop.org/archives/mesa-dev/2012-July/024339.html

With this patch, all the GLSL 1.3 interpolation tests that do not clip
(spec/glsl-1.30/execution/interpolation/*-none.shader_test) pass.

V5: Move key.do_flat_shading to brw_sf_compile.has_flat_shading; drop
vestigial hunks.
V6: Real bools.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Add helper functions for interpolation map
Chris Forbes [Wed, 31 Jul 2013 10:28:13 +0000 (22:28 +1200)]
i965: Add helper functions for interpolation map

V6: real bools

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965 Gen4/5: Introduce 'interpolation map' alongside the VUE map
Chris Forbes [Sat, 6 Jul 2013 14:56:14 +0000 (02:56 +1200)]
i965 Gen4/5: Introduce 'interpolation map' alongside the VUE map

The interpolation map (in brw->interpolation_mode) is a new auxiliary
structure alongside the post-GS VUE map, which describes the
interpolation modes for each VUE slot, for use by the clip and SF
stages.

This patch introduces a new state atom to compute the interpolation map,
and adjusts the program keys for the clip and SF stages, but it is not
actually used yet.

[V1-2]: Signed-off-by: Olivier Galibert <galibert at pobox.com>

V3: Updated for vue_map changes, intel -> brw merge, etc. (Chris Forbes)
V4: Compute interpolation map as a new state atom rather than tacking it
on the front of the clip setup
V5: Rework commit message, make interpolation_mode_map a struct.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoget-pick-list: Allow for non-whitespace between "CC:" and "mesa-stable"
Carl Worth [Wed, 31 Jul 2013 22:49:48 +0000 (15:49 -0700)]
get-pick-list: Allow for non-whitespace between "CC:" and "mesa-stable"

We recently proposed a new syntax for stable-patch nominations such as:

CC: "9.2 and 9.1" <mesa-stable@lists.freedesktop.org>
and this has already appeared in the wild.

So we extend the regular expression to pick this up as well.

11 years agonvc0: properly align NVE4_COMPUTE_MP_TEMP_SIZE
Samuel Pitoiset [Thu, 25 Jul 2013 08:35:33 +0000 (10:35 +0200)]
nvc0: properly align NVE4_COMPUTE_MP_TEMP_SIZE

MP_TEMP_SIZE must be aligned to 0x8000, while TEMP_SIZE on NVE4_3D
must be aligned to 0x20000, so perform both alignments to be sure
we allocate enough space (actually the bo will most likely use 128
KiB pages and not aligning to that would be a waste anyway).

Cc: "9.2" mesa-stable@lists.freedesktop.org
11 years agomesa/program: remove useless YYID
Laurent Carlier [Wed, 31 Jul 2013 13:18:52 +0000 (15:18 +0200)]
mesa/program: remove useless YYID

This fixes the build with Bison 3.0. Also works with Bison 2.7.1.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa/program: Switch from the deprecated YYLEX_PARAM to %lex-param.
Kenneth Graunke [Mon, 29 Jul 2013 23:03:46 +0000 (16:03 -0700)]
mesa/program: Switch from the deprecated YYLEX_PARAM to %lex-param.

YYLEX_PARAM is no longer supported as of Bison 3.0.  Instead, the Bison
developers recommend using %lex-param.

%lex-param takes a type and variable name, similar to %parse-param,
so you can't pass an arbitrary expression like state->scanner.  But Flex
insists on passing the actual scanner object, not an arbitrary object
like state.

To solve this, the parser defines a wrapper lex() function which accepts
"state," and calls Flex's lex() function with state->scanner.

Fixes the build with Bison 3.0.  Also works with Bison 2.7.1.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67354
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Tested-by: Laurent Carlier <lordheavym@gmail.com>
Cc: "9.2" mesa-stable@lists.freedesktop.org
11 years agomesa/program: Change the program parser's namespace.
Kenneth Graunke [Mon, 29 Jul 2013 22:55:06 +0000 (15:55 -0700)]
mesa/program: Change the program parser's namespace.

Bison 3.0 removes the YYLEX_PARAM macro.  In preparation for handling
this using %lex-param, the parser needs a wrapper function for the
actual Flex lex() function.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67354
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Tested-by: Laurent Carlier <lordheavym@gmail.com>
Cc: "9.2" mesa-stable@lists.freedesktop.org
11 years agoglsl: Switch from the deprecated YYLEX_PARAM to %lex-param.
Kenneth Graunke [Mon, 29 Jul 2013 22:28:59 +0000 (15:28 -0700)]
glsl: Switch from the deprecated YYLEX_PARAM to %lex-param.

YYLEX_PARAM is no longer supported as of Bison 3.0.  Instead, the Bison
developers recommend using %lex-param.

%lex-param takes a type and variable name, similar to %parse-param,
so you can't pass an arbitrary expression like state->scanner.  But Flex
insists on passing the actual scanner object, not an arbitrary object
like state.

To solve this, the parser defines a wrapper lex() function which accepts
"state," and calls Flex's lex() function with state->scanner.

Fixes the build with Bison 3.0.  Also works with Bison 2.7.1.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67354
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Tested-by: Laurent Carlier <lordheavym@gmail.com>
Cc: "9.2" mesa-stable@lists.freedesktop.org
11 years agoglsl: Change the lexer's namespace.
Kenneth Graunke [Mon, 29 Jul 2013 22:27:46 +0000 (15:27 -0700)]
glsl: Change the lexer's namespace.

Bison 3.0 removes the YYLEX_PARAM macro.  In preparation for handling
this using %lex-param, the parser needs a wrapper function for the
actual Flex lex() function.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67354
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Tested-by: Laurent Carlier <lordheavym@gmail.com>
Cc: "9.2" mesa-stable@lists.freedesktop.org
11 years agoegl: Restore "bogus" DRI2 invalidate event code.
Eric Anholt [Fri, 21 Jun 2013 22:34:52 +0000 (15:34 -0700)]
egl: Restore "bogus" DRI2 invalidate event code.

I had removed it in commit 1e7776ca2bc59a6978d9b933d23852d47078dfa8
because it was obviously wrong -- why do we care whether the server is a
version that emits events, if we're not watching for the server's events,
anyway?  And why would you only invalidate on a server that emits
invalidate events, when the comment said to emit invalidates if the server
*doesn't*?  Only, I missed that we otherwise don't flag that our buffers
might have changed at swap time at all, so the driver was only checking
for new buffers when triggered by the Viewport hack.  Of course you don't
expect Viewport to be called after a swap.

So, this is effectively a revert of the previous commit, except that I
dropped the check for only emitting invalidates on a new server -- we
*always* need to invalidate if we're doing a SwapBuffers.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63435
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.1 and 9.2" <mesa-stable@lists.freedesktop.org>
11 years agogallivm: use nearest rounding for float->unorm24 conversion
Roland Scheidegger [Wed, 31 Jul 2013 14:57:50 +0000 (16:57 +0200)]
gallivm: use nearest rounding for float->unorm24 conversion

Previously we were using truncation, which gives the correct result
only for numbers in [0.5-1.0] range (because there's no mantissa bits
to do any rounding there).
This is frequently hit (and probably only used there) when converting
fragment depth to depth format (d24s8 etc.) or otherwise dealing with
depth format.

v2: as spotted by Jose, get rid of extra type (src_type is already unsigned).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agomesa: fix multisampling proxy textures not being queryable
Mikko Juola [Tue, 30 Jul 2013 17:39:00 +0000 (20:39 +0300)]
mesa: fix multisampling proxy textures not being queryable

The code that checks if some texture target is valid for
glGetTexLevelParameter*() was not programmed to check for multisampling
proxy textures.  This made it impossible(?) to use the proxy textures
for their intended purpose as glGetTexLevelParameter*() would just fail
on you.

Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: mesa-stable@lists.freedesktop.org
11 years agomesa: fix proxy textures becoming immutable and unusable
Mikko Juola [Tue, 30 Jul 2013 03:36:43 +0000 (06:36 +0300)]
mesa: fix proxy textures becoming immutable and unusable

glTexStorage*() functions make textures immutable.  This carries on to
proxy textures.  Error checking in texture storage functions prevents
proxy textures from working after first time because internally, they
became immutable.

This commit makes the error checking ignore the immutability flag when
working with proxy textures.

Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: mesa-stable@lists.freedesktop.org
11 years agomesa: fix proxy textures not working with default texture binding
Mikko Juola [Tue, 30 Jul 2013 03:29:54 +0000 (06:29 +0300)]
mesa: fix proxy textures not working with default texture binding

When working with the glTexStorage*() functions, the error checking
checks that a non-default (i.e., non-zero) texture is currently bound.
However, this check made glTexStorage*() functions fail with proxy
textures when the default texture is bound. Proxy textures do not care
about the current texture bindings so for them this check should not
be done.

Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: mesa-stable@lists.freedesktop.org
11 years agomesa: fix number of mipmaps calculation for proxy textures
Mikko Juola [Tue, 30 Jul 2013 03:19:59 +0000 (06:19 +0300)]
mesa: fix number of mipmaps calculation for proxy textures

The function _mesa_get_tex_max_num_levels() is supposed to calculate
the number of mipmap levels but it was not written to handle proxy
textures, at best returning a maximum of 1 mipmap level. Because of
this, at least glTexStorage*() calls would incorrectly fail when used
with proxy textures with more than one mipmap level.

Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: mesa-stable@lists.freedesktop.org
11 years agomesa: improve free() cleanup in generate_mipmap_compressed()
Brian Paul [Fri, 26 Jul 2013 15:50:36 +0000 (09:50 -0600)]
mesa: improve free() cleanup in generate_mipmap_compressed()

Free all our temporary buffers in one place at the end of the
function.  Fixes memory leak detected by Coverity.

Note: This is a candidate for the 9.x branches
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agogallium/util: reformat, comment util_get_offset()
Brian Paul [Thu, 25 Jul 2013 17:21:50 +0000 (11:21 -0600)]
gallium/util: reformat, comment util_get_offset()

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agogallium/util: comments, var renaming in u_inlines.h
Brian Paul [Thu, 25 Jul 2013 17:17:52 +0000 (11:17 -0600)]
gallium/util: comments, var renaming in u_inlines.h

The variable 'usage' was being used for two different things.
Sometimes for PIPE_USAGE_x and other times for PIPE_TRANSFER_x.
This renames usage to access when we're talking about PIPE_TRANSFER_x
flags.  Plus, add a bunch of comments to remind us what's going on.

Also, use unsigned for PIPE_TRANSFER_x bitmask to be consistent with
other places.  And add a missing const qualifier.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agosoftpipe: use new softpipe_resource_data() accessor
Brian Paul [Thu, 25 Jul 2013 15:27:09 +0000 (09:27 -0600)]
softpipe: use new softpipe_resource_data() accessor

We should probably be using map()/unmap() when accessing resource
data, but this is a little better.

v2: assert that the resource is not a display target, per Jose.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agosoftpipe: don't ignore pipe_constant_buffer::buffer_offset
Brian Paul [Thu, 25 Jul 2013 15:13:47 +0000 (09:13 -0600)]
softpipe: don't ignore pipe_constant_buffer::buffer_offset

This was never a problem since the Mesa state tracker always gives
us a user-space constant buffer with buffer_offset=0.  But if another
state tracker ever gave us a "HW" constant buffer with non-zero
buffer_offset we'd mis-render.

Also, use the correct buffer size.  And move an assertion to the
top of the function.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agogallium/docs: clarify definition of PIPE_CAP_USER_CONSTANT_BUFFERS, etc
Brian Paul [Thu, 25 Jul 2013 15:15:52 +0000 (09:15 -0600)]
gallium/docs: clarify definition of PIPE_CAP_USER_CONSTANT_BUFFERS, etc

The cap means _can_ accept user-space constant buffers; it doesn't
mean _only_ accepts user-space constant buffers.

v2: also update the PIPE_CAP_USER_VERTEX_BUFFERS and
PIPE_CAP_USER_INDEX_BUFFERS descriptions as well.  Per Jose.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agoi965/vs: Put lod parameter in the correct place for Gen4
Chris Forbes [Tue, 30 Jul 2013 04:03:58 +0000 (16:03 +1200)]
i965/vs: Put lod parameter in the correct place for Gen4

This was never visible before due to the bogus sampler state pointer.
Fixes remaining vertex texturing breakage on Gen4.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
11 years agoi965/vs: set up sampler state pointer for Gen4/5.
Chris Forbes [Mon, 29 Jul 2013 18:12:24 +0000 (06:12 +1200)]
i965/vs: set up sampler state pointer for Gen4/5.

Fixes broken filter and lod selection for vertex texturing.
(txs/txf only worked properly because they ignore the sampler state
completely)

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
11 years agost/dri: add a new driconf option disable_shader_bit_encoding for Unigine
Marek Olšák [Tue, 30 Jul 2013 20:29:27 +0000 (22:29 +0200)]
st/dri: add a new driconf option disable_shader_bit_encoding for Unigine

Now Unigine Heaven 3.0 finally works with r600g.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: fix opcode translation for ARB_shader_bit_encoding functions
Marek Olšák [Tue, 30 Jul 2013 20:29:25 +0000 (22:29 +0200)]
st/mesa: fix opcode translation for ARB_shader_bit_encoding functions

We treat the opcodes as MOVs, but we should at least change the type
of the expression, which later affects which TGSI opcode is chosen.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa,glsl,st/dri: add a new driconf option force_glsl_version for Unigine
Marek Olšák [Tue, 30 Jul 2013 20:29:24 +0000 (22:29 +0200)]
mesa,glsl,st/dri: add a new driconf option force_glsl_version for Unigine

See documentation in mtypes.h.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: add MESA_GLSL debug flag to dump shaders on compile error
Marek Olšák [Tue, 30 Jul 2013 20:29:23 +0000 (22:29 +0200)]
mesa: add MESA_GLSL debug flag to dump shaders on compile error

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agodriconf: enable app-specific workarounds for all drivers
Marek Olšák [Tue, 30 Jul 2013 20:29:22 +0000 (22:29 +0200)]
driconf: enable app-specific workarounds for all drivers

They were only enabled for i965.

Note that drirc must be installed in /etc.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agost/dri: remove driOptionCache from dri_context in favor of dri_screen
Marek Olšák [Tue, 30 Jul 2013 20:29:21 +0000 (22:29 +0200)]
st/dri: remove driOptionCache from dri_context in favor of dri_screen

There is no reason to have this duplicated.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/dri: move enabling postprocessing to dri_screen
Marek Olšák [Tue, 30 Jul 2013 20:29:20 +0000 (22:29 +0200)]
st/dri: move enabling postprocessing to dri_screen

The driconf options are global.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/dri: remove more unused driconf options
Marek Olšák [Tue, 30 Jul 2013 20:29:19 +0000 (22:29 +0200)]
st/dri: remove more unused driconf options

vblank_mode is read by dri_util.c and falls under the "dri2" driver name,
which is not connected to the actual Mesa/Gallium driver in any way.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/dri: implement the driconf option force_s3tc_enable properly
Marek Olšák [Tue, 30 Jul 2013 20:29:18 +0000 (22:29 +0200)]
st/dri: implement the driconf option force_s3tc_enable properly

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodriconf: remove the unused option allow_large_textures
Marek Olšák [Tue, 30 Jul 2013 20:29:17 +0000 (22:29 +0200)]
driconf: remove the unused option allow_large_textures

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agost/dri: support the driconf option disable_blend_func_extended
Marek Olšák [Tue, 30 Jul 2013 20:29:16 +0000 (22:29 +0200)]
st/dri: support the driconf option disable_blend_func_extended

This is needed for Unigine.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>