Commit Graph

69480 Commits

Author SHA1 Message Date
Marek Olšák 0d46440c3a glsl_to_tgsi: only associate the uniform storage once at link time
This hack is no longer needed. (see the previous commit)

Reviewed-by: Brian Paul <brianp@vmware.com>
2015-04-16 18:36:29 +02:00
Marek Olšák bb5df7350b glsl_to_tgsi: add STATE_FB_WPOS_Y_TRANSFORM at link time
This will allow removing the uniform storage re-association during
TGSI generation at draw time.

Reviewed-by: Brian Paul <brianp@vmware.com>
2015-04-16 18:36:29 +02:00
Marek Olšák e2066a4344 glsl_to_tgsi: add assertions for detecting out-of-bounds immediates access
Reviewed-by: Brian Paul <brianp@vmware.com>
2015-04-16 18:36:29 +02:00
Marek Olšák dcc74d47c4 glsl_to_tgsi: don't use a potentially-undefined immediate for ir_query_levels
Cc: 10.4 10.5 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
2015-04-16 18:36:29 +02:00
Marek Olšák 14c5bc3b9a glsl_to_tgsi: fix out-of-bounds constant access and crash for uniforms
This fixes piglit shaders@glsl-fs-uniform-array-loop-unroll with immediate
shader compilation - it's a compiler test, so it has never been translated
to TGSI before.

Cc: 10.4 10.5 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
2015-04-16 18:36:29 +02:00
Marek Olšák d3045d391b glsl_to_tgsi: cleanup includes
Reviewed-by: Brian Paul <brianp@vmware.com>
2015-04-16 18:36:29 +02:00
Marek Olšák 76c2d4498d mesa/program: remove dead code
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-04-16 18:36:29 +02:00
Marek Olšák b79c620663 radeonsi: add a debug option to compile shaders when they're created
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2015-04-16 18:36:29 +02:00
Marek Olšák 99eef3b8b3 st/mesa: add a debug option to compile shaders at link time
v2: fix crashes

Tested-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-04-16 18:36:29 +02:00
Kristian Høgsberg 993a6288f7 i965: Rewrite ir_tex to ir_txl with lod 0 for vertex shaders
The ir_tex opcode turns into a sample or sample_c message, which will try to
compute derivatives to determine the lod. This produces garbage for
non-fragment shaders where the sample coordinates don't correspond to
subspans.

We fix this by rewriting the opcode from ir_tex to ir_txl and setting the
lod to 0.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89457
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kristian Høgsberg <kristian.h.kristensen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-04-16 09:18:30 -07:00
Emil Velikov a7d018accf radeonsi: remove bogus r600-- triple
As mentioned by Michel Dänzer for LLVM >= 3.6 we create the
LLVMTargetMachine (with triple amdgcn--), as we setup the radeonsi
context. For older LLVM or hardware (r600) the triple is always r600--
and is created at a later stage - radeon_llvm_compile()

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-04-16 14:15:19 +01:00
Neil Roberts 33f73e93ff i965/skl: Add the header for constant loads outside of the generator
Commit 5a06ee738 added a step to the generator to set up the message
header when generating the VS_OPCODE_PULL_CONSTANT_LOAD_GEN7
instruction. That pseudo opcode is implemented in terms of multiple
actual opcodes, one of which writes to one of the source registers in
order to set up the message header. This causes problems because the
scheduler isn't aware that the source register is written to and it
can end up reorganising the instructions incorrectly such that the
write to the source register overwrites a needed value from a previous
instruction. This problem was presenting itself as a rendering error
in the weapon in Enemy Territory: Quake Wars.

Since commit 588859e1 there is an additional problem that the double
register allocated to include the message header would end up being
split into two. This wasn't happening previously because the code to
split registers was explicitly avoided for instructions that are
sending from the GRF.

This patch fixes both problems by splitting the code to set up the
message header into a new pseudo opcode so that it will be done
outside of the generator. This new opcode has the header register as a
destination so the scheduler can recognise that the register is
written to. This has the additional benefit that the scheduler can
optimise the message header slightly better by moving the mov
instructions further away from the send instructions.

On Skylake it appears to fix the following three Piglit tests without
causing any regressions:

 gs-float-array-variable-index
 gs-mat3x4-row-major
 gs-mat4x3-row-major

I think we actually may need to do something similar for the fs
backend and possibly for message headers from regular texture sampling
but I'm not entirely sure.

v2: Make sure the exec-size is retained as 8 for the mov instruction
    to initialise the header from g0. This was accidentally lost
    during a rebase on top of 07c571a39f.
    Split the patch into two so that the helper function is a separate
    change.
    Fix emitting the MOV instruction on Gen7.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89058
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
2015-04-16 13:02:26 +01:00
Neil Roberts a9e4cf5d32 i965/vec4: Add a helper function to emit VS_OPCODE_PULL_CONSTANT_LOAD
There were three places in the visitor that had a similar chunk of
code to emit the VS_OPCODE_PULL_CONSTANT_LOAD opcode using a register
for the offset. This patch combines the chunks into a helper function
to reduce the code duplication. It will also be useful in the next
patch to expand what happens on Gen9+. This shouldn't introduce any
functional changes.

Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
2015-04-16 13:01:43 +01:00
Jose Fonseca 037e0e78ab mesa,glsl: rename `interface` to `programInterface`.
`interface` is a define on Windows -- an alias for `struct` keyword,
used when declaring COM interfaces in C or C++.

So use instead `programInterface`, therefore matching the name used
in GL_ARB_program_interface_query spec/headers, which was renamed exactly
for the same reason:

  "Revision 10, May 10, 2012 (pbrown)
     - Rename the formal parameter <interface> used by the functions in this
       extension to <programInterface>.  Certain versions of the Microsoft
       C/C++ compiler and/or its headers cause "interface" to be treated as a
       reserved keyword."

Trivial.
2015-04-16 10:23:24 +01:00
Flora Cui f78b2c432f gbm: Add GBM_BO_USE_LINEAR flag
Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-04-16 15:49:15 +09:00
Tapani Pälli 7c154bbe60 mesa: refactor GetUniformBlockIndex
Use _mesa_program_resource_index to get index.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2015-04-16 07:55:57 +03:00
Tapani Pälli 1b256eb0ec mesa: refactor GetUniformIndices
Use _mesa_program_resource_index to get indices.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2015-04-16 07:55:57 +03:00
Tapani Pälli 51313f567d mesa: refactor GetUniformLocation
Use _mesa_program_resource_location to get location.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2015-04-16 07:55:57 +03:00
Tapani Pälli 45637e9c1f mesa: refactor GetActiveUniformBlockName
Use _mesa_get_program_resource_name to get name.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2015-04-16 07:55:57 +03:00
Tapani Pälli 284003e1f1 mesa: remove unused _mesa_get_uniform_name
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2015-04-16 07:55:57 +03:00
Tapani Pälli 8d6fa52e33 mesa: refactor GetActiveUniformName
Use _mesa_get_program_resource_name to get name.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2015-04-16 07:55:57 +03:00
Tapani Pälli 17dc939f75 mesa: refactor GetActiveUniform
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2015-04-16 07:55:57 +03:00
Tapani Pälli dc39d843d2 mesa: refactor GetTransformFeedbackVarying
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2015-04-16 07:55:57 +03:00
Tapani Pälli 7519ddb4d8 mesa: refactor GetActiveUniformsiv, use _mesa_program_resource_prop
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2015-04-16 07:55:57 +03:00
Tapani Pälli 34df5ebd77 mesa: mesa_bufferiv utility function for buffer objects
Patch adds new function 'mesa_bufferiv' and refactors existing
GetActiveUniformBlockiv and GetActiveAtomicCounterBufferiv to
use it.

corresponding Piglit tests:
   arb_uniform_buffer_object*
   arb_shader_atomic_counters*

(Many tests hit the corresponding queries.)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2015-04-16 07:55:57 +03:00
Tapani Pälli 4e7f134f89 mesa: refactor GetFragDataIndex
Use _mesa_program_resource_location_index to fetch index.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2015-04-16 07:55:57 +03:00
Tapani Pälli 62057c77f1 mesa: refactor GetFragDataLocation
Use program_resource_location to fetch location.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2015-04-16 07:55:57 +03:00
Tapani Pälli 3d1544cc91 mesa: refactor GetAttribLocation
Use program_resource_location to fetch location.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2015-04-16 07:55:57 +03:00
Tapani Pälli 26c0394a96 mesa: refactor GetActiveAttrib
Instead of iterating IR, retrieve required information through
the new program resource functions.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2015-04-16 07:55:57 +03:00
Tapani Pälli 41c230cd98 mesa: enable GL_ARB_program_interface_query extension
(and mark it as DONE in docs/GL3.txt + 10.6.0 relnotes)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2015-04-16 07:55:57 +03:00
Tapani Pälli 2ab8de2181 mesa: implementation of glGetProgramResourceiv
Patch adds required helper functions to shaderapi.h and
the actual implementation.

The property query functionality can be tested with tests for
following functions that are refactored by later patches:

   GetActiveAtomicCounterBufferiv
   GetActiveUniformBlockiv
   GetActiveUniformsiv

v2: code cleanup (Ilia Mirkin)
    add bufSize < 0 check and error out
    fix is_resource_referenced to return bool
    check for propCount and bufSize, fixes in buffer_prop

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2015-04-16 07:55:57 +03:00
Tapani Pälli 9367ade331 mesa: glGetProgramResourceLocationIndex
Patch adds required helper functions to shaderapi.h and
the actual implementation.

The added functionality can be tested by tests for following
functions that are refactored by later patches:

   GetFragDataIndex

v2: return -1 if output not referenced by fragment stage
    (Ilia Mirkin)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2015-04-16 07:55:56 +03:00
Tapani Pälli e0e4d77f01 mesa: glGetProgramResourceLocation
Patch adds required helper functions to shaderapi.h and
the actual implementation.

corresponding Piglit test:
   arb_program_interface_query-resource-location

The added functionality can be tested by tests for following
functions that are refactored by later patches:

   GetAttribLocation
   GetUniformLocation
   GetFragDataLocation

v2: code cleanup, changes to array element
    syntax checking (Ilia Mirkin)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2015-04-16 07:55:56 +03:00
Tapani Pälli 2a5a0d19d6 mesa: glGetProgramResourceName
Patch adds required helper functions to shaderapi.h and
the actual implementation.

Name generation copied from '_mesa_get_uniform_name' which can
be removed later by refactoring functions to use resource list.

The added functionality can be tested by tests for following
functions that are refactored by later patches:

   GetActiveUniformName
   GetActiveUniformBlockName

v2: no index for geometry shader inputs (Ilia Mirkin)
    add bufSize < 0 check and error out
    validate enum

corresponding Piglit test:
   arb_program_interface_query-getprogramresourcename

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.org>
2015-04-16 07:55:56 +03:00
Tapani Pälli 161f57f610 mesa: glGetProgramResourceIndex
Patch adds required helper functions to shaderapi.h and
the actual implementation.

v2: code cleanup (Ilia Mirkin)

corresponding Piglit test:
   arb_program_interface_query-getprogramresourceindex

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.org>
2015-04-16 07:55:56 +03:00
Tapani Pälli 4d3b98bc58 mesa: glGetProgramInterfaceiv
Patch adds required helper functions to shaderapi.h and
the actual implementation.

v2: code cleanup (Ilia Mirkin)
    fix array size fo xfb varyings
    validate programInterface and throw error

v3: put GL_MAX_NUM_COMPATIBLE_SUBROUTINES where
    it belongs

corresponding Piglit test:
   arb_program_interface_query-getprograminterfaceiv

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2015-04-16 07:55:56 +03:00
Tapani Pälli c796ce4108 mesa/glsl: build list of program resources during linking
Patch adds ProgramResourceList to gl_shader_program structure.
List contains references to active program resources and is
constructed during linking phase.

This list will be used by follow-up patches to implement hooks
for GL_ARB_program_interface_query. It can be also used to
implement any of the older shader program query APIs.

v2: code cleanups + note for SSBO and subroutines (Ilia Mirkin)
v3: code cleanups + assert(MESA_SHADER_STAGES < 8) (Martin Peres)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2015-04-16 07:55:35 +03:00
Tapani Pälli b297fc27aa glapi: add GL_ARB_program_interface_query skeleton
v2: update dispatch_sanity test (Jason Ekstrand)
    + small code cleanups

v3: xml and Makefile fixes (Ilia Mirkin, Matt Turner)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2015-04-16 07:30:12 +03:00
Tapani Pälli 993b9b6adb linker: fix varying linking if SSO program has only gs and fs
Previously linker did not take in to account case where one would
have only gs and fs (with SSO), patch adds the case by refactoring
code around assign_varying_locations. This makes sure locations for
gs get populated correctly.

This was found with some of the SSO subtests of Martin's upcoming
GetProgramInterfaceiv Piglit test which passes with the patch, no
Piglit regressions.

v2: code cleanups (Martin Peres)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2015-04-16 07:30:12 +03:00
Glenn Kennard 17d69862a9 r600g/sb: Skip empty ALU clause while scheduling
Fixes assert triggered by
ext_transform_feedback-intervening-read output use_gs
piglit test.

Signed-off-by: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-04-16 12:43:20 +10:00
Ian Romanick 4cf5ca5ca5 nir: Try commutative sources in CSE
Shader-db results:

GM45 NIR:
total instructions in shared programs: 4082044 -> 4081919 (-0.00%)
instructions in affected programs:     27609 -> 27484 (-0.45%)
helped:                                44

Iron Lake NIR:
total instructions in shared programs: 5678776 -> 5678646 (-0.00%)
instructions in affected programs:     27406 -> 27276 (-0.47%)
helped:                                45

Sandy Bridge NIR:
total instructions in shared programs: 7329995 -> 7329096 (-0.01%)
instructions in affected programs:     142035 -> 141136 (-0.63%)
helped:                                406
HURT:                                  19

Ivy Bridge NIR:
total instructions in shared programs: 6769314 -> 6768359 (-0.01%)
instructions in affected programs:     140820 -> 139865 (-0.68%)
helped:                                423
HURT:                                  2

Haswell NIR:
total instructions in shared programs: 6183693 -> 6183298 (-0.01%)
instructions in affected programs:     96538 -> 96143 (-0.41%)
helped:                                303
HURT:                                  4

Broadwell NIR:
total instructions in shared programs: 7501711 -> 7498170 (-0.05%)
instructions in affected programs:     266403 -> 262862 (-1.33%)
helped:                                705
HURT:                                  5
GAINED:                                4

v2: Rebase on top of Connor's fix.

v3: Convert the if-test for num_inputs == 2 to an assertion.  Suggested
by Jason after some comments / questions by Ilia.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> [v1]
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Cc: Connor Abbott <cwabbott0@gmail.com>
2015-04-15 18:15:59 -07:00
Ian Romanick 8957c9e448 glx: Create proper server dependency for GLX_EXT_create_context_es2_profile
Previously GLX_EXT_create_context_es2_profile was marked as "direct
only" so that it would not depend on server support.  Since the
extension required functions that are part of
GLX_ARB_create_context_profile, support for the EXT was disabled if the
ARB was not supported.

This was complete rubbish.  If the server supported the ARB but not the
EXT, sending a request with GLX_CONTEXT_ES2_PROFILE_BIT_EXT would result
in GLXBadProfileARB.

Instead of the misguided hack, make GLX_EXT_create_context_es2_profile
properly depend on server support by not marking it as "direct only."

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
2015-04-15 18:11:54 -07:00
Eric Anholt b229e6c7de vc4: Don't try to use color load/stores to blit across format changes.
We could potentially support the right combination of 8888 to 565, but the
important thing for now is to not mix up our orderings of 8888.  Fixes
fbo-copyteximage regressions.
2015-04-15 16:50:23 -07:00
Eric Anholt cff2e08c4c vc4: Don't try to use color load/stores to do depth/stencil blits.
Fixes regressions in fbo-generatemipmap-formats on depth/stencil (which
does blits to work around baselevel/lastlevel).
2015-04-15 16:50:23 -07:00
Eric Anholt 3a728d4dfb vc4: Update the shadow texture for public textures on every draw.
We don't know who else has written to it, so we'd better update it every
time.  This makes the gears spin in X again.
2015-04-15 16:50:23 -07:00
Eric Anholt bd957b1b79 vc4: Hook up VC4_DEBUG=perf to some useful printfs. 2015-04-15 16:50:22 -07:00
Brian Paul e1d095053b st/mesa: log shaders, GLSL info log with _mesa_log()
As with previous patch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2015-04-15 16:30:49 -06:00
Brian Paul 011cad806a mesa: log shaders, GLSL info log with _mesa_log()
Now, if we set MESA_LOG_FILE and MESA_GLSL=dump, all the shader info
will get logged to the named file instead of stderr.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2015-04-15 16:30:49 -06:00
Brian Paul 2926bbfb28 mesa: add _mesa_log(), _mesa_get_log_file() functions
_mesa_log() simply writes log information to stderr or MESA_LOG_FILE.
_mesa_get_log_file() returns the file handle to use for logging.

This will be used for shader dumping/logging instead of always printing
to stderr.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2015-04-15 16:30:49 -06:00
Brian Paul 11bfee4c3a tgsi: also dump label for TGSI_OPCODE_BGNSUB opcode
So we can see the label associated with subroutines.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2015-04-15 16:30:49 -06:00