Commit Graph

58505 Commits

Author SHA1 Message Date
Vinson Lee fd66a85f6b mesa: Ensure gl_sync_object is fully initialized.
278372b47e added the uninitialized pointer
field gl_sync_object:Label. A free of this pointer, added in commit
6d8dd59cf5, resulted in a crash.

This patch fixes piglit ARB_sync regressions with swrast introduced by
6d8dd59cf5.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-09-10 10:54:26 -07:00
Vinson Lee 49f2ba2cb0 radeonsi: Add parentheses around '|' operands.
Fixes GCC parentheses warning.

r600_texture.c: In function 'si_texture_create':
r600_texture.c:518:20: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]
      !(templ->bind & PIPE_BIND_CURSOR | PIPE_BIND_LINEAR)) {
                    ^

Fixes "Wrong operator used" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2013-09-10 10:44:09 -07:00
Vinson Lee d93e23ba25 util: Fix unmatched parenthesis.
Fixes MSVC build error introduced with commit
923d346714.

src\gallium\auxiliary\util\u_cpu_detect.c(286) : fatal error C1012: unmatched parenthesis : missing '('

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
2013-09-10 10:33:47 -07:00
Brian Paul 923d346714 util: don't use _fxsave() with MSVC 2010 or older
And update _MSC_VER comments in p_config.h

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2013-09-10 11:01:37 -06:00
Vinson Lee 787ac4207e glsl: Add missing va_end in builtin_builder::add_function.
Fixes "Missing varargs init or cleanup" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-09-10 09:52:03 -07:00
Vinson Lee 118cdd1d3f glsl: Initialize builtin_builder member variables.
Fixes "Uninitialized pointer field" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-09-10 09:49:02 -07:00
Brian Paul 395b941086 glsl: fix variadic macro for MSVC
MSVC doesn't accept the rest... syntax.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-09-09 17:52:44 -06:00
Brian Paul 1ddb56d160 glsl: remove struct keyword from ir_variable declarations
To silence MSVC warnings.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-09-09 17:52:44 -06:00
Kenneth Graunke 0bb3cd8090 Revert "i965/vec4: Only zero out unused message components when there are any."
This reverts commit 6c3db2167c, which I
accidentally pushed along with other code.  A better version of the fix
will be committed later.
2013-09-09 15:33:16 -07:00
Matt Turner 89f5f675ad i965: Allow immediates to be folded into logical and shift instructions.
These instructions will be used with immediate arguments in the upcoming
ldexp lowering pass and frexp implementation.

v2: Add vec4 support as well.
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 15:01:08 -07:00
Matt Turner d83221c2d3 i965: Enable MESA_shader_integer_mix.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-09-09 15:01:08 -07:00
Matt Turner 56fff7063d glsl: Implement MESA_shader_integer_mix extension.
Because why doesn't GLSL allow you to do this already?

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-09-09 15:01:08 -07:00
Matt Turner fd183fa02c glsl: Use conditional-select in mix().
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-09-09 15:01:08 -07:00
Matt Turner 8477262958 i965: Add support for ir_triop_csel.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-09-09 15:01:08 -07:00
Matt Turner 7aaa38728f glsl: Add conditional-select IR.
It's a ?: that operates per-component on vectors. Will be used in
upcoming lowering pass for ldexp and the implementation of frexp.

 csel(selector, a, b):
   per-component result = selector ? a : b

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-09-09 15:01:08 -07:00
Kenneth Graunke 60850b7b9f glsl: Rename ir_function_signature::builtin_info to builtin_avail.
builtin_info was originally going to be a structure containing a bunch
of information, but after various rewrites, it turned into a boolean
availability predicate.

builtin_avail is a better name than builtin_info, since it doesn't
store any information other than availability.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 14:54:46 -07:00
Kenneth Graunke 260965b7a7 build: Delete cross-compiling macros.
Now that builtin_compiler is gone, nothing uses these.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 14:42:33 -07:00
Kenneth Graunke b973b44a4d glsl: Add missing type inference for ir_binop_bfm.
Matt noticed that this was missing.  Nothing uses this currently.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 14:42:33 -07:00
Kenneth Graunke 722eff674b glsl: Delete old built-in function generation code.
None of this is used anymore.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 14:42:33 -07:00
Kenneth Graunke c845140a20 glsl: Remove builtin_compiler from the build system.
We don't actually use anything from builtin_function.cpp, so we don't
need to generate it anymore.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 14:42:33 -07:00
Kenneth Graunke 76d2f73643 glsl: Switch to the new built-in function module.
All built-ins are now handled by the new code; the old system is dead.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 14:42:33 -07:00
Kenneth Graunke 7ddc312c1b glsl: Write a new built-in function module.
This creates a new replacement for the existing built-in function code.
The new module lives in builtin_functions.cpp (not builtin_function.cpp)
and exists in parallel with the existing system.  It isn't used yet.

The new built-in function code takes a significantly different approach:

Instead of implementing built-ins via printed IR, build time scripts,
and run time parsing, we now implement them directly in C++, using
ir_builder.  This translates to faster load times, and a much less
complex build system.

It also takes a different approach to built-in availability: each
signature now stores a boolean predicate, which makes it easy to
construct arbitrary expressions based on _mesa_glsl_parse_state's
fields.  This is much more flexible than the old system, and also
easier to use.

Built-ins are also now stored in a single gl_shader object, rather
than being spread out across a number of shaders that need to be linked.
When searching for a matching prototype, we simply consult the
availability predicate.  This also simplifies the code.

v2: Incorporate Matt Turner's feedback: use the new fma() function rather
    than expr().  Don't expose textureQueryLOD() in GLSL 4.00 (since it
    was renamed to textureQueryLod()).  Also correct some #undefs.
v3: Incorporate Paul Berry's feedback: rename legacy to compatibility;
    add comments to explain a few things; fix uvec availability; include
    shaderobj.h instead of repeating the _mesa_new_shader prototype.
v4: Fix lack of TEX_PROJECT on textureProjGrad[Offset] (caught by oglc).
    Add an out_var convenience function (more feedback by Matt Turner).
v5: Rework availability predicates for Lod functions.  They were broken.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Enthusiastically-acked-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 14:42:18 -07:00
Kenneth Graunke 8d90328eb3 glsl: Add optional parameters to the ir_factory constructor.
Each ir_factory needs an instruction list and memory context in order to
be useful.  Rather than creating an object and manually assigning these,
we can just use optional parameters in the constructor.

This makes it possible to create a ready-to-use factory in one line:

   ir_factory body(&sig->body, mem_ctx);

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 11:52:22 -07:00
Kenneth Graunke 666df56551 glsl: Add IR builder shortcuts for a bunch of random opcodes.
Adding new convenience emitters makes it easier to generate IR involving
these opcodes.

bitfield_insert is particularly useful, since there is no expr() for
quadops.

v2: Add fma() and rename lrp() operands to x/y/a to match the GLSL
    specification (suggested by Matt Turner).  Fix whitespace issues.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 11:52:22 -07:00
Kenneth Graunke 1a6c0efa11 glsl: Expose IR builder support for arbitrary swizzling.
IR builder already offers a lot of swizzling functions, such as
swizzle_xxxx, swizzle_z, or swizzle_for_size.

The swizzle_xxxx style is convenient if you statically know which
components you want.  swizzle_for_size is great if you want to select
the first few components.  However, if you want to select components
based on, say, a loop counter, none of those are sufficient.

IR builder actually already had support for arbitrary swizzling, but
didn't expose it.  This patch exposes that API.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 11:52:22 -07:00
Kenneth Graunke 202238824b glsl: Add a new ir_builder::dotlike() function.
dotlike() uses ir_binop_mul for scalars, and ir_binop_dot for vectors.

When generating built-in functions, we often want to use regular
multiply for scalar signatures, and dot() for vector signatures.
ir_binop_dot only works on vectors, so we have to switch opcodes,
even if the code is otherwise identical.  dotlike() makes this easy.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 11:52:22 -07:00
Kenneth Graunke d716b3376c glsl: Add IR builder support for generating return statements.
We use "ret" as the function name since "return" is a C++ keyword, and
"ir_return" is already a class name.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 11:52:22 -07:00
Kenneth Graunke f72a8498e7 glsl: Add IR builder support for conditional assignments.
This adds two new signatures:

   assign(lhs, rhs, condition, writemask);
   assign(lhs, rhs, condition);

All the other existing APIs still exist.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 11:52:22 -07:00
Kenneth Graunke eff2ca1ac3 glsl: Add IR builder support for triops.
Now that we have the ir_expression constructor that does type inference,
this is trivial to do.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 11:52:22 -07:00
Kenneth Graunke 7f0f60cd84 glsl: Add an ir_expression triop constructor with type inference.
We already have ir_expression constructors for unary and binary
operations, which automatically infer the type based on the opcode and
operand types.

These are convenient and also required for ir_builder support.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 11:52:22 -07:00
Kenneth Graunke 183f7a3e6f glsl: Add missing type inference support for ARB_gpu_shader5 unops.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 11:52:21 -07:00
Kenneth Graunke 33faaf0b4a glsl: Initialize lod_info in the ir_texture constructor.
This isn't strictly necessary, since creators of ir_texture objects
should set LOD when relevant.  However, it's nice to have a NULL pointer
in case they forget.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 11:52:21 -07:00
Kenneth Graunke 1b3a482a96 glsl: Skip unavailable built-ins when printing out similar candidates.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 11:52:21 -07:00
Kenneth Graunke 1ffcef04ce glsl: Skip unavailable built-ins when matching signatures.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 11:52:21 -07:00
Kenneth Graunke 3e820e3aef glsl: Pass _mesa_glsl_parse_state into matching_signature and such.
During compilation, we'll use this to determine built-in availability.
The plan is to have a single shader containing every built-in in every
version of the language, but filter out the ones that aren't actually
available to the shader being compiled.

At link time, we don't actually need this filtering capability: we've
already imported prototypes for every built-in that the shader actually
calls, and they're flagged as is_builtin().  The linker doesn't import
any additional prototypes, so it won't pull in any unavailable
built-ins.  When resolving prototypes to function definitions, the
linker ensures the values of is_builtin() match, which means that a
shader can't trick the linker into importing the body of an unavailable
built-in by defining a suspiciously similar prototype.

In other words, during linking, we can just pass in NULL.  It will work
out fine.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 11:52:21 -07:00
Kenneth Graunke 0823a87a75 glsl: Add a method to tell whether a built-in is available.
We can simply call the stored predicate function.  If state is NULL,
just report that the function is available.

v2: Add a comment (requested by Paul Berry).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 11:52:16 -07:00
Kenneth Graunke d403a10573 glsl: Mark _mesa_glsl_parse_state::is_version() as const.
This promises the method won't modify the contents of the object.
This allows us to call it even with a const pointer to the state.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 11:46:51 -07:00
Kenneth Graunke 4b0bac0dce glsl: Convert ir_function_signature::is_builtin to a method.
A signature is a built-in if and only if builtin_info != NULL, so we
don't actually need a separate flag bit.  Making a boolean-valued
method allows existing code to ask the same question while not worrying
about the internal representation.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 11:46:51 -07:00
Kenneth Graunke ca321d07fd glsl: Store a predicate for whether a built-in signature is available.
For the upcoming built-in function rewrite, we'll need to be able to
answer "Is this built-in function signature available?".

This is actually a somewhat complex question, since it depends on the
language version, GLSL vs. GLSL ES, enabled extensions, and the current
shader stage.

Storing such a set of constraints in a structure would be painful, so
instead we store a function pointer.  When creating a signature, we
simply point to a predicate that inspects _mesa_glsl_parse_state and
answers whether the signature is available in the current shader.

Unfortunately, IR reader doesn't actually know when built-in functions
are available, so this patch makes it lie and say that they're always
present.  This allows us to hook up the new functionality; it just won't
be useful until real data is populated.  In the meantime, the existing
profile mechanism ensures built-ins are available in the right places.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-09-09 11:46:50 -07:00
Kenneth Graunke 6c3db2167c i965/vec4: Only zero out unused message components when there are any.
Otherwise, coordinates with four components would result in a MOV
with a destination writemask that has no channels enabled:

mov(8) g115<1>.F 0D { align16 WE_normal NoDDChk 1Q };

At best, this is stupid: we emit code that shouldn't do anything.
Worse, it apparently causes GPU hangs (observable with Chris's
textureGather test on CubeArrays.)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: Chris Forbes <chrisf@ijw.co.nz>
Cc: mesa-stable@lists.freedesktop.org
2013-09-09 11:26:53 -07:00
Paul Berry 2924b5f73b vbo: Implement new gs prim types in vbo_count_tessellated_primitives.
Reviewed-by: Matt Turner <mattst88@gmail.com>
2013-09-09 09:34:46 -07:00
Ian Romanick 2937d704dc i965: Enable AMD_seamless_cubemap_per_texture
The change is very small.  Do seamless filtering if either the context
enable is set or the sampler enable is set.

The AMD_seamless_cubemap_per_texture says:

    "If TEXTURE_CUBE_MAP_SEAMLESS_ARB is emabled (sic) globally or the
    value of the texture's TEXTURE_CUBE_MAP_SEAMLESS_ARB parameter is
    TRUE, seamless cube map sampling is enabled..."

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-09-08 07:54:12 -07:00
Ian Romanick 4a19503516 mesa: Always use seamless cubemap filtering in GLES3
Appendix F.2 of the OpenGL ES 3.0.0 spec says:

    "OpenGL ES 3.0 requires that all cube map filtering be
    seamless. OpenGL ES 2.0 specified that a single cube map face be
    selected and used for filtering."

Setting the field only in the context will work fine with sampler
objects (and drivers that support AMD_seamless_cubemap_per_texture)
because seamless filtering is used if *either* the context or the
sampler enable it:

    "If TEXTURE_CUBE_MAP_SEAMLESS_ARB is emabled (sic) globally or the
    value of the texture's TEXTURE_CUBE_MAP_SEAMLESS_ARB parameter is
    TRUE, seamless cube map sampling is enabled..."

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reported-by: Maxence Le Dore <maxence.ledore@gmail.com>
Thanked-by: Maxence Le Dore <maxence.ledore@gmail.com>
2013-09-08 07:54:12 -07:00
Ian Romanick e334ff43c4 mesa: Don't allow glSamplerParameteriv(GL_TEXTURE_CUBE_MAP_SEAMLESS) in ES
There is no GL_TEXTURE_CUBE_MAP_SEAMLESS in any version of OpenGL ES or
in any extension that applies to OpenGL ES.  The same error check
already occurs for glTexParameteri.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Cc: Maxence Le Dore <maxence.ledore@gmail.com>
2013-09-08 07:54:12 -07:00
Ian Romanick 7efe55cb2d docs: initial 9.3 release notes file
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
2013-09-08 07:54:11 -07:00
Chia-I Wu e67f99bd29 ilo: preliminary GEN 7.5 support
This is based on grepping for brw->is_haswell in i965 to see how GEN 7.5
differs from GEN 7.  Slightly tested with Xonotic and some Mesa demos.
2013-09-08 01:22:52 +08:00
Alex Deucher 18805b16c8 radeonsi: add berlin pci ids
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-09-06 19:27:23 -04:00
Alex Deucher 9bc47dbe50 r600g: remove DMA padding
This is now handled in the winsys.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-09-06 19:10:27 -04:00
Alex Deucher a81beee37e radeon/winsys: pad IBs to a multiple of 8 DWs
This aligns the gfx, compute, and dma IBs to 8 DW boundries.
This aligns the the IB to the fetch size of the CP for optimal
performance. Additionally, r6xx hardware requires at least 4
DW alignment to avoid a hw bug.  This also aligns the DMA
IBs to 8 DW which is required for the DMA engine.  This
alignment is already handled in the gallium driver, but that
patch can be removed now that it's done in the winsys.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
CC: "9.2" <mesa-stable@lists.freedesktop.org>
CC: "9.1" <mesa-stable@lists.freedesktop.org>
2013-09-06 19:08:35 -04:00
Axel Davy e8f9195e5f gallium, intel: Implements new __DRI_IMAGE_USE_LINEAR and PIPE_BIND_LINEAR flags to enforce no tiling.
Signed-off-by: Axel Davy <axel.davy@ens.fr>
2013-09-06 15:02:34 -07:00