Marek Olšák [Thu, 4 Aug 2011 01:01:44 +0000 (03:01 +0200)]
r600g: move more DRM queries into winsys/radeon
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Marek Olšák [Thu, 4 Aug 2011 00:36:57 +0000 (02:36 +0200)]
winsys/radeon: consolidate the add_reloc function
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Marek Olšák [Wed, 3 Aug 2011 23:37:33 +0000 (01:37 +0200)]
r600g: emit CS using radeon_winsys
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Marek Olšák [Wed, 3 Aug 2011 22:15:54 +0000 (00:15 +0200)]
r600g: remove struct r600_reloc
That is really private to winsys/radeon.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Marek Olšák [Wed, 3 Aug 2011 17:27:49 +0000 (19:27 +0200)]
r600g: don't use RADEON_GEM_DOMAIN_CPU
Also staging resources shouldn't be allocated with the initial domain
being VRAM.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Marek Olšák [Wed, 3 Aug 2011 03:15:36 +0000 (05:15 +0200)]
r600g: remove reloc-related variables from radeon_bo
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Marek Olšák [Wed, 3 Aug 2011 02:31:02 +0000 (04:31 +0200)]
r600g: let radeon_winsys maintain the list of relocations
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Marek Olšák [Wed, 3 Aug 2011 00:24:15 +0000 (02:24 +0200)]
r600g: remove now-unused r600_context::fenced_bo
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Marek Olšák [Tue, 2 Aug 2011 23:59:02 +0000 (01:59 +0200)]
r600g: remove the fences which were used for the cache buffer manager
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Marek Olšák [Tue, 2 Aug 2011 23:47:57 +0000 (01:47 +0200)]
r600g: remove now-unused r600_bo::size
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Marek Olšák [Tue, 2 Aug 2011 23:34:39 +0000 (01:34 +0200)]
r600g: remove the cache buffer manager from winsys/r600
As we've just started using the one from winsys/radeon.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Marek Olšák [Tue, 2 Aug 2011 23:03:13 +0000 (01:03 +0200)]
r600g: allocate/destroy buffers using radeon_winsys
We use the cache buffer manager from radeon_winsys now, but we don't use
anything else yet.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Marek Olšák [Tue, 2 Aug 2011 21:58:57 +0000 (23:58 +0200)]
r600g: remove unused function declarations
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Marek Olšák [Tue, 2 Aug 2011 21:03:11 +0000 (23:03 +0200)]
r600g: remove unused r600_bo::tiling_flags
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Marek Olšák [Tue, 2 Aug 2011 19:18:10 +0000 (21:18 +0200)]
r600g: remove unused r600_bo::kernel_pitch
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Marek Olšák [Tue, 2 Aug 2011 18:25:13 +0000 (20:25 +0200)]
r600g: put radeon_winsys in screen::winsys, don't include drm_driver in the pipe
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Marek Olšák [Fri, 22 Jul 2011 19:38:56 +0000 (21:38 +0200)]
r600g: cleanup includes in winsys
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Marek Olšák [Fri, 22 Jul 2011 18:15:47 +0000 (20:15 +0200)]
r600g: move some queries into winsys/radeon
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Marek Olšák [Fri, 22 Jul 2011 17:25:07 +0000 (19:25 +0200)]
r600g: first step into winsys/radeon
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Benjamin Franzke [Mon, 15 Aug 2011 07:50:19 +0000 (09:50 +0200)]
dri2: Add __DRI_BUFFER_COUNT token
Remove definition from egl_dri2.
Defining this is egl_dri2.h breaks as soon as
a new dri2 buffer token is added like with commit
4501a5d6e8d00fd0d87625352ed5ba1a8861f72e.
Cooper Yuan [Tue, 16 Aug 2011 01:32:10 +0000 (09:32 +0800)]
dri2: add code to dri2_Flush extension.
It's going to flush client's commands in eglWaitClient(). Before this,
egl applications using pixmap or pbuffer flicker because of no flush.
Reviewed-by: Alan Hourihane
Eric Anholt [Sat, 6 Aug 2011 04:40:50 +0000 (21:40 -0700)]
glsl: When assigning to a whole array, mark the array as accessed.
The vs-varying-array-mat2-col-row-wr test writes a mat2[3] constant to
a mat2[3] varying out array, and also statically accesses element 1 of
it on the VS and FS sides. At link time it would get trimmed down to
just 2 elements, and then codegen of the VS would end up generating
assignments to the unallocated last entry of the array. On the new
i965 VS backend, that happened to land on the vertex position.
Some issues remain in this test on softpipe, i965/old-vs and
i965/new-vs on visual inspection, but i965 is passing because only one
green pixel is probed, not the whole split green/red quad.
Eric Anholt [Wed, 3 Aug 2011 23:36:42 +0000 (16:36 -0700)]
radeon: Explain to the user what went wrong when built without libdrm.
Before this commit, even LIBGL_DEBUG=verbose would just fail with:
libGL error: failed to create dri screen
Paul Berry [Tue, 2 Aug 2011 22:44:39 +0000 (15:44 -0700)]
glsl: Add validations for ir_call.
This patch extends ir_validate.cpp to check the following
characteristics of each ir_call:
- The number of actual parameters must match the number of formal
parameters in the signature.
- The type of each actual parameter must match the type of the
corresponding formal parameter in the signature.
- Each "out" or "inout" actual parameter must be an lvalue.
Reviewed-by: Chad Versace <chad@chad-versace.us>
Paul Berry [Tue, 2 Aug 2011 22:22:25 +0000 (15:22 -0700)]
glsl: Make is_lvalue() and variable_referenced() const.
These functions don't modify the target instruction, so it makes sense
to make them const. This allows these functions to be called from ir
validation code (which uses const to ensure that it doesn't
accidentally modify the IR being validated).
Reviewed-by: Chad Versace <chad@chad-versace.us>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Tue, 2 Aug 2011 21:34:17 +0000 (14:34 -0700)]
glsl: Perform implicit type conversions on function call out parameters.
When an out parameter undergoes an implicit type conversion, we need
to store it in a temporary, and then after the call completes, convert
the resulting value. In other words, we convert code like the
following:
void f(out int x);
float value;
f(value);
Into IR that's equivalent to this:
void f(out int x);
float value;
int out_parameter_conversion;
f(out_parameter_conversion);
value = float(out_parameter_conversion);
This transformation needs to happen during ast-to-IR convertion (as
opposed to, say, a lowering pass), because it is invalid IR for formal
and actual parameters to have types that don't match.
Fixes piglit tests
spec/glsl-1.20/compiler/qualifiers/out-conversion-int-to-float.vert and
spec/glsl-1.20/execution/qualifiers/vs-out-conversion-*.shader_test,
and bug 39651.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=39651
Reviewed-by: Chad Versace <chad@chad-versace.us>
Kenneth Graunke [Fri, 5 Aug 2011 23:59:04 +0000 (16:59 -0700)]
docs: Remove GLw from the documentation except for a new FAQ entry.
Also remove an outdated reference to GLEW being in tree.
Reviewed-by: Brian Paul <brianp@vmware.com>
Kenneth Graunke [Fri, 5 Aug 2011 23:39:56 +0000 (16:39 -0700)]
glw: Remove GLw source.
libGLw is an old OpenGL widget library with optional Motif support.
It almost never changes and very few people actually still care about
it, so we've decided to ship it separately.
The new home for libGLw is: git://git.freedesktop.org/mesa/glw/
Reviewed-by: Brian Paul <brianp@vmware.com>
Ian Romanick [Mon, 1 Aug 2011 21:13:10 +0000 (14:13 -0700)]
glsl: Modify strategy for accumulating conditions when lowering if-statements
Previously if-statements were lowered from inner-most to outer-most
(i.e., bottom-up). All assignments within an if-statement would have
the condition of the if-statement appended to its existing condition.
As a result the assignments from a deeply nested if-statement would
have a very long and complex condition.
Several shaders in the OpenGL ES2 conformance test suite contain
non-constant array indexing that has been lowered by the shader
writer. These tests usually look something like:
if (i == 0) {
value = array[0];
} else if (i == 1) {
value = array[1];
} else ...
The IR for the last assignment ends up as:
(assign (expression bool && (expression bool ! (var_ref if_to_cond_assign_condition) ) (expression bool && (expression bool ! (var_ref if_to_cond_assign_condition@20) ) (expression bool && (expression bool ! (var_ref if_to_cond_assign_condition@22) ) (expression bool && (expression bool ! (var_ref if_to_cond_assign_condition@24) ) (var_ref if_to_cond_assign_condition@26) ) ) ) ) (x) (var_ref value) (array_ref (var_ref array) (constant int (5)))
The Mesa IR that is generated from this is just as awesome as you
might expect.
Three changes are made to the way if-statements are lowered.
1. Two condition variables, if_to_cond_assign_then and
if_to_cond_assign_else, are created for each if-then-else structure.
The former contains the "positive" condition, and the later contains
the "negative" condtion. This change was implemented in the previous
patch.
2. Each condition variable is added to a hash-table when it is created.
3. When lowering an if-statement, assignments to existing condtion
variables get the current condition anded. This ensures that nested
condition variables are only set to true when the condition variable
for all outer if-statements is also true.
Changes #1 and #3 combine to ensure the correctness of the resulting
code.
4. When a condition assignment is encountered with a condition that is
a dereference of a previously added condition variable, the condition
is not modified.
Change #4 prevents the continuous accumulation of conditions on
assignments.
If the original if-statements were:
if (x) {
if (a && b && c && d && e) {
...
} else {
...
}
} else {
if (g && h && i && j && k) {
...
} else {
...
}
}
The lowered code will be
if_to_cond_assign_then@1 = x;
if_to_cond_assign_then@2 = a && b && c && d && e
&& if_to_cond_assign_then@1;
...
if_to_cond_assign_else@2 = !if_to_cond_assign_then
&& if_to_cond_assign_then@1;
...
if_to_cond_assign_else@1 = !if_to_cond_assign_then@1;
if_to_cond_assign_then@3 = g && h && i && j;
&& if_to_cond_assign_else@1;
...
if_to_cond_assign_else@3 = !if_to_cond_assign_then
&& if_to_cond_assign_else@1;
...
Depending on how instructions are emitted, there may be an extra
instruction due to the duplication of the '&&
if_to_cond_assign_{then,else}@1' on the nested else conditions. In
addition, this may cause some unnecessary register pressure since in
the simple case (where the nested conditions are not complex) the
nested then-condition variables are live longer than strictly
necessary.
Before this change, one of the shaders in the OpenGL ES2 conformance
test suite's acos_float_frag_xvary generated 348 Mesa IR instructions.
After this change it only generates 124. Many, but not all, of these
instructions would have also been eliminated by CSE.
Reviewed-by: Eric Anholt <eric@anholt.net>
Ian Romanick [Mon, 1 Aug 2011 20:55:46 +0000 (13:55 -0700)]
glsl: Slight change to the code generated by if-flattening
Now the condition (for the then-clause) and the inverse condition (for
the else-clause) get written to separate temporary variables. In the
presence of complex conditions, this shouldn't result in more code
being generated. If the original if-statement was
if (a && b && c && d && e) {
...
} else {
...
}
The lowered code will be
if_to_cond_assign_then = a && b && c && d && e;
...
if_to_cond_assign_else = !if_to_cond_assign_then;
...
Reviewed-by: Eric Anholt <eric@anholt.net>
Ian Romanick [Mon, 1 Aug 2011 20:36:12 +0000 (13:36 -0700)]
glsl: Replace foreach_iter with foreach_list_safe
Reviewed-by: Eric Anholt <eric@anholt.net>
Ian Romanick [Mon, 1 Aug 2011 20:28:11 +0000 (13:28 -0700)]
glsl: Make move_block_to_cond_assign not care which branch it's processing
This will make some future changes a bit easier to digest.
Reviewed-by: Eric Anholt <eric@anholt.net>
Benjamin Franzke [Tue, 9 Aug 2011 14:16:33 +0000 (16:16 +0200)]
egl: Log (debug) native platform type
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Benjamin Franzke [Tue, 9 Aug 2011 12:23:18 +0000 (14:23 +0200)]
egl: Native Display autodetection
EGL doesnt define howto manage different native platforms.
So mesa has a builtime configurable default platform,
whith non-standard envvar (EGL_PLATFORM) overwrites.
This caused unneeded bugreports, when EGL_PLATFORM was forgotten.
Detection is grouped into basic types of NativeDisplays (which itself
needs to be detected). The final decision is based on characteristcs
of these basic types:
File Desciptor based platforms (fbdev):
- fstat(2) to check for being a fd that belongs to a character device
- check kernel subsystem (todo)
Pointer to structuctures (x11, wayland, drm/gbm):
- mincore(2) to check whether its valid pointer to some memory.
- magic elements (e.g. pointers to exported symbols):
o wayland display stores interface type pointer (first elm.)
o gbm stores pointer to its constructor (first elm.)
o x11 as a fallback (FIXME?)
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Cooper Yuan [Sun, 14 Aug 2011 07:14:17 +0000 (15:14 +0800)]
Destroy context in dri2/glx driver when apps call eglDestroyContext
Chia-I Wu [Sun, 7 Aug 2011 14:57:51 +0000 (23:57 +0900)]
glapi: remove gen-es
Not used anymore.
Chia-I Wu [Thu, 11 Aug 2011 08:41:09 +0000 (16:41 +0800)]
glapi: generate ES dispatch headers from core mesa
GLESv1 and GLESv2 have their own dispatch.h and remap_helper.h. These
headers are only used by api_exec_es1.c and api_exec_es2.c in core mesa.
Move the rules to generate them from glapi to core mesa.
Reviewed-by: Brian Paul <brianp@vmware.com>
[olv: updated after reviewing to fix SCons build]
Chia-I Wu [Mon, 8 Aug 2011 01:40:12 +0000 (10:40 +0900)]
glapi: add glapi_gen.mk to help header generation
glapi_gen.mk is supposed to be included by glapi users to simplify
header generation. This commit also makes es1api, es2api, and
shared-glapi use it.
Reviewed-by: Brian Paul <brianp@vmware.com>
[olv: updated after reviewing to prefix all variables in glapi_gen.mk by
glapi_gen]
Chia-I Wu [Mon, 8 Aug 2011 01:14:44 +0000 (10:14 +0900)]
glapi: use gl_and_es_API.xml to generate GLES headers
glapi/gen-es/ defines two sets of GLAPI XMLs for OpenGL ES 1.1
(es1_API.xml) and 2.0 (es2_API.xml) respectively. They are used to
generate dispatch.h and remap_helper.h for GLES. Together with
gl_and_es_API.xml, we have to maintain three sets of GLAPI XMLs.
This commit makes dispatch.h and remap_helper.h for GLES be generated
from gl_and_es_API.xml.
Reviewed-by: Brian Paul <brianp@vmware.com>
Chia-I Wu [Sun, 7 Aug 2011 14:19:51 +0000 (23:19 +0900)]
glapi: add methods to filter functions
add gl_api::filter_functions and gl_function::filter_entry_points to
filter out unwanted functions and entry points.
Reviewed-by: Brian Paul <brianp@vmware.com>
Chia-I Wu [Sun, 7 Aug 2011 07:58:29 +0000 (16:58 +0900)]
glapi: add gles_api.py
Move the list of entry points belong to GLES from mapi_abi.py to a new
file.
Until we figure out how to describe the APIs an entry point belongs to
in the XML file, and how to handle the case where an entry point others
alias is missing in some APIs, this is an easier solution than
maintaining another two sets of XMLs in glapi/gen-es/.
Reviewed-by: Brian Paul <brianp@vmware.com>
Michel Dänzer [Fri, 12 Aug 2011 09:10:56 +0000 (11:10 +0200)]
gallium/gbm: Add dependencies for libraries linked into pipe_*.so.
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Chad Versace [Wed, 10 Aug 2011 22:46:14 +0000 (15:46 -0700)]
x86-64: Fix compile error with clang
Remove the 'f' suffix from a float literal.
- .float 0.0f+1.0
+ .float 1.0
This fixes the following compile error with clang:
error: unexpected token in directive
.float 0.0f+1.0
^
Note: This is a candidate for the stable branches.
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Chad Versace <chad@chad-versace.us>
Brian Paul [Thu, 11 Aug 2011 15:02:16 +0000 (09:02 -0600)]
mesa: fix initialization of GL_FOG_MODE in _mesa_init_driver_state()
Brian Paul [Thu, 11 Aug 2011 14:58:08 +0000 (08:58 -0600)]
mesa: fix ColorMask array index in _mesa_init_driver_state()
This doesn't really make any difference because all the colormasks
are the same upon context set-up, but it makes more sense.
Brian Paul [Thu, 11 Aug 2011 14:52:41 +0000 (08:52 -0600)]
swrast: don't try to do depth testing if there's no depth buffer
Fixes piglit hiz-depth-stencil-test-fbo-d0-s8 crash.
See http://bugs.freedesktop.org/show_bug.cgi?id=37907
NOTE: This is a candidate for the 7.11 branch.
Andreas Fänger [Wed, 10 Aug 2011 08:07:29 +0000 (08:07 +0000)]
swrast: initial multi-threaded span rendering
Optional parallel rendering of spans using OpenMP.
Initial implementation for aa triangles. A new option for scons is
also provided to activate the openmp support (off by default).
Signed-off-by: Brian Paul <brianp@vmware.com>
Ben Widawsky [Mon, 8 Aug 2011 00:04:04 +0000 (17:04 -0700)]
intel: GetBuffer fix
After copy buffer on preGEN6, it is necessary to wait for the blit to
complete before returning data to the user.
This should fix the piglit test: copy_buffer_coherency (pre-GEN6).
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Lauri Kasanen [Mon, 8 Aug 2011 09:32:13 +0000 (12:32 +0300)]
r600g: Add support for ROUND, v2
This is a GLSL 1.3 feature, but also used by MLAA.
Signed-off-by: Lauri Kasanen <cand@gmx.com>
Carl Simonson [Wed, 10 Aug 2011 18:10:43 +0000 (11:10 -0700)]
i830: Add missing vtable entry for i830 from the hiz work.
Eric Anholt [Sun, 15 May 2011 16:36:19 +0000 (09:36 -0700)]
i965: Drop the reg/hw_reg distinction.
"reg" was set in only one case, virtual GRFs pre register allocation,
and would be unset and have hw_reg set after allocation. Since we
never bothered with looking at virtual GRF number after allocation
anyway, just use the same storage and avoid confusion.
Eric Anholt [Mon, 9 May 2011 16:56:18 +0000 (09:56 -0700)]
i965/fs: Factor out the register allocator setup to a separate function.
Besides separating out a logical step of the giant register allocator
function, this now communicates a bunch of the allocator information
through entries in brw_context, which will make this code partially
reusable for caching the expensive allocator setup.
Eric Anholt [Fri, 6 May 2011 02:37:10 +0000 (19:37 -0700)]
i965/fs: Simplify the register allocator using a map from RA reg to GRF.
It's fewer pointers to track, and when we start caching the register
set, should be algorithmically better in the cache hit case (lookup in
a byte-per-register array, instead of a linear walk through
desctiption of register classes to find how to translate that class).
Eric Anholt [Wed, 4 May 2011 20:50:13 +0000 (13:50 -0700)]
i965/fs: Eliminate the magic nature of virtual GRF 0.
This was a debugging aid at one point -- virtual grf 0 should never be
allocated, and it would be used if undefined register access occurred
in codegen. However, it made the confusing register allocation code
even more confusing by indexing things off of 1 all over.
Eric Anholt [Wed, 4 May 2011 20:31:01 +0000 (13:31 -0700)]
i965/fs: Use the new convenience interface for setting up reg conflicts.
That code I wrote was impenetrable, and hard to write the first time.
This makes things a lot more obvious.
Eric Anholt [Wed, 4 May 2011 20:27:33 +0000 (13:27 -0700)]
mesa: Add a convenience interface for register allocator conflicts setup.
Henri Verbeet [Tue, 9 Aug 2011 17:23:47 +0000 (12:23 -0500)]
glsl_to_tgsi: improve assignment hack
Fixes StarCraft 2 and Fallout 3 in Wine.
Brian Paul [Tue, 9 Aug 2011 15:00:29 +0000 (09:00 -0600)]
r300g: silence some warnings about uninitialized variables
Brian Paul [Tue, 9 Aug 2011 14:58:47 +0000 (08:58 -0600)]
svga: add missing switch case for PIPE_SHADER_CAP_INTEGERS
Brian Paul [Tue, 9 Aug 2011 14:58:20 +0000 (08:58 -0600)]
glx: move declarations before code
Fabio Pedretti [Tue, 9 Aug 2011 14:08:59 +0000 (08:08 -0600)]
swrast: silence unused var warnings
Signed-off-by: Brian Paul <brianp@vmware.com>
Dave Airlie [Tue, 9 Aug 2011 09:39:52 +0000 (10:39 +0100)]
docs: update GL3.txt with new GL 4.2 extensions
Paul Berry [Wed, 3 Aug 2011 22:37:01 +0000 (15:37 -0700)]
glsl: validate IR after linking (debug builds only)
At least one of the invariants verified by IR validation concerns the
relative ordering of toplevel constructs in the IR: references to
global variables must come after the declarations of those global
variables.
Since linking affects the ordering of toplevel constructs in the IR,
it's possible that a bug in the linker will cause invalid IR to be
generated, even if all the pre-linked shaders are valid. (In fact,
such a bug was fixed by the previous commit.)
Bugs like this are easily masked by further optimization passes,
particularly inlining. So to make them easier to track down, this
patch addes an IR validation step right after linking, and before
final optimization occurs. The validation only occurs on debug
builds.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Wed, 3 Aug 2011 23:16:59 +0000 (16:16 -0700)]
glsl: When linking, emit functions at the tail of the final linked program.
When link_functions.cpp adds a new function to the final linked
program, it needs to add it after any global variable declarations
that the function refers to, otherwise the IR will be invalid (because
variable declarations must occur before variable accesses). The
easiest way to do that is to have the linker emit functions to the
tail of the final linked program.
The linker used to emit functions to the head of the final linked
program, in an effort to keep callees sorted before their callers.
However, this was not reliable: it didn't work for functions declared
or defined in the same compilation unit as main, for diamond-shaped
patterns in the call graph, or for some obscure cases involving
overloaded functions. And no code currently relies on this sort
order.
No Piglit regressions with i965 Ironlake.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Mon, 1 Aug 2011 22:23:07 +0000 (15:23 -0700)]
glsl: Check array size is const before asserting that no IR was generated.
process_array_type() contains an assertion to verify that no IR
instructions are generated while processing the expression that
specifies the size of the array. This assertion needs to happen
_after_ checking whether the expression is constant. Otherwise we may
crash on an illegal shader rather than reporting an error.
Fixes piglit tests array-size-non-builtin-function.vert and
array-size-with-side-effect.vert.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Sat, 30 Jul 2011 18:55:53 +0000 (11:55 -0700)]
glsl: Constant-fold built-in functions before outputting IR
Rearranged the logic for converting the ast for a function call to
hir, so that we constant fold before emitting any IR. Previously we
would emit some IR, and then only later detect whether we could
constant fold. The unnecessary IR would usually get cleaned up by a
later optimization step, however in the case of a builtin function
being used to compute an array size, it was causing an assertion.
Fixes Piglit test array-size-constant-relational.vert.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38625
Paul Berry [Fri, 29 Jul 2011 22:28:52 +0000 (15:28 -0700)]
glsl: Emit function signatures at toplevel, even for built-ins.
The ast-to-hir conversion needs to emit function signatures in two
circumstances: when a function declaration (or definition) is
encountered, and when a built-in function is encountered.
To avoid emitting a function signature in an illegal place (such as
inside a function), emit_function() checked whether we were inside a
function definition, and if so, emitted the signature before the
function definition.
However, this didn't cover the case of emitting function signatures
for built-in functions when those built-in functions are called from
inside the constant integer expression that specifies the length of a
global array. This failed because when processing an array length, we
are emitting IR into a dummy exec_list (see process_array_type() in
ast_to_hir.cpp). process_array_type() later checks (via an assertion)
that no instructions were emitted to the dummy exec_list, based on the
reasonable assumption that we shouldn't need to emit instructions to
calculate the value of a constant.
This patch changes emit_function() so that it emits function
signatures at toplevel in all cases.
This partially fixes bug 38625
(https://bugs.freedesktop.org/show_bug.cgi?id=38625). The remainder
of the fix is in the patch that follows.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Mon, 1 Aug 2011 20:06:06 +0000 (13:06 -0700)]
Revert "glsl: Skip processing the first function's body in do_dead_functions()."
opt_dead_functions contained a shortcut to skip processing the first
function's body, based on the assumption that IR functions are
topologically sorted, with callees always coming before their callers
(therefore the first function cannot contain any calls).
This assumption turns out not to be true in general. For example, the
following code snippet gets translated to IR that violates this
assumption:
void f();
void g();
void f() { g(); }
void g() { ... }
In practice, the shortcut didn't cause bugs because of a coincidence
of the circumstances in which opt_dead_functions is called:
(a) we do inlining right before dead function elimination, and
inlining (when successful) eliminates all calls.
(b) for user-defined functions, inlining is always successful, because
previous optimization passes (during compilation) have reduced
them to a form that is eligible for inlining.
(c) the function that appears first in the IR can't possibly call a
built-in function, because built-in functions are always emitted
before the function that calls them.
It seems unnecessarily fragile to have opt_dead_functions depend on
these coincidences. And the next patch in this series will break (c).
So I'm reverting the shortcut. The consequence will be a slight
increase in link time for complex shaders.
This reverts commit
c75427f4c8767e131e5fb3de44fbc9d904cb992d.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Bryan Cain [Sun, 7 Aug 2011 19:15:35 +0000 (14:15 -0500)]
st/mesa: inline st_prepare_fragment_program in st_translate_fragment_program
This reverts an unnecessary part of commit
4683529048ee and fixes misrendering
and an assertion failure in Cogs.
Fixes freedesktop.org bug 39888.
Reviewed-by: Brian Paul <brianp@vmware.com>
Brian Paul [Mon, 8 Aug 2011 15:01:13 +0000 (09:01 -0600)]
glext: upgrade to version 72
Brian Paul [Mon, 8 Aug 2011 15:00:57 +0000 (09:00 -0600)]
glsl: silence warning about trailing comma in enum list
Brian Paul [Mon, 8 Aug 2011 15:00:06 +0000 (09:00 -0600)]
gallium: silence warnings about trailing commas in enum lists
Brian Paul [Fri, 5 Aug 2011 21:01:41 +0000 (15:01 -0600)]
mesa: whitespace changes
Christoph Bumiller [Sun, 7 Aug 2011 13:34:07 +0000 (15:34 +0200)]
d3d1x: adapt to resource_resolve interface change
Christoph Bumiller [Mon, 25 Jul 2011 16:13:26 +0000 (18:13 +0200)]
nv50,nvc0: never convert in resource copy when format sizes match
If there are any cases left where the st thinks that RGBA -> BGRA
will swap components, it will get what it deserves.
Now the GPU's 2D engine goes unused. What a shame.
Christoph Bumiller [Fri, 5 Aug 2011 18:10:04 +0000 (20:10 +0200)]
st/mesa: don't resolve stencil twice
Marek Olšák [Sat, 6 Aug 2011 03:15:30 +0000 (05:15 +0200)]
winsys/radeon: disable use of the buffer busy-for-write flag
Kenneth Graunke [Sun, 31 Jul 2011 04:26:26 +0000 (21:26 -0700)]
mesa: In validate_program(), initialize errMsg for safety.
validate_program relies on validate_shader_program to fill in errMsg;
empirically, there exist cases where that doesn't happen.
While tracking those down may be worthwhile, initializing the string so
we don't try to ralloc_strdup random garbage also seems wise.
Fixes issues caught by valgrind while running some test case.
NOTE: This is a candidate for stable release branches.
Reviewed-by: Chad Versace <chad@chad-versace.us>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Eric Anholt [Fri, 5 Aug 2011 19:47:25 +0000 (12:47 -0700)]
intel: Fix warnings from gl_constant_parameter changes.
Bryan Cain [Fri, 5 Aug 2011 19:37:33 +0000 (14:37 -0500)]
glsl_to_tgsi: replace open-coded swizzle_for_size()
This is a port of commit
4c7e215c7bb to glsl_to_tgsi.
Bryan Cain [Fri, 5 Aug 2011 19:09:37 +0000 (14:09 -0500)]
glsl_to_tgsi: try to avoid emitting a MOV_SAT to saturate an expression tree
This is a port of commit
62722d9 to glsl_to_tgsi, with minor aesthetic
changes (moved the declaration and assignment of new_inst inside the if block).
Eric Anholt [Mon, 2 May 2011 23:27:46 +0000 (16:27 -0700)]
ir_to_mesa: Replace open-coded swizzle_for_size()
Christopher James Halse Rogers [Thu, 4 Aug 2011 02:06:13 +0000 (12:06 +1000)]
glx/dri2: Paper over errors in DRI2Connect when indirect
DRI2 will throw BadRequest for this when the client is not local, but
DRI2 is an implementation detail and not something callers should have
to know about. Silently swallow errors in this case, and just propagate
the failure through DRI2Connect's return code.
Note: This is a candidate for the stable release branches.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=28125
Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Eric Anholt [Fri, 22 Jul 2011 20:54:15 +0000 (13:54 -0700)]
ir_to_mesa: Try to avoid emitting a MOV_SAT to saturate an expression tree.
Fixes a regression in codegen quality for ff_fragment_shader
conversion to GLSL -- glean texCombine produces 7.5% fewer Mesa IR
instructions.
Eric Anholt [Fri, 22 Jul 2011 22:13:08 +0000 (15:13 -0700)]
prog_optimize: Add support for saturates to _mesa_merge_mov_into_inst.
This fixes the remaining regression from ff_fragment_shader in Mesa IR
instruction count, to now being a 1.9% win overall.
Eric Anholt [Tue, 26 Jul 2011 01:15:25 +0000 (18:15 -0700)]
i965: Add dumping for gen6 WM constants too.
This looks just like the VS dump for now.
Eric Anholt [Thu, 28 Jul 2011 16:52:03 +0000 (09:52 -0700)]
mesa: Remove dead "MemPool" field of gl_shader_state.
Eric Anholt [Tue, 26 Jul 2011 01:13:04 +0000 (18:13 -0700)]
i965/fs: Don't upload unused uniform components.
This saves both register space and upload bandwidth for unused values.
Note that previously we were relying on the visitor not initially
generating references to different sets of uniforms between the 8-wide
and 16-wide code generation, and now we're relying on them dead-code
eliminating the same stuff, too.
Eric Anholt [Thu, 28 Jul 2011 16:57:19 +0000 (09:57 -0700)]
i965/fs: Don't allocate the old backend's compile structs for our compile.
This saves some 35MB when the program only uses GLSL shaders.
Marek Olšák [Wed, 3 Aug 2011 19:01:31 +0000 (21:01 +0200)]
winsys/radeon: do the CS cleanup in the CS ioctl thread
Marek Olšák [Wed, 3 Aug 2011 18:57:48 +0000 (20:57 +0200)]
winsys/radeon: fix space checking
We should remove the relocations which caused a validation failure
from the list, so that the kernel receives only the validated ones.
NOTE: This is a candidate for the 7.11 branch.
Marek Olšák [Fri, 5 Aug 2011 05:07:46 +0000 (07:07 +0200)]
st/dri: remove an unused-but-set variable
Marek Olšák [Fri, 5 Aug 2011 05:02:25 +0000 (07:02 +0200)]
st/dri: remove a dummy function dri2_create_context
It does nothing besides calling dri_create_context with the same parameters.
Marek Olšák [Fri, 5 Aug 2011 04:57:07 +0000 (06:57 +0200)]
st/mesa: remove unused-but-set variables in st_glsl_to_tgsi.cpp
Marek Olšák [Fri, 5 Aug 2011 04:04:05 +0000 (06:04 +0200)]
r300g: handle new CAPs
Marek Olšák [Fri, 5 Aug 2011 04:03:18 +0000 (06:03 +0200)]
r300g: adapt to the resource_resolve interface change
Marek Olšák [Thu, 4 Aug 2011 05:38:13 +0000 (07:38 +0200)]
vbo: do not call _mesa_max_buffer_index in debug builds
That code drops performance in Unigine Heaven and Tropics
by a factor of 10. That's too crazy even for a debug build.
NOTE: This is a candidate for the 7.11 branch.
Reviewed-by: Brian Paul <brianp@vmware.com>
Chia-I Wu [Wed, 3 Aug 2011 15:39:07 +0000 (00:39 +0900)]
glsl: empty declarations should be valid
Unlike C++, empty declarations such as
float;
should be valid. The spec is not explicit about this actually.
Some apps that generate their shader sources may rely on this. This was
noted when porting one of them to Linux from Windows.
Reviewed-by: Chad Versace <chad@chad-versace.us>
Note: this is a candidate for the 7.11 branch.
Vinson Lee [Fri, 5 Aug 2011 01:04:44 +0000 (18:04 -0700)]
mesa: Remove MSVC stdint typedefs from compiler.h.
MSVC can now include the stdint.h at include/c99/stdint.h.
Brian Paul [Thu, 4 Aug 2011 22:01:27 +0000 (16:01 -0600)]
mesa: pass correct constant type to _mesa_fetch_state()
Fixes assorted warnings about float vs. gl_constant_value pointers.