Marek Olšák [Wed, 6 Aug 2014 11:20:41 +0000 (13:20 +0200)]
st/mesa: dump TGSI before calling into the driver
If the driver crashes in create_xx_shader, you want to see the shader.
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Jon TURNEY [Fri, 8 Aug 2014 19:13:18 +0000 (20:13 +0100)]
configure.ac: Use LIBS rather than LDFLAGS to add -ldl to dladdr check
ec8ebff "Check for dladdr()" erroneously uses LDFLAGS rather than LIBS to add
-ldl to the dladdr check.
Replace the workaround in
39a4cc4 of explicitly checking in libdl, with a more
correct approach of using LIBS.
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Pali Rohár <pali.rohar@gmail.com>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
Eric Anholt [Thu, 7 Aug 2014 00:25:31 +0000 (17:25 -0700)]
vc4: Add support for the COS instruction.
Eric Anholt [Wed, 6 Aug 2014 23:41:12 +0000 (16:41 -0700)]
vc4: Add support for the SIN instruction.
v2: Rebase on helpers.
Eric Anholt [Wed, 6 Aug 2014 19:34:00 +0000 (12:34 -0700)]
vc4: Fix register aliasing for packing of scaled coordinates.
Fixes glean fragProg1's "ADD test" and likely many others.
Eric Anholt [Wed, 6 Aug 2014 18:52:57 +0000 (11:52 -0700)]
vc4: Add some debug code for forcing fragment shader output color.
Eric Anholt [Tue, 5 Aug 2014 18:29:07 +0000 (11:29 -0700)]
u_primconvert: Copy min/max_index from the original primitive.
These values are supposed to be the minimum/maximum index values used to
read from the vertex buffers. This code either copies index values out of
the old IB (so, same min/max as the original draw call), or generates a
new IB (using index values between the start and the start + count of the
old array draw info, which just happens to be what min/max_index are set
to by st_draw.c).
We were incorrectly setting the max_index in the
converting-from-glDrawArrays case to the start vertex plus the number of
vertices generated in the new IB, which broke QUADS primitive conversion
on VC4 (where max_index really has to be correct, or the kernel might
reject your draw call due to buffer overflow).
Reviewed-by: Rob Clark <robclark@freedesktop.org> (from verbal description
of the patch)
Eric Anholt [Fri, 1 Aug 2014 22:45:41 +0000 (15:45 -0700)]
vc4: Fix using and emitting the 1/W from the vertex/coord shaders.
v2: Rebase on helpers change.
Eric Anholt [Fri, 1 Aug 2014 19:50:53 +0000 (12:50 -0700)]
vc4: Add support for swizzles of 32 bit float vertex attributes.
Some tests start working (useprogram-flushverts, for example) due to
getitng the right vertices now. Some that used to pass start failing with
memory overflow during binning, which is weird (glsl-fs-texture2drect).
And a couple stop rendering correctly (glsl-fs-bug25902).
v2: Move the attribute format setup in the key from after search time to
before the search.
v3: Fix reading of attributes other than position (I forgot to respect
attr and stored everything in inputs 0-3, i.e. position).
Eric Anholt [Tue, 5 Aug 2014 20:35:19 +0000 (13:35 -0700)]
vc4: Add support for the TGSI FRC opcode.
v2: Rebase on helpers.
Eric Anholt [Tue, 5 Aug 2014 20:33:50 +0000 (13:33 -0700)]
vc4: Add support for the TGSI TRUNC opcode.
v2: Rebase on helpers.
Eric Anholt [Thu, 17 Jul 2014 05:45:41 +0000 (22:45 -0700)]
vc4: Crank up the tile allocation BO size
This avoids a simulator assertion failure with glamor. I need to actually
support resize, though.
Eric Anholt [Thu, 17 Jul 2014 05:11:08 +0000 (22:11 -0700)]
vc4: Add support for multiple attributes
Eric Anholt [Wed, 16 Jul 2014 16:09:05 +0000 (09:09 -0700)]
vc4: Add more useful debug for the undefined-source case
We could get undefined sources in real programs from the wild, so we'll
need to turn off this debug eventually. But for now, using undefined
sources is typically me just mistyping something.
Eric Anholt [Wed, 16 Jul 2014 16:08:48 +0000 (09:08 -0700)]
vc4: Add support for the lit opcode.
v2: Fix how it was using the X channel for the real work of the opcode,
instead of Y. Fixes glean's LIT test.
v3: Rebase on the helpers.
Eric Anholt [Wed, 16 Jul 2014 15:44:50 +0000 (08:44 -0700)]
vc4: Add support for the POW opcode
v2: Rebase on helpers.
Eric Anholt [Tue, 15 Jul 2014 18:46:20 +0000 (11:46 -0700)]
vc4: Refactor uniform handling.
I wanted an easy way to set up new uniforms every time, so I could handle
texture-sampler-related uniforms.
v2: Rebase on helpers change.
Eric Anholt [Tue, 15 Jul 2014 18:04:41 +0000 (11:04 -0700)]
vc4: Add support for the LRP opcode.
v2: Rebase on helpers, cutting out most of the code in this change.
Eric Anholt [Fri, 4 Jul 2014 17:59:42 +0000 (10:59 -0700)]
vc4: Add copy propagation between temps.
We put in a bunch of extra MOVs for program outputs, and this can clean
those up. We should do uniforms, too, though.
v2: Fix missing flagging of progress when we actually optimize. Caught by
Aaron Watry.
Eric Anholt [Fri, 4 Jul 2014 16:48:23 +0000 (09:48 -0700)]
vc4: Add dead code elimination.
This cleans up a bunch of noise in the compiled coordinate shaders (since
we don't need the varying outputs), and also from writemasked instructions
with negated src operands.
Eric Anholt [Thu, 3 Jul 2014 20:18:49 +0000 (13:18 -0700)]
vc4: Add an initial pass of algebraic optimization.
There was a lot of extra noise in my piglit shader dumps because of silly
CMPs.
Eric Anholt [Wed, 16 Jul 2014 15:12:27 +0000 (08:12 -0700)]
vc4: Add support for CMP.
This took a couple of tries, and this is the squash of those attempts.
v2: Fix register file conflicts on the args in the
destination-is-accumulator case.
v3: Rebase on helper change and qir_inst4 change.
Eric Anholt [Fri, 4 Jul 2014 18:51:31 +0000 (11:51 -0700)]
vc4: Make scheduling of NOPs a separate step from QIR -> QPU translation.
This should also be used as a way to pair QIR instructions into QPU
instructions later.
Eric Anholt [Fri, 4 Jul 2014 16:38:44 +0000 (09:38 -0700)]
vc4: Add WIP support for varyings.
It doesn't do all the interpolation yet, but more tests can run now.
v2: Rebase on helpers.
Eric Anholt [Fri, 4 Jul 2014 17:23:50 +0000 (10:23 -0700)]
vc4: Use r3 instead of r5 for temps, since r5 only has 32 bits of storage
Reserving a whole accumulator for temps is awful in the first place, but
I'll fix that later.
Eric Anholt [Wed, 2 Jul 2014 17:43:50 +0000 (10:43 -0700)]
vc4: Fix emit of ABS
v2: Rebase on qir helpers.
Eric Anholt [Tue, 1 Jul 2014 21:42:42 +0000 (14:42 -0700)]
vc4: Add shader variant caching to handle FS output swizzle.
Eric Anholt [Tue, 1 Jul 2014 17:10:37 +0000 (10:10 -0700)]
vc4: Load the tile buffer before incrementally drawing.
We will want to occasionally disable this again when we do clear support.
v2: Squash with the previous commit (I accidentally committed at two
stages of writing the change)
Eric Anholt [Sat, 28 Jun 2014 21:59:18 +0000 (14:59 -0700)]
vc4: Don't reallocate the tile alloc/state bos every frame.
This was a problem for the simulator since we don't free memory back to
it, and it would soon just run out.
Eric Anholt [Sat, 28 Jun 2014 21:36:26 +0000 (14:36 -0700)]
vc4: Add VC4_DEBUG env option
v2: Fix an accidental deletion of some characters from the copyright
message (caught by Ilia Mirkin)
Eric Anholt [Sat, 28 Jun 2014 16:26:15 +0000 (17:26 +0100)]
vc4: Add support for SNE/SEQ/SGE/SLT.
Eric Anholt [Fri, 27 Jun 2014 15:32:03 +0000 (16:32 +0100)]
vc4: Use the user's actual first vertex attribute.
This is hardcoded to read it as RGBA32F so far, but starts to get more
tests working.
Eric Anholt [Fri, 18 Jul 2014 23:29:18 +0000 (16:29 -0700)]
vc4: Fix UBO allocation when no uniforms are used.
We do rely on a real BO getting allocated, so make sure we ask for a non-zero size.
Eric Anholt [Wed, 16 Jul 2014 15:25:22 +0000 (08:25 -0700)]
vc4: Add initial support for math opcodes
Eric Anholt [Thu, 26 Jun 2014 22:07:39 +0000 (23:07 +0100)]
vc4: Switch to actually generating vertex and fragment shader code from TGSI.
This introduces an IR (QIR, for QPU IR) to do optimization on. It's a
scalar, SSA IR in general. It looks like optimization is pretty easy this
way, though I haven't figured out if it's going to be good for our weird
register allocation or not (or if I want to reduce to basically QPU
instructions first), and I've got some problems with it having some
multi-QPU-instruction opcodes (SEQ and CMP, for example) which I probably
want to break down.
Of course, this commit mostly doesn't work, since many other things are
still hardwired, like the VBO data.
v2: Rewrite to use a bunch of helpers (qir_OPCODE) for emitting QIR
instructions into temporary values, and make qir_inst4 take the 4 args
separately instead of an array (all later callers wanted individual
args).
Eric Anholt [Tue, 24 Jun 2014 15:39:08 +0000 (16:39 +0100)]
vc4: Start converting the driver to use vertex shaders.
Note: This is the cutoff point where I switched from developing primarily
on the Pi to developing o the simulator. As a result, from this point on
the code is untested on the Pi (the kernel code I have currently wasn't
rendering anything at this commit, though the simulator renders
successfully, suggesting kernel bugs).
Eric Anholt [Thu, 19 Jun 2014 07:19:38 +0000 (08:19 +0100)]
vc4: Initial skeleton driver import.
This mostly just takes every draw call and turns it into a sequence of
commands that clear the FBO and draw a single shaded triangle to it,
regardless of the actual input vertices or shaders. I copied the initial
driver skeleton mostly from freedreno, and I've preserved Rob Clark's
copyright for those. I also based my initial hardcoded shaders and
command lists on Scott Mansell (phire)'s "hackdriver" project, though the
bit patterns of the shaders emitted end up being different.
v2: Rebase on gallium megadrivers changes.
v3: Rebase on PIPE_SHADER_CAP_MAX_CONSTS change.
v4: Rely on simpenrose actually being installed when building for
simulation.
v5: Add more header duplicate-include guards.
v6: Apply Emil's review (protection against vc4 sim and ilo at the same
time, and dropping the dricommon drm bits) and fix a copyright header
(thanks, Roland)
Roland Scheidegger [Fri, 8 Aug 2014 16:17:18 +0000 (18:17 +0200)]
draw: (trivial) use information about gs being present from variant key
This is a purely cosmetic change.
Reviewed-by: Brian Paul <brianp@vmware.com>
Roland Scheidegger [Sat, 9 Aug 2014 01:51:23 +0000 (03:51 +0200)]
draw: don't use clipvertex output if user plane clipping is disabled
The non-llvm path made sure that both clip and pre_clip_pos point to the data
output by position, not clipvertex, if user based clipping is disabled.
However, the llvm path did not, which apparently led to failures if
gl_ClipVertex was written but user plane clipping not enabled (bug 80183).
Why I have no idea really, but just make it match the non-llvm behavior...
Reviewed-by: Brian Paul <brianp@vmware.com>
Chris Forbes [Sun, 3 Aug 2014 09:40:00 +0000 (21:40 +1200)]
i965: Get rid of backend_instruction::sampler
The generators no longer use this.
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Chris Forbes [Mon, 4 Aug 2014 07:41:03 +0000 (19:41 +1200)]
i965/vec4/Gen8: Use src1 for sampler_index instead of ->sampler field
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Chris Forbes [Mon, 4 Aug 2014 07:41:03 +0000 (19:41 +1200)]
i965/vec4/Gen4-7: Use src1 for sampler_index instead of ->sampler field
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Chris Forbes [Mon, 4 Aug 2014 07:37:58 +0000 (19:37 +1200)]
i965/vec4: Pass sampler index in src1 for texture ops
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Chris Forbes [Sun, 3 Aug 2014 10:01:11 +0000 (22:01 +1200)]
i965/vec4: Collect all emits of texture ops into one place
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Chris Forbes [Sun, 3 Aug 2014 09:23:31 +0000 (21:23 +1200)]
i965/fs/Gen8: Pass sampler_index to generate_tex
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Chris Forbes [Sun, 3 Aug 2014 09:23:31 +0000 (21:23 +1200)]
i965/fs/Gen4-7: Pass sampler_index to generate_tex
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Chris Forbes [Sun, 3 Aug 2014 09:39:13 +0000 (21:39 +1200)]
i965/blorp: Put sampler index in src1 of texture ops
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Chris Forbes [Sun, 3 Aug 2014 09:13:02 +0000 (21:13 +1200)]
i965/fs: pass sampler as src1 of texture op
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Chris Forbes [Sun, 3 Aug 2014 08:48:20 +0000 (20:48 +1200)]
i965/fs: Collect all emits of texture ops for Gen5/6 into one place
Reduces duplication, and will do so even more when we change the sampler
plumbing.
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Chris Forbes [Sun, 3 Aug 2014 08:48:20 +0000 (20:48 +1200)]
i965/fs: Collect all emits of texture ops for Gen4 into one place
Reduces duplication, and will do so even more when we change the sampler
plumbing.
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Pali Rohár [Fri, 8 Aug 2014 17:31:07 +0000 (18:31 +0100)]
configure: check for dladdr via AC_CHECK_FUNC/AC_CHECK_LIB
Use both macros as in some cases using AC_CHECK_FUNCS alone may fail.
Thus HAVE_DLADDR will not be defined, and as a result most of the code
in megadriver_stub.c will not be compiled. Breaking the backwards
compatibility between older libGL/xserver(s) and DRI megadrivers.
Cc: Jon TURNEY <jon.turney@dronecode.org.uk>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
[Emil Velikov] Commit message.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Emil Velikov [Tue, 5 Aug 2014 14:31:54 +0000 (15:31 +0100)]
util: remove ralloc_test
The tests in an empty stub, which we're currently building twice.
If anyone is interested in expanding it (adding actual tests) they
can always bring it back.
Suggested-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Darius Goad [Thu, 7 Aug 2014 20:51:48 +0000 (22:51 +0200)]
gallivm: Handle MSAA textures in emit_fetch_texels
This support is preliminary due to the fact that MSAA is not
actually implemented.
However, this patch does fix the piglit test:
spec/!OpenGL 3.2/glsl-resource-not-bound 2DMS (bug #79740).
(v2 RS: don't emit 4th coord as explicit lod)
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Roland Scheidegger [Thu, 7 Aug 2014 18:34:17 +0000 (20:34 +0200)]
draw: hack around weird primitive id input in gs
The distinction between system values and ordinary inputs is not very
obvious in gallium - further fueled by the fact that they use the same
semantic names.
Still, if there's any value which imho really is a system value, it's the
primitive id input into the gs (while earlier (tessleation) stages could read
it, it is _always_ generated by the system). For some odd reason though (which
I'd classify as a bug but seems too complicated to fix) the glsl compiler in
mesa treats this as an ordinary varying, and everything else after that
(including the state tracker and other drivers) just go along with that.
But input fetching in gs for llvm based draw was definitely limited to the
ordinary (2-dimensional) inputs so only worked with other state trackers,
the code was also additionally relying on tgsi_scan_shader filling
uses_primid correctly which did not happen neither (would set it only for
all stages if it was a system value, but only set it for the fragment shader
if it was an input value).
This fixes piglit glsl-1.50-geometry-primitive-id-restart and primitive-id-in
in llvmpipe.
Reviewed-by: Brian Paul <brianp@vmware.com>
Roland Scheidegger [Thu, 7 Aug 2014 16:37:42 +0000 (18:37 +0200)]
draw: fix prim id float cast for non-llvm path
These values are always uints, casting them to floats does no good.
Fixes piglit glsl-1.50-geometry-primitive-id-restart tests for softpipe.
Reviewed-by: Brian Paul <brianp@vmware.com>
Bruno Jiménez [Thu, 7 Aug 2014 14:34:53 +0000 (16:34 +0200)]
clover: Add support for CL_MAP_WRITE_INVALIDATE_REGION
OpenCL 1.2 CL_MAP_WRITE_INVALIDATE_REGION sounds a lot like
PIPE_TRANSFER_DISCARD_RANGE:
From OpenCL 1.2 spec:
The contents of the region being mapped are to be discarded.
From p_defines.h:
Discards the memory within the mapped region.
v2: Move the code for validating flags to the front-end as
suggested by Francisco Jerez
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Chia-I Wu [Fri, 8 Aug 2014 06:52:15 +0000 (14:52 +0800)]
ilo: break down the format table
The PRMs no longer have a single table for format capabilities. Multiple
tables take up less space, and are easier to maintain.
Encode typed write information while at it.
Kenneth Graunke [Mon, 4 Aug 2014 06:54:22 +0000 (23:54 -0700)]
i965: Emit a performance warning on conditional rendering.
We have a CPU-side implementation of conditional rendering; it really
should be done on the GPU. It's not necessarily that hard, but nobody
has gotten to fixing it yet.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Kenneth Graunke [Mon, 4 Aug 2014 07:06:05 +0000 (00:06 -0700)]
i965: Set ExecSize to 16 for loop instructions in SIMD16 shaders.
Previously, we explicitly set the execution size to BRW_EXECUTE_8 and
disabled compression for loop instructions. I can't imagine how this
could be correct in SIMD16 mode.
Looking at the history, it appears that this code has used BRW_EXECUTE_8
since 2007, when we had a SIMD8 backend that supported control flow and
a separate SIMD16 backend that didn't. Presumably, when we added SIMD16
support for shaders with control flow, we simply neglected to update it.
Note that Gen4-5 don't support SIMD16 on shaders with control flow.
This might be a candidate for stable, but would need to be rewritten
completely due to the brw_inst API changes in master.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Kenneth Graunke [Mon, 4 Aug 2014 21:26:26 +0000 (14:26 -0700)]
i965/eu: Merge brw_CONT and gen6_CONT.
The only difference is setting PopCount on Gen4-5.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Kenneth Graunke [Mon, 4 Aug 2014 21:07:27 +0000 (14:07 -0700)]
i965/eu: Drop redundant brw_set_src0/brw_set_dest from gen6_CONT.
We shouldn't need to set them, then set them differently.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Juha-Pekka Heikkila [Thu, 7 Aug 2014 12:58:26 +0000 (15:58 +0300)]
util: add src/util/format_srgb.c to .gitignore
format_srgb.c is generated by format_srgb.py python script, having
format_srgb.c in git ignore list will silence git complaints about
untracked file.
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Ian Romanick [Sat, 2 Aug 2014 01:53:09 +0000 (18:53 -0700)]
mesa: Fold _mesa_uniform_merge_location_offset into its only caller
Also delete the comment before that function. Everything in that
comment was either stale, wrong, or captured elsewhere.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Ian Romanick [Sat, 2 Aug 2014 01:51:30 +0000 (18:51 -0700)]
mesa: Fold _mesa_uniform_split_location_offset into its only caller
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Ian Romanick [Sat, 2 Aug 2014 01:50:07 +0000 (18:50 -0700)]
glsl_to_tgsi: Delete unused function set_uniform_initializer
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Ian Romanick [Sat, 2 Aug 2014 01:39:21 +0000 (18:39 -0700)]
mesa: Use MAX2 to calculate maximum uniform element
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Ian Romanick [Sat, 2 Aug 2014 01:37:58 +0000 (18:37 -0700)]
mesa: Have validate_uniform_parameters return the gl_uniform_storage pointer
This simplifies all the callers, and it enables the removal of one of
the function parameters.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Carl Worth [Mon, 28 Jul 2014 19:26:06 +0000 (12:26 -0700)]
glsl/glcpp: Rename one test to avoid a duplicate test number
With two tests both numbered 118, there was a confusing off-by-two difference
between the last test number and the total number of tests (as reported by
glcpp-test).
With this rename, there's only an off-by-one difference left, (which is easy
to understand given the zero-based test numbering).
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Carl Worth [Thu, 3 Jul 2014 21:16:07 +0000 (14:16 -0700)]
glsl/glcpp: Fix handling of commas that result from macro expansion
Here is some additional stress testing of nested macros where the expansion
of macros involves commas, (and whether those commas are interpreted as
argument separators or not in subsequent function-like macro calls).
Credit to the GCC documentation that directed my attention toward this issue:
https://gcc.gnu.org/onlinedocs/gcc-3.2/cpp/Argument-Prescan.html
Fixing the bug required only removing code from glcpp. When first testing the
details of expansions involving commas, I had come to the mistaken conclusion
that an expanded comma should never be treated as an argument separator, (so
had introduced the rather ugly COMMA_FINAL token to represent this).
In fact, an expanded comma should be treated as a separator, (as tested here),
and this treatment can be avoided by judicious use of parentheses (as also
tested here).
With this simple removal of the COMMA_FINAL token, the behavior of glcpp
matches that of gcc's preprocessor for all of these hairy cases.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Carl Worth [Thu, 3 Jul 2014 20:25:47 +0000 (13:25 -0700)]
glsl/glcpp: Integrate recent glcpp-test-cr-lf test into "make check"
Beyond just listing this in the TESTS variable in Makefile.am, only minor
changes were needed to make this work. The primary issue is that the build
system runs the test script from a different directory than the script
itself. So we have to use the $srcdir variable to find the test input files.
Using $srcdir in this way also ensures that this test works when using an
out-of-tree build.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Carl Worth [Thu, 3 Jul 2014 05:58:57 +0000 (22:58 -0700)]
glsl/glcpp: Fix glcpp-test to correctly extract test-specific arguments
The (optional) test-specific command-line arguments to be passed to glcpp are
embedded within the source files of some tests, and glcpp-test uses grep to
extract them.
Of course, grep is line-based and looks for the native line-separator to
determine line boundaries. So, for files using non-native line separators,
grep was getting quite confused and passing bogus arguments to glcpp.
Fix this by canonical-izing the line separators in the source file prior to
using grep.
With this commit, the glcpp-test-cr-lf tests pass entirely:
\r: 143/143 tests pass
\r\n: 143/143 tests pass
\n\r: 143/143 tests pass
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Carl Worth [Thu, 3 Jul 2014 05:49:58 +0000 (22:49 -0700)]
glsl/glcpp: Fix line-continuation code to handle multiple newline flavors
Sometimes the newline separator is a single character, and sometimes it is two
characters. Before we can fold away and line-continuation backslashes, we
identify the flavor of line separator that is in use.
With this identified, we then correctly search for backslashes followed
immediately by the first character of the line separator.
Also, when re-inserting newlines to replace collapsed newlines, we carefully
insert newlines of the same flavor.
With this commit, almost all remaining test are fixed as tested by
glcpp-test-cr-lf:
\r: 142/143 tests pass
\r\n: 142/143 tests pass
\n\r: 143/143 tests pass
(The only remaining failures have nothing to do with the actual pre-processor
code, but are due to a bug in the way the test suite uses grep to try to
extract test-specific command-line options from the source files.)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Carl Worth [Thu, 3 Jul 2014 05:20:43 +0000 (22:20 -0700)]
glsl/glcpp: Don't include any newline characters in #error token
Some tests were failing because the message printed by #error was including a
'\r' character from the source file in its output.
This is easily avoided by fixing the regular expression for #error to never
include any of the possible newline characters, (neither '\r' nor '\n').
With this commit 2 tests are fixed for each of the '\r' and '\r\n' cases.
Current results after the commit are:
\r: 137/143 tests pass
\r\n 142/143 tests pass
\n\r: 139/143 tests pass
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Carl Worth [Tue, 1 Jul 2014 23:31:07 +0000 (16:31 -0700)]
glsl/glcpp: Treat CR+LF pair as a single newline
The GLSL specification says that either carriage-return, line-feed, or both
together can be used to terminate lines. Further, it says that when used
together, the pair of terminators shall be interpreted as a single line.
This final requirement has not been respected by glcpp up until now, (it has
been emitting two newlines for every CR+LF pair).
Here, we fix the lexer by using a regular expression for NEWLINE that eats
up both "\r\n" (or even "\n\r") if possible before also considering a single
'\n' or a single '\r' as a line terminator.
Before this commit, the test results are as follows:
\r: 135/143 tests pass
\r\n: 4/143 tests pass
\n\r: 4/143 tests pass
After this commit, the test results are as follows:
\r: 135/143 tests pass
\r\n: 140/143 tests pass
\n\r: 139/143 tests pass
So, obviously, a dramatic improvement.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Carl Worth [Thu, 3 Jul 2014 00:14:51 +0000 (17:14 -0700)]
glsl/glcpp: Add test script for testing various line-termination characters
The GLSL specification has a very broad definition of what is a
newline. Namely, it can be the carriage-return character, '\r', the newline
character, '\n', or any combination of the two, (though in combination, the
two are treated as a single newline).
Here, we add a new test-runner, glcpp-test-cr-lf, that, for each possible
line-termination combination, runs through the existing test suite with all
source files modified to use those line-termination characters. Instead of
using the .expected files for this, this script assumes that the regular test
suite has been run already and expects the output to match the .out
files. This avoids getting 4 test failures for any one bug, and instead will
hopefully only report bugs actually related to the line-termination
characters.
The new testing is not yet integrated into "make check". For that, some
munging of the testdir option will be necessary, (to support "make check" with
out-of-tree builds). For now, the scripts can just be run directly by hand.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Carl Worth [Wed, 2 Jul 2014 19:52:33 +0000 (12:52 -0700)]
glsl/glcpp: Fix for macros that expand to include "defined" operators
Prior to this commit, the following snippet would trigger an error in glcpp:
#define FOO defined BAR
#if FOO
#endif
The problem was that support for the "defined" operator was implemented within
the grammar, (where the parser was parsing the tokens of the condition
itself). But what is required is to interpret the "defined" operator that
results after macro expansion is performed.
I could not find any fix for this case by modifying the grammar alone. The
difficulty is that outside of the grammar we already have a recursive function
that performs macro expansion (_glcpp_parser_expand_token_list) and that
function itself must be augmented to be made aware of the semantics of the
"defined" operator.
The reason we can't simply handle "defined" outside of the recursive expansion
function is that not only must we scan for any "defined" operators in the
original condition (before any macro expansion occurs); but at each level of
the recursive expansion, we must again scan the list of tokens resulting from
expansion and handle "defined" before entering the next level of recursion to
further expand macros.
And of course, all of this is context dependent. The evaluation of "defined"
operators must only happen when we are handling preprocessor conditionals,
(#if and #elif) and not when performing any other expansion, (such as in the
main body).
To implement this, we add a new "mode" parameter to all of the expansion
functions to specify whether resulting DEFINED tokens should be evaluated or
ignored.
One side benefit of this change is that an ugly wart in the grammar is
removed. We previously had "conditional_token" and "conditional_tokens"
productions that were basically copies of "pp_token" and "pp_tokens" but with
added productions for the various forms of DEFINED operators. With the new
code here, those ugly copy-and-paste productions are eliminated from the
grammar.
A new "make check" test is added to stress-test the code here.
This commit fixes the following Khronos GLES3 CTS tests:
conditional_inclusion.basic_2_vertex
conditional_inclusion.basic_2_fragment
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Carl Worth [Wed, 2 Jul 2014 17:32:46 +0000 (10:32 -0700)]
glsl/glcpp: Swallow empty #pragma directives.
Previously, we were passing these through, just like any other pragma. But the
downstream compiler was tripping up on them. It seems easier to swallow these
in the preprocessor and not pass them on at all rather than fixing the
downstream compiler.
This fixes the following Khronos GLES3 CTS tests:
preprocessor.pragmas.pragma_vertex
preprocessor.pragmas.pragma_fragment
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Carl Worth [Wed, 2 Jul 2014 17:27:50 +0000 (10:27 -0700)]
glsl/glcpp: Fix #pragma to not over-increment the line-number count
Previously, the #pragma directive was swallowing an entire line, (including
the final newline). At that time it was appropriate for it to increment the
line count.
More recently, our handling of #pragma changed to not include the newline. But
the code to increment yylineno stuck around. This was causing __LINE__ to be
increased by one more than desired for every #pragma.
Remove the bogus, extra increment, and add a test for this case.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Carl Worth [Wed, 2 Jul 2014 01:00:41 +0000 (18:00 -0700)]
glsl/glcpp: Add testing for null directives with spaces and comments
This new "make check" test stresses out the support from the last two commits,
(to esnure that '#' is correctly interpreted as the null directives,
regardless of any whitespace or comments on the same line).
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Carl Worth [Wed, 2 Jul 2014 00:58:37 +0000 (17:58 -0700)]
glsl/glcpp: Fix NULL directives when followed by a single-line comment
This is the fix for the following line:
# // comment to ignore here
According to the translation-phase rules, the comment should be removed before
the preprocessor looks to interpret the null directive.
So in our implementation we must explicitly look for single-line comments in
the <HASH> start condition as well.
This commit fixes the following Khronos GLES3 CTS tests:
null_directive_vertex
null_directive_fragment
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Carl Worth [Wed, 2 Jul 2014 00:49:45 +0000 (17:49 -0700)]
glsl/glcpp: Add tests for #define followed by comments
This simply tests the previous commit, (that #define followed by a comment
will still generate the expected "#define without macro name" error message).
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Carl Worth [Wed, 2 Jul 2014 00:47:29 +0000 (17:47 -0700)]
glsl/glcpp: Allow single-line comments immediately after #define
We were already correctly supporting single-line comments in case like:
#define FOO bar // comment here...
The new support added here is simply for the none-too-useful:
#define // comment instead of macro name
With this commit, this line will now give the expected "#define without
macro name" error message instead of the lexer just going off into the
weeds.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Carl Worth [Wed, 2 Jul 2014 00:44:55 +0000 (17:44 -0700)]
glsl/glcpp: Add test for "#define without macro name"
This ensures that the previous commit indeed generates the expected error
message when a "#define" directive is not followed by anything except for a
newline.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Carl Worth [Wed, 2 Jul 2014 00:40:28 +0000 (17:40 -0700)]
glsl/glcpp: Add explicit error for "#define without macro name"
Previously, glcpp would emit an error like this if <EOF> happened to occur
immediately after the "#define", but in general would just get confused,
(leading to un-helpful error messages).
To fix things to generate a clean error message, we do a few things:
1. Don't require horizontal whitespace immediately after #define
2. Add a production for the error case, (DEFINE_TOKEN followed
immediately by a NEWLINE token).
3. Make the lexer reset to the <INITIAL> state after every NEWLINE.
This 3rd point prevents the lexer from getting so confused and generating
further spurious errors in the file because it was stuck in the <DEFINE> start
condition.
We also drop the similar error message from the <EOF> rule since the
newly-added rule will have already printed the error message.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Matt Turner [Thu, 7 Aug 2014 04:11:50 +0000 (21:11 -0700)]
docs: List GL+GLSL versions as parts of a whole.
Listing the GLSL version as an individual component of a GL version,
separate from the extensions isn't really right. The GLSL changes are
(almost?) entirely comprised of changes listed in the extensions.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Matt Turner [Thu, 7 Aug 2014 02:58:34 +0000 (19:58 -0700)]
i965/vec4: Remove unused emit_bool_comparison method.
Apparently unused since it was added in commit
af3c9803.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Matt Turner [Wed, 6 Aug 2014 23:13:26 +0000 (16:13 -0700)]
mesa: Drop USE_IEEE define.
I think OpenVMS was the only platform that Mesa ran on that used a
non-IEEE representation for floats. We removed OpenVMS support a while
back, and this should alleviate the need to continue updating the
this-platform-uses-IEEE list.
The one bit of this patch that needs review is the IS_INF_OR_NAN,
because I'm not sure if MSVC supports isfinite.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82268
Reviewed-by: Brian Paul <brianp@vmware.com>
Ian Romanick [Wed, 18 Jun 2014 22:48:36 +0000 (15:48 -0700)]
mesa: Group gl_system_value values by the stage where they exist
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Ian Romanick [Wed, 18 Jun 2014 22:43:32 +0000 (15:43 -0700)]
glsl_to_tgsi: Assert that the _mesa_sysval_to_semantic mapping is correct
Future patches will rearrange the values in gl_system_value, and I want
to catch errors. Designated initializers would make all of this
unnecessary.
v2: Don't use STATIC_ASSERT. Not only does it not work, but GCC doesn't
tell you that it's not going to work. Thanks for nothing!
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Ian Romanick [Wed, 18 Jun 2014 22:41:44 +0000 (15:41 -0700)]
mesa/st: Only one copy of mesa_sysval_to_semantic
Future patches will necessitate changes to the table, and I only want to
update one.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Ian Romanick [Wed, 18 Jun 2014 22:22:25 +0000 (15:22 -0700)]
glsl_to_tgsi: Constify mesa_sysval_to_semantic
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Kenneth Graunke [Wed, 6 Aug 2014 06:57:17 +0000 (23:57 -0700)]
i965/clip: Fix brw_clip_unfilled.c/compute_offset's assembly.
Due to the destination register width of 1 or 2, these instructions get
ExecSize 1 or 2. But dir and offset (used as src0) are both registers
of width 4, violating the execsize >= width assertion.
I honestly don't think this could have ever worked.
Fixes Piglit's polygon-offset and polygon-mode-offset tests on Gen4-5.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70441
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Tapani Pälli [Wed, 30 Jul 2014 10:02:52 +0000 (13:02 +0300)]
glsl: support unsigned increment in ir_loop controls
Current version can create ir_expression where operands have
different base type, patch adds support for unsigned type.
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
https://bugs.freedesktop.org/show_bug.cgi?id=80880
Jason Ekstrand [Wed, 6 Aug 2014 17:29:40 +0000 (10:29 -0700)]
mesa/formats: Fix the size of ETC2_SRGB8_PUNCHTHROUGH_ALPHA1
Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Jason Ekstrand [Wed, 6 Aug 2014 17:27:58 +0000 (10:27 -0700)]
mesa/formats: Use the correct swizzle parameter for the 11-bit EAC formats
Red-only formats should be x001 and RG formats should be xy01.
Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Roland Scheidegger [Wed, 6 Aug 2014 01:40:31 +0000 (03:40 +0200)]
draw: fix clipvertex trouble if position comes from gs
If the vertex shader has no position but the gs has, the clipvertex output
was -1 (because it's the same as vs position in this case if there's no
explicit clipvertex output). This caused crashes (or assertion failures) in
clipping since in the end position (which came from gs) was different from
cv (-1) and we then tried to use the bogus cv input.
Rather than just test for -1 cv value in clipping, make it explicitly return
the position output of the gs instead which seems cleaner (since we really
don't want to use the clipvertex value from the vs (it could be a valid value
in the (unsupported) case of vs writing clipvertex but still using a gs).
This fixes piglit shader_runner clip-distance-out-values.shader_test.
Reviewed-by: Zack Rusin <zackr@vmware.com>
Roland Scheidegger [Tue, 5 Aug 2014 23:07:18 +0000 (01:07 +0200)]
draw: don't run pipeline stages when gs has no position output
The clip stage may crash if there's no position output, for this reason
code was added to avoid running the pipeline stages in this case
(
c7c7186045ec617c53f7899280cbe12e59503e4d). However, this failed to actually
work when there was a geometry shader, since unlike the vertex shader it did
not initialize the position output to -1, hence the code trying to detect
this didn't trigger. So simply initialize the position output to -1 just like
the vs does.
This fixes piglit glsl-1.50-transform-feedback-type-and-size (segfault->pass).
clip-distance-out-values.shader_test goes from segfault to assertion failure,
suggesting more fixes are needed, no other piglit changes.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
Vinson Lee [Sun, 3 Aug 2014 20:00:32 +0000 (13:00 -0700)]
dri/xmlconfig: s/uint/unsigned int/
This patch fixes this build error on Mac OS X.
./xmlconfig.h:61:5: error: unknown type name 'uint'; did you mean 'int'?
uint nRanges; /**< \brief Number of ranges */
^~~~
int
./xmlconfig.h:79:5: error: unknown type name 'uint'; did you mean 'int'?
uint tableSize;
^~~~
int
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Brian Paul [Tue, 5 Aug 2014 19:07:42 +0000 (13:07 -0600)]
mesa include stdint.h in formats.h
To get uint8_t type, to fix MSVC build.
Trivial.
Jason Ekstrand [Thu, 17 Jul 2014 05:18:53 +0000 (22:18 -0700)]
mesa/texstore: Add a generic rgba integer texture upload path
Again, we delete a lot of functions that aren't really doing anything
interesting anymore.
v2: Comment the texstore_rgba_integer function
Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>