mesa.git
13 years agoswrast: don't try to do depth testing if there's no depth buffer
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.

13 years agoswrast: initial multi-threaded span rendering
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>
13 years agointel: GetBuffer fix
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>
13 years agor600g: Add support for ROUND, v2
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>
13 years agoi830: Add missing vtable entry for i830 from the hiz work.
Carl Simonson [Wed, 10 Aug 2011 18:10:43 +0000 (11:10 -0700)]
i830: Add missing vtable entry for i830 from the hiz work.

13 years agoi965: Drop the reg/hw_reg distinction.
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.

13 years agoi965/fs: Factor out the register allocator setup to a separate function.
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.

13 years agoi965/fs: Simplify the register allocator using a map from RA reg to GRF.
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).

13 years agoi965/fs: Eliminate the magic nature of virtual GRF 0.
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.

13 years agoi965/fs: Use the new convenience interface for setting up reg conflicts.
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.

13 years agomesa: Add a convenience interface for register allocator conflicts setup.
Eric Anholt [Wed, 4 May 2011 20:27:33 +0000 (13:27 -0700)]
mesa: Add a convenience interface for register allocator conflicts setup.

13 years agoglsl_to_tgsi: improve assignment hack
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.

13 years agor300g: silence some warnings about uninitialized variables
Brian Paul [Tue, 9 Aug 2011 15:00:29 +0000 (09:00 -0600)]
r300g: silence some warnings about uninitialized variables

13 years agosvga: add missing switch case for PIPE_SHADER_CAP_INTEGERS
Brian Paul [Tue, 9 Aug 2011 14:58:47 +0000 (08:58 -0600)]
svga: add missing switch case for PIPE_SHADER_CAP_INTEGERS

13 years agoglx: move declarations before code
Brian Paul [Tue, 9 Aug 2011 14:58:20 +0000 (08:58 -0600)]
glx: move declarations before code

13 years agoswrast: silence unused var warnings
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>
13 years agodocs: update GL3.txt with new GL 4.2 extensions
Dave Airlie [Tue, 9 Aug 2011 09:39:52 +0000 (10:39 +0100)]
docs: update GL3.txt with new GL 4.2 extensions

13 years agoglsl: validate IR after linking (debug builds only)
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>
13 years agoglsl: When linking, emit functions at the tail of the final linked program.
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>
13 years agoglsl: Check array size is const before asserting that no IR was generated.
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>
13 years agoglsl: Constant-fold built-in functions before outputting IR
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

13 years agoglsl: Emit function signatures at toplevel, even for built-ins.
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>
13 years agoRevert "glsl: Skip processing the first function's body in do_dead_functions()."
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>
13 years agost/mesa: inline st_prepare_fragment_program in st_translate_fragment_program
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>
13 years agoglext: upgrade to version 72
Brian Paul [Mon, 8 Aug 2011 15:01:13 +0000 (09:01 -0600)]
glext: upgrade to version 72

13 years agoglsl: silence warning about trailing comma in enum list
Brian Paul [Mon, 8 Aug 2011 15:00:57 +0000 (09:00 -0600)]
glsl: silence warning about trailing comma in enum list

13 years agogallium: silence warnings about trailing commas in enum lists
Brian Paul [Mon, 8 Aug 2011 15:00:06 +0000 (09:00 -0600)]
gallium: silence warnings about trailing commas in enum lists

13 years agomesa: whitespace changes
Brian Paul [Fri, 5 Aug 2011 21:01:41 +0000 (15:01 -0600)]
mesa: whitespace changes

13 years agod3d1x: adapt to resource_resolve interface change
Christoph Bumiller [Sun, 7 Aug 2011 13:34:07 +0000 (15:34 +0200)]
d3d1x: adapt to resource_resolve interface change

13 years agonv50,nvc0: never convert in resource copy when format sizes match
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.

13 years agost/mesa: don't resolve stencil twice
Christoph Bumiller [Fri, 5 Aug 2011 18:10:04 +0000 (20:10 +0200)]
st/mesa: don't resolve stencil twice

13 years agowinsys/radeon: disable use of the buffer busy-for-write flag
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

13 years agomesa: In validate_program(), initialize errMsg for safety.
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>
13 years agointel: Fix warnings from gl_constant_parameter changes.
Eric Anholt [Fri, 5 Aug 2011 19:47:25 +0000 (12:47 -0700)]
intel: Fix warnings from gl_constant_parameter changes.

13 years agoglsl_to_tgsi: replace open-coded swizzle_for_size()
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.

13 years agoglsl_to_tgsi: try to avoid emitting a MOV_SAT to saturate an expression tree
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).

13 years agoir_to_mesa: Replace open-coded swizzle_for_size()
Eric Anholt [Mon, 2 May 2011 23:27:46 +0000 (16:27 -0700)]
ir_to_mesa: Replace open-coded swizzle_for_size()

13 years agoglx/dri2: Paper over errors in DRI2Connect when indirect
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>
13 years agoir_to_mesa: Try to avoid emitting a MOV_SAT to saturate an expression tree.
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.

13 years agoprog_optimize: Add support for saturates to _mesa_merge_mov_into_inst.
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.

13 years agoi965: Add dumping for gen6 WM constants too.
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.

13 years agomesa: Remove dead "MemPool" field of gl_shader_state.
Eric Anholt [Thu, 28 Jul 2011 16:52:03 +0000 (09:52 -0700)]
mesa: Remove dead "MemPool" field of gl_shader_state.

13 years agoi965/fs: Don't upload unused uniform components.
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.

13 years agoi965/fs: Don't allocate the old backend's compile structs for our compile.
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.

13 years agowinsys/radeon: do the CS cleanup in the CS ioctl thread
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

13 years agowinsys/radeon: fix space checking
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.

13 years agost/dri: remove an unused-but-set variable
Marek Olšák [Fri, 5 Aug 2011 05:07:46 +0000 (07:07 +0200)]
st/dri: remove an unused-but-set variable

13 years agost/dri: remove a dummy function dri2_create_context
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.

13 years agost/mesa: remove unused-but-set variables in st_glsl_to_tgsi.cpp
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

13 years agor300g: handle new CAPs
Marek Olšák [Fri, 5 Aug 2011 04:04:05 +0000 (06:04 +0200)]
r300g: handle new CAPs

13 years agor300g: adapt to the resource_resolve interface change
Marek Olšák [Fri, 5 Aug 2011 04:03:18 +0000 (06:03 +0200)]
r300g: adapt to the resource_resolve interface change

13 years agovbo: do not call _mesa_max_buffer_index in debug builds
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>
13 years agoglsl: empty declarations should be valid
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.

13 years agomesa: Remove MSVC stdint typedefs from compiler.h.
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.

13 years agomesa: pass correct constant type to _mesa_fetch_state()
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.

13 years agomesa: use gl_constant_value type in ARB program parser
Brian Paul [Thu, 4 Aug 2011 22:00:06 +0000 (16:00 -0600)]
mesa: use gl_constant_value type in ARB program parser

13 years agomesa: use gl_constant_value type in _mesa_[Get]ProgramNamedParameter4fNV()
Brian Paul [Thu, 4 Aug 2011 21:55:50 +0000 (15:55 -0600)]
mesa: use gl_constant_value type in _mesa_[Get]ProgramNamedParameter4fNV()

13 years agomesa: add st_glsl_to_tgsi.cpp to Sconscript
Brian Paul [Thu, 4 Aug 2011 21:55:13 +0000 (15:55 -0600)]
mesa: add st_glsl_to_tgsi.cpp to Sconscript

13 years agomesa: fix out of bounds array access in rtgc debug code
Brian Paul [Thu, 4 Aug 2011 21:32:09 +0000 (15:32 -0600)]
mesa: fix out of bounds array access in rtgc debug code

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=39841
This would only be hit if someone set RGTC_DEBUG=1.

13 years agomesa: don't use K&R style function pointer calls
Brian Paul [Thu, 4 Aug 2011 19:07:50 +0000 (13:07 -0600)]
mesa: don't use K&R style function pointer calls

13 years agoMerge branch 'glsl-to-tgsi'
Bryan Cain [Thu, 4 Aug 2011 20:43:34 +0000 (15:43 -0500)]
Merge branch 'glsl-to-tgsi'

Conflicts:
src/mesa/state_tracker/st_atom_pixeltransfer.c
src/mesa/state_tracker/st_program.c

13 years agost/mesa: replace duplicated create_color_map_texture() function with shared function
Bryan Cain [Thu, 4 Aug 2011 15:15:54 +0000 (10:15 -0500)]
st/mesa: replace duplicated create_color_map_texture() function with shared function

13 years agoglsl_to_tgsi: remove debugging printf
Bryan Cain [Tue, 2 Aug 2011 16:36:44 +0000 (11:36 -0500)]
glsl_to_tgsi: remove debugging printf

13 years agost/mesa: silence int/float and double/float conversion warnings
Brian Paul [Thu, 4 Aug 2011 14:22:31 +0000 (08:22 -0600)]
st/mesa: silence int/float and double/float conversion warnings

13 years agost/mesa: move declaration before code
Brian Paul [Thu, 4 Aug 2011 14:22:31 +0000 (08:22 -0600)]
st/mesa: move declaration before code

13 years agomesa: minor comment updates in enable.c
Brian Paul [Thu, 4 Aug 2011 14:22:31 +0000 (08:22 -0600)]
mesa: minor comment updates in enable.c

13 years agomesa: whitespace, formatting fixes in GetTexParameter() code
Brian Paul [Thu, 4 Aug 2011 14:22:31 +0000 (08:22 -0600)]
mesa: whitespace, formatting fixes in GetTexParameter() code

13 years agomesa: add null ptr checks in GetTexParameterI[u]iv() functions
Brian Paul [Thu, 4 Aug 2011 14:22:31 +0000 (08:22 -0600)]
mesa: add null ptr checks in GetTexParameterI[u]iv() functions

13 years agomesa: condense GL_TEXTURE_RESIDENT query code
Brian Paul [Thu, 4 Aug 2011 14:22:31 +0000 (08:22 -0600)]
mesa: condense GL_TEXTURE_RESIDENT query code

13 years agomesa: make error handling in glGetTexParameter() a bit more concise
Brian Paul [Thu, 4 Aug 2011 14:22:30 +0000 (08:22 -0600)]
mesa: make error handling in glGetTexParameter() a bit more concise

13 years agonv50: implement resource_resolve with custom blit
Christoph Bumiller [Thu, 28 Jul 2011 13:54:53 +0000 (15:54 +0200)]
nv50: implement resource_resolve with custom blit

13 years agost/mesa: implement multisample resolve via BlitFramebuffer
Christoph Bumiller [Wed, 3 Aug 2011 14:01:41 +0000 (16:01 +0200)]
st/mesa: implement multisample resolve via BlitFramebuffer

13 years agogallium: extend resource_resolve to accommodate BlitFramebuffer
Christoph Bumiller [Wed, 3 Aug 2011 13:43:16 +0000 (15:43 +0200)]
gallium: extend resource_resolve to accommodate BlitFramebuffer

Resolve via glBlitFramebuffer allows resolving a sub-region of a
renderbuffer to a different location in any mipmap level of some
other texture, and, with a new extension, even scaling. Therefore,
location and size parameters are needed.

The mask parameter was added because resolving only depth or only
stencil of a combined buffer is possible as well.

Full information about the blit operation allows the drivers to
take the most efficient path they possibly can.

13 years agost/mesa: determine Const.MaxSamples in init_extensions
Christoph Bumiller [Thu, 28 Jul 2011 13:26:01 +0000 (15:26 +0200)]
st/mesa: determine Const.MaxSamples in init_extensions

v2: Check for non-pow2 sample counts as well.

13 years agoegl/gbm: Fix EGL_DEFAULT_DISPLAY
Benjamin Franzke [Wed, 29 Jun 2011 06:49:39 +0000 (08:49 +0200)]
egl/gbm: Fix EGL_DEFAULT_DISPLAY

13 years agogbm: link gbm_gallium_drm.so against math library
Benjamin Franzke [Thu, 4 Aug 2011 11:37:42 +0000 (13:37 +0200)]
gbm: link gbm_gallium_drm.so against math library

This avoids the following runtime error with EGL on platforms that
require linking with libm for nontrivial math functions:

failed to load module: /xorg/lib64/gbm/gbm_gallium_drm.so: undefined
symbol: powf

(Based on Kristóf RALOVICHs patch and Ian's suggestions in
http://lists.freedesktop.org/archives/mesa-dev/2011-August/010036.html)

13 years agogbm/dri: avoid crash in dri_screen_create
RALOVICH, Kristóf [Sun, 31 Jul 2011 21:49:43 +0000 (23:49 +0200)]
gbm/dri: avoid crash in dri_screen_create

13 years agor600g: remove more of unused code
Marek Olšák [Thu, 4 Aug 2011 01:23:12 +0000 (03:23 +0200)]
r600g: remove more of unused code

This is a follow-up to f6df430a85141f6a384c18079fb5b2ad848dac0d.

13 years agor600g: take into account force_add_cf in pops
Vadim Girlin [Wed, 3 Aug 2011 11:35:02 +0000 (15:35 +0400)]
r600g: take into account force_add_cf in pops

When we have two ENDIFs in a row, we shouldn't modify the pop_count
for the same alu clause twice.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=38163

Note: this is a candidate for the 7.11 branch.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: use backend mask for occlusion queries
Vadim Girlin [Tue, 2 Aug 2011 21:04:19 +0000 (01:04 +0400)]
r600g: use backend mask for occlusion queries

Use backend_map kernel query if supported, otherwise analyze ZPASS_DONE
results to get the mask.

Fixes lockups with predicated rendering due to incorrect query buffer
initialization on some cards.

Note: this is a candidate for the 7.11 branch.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 years agowinsys/radeon: remove dummy function pb_buffer
Marek Olšák [Tue, 2 Aug 2011 22:52:55 +0000 (00:52 +0200)]
winsys/radeon: remove dummy function pb_buffer

13 years agoutil: fix a typo in util_format_swizzle_4f
Marek Olšák [Tue, 2 Aug 2011 23:13:06 +0000 (01:13 +0200)]
util: fix a typo in util_format_swizzle_4f

Reported by Gustaw Smolarczyk.

13 years agoradeon: Remove some remaining set-but-unused variables.
Eric Anholt [Tue, 2 Aug 2011 20:49:05 +0000 (13:49 -0700)]
radeon: Remove some remaining set-but-unused variables.

These looked more like copy-and-paste to me than the others (which
looked more like possibly someone forgot to write some code in a
refactor), so I didn't verify where they came from.

13 years agoradeon: Remove set-but-unused variables in radeon_lock.c
Eric Anholt [Tue, 2 Aug 2011 20:47:18 +0000 (13:47 -0700)]
radeon: Remove set-but-unused variables in radeon_lock.c

These have been unused since this function's introduction in the FBO
support development around 2009.

13 years agoradeon: Remove set-but-unused variables in radeonSetTexBuffer2() variants.
Eric Anholt [Tue, 2 Aug 2011 20:41:59 +0000 (13:41 -0700)]
radeon: Remove set-but-unused variables in radeonSetTexBuffer2() variants.

These have been unused since 2009.

13 years agoradeon: Remove set-but-unused log2depth variable.
Eric Anholt [Tue, 2 Aug 2011 20:39:43 +0000 (13:39 -0700)]
radeon: Remove set-but-unused log2depth variable.

r100 doesn't support 3D GL_EXT_texture3D.

13 years agoradeon: Remove set-but-unused color_mask variable.
Eric Anholt [Tue, 2 Aug 2011 20:36:57 +0000 (13:36 -0700)]
radeon: Remove set-but-unused color_mask variable.

This has been around since the initial import in 2003 and never used.

13 years agointel: Fix unused variable warning.
Eric Anholt [Mon, 1 Aug 2011 23:06:59 +0000 (16:06 -0700)]
intel: Fix unused variable warning.

13 years agor600g: remove dummy function r600_bo_offset
Marek Olšák [Sat, 23 Jul 2011 02:29:59 +0000 (04:29 +0200)]
r600g: remove dummy function r600_bo_offset

Always returned 0.

13 years agor600g: remove unused code
Marek Olšák [Fri, 22 Jul 2011 16:45:30 +0000 (18:45 +0200)]
r600g: remove unused code

13 years agogallium/util: add functions for manipulating swizzles
Marek Olšák [Mon, 1 Aug 2011 23:04:58 +0000 (01:04 +0200)]
gallium/util: add functions for manipulating swizzles

Some of those have been in drivers already.

13 years agoi915: Only emit program errors when INTEL_DEBUG=wm or INTEL_DEBUG=fallbacks
Ian Romanick [Thu, 10 Feb 2011 21:20:26 +0000 (13:20 -0800)]
i915: Only emit program errors when INTEL_DEBUG=wm or INTEL_DEBUG=fallbacks

This makes piglit a lot more happy.  The errors are logged when
INTEL_DEBUG=fallbacks because the application is about to hit a big
software fallback.  We frequently ask people to run applications that
are hitting software fallbacks with INTEL_DEBUG=fallbacks so the we
can help them debug the reason for the software fallback.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi915: Fail without crashing if a Mesa IR program uses too many registers
Ian Romanick [Mon, 25 Jul 2011 23:41:39 +0000 (16:41 -0700)]
i915: Fail without crashing if a Mesa IR program uses too many registers

This can only happen in GLSL shaders because assembly shaders that use
too many temps are rejected by core Mesa.  It is easiest to make this
happen with shaders that contain flow-control that could not be lowered.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoir_to_mesa: Emit warnings instead of errors for IR that can't be lowered
Ian Romanick [Mon, 25 Jul 2011 22:58:07 +0000 (15:58 -0700)]
ir_to_mesa: Emit warnings instead of errors for IR that can't be lowered

Rely on the driver to do the right thing.  This probably means falling
back to software.  Page 88 of the OpenGL 2.1 spec specifically says:

    "A shader should not fail to compile, and a program object should
    not fail to link due to lack of instruction space or lack of
    temporary variables. Implementations should ensure that all valid
    shaders and program objects may be successfully compiled, linked
    and executed."

There is no provision for saying "No" to a valid shader that is
difficult for the hardware to handle, so stop doing that.

On i915 this causes a large number of piglit tests to change from FAIL
to WARN.  The warning is because the driver still emits messages to
stderr like "i915_program_error: Unsupported opcode: BGNLOOP".

It also fixes ES2 conformance CorrectFull_frag and CorrectParse1_frag
on i915 (and probably other hardware that can't handle loops).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoir_to_mesa: Use Add linker_error instead of fail_link
Ian Romanick [Mon, 25 Jul 2011 22:55:59 +0000 (15:55 -0700)]
ir_to_mesa: Use Add linker_error instead of fail_link

The functions were almost identical.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa: Ensure that gl_shader_program::InfoLog is never NULL
Ian Romanick [Thu, 28 Jul 2011 22:10:17 +0000 (15:10 -0700)]
mesa: Ensure that gl_shader_program::InfoLog is never NULL

This prevents assertion failures in ralloc_strcat.  The ralloc_free in
_mesa_free_shader_program_data can be omitted because freeing the
gl_shader_program in _mesa_delete_shader_program will take care of
this automatically.

A bunch of this code could use a refactor to use ralloc a bit more
effectively.  A bunch of the things that are allocated with malloc and
owned by the gl_shader_program should be allocated with ralloc (using
the gl_shader_program as the context).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agolinker: Make linker_{error,warning} generally available
Ian Romanick [Thu, 28 Jul 2011 21:09:06 +0000 (14:09 -0700)]
linker: Make linker_{error,warning} generally available

linker_warning is a new function.  It's identical to linker_error
except that it doesn't set LinkStatus=false and it prepends "warning: "
on messages instead of "error: ".

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agolinker: Make linker_error set LinkStatus to false
Ian Romanick [Thu, 28 Jul 2011 21:04:09 +0000 (14:04 -0700)]
linker: Make linker_error set LinkStatus to false

Remove the other places that set LinkStatus to false since they all
immediately follow a call to linker_error.  The function linker_error
was previously known as linker_error_printf.  The name was changed
because it may seem surprising that a printf function will set an
error flag.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965/gen5+: Fix incorrect miptree layout for non-power-of-two cubemaps.
Kenneth Graunke [Sat, 30 Jul 2011 23:44:49 +0000 (16:44 -0700)]
i965/gen5+: Fix incorrect miptree layout for non-power-of-two cubemaps.

For power-of-two sizes, h0 == mt->height0 since it's already a multiple
of two.  However, for NPOT, they're different; h1 should be computed
based on the original size.

Fixes piglit test "cubemap npot" and oglconform test "textureNPOT".

NOTE: This is a candidate for stable release branches.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoglsl_to_tgsi: copy reladdr in st_src_reg(st_dst_reg) constructor
Bryan Cain [Wed, 27 Jul 2011 21:39:40 +0000 (16:39 -0500)]
glsl_to_tgsi: copy reladdr in st_src_reg(st_dst_reg) constructor

This is a glsl_to_tgsi port of commit f7cd9a858c04.