Commit graph

47189 commits

Author SHA1 Message Date
Eric Anholt
7ec2b0d0d6 mesa: Convert fixed function fragment program generator to GLSL IR.
This is a step towards providing a direct route for drivers accepting
GLSL IR for codegen.  Perhaps more importantly, it runs the fixed
function fragment program through the GLSL IR optimization.  Having
seen how easy it is to make ugly fixed function texenv code that can
do unnecessary work, this may improve real applicatinos.
2011-10-18 10:54:32 -07:00
Eric Anholt
57f7978b1d mesa: Add a flag for shader programs to allow SSO linkage in GLES2.
On converting fixed function programs to generate GLSL, the linker
became cranky that we were trying to make something that wasn't a
linked vertex+fragment program.  Given that the Mesa GLES2 drivers
also support desktop GL with EXT_sso, just telling the linker to shut
up seems like the easiest solution.
2011-10-18 10:54:32 -07:00
Eric Anholt
f868cb0963 glsl: Add gl_CurrentAttrib{Vert,Frag}MESA internal builtin uniforms.
These will be used by the FF VS/FS to represent the current attributes
when they don't have an active vertex array.
2011-10-18 10:54:32 -07:00
Eric Anholt
b64ecf7db8 ff_fragment_shader: Use FRAG_RESULT_COLOR to write all our colors at once.
This is a slight simplification on the way to actually generating GLSL
fragment shaders.
2011-10-18 10:54:31 -07:00
Thomas Hellstrom
6235846cb7 svga: Plug a fence leak
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
2011-10-18 10:37:12 +02:00
Stéphane Marchesin
0b3842edb1 i915g: Use the right shader limits. 2011-10-17 21:43:46 -07:00
Stéphane Marchesin
3637b5f0dd i915g: Add TODO. 2011-10-17 21:43:46 -07:00
Mathias Fröhlich
e556983fc8 r600g: Use the bitfield define matching the register it is used for.
Fix a typo that should result in the same code.
2011-10-18 06:35:21 +02:00
Marcin Slusarz
638d5a10f3 st/xorg: fix build when /lib/gallium directory does not exist yet
TARGET was not defined, so make checked directory instead of file
2011-10-17 22:57:27 +02:00
Marcin Slusarz
106c99fee5 targets/va/vdpau/xvmc: don't rebuild target lib every time
Dependency on target directory caused unnecessary relink. Remove them.
2011-10-17 22:57:27 +02:00
Marcin Slusarz
adbab41e67 st/xorg: remove target library on make clean 2011-10-17 22:57:27 +02:00
Marcin Slusarz
757390491c gallium/targets: use c++ compiler for linking
As pointed out by Michel Dänzer, gcc -lstdc++ doesn't work on all systems,
because it may require other libraries which are only pulled in implicitly
by g++. And libstdc++ is available only with GNU compiler.

Use c++ compiler for linking and remove redundant LDFLAGS += -lstdc++
all over the tree.
2011-10-17 22:57:27 +02:00
Tom Fogal
c0573fb29d Add an autoconf option for mangling Mesa.
In addition to setting up the flags correctly, this renames the
generated libraries to ensure they get 'Mangled' in the name.
This is very useful for distros and the like, where mangled Mesa
and non-mangled GL libraries typically need to be installed
side-by-side.

Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2011-10-17 10:14:26 -06:00
Tom Stellard
53d32600cc r300/compiler: Try to eliminate REPL_ALPHA instructions
Scalar instruction that need to write to the xyz components of a
register must reserve the RGB instruction slot for a REPL_ALPHA
instruction.  With this commit, the scheduler will attempt to free
the RGB slot by moving the write to the w component of a register.
2011-10-16 19:54:48 -07:00
Tom Stellard
8327fd18c9 r300/compiler: More agressive RGB to Alpha conversions 2011-10-16 19:54:48 -07:00
Tom Stellard
653c7af3d6 r300/compiler: Only convert RGB->Alpha when optimizations are enabled 2011-10-16 19:54:48 -07:00
Yuanhan Liu
e9edcf8b1d mesa: add a function to do the image data copy stuff for save_CompressedTex(Sub)Image
Introuduce a simple function called copy_data to do the image data copy
stuff for all the save_CompressedTex*Image function. The function check
the NULL data case to avoid some potential segfault. This also would
make the code a bit simpler and less redundance.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2011-10-17 09:41:58 +08:00
José Fonseca
1448bdf1c0 configure: Use -fno-builtin-memcmp.
Issue spotted by Adam Jackson <ajax at redhat.com>.

http://lists.freedesktop.org/archives/mesa-dev/2011-June/009077.html
2011-10-16 16:11:46 +01:00
José Fonseca
e1e03ce492 gallivm: Eliminate tgsi_util_get_full_src_register_sign_mode call.
It complicates more than it simplifies, now that there's only one negate
bit on TGSI registers.
2011-10-16 14:18:42 +01:00
José Fonseca
e9c1d87ce7 llvmpipe: Use lp_build_ifloor_fract for exp2 calculation.
Instead of separate ifloor / fract calls.

No change for SSE4.1 code, but less FP<->SI conversions on non SSE4.1
systems.
2011-10-16 14:18:41 +01:00
Marek Olšák
1350882e49 Revert "r300g: fix rendering with a non-zero index bias in draw_elements_immediate"
This reverts commit 5506f6ef96.

It breaks more things than it fixes.
2011-10-16 03:19:11 +02:00
Chad Versace
4bcda85698 swrast: Remove redundant term in logic expression
Fix is in {read,draw}_depth_stencil_pixels().  If depthRb == stencilRb,
then it is redundant to check depthRb->x *and* stencilRb->x.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Chad Versace <chad@chad-versace.us>
2011-10-15 15:49:03 -07:00
Chad Versace
244a02c47d swrast: Fix fastpaths in glRead/WritePixels(GL_DEPTH_STENCIL)
For glReadPixels, the user supplied pixels have format
GL_UNSIGNED_INT_24_8.  But, when the depthstencil buffer's format was
MESA_FORMAT_S8_Z24, the fastpath read from the buffer without reordering
the depth and stencil bits. To fix this, this patch just skips the
fastpath when the format is not MESA_FORMAT_Z24_S8.

The problem and fix for glWritePixels is analagous.

Fixes the Piglit tests below on i965/gen6 and causes no regressions.
   general/depthstencil-default_fb-drawpixels-24_8
   general/depthstencil-default_fb-readpixels-24_8
   EXT_packed_depth_stencil/fbo-depthstencil-GL_DEPTH24_STENCIL8-drawpixels-24_8
   EXT_packed_depth_stencil/fbo-depthstencil-GL_DEPTH24_STENCIL8-readpixels-24_8

Note: This is a candidate for the stable branches.
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Chad Versace <chad@chad-versace.us>
2011-10-15 15:45:07 -07:00
Christoph Bumiller
9934bfe28d nv50,nvc0: extend formats table for integer formats 2011-10-15 14:12:31 +02:00
Christoph Bumiller
a4f26f2bea gallium: add PIPE_BIND_BLENDABLE flag
This is required for an accurate implementation of d3d1x's
CheckFormatSupport query.

It also seems generally useful for state trackers, which could
choose alternative rendering paths or formats if blending would
come at a significant performance loss.
2011-10-15 14:12:31 +02:00
Tom Stellard
0dc97e7fd4 r300/compiler: Enable reg rename pass on r500 and run it before optimizations
The scheduler and the register allocator are now smart enough to handle
it.
2011-10-14 18:30:14 -07:00
Tom Stellard
163629fd05 r300/compiler: Implement the texture semaphore
The texture semaphore allows for prefetching of texture data.  On my
RV515, this increases the FPS of Lightsmark by 33% (This is with the
reg_rename pass enabled, which is enabled in the next commit).

There is a new env variable now called RADEON_TEX_GROUP, which allows
you to specify the maximum number of texture lookups to do at once.
The default is 8, but different values could produce better results
for various application / card combinations.
2011-10-14 18:30:14 -07:00
Tom Stellard
51fe9994bd r300/compiler: Don't pair output writes with GPR writes in the scheduler 2011-10-14 18:30:14 -07:00
Tom Stellard
6fafb6beb7 r300/compiler: Prevent regalloc from creating non-native swizzles 2011-10-14 18:30:14 -07:00
Tom Stellard
47c7512846 r300/compiler: Allow merged instructions to be scheduled on demand
We no longer emit full instructions immediately after they have been
merged.  Instead merged instructions are added to the ready list and
the scheduler can commit them whenever it wants.
2011-10-14 18:30:14 -07:00
Ian Romanick
c19f8ab279 mesa/vbo: Treat attribute 0 and vertex as the same
This is supported by the pseudo-code on pages 27 and 28 (pages 41 and
42 of the PDF) of the OpenGL 2.1 spec.  The last part of the
implementation of ArrayElement is:

    if (generic attribute array 0 enabled) {
      if (generic vertex attribute 0 array normalization flag is set, and
	  type is not FLOAT or DOUBLE)
	VertexAttrib[size]N[type]v(0, generic vertex attribute 0 array element i);
      else
	VertexAttrib[size][type]v(0, generic vertex attribute 0 array element i);
    } else if (vertex array enabled) {
      Vertex[size][type]v(vertex array element i);
    }

Page 23 (page 37 of the PDF) of the same spec says:

    "Setting generic vertex attribute zero specifies a vertex; the
    four vertex coordinates are taken from the values of attribute
    zero. A Vertex2, Vertex3, or Vertex4 command is completely
    equivalent to the corresponding VertexAttrib* command with an
    index of zero."

Fixes piglit test attribute0.

NOTE: This is a candidate for stable branches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2011-10-14 09:40:31 -07:00
Marek Olšák
ae272a92a1 r300g: set max vertex samplers to 0 on swtcl chipsets
This should fix a bug added by f5bfe54a.

Might also fix:
https://bugs.freedesktop.org/show_bug.cgi?id=41715
2011-10-14 15:06:01 +02:00
Thomas Hellstrom
5dddeb7776 winsys/svga: Rework buffer allocation to make it more robust v2.
Don't allow any "CPU" buffers to be allocated by the pb_fenced
buffer manager, since we can't protect against failures during
buffer validation.
Also, add an extra slab buffer manager to allocate buffers from
the kernel if there is a failure to allocate from our big buffer pool.
The reason we use a slab manager for this, is to avoid allocating
many very small buffers from the kernel.

v2: Increased VMW_MAX_BUFFER_SIZE and fixed some comments.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
2011-10-14 09:53:19 +02:00
Thomas Hellstrom
83d57635bc dri-vmwgfx: Hook up a drm_descriptor configuration function
Returns a configuration that makes the dri state-tracker-manager
throttle.
Also disable kernel-based throttling.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
2011-10-14 09:53:15 +02:00
Thomas Hellstrom
bde2fc5a71 st/dri: Hook up throttling based on the drm driver_descriptor configuration
Hooks up throttling if there is a configuration function present and
it indicates that throttling is desired.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
2011-10-14 09:53:11 +02:00
Thomas Hellstrom
ec7d5b8c02 drm_driver: Add a configuration function to the driver descriptor.
Adds a possibility for the state tracker manager to query the
target for a specific configuration.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
2011-10-14 09:53:05 +02:00
Thomas Hellstrom
5a6ca7e9f2 svga/winsys: Make sure a flush always inserts and returns a fence if requested
Needed for throttling.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrant <jakob@vmware.com>
2011-10-14 09:53:01 +02:00
Thomas Hellstrom
23c41233ce st/dri: Implement the new dri2 throttling extension
But don't hook it up just yet until we figure out a good way to do that.
Also, we should, in the future, add driconf options to control what
throttling reasons should be honored, and the number of outstanding
swaps allowed.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
2011-10-14 09:52:57 +02:00
Thomas Hellstrom
511dc295f8 dri2: Implement a throttle dri extension.
The X server has limited throttle support on the server side,
but doing this in the client has some benefits:

1) X server throttling is per client. Client side throttling can be done
per drawable.

2) It's easier to control the throttling based on what client is run,
for example using "driconf".

3) X server throttling requires drm swap complete events.

So implement a dri2 throttling extension intended to be used by direct
rendering clients.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Michel Dänzer <michel@daenzer.net>
2011-10-14 09:52:53 +02:00
Brian Paul
718cbe4ba9 swrast: be a bit smarter in clip_span()
If no pixels pass the clip test, return false.
2011-10-13 17:16:19 -06:00
Brian Paul
bc4ef33108 mesa: remove unused gl_sampler_object::_CompleteTexture field 2011-10-13 17:14:24 -06:00
Brian Paul
6fc6d5a09e meta: fix redBits size test in get_temp_image_type()
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=41768
2011-10-13 17:12:44 -06:00
Mathias Froehlich
7b09a94282 st/wgl: Release stw_framebuffer::mutex after pbuffer creation.
This change releases the stw_framebuffer::mutex past creation of
the pbuffer stw_framebuffer. Without this change the pbuffers
lock is never released. Since on win32 mutexes are recursive, this
does not hurt as long as all actions on a context are done from
the same thread. But if, for example, context creation happens in
a different thread than usage, every access to the context will
block for ever.

Signed-off-by: José Fonseca <jfonseca@vmware.com>
2011-10-13 19:53:13 +01:00
Marcin Slusarz
349e4db99e st/xorg: fix build without LLVM 2011-10-13 19:02:20 +02:00
Paul Berry
7a4fee71aa i965 Gen6+: De-compact clip plane constants for old VS backend.
In commit 018ea68d87, when I
de-compacted clip planes on Gen6+, I updated both the old and new VS
back-ends to reflect the change in how clip planes are stored, but I
failed to change the code in gen6_vs_state.c that uploads clip plane
constants when using the old VS back-end.

As a result, if the set of enabled clip planes wasn't contiguous
starting with 0, then clipping would not occur properly.  This patch
corrects gen6_vs_state.c to upload clip plane constants in the new
de-compacted form.

This only affects the old VS back-end (which is used for
fixed-function and ARB vertex programs, not for GLSL vertex shaders).

Fixes Piglit test fixed-clip-enables.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41603

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-10-13 08:41:16 -07:00
Brian Paul
a9e5528f09 st/mesa: kill instruction if writemask=0 in eliminate_dead_code_advanced()
This fixes a bug where we'd wind up emitting an invalid instruction like
MOVE R[0]., R[1];  - note the empty/zero writemask.  If we don't write to
any dest register channels, cull the instruction.

v2: simply change/fix the existing test for instruction culling.
2011-10-13 08:35:19 -06:00
Brian Paul
e06277bd88 s/format/baseFormat/ to be more explicit
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-10-13 07:38:28 -06:00
Brian Paul
241b3e4bbe mesa: remove redundant buffer checks in copytexsubimage_error_check2()
Again, there was already a call to _mesa_source_buffer_exists() earlier in
the function.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-10-13 07:38:24 -06:00
Brian Paul
63aa53bf34 mesa: remove redundant buffer checks in copytexture_error_check()
There was already a call to _mesa_source_buffer_exists() earlier in
the function.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-10-13 07:38:03 -06:00
Brian Paul
504d0add12 mesa: check attachment Type field in renderbuffer_exists()
Instead of the renderbuffer pointer.  In the future, attaching a texture
may not mean the renderbuffer pointer gets set too.
Plus, remove some commented-out assertions.
2011-10-13 07:37:43 -06:00