Commit graph

48156 commits

Author SHA1 Message Date
Brian Paul
94780b5ee6 st/mesa: remove most of the ReadPixels code
We can use the core Mesa code for glReadPixels now.  We just have to
validate state and flush the bitmap cache before reading.
2011-11-15 07:49:26 -07:00
Brian Paul
3754ebb33d st/mesa: remove dependencies on code in st_cb_readpixels.c
st_cb_readpixels.c is going away next.

Acked-by: Eric Anholt <eric@anholt.net>
2011-11-15 07:49:26 -07:00
Brian Paul
77c85f014a mesa: remove _swrast_ReadPixels()
We use the code in main/readpix.c now.

Acked-by: Eric Anholt <eric@anholt.net>
2011-11-15 07:49:26 -07:00
Brian Paul
bd5ba36bf7 mesa: use _mesa_readpixels() as default driver hook
Acked-by: Eric Anholt <eric@anholt.net>
2011-11-15 07:49:26 -07:00
Brian Paul
d2a23d4ded mesa: move swrast ReadPixels code into core Mesa
The swrast ReadPixels code has no dependencies on swrast since moving
to Map/UnmapRenderbuffer().  We'll be able to remove s_readpix.c and
remove the state tracker's glReadPixels code next.

Acked-by: Eric Anholt <eric@anholt.net>
2011-11-15 07:49:26 -07:00
Brian Paul
e0e454943c st/mesa: check renderbuffer orientation in st_MapRenderbuffer()
We'll soon be able to use these for a core Mesa implementation of
glReadPixels.

Acked-by: Eric Anholt <eric@anholt.net>
2011-11-15 07:49:25 -07:00
Brian Paul
371b1648ab mesa: remove support for software alpha buffers
This was only used by the xlib driver to add an alpha channel to the
front/window color buffer.  This was no longer going to work well with
the move to direct mapping of renderbuffers.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-11-15 07:49:25 -07:00
Brian Paul
6c6803f28d xlib: remove xm_image.[ch] files
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-11-15 07:49:25 -07:00
Brian Paul
bc63b226bc xlib: remove a ton of old xlib driver cruft
The days of 1-bpp, 8-bpp and dithering are long behind us.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-11-15 07:49:25 -07:00
Brian Paul
c9bfad2921 xlib: use MESA_FORMAT_XRGB8888 for pixmap surfaces
We no longer have software-allocated alpha buffers so we can forget
about the alpha channel.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-11-15 07:49:25 -07:00
Brian Paul
dff2394e08 xlib: remove software alpha buffer support
Seldom used and this won't work when we move to using Map/UnmapRenderbuffer
everywhere.  This will let us remove a bunch of core Mesa code too.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-11-15 07:49:25 -07:00
Brian Paul
6d68855df1 mesa: replace GLstencil with GLubyte 2011-11-15 07:49:25 -07:00
Chad Versace
cc502aa941 intel: Fix intel_map_renderbuffer() for depthstencil buffers with separate stencil
For a depthstencil buffer with separate stencil,
intel_renderbuffer::region is null. (The regions are kept in hidden depth
and stencil buffers). Since the region is null, intel_map_renderbuffer()
assumed there was no data and returned a null map pointer, which in turn
was dereferenced (!) by MapRenderbuffer's caller.

This patch fixes intel_map_renderbuffer() to map the hidden depth buffer
through the GTT and return that as the mapped pointer. Also, the stencil
bits are scattered and gathered when needed.

Fixes the following Piglit tests on gen7:
    fbo/fbo-readpixels-depth-formats
    hiz/hiz-depth-read-fbo-d24s8
    hiz/hiz-stencil-read-fbo-d24s8
    EXT_packed_depth_stencil/fbo-clear-formats
    EXT_packed_depth_stencil/fbo-depth-GL_DEPTH24_STENCIL8-blit
    EXT_packed_depth_stencil/fbo-depth-GL_DEPTH24_STENCIL8-drawpixels
    EXT_packed_depth_stencil/fbo-depth-GL_DEPTH24_STENCIL8-readpixels
    EXT_packed_depth_stencil/fbo-depthstencil-GL_DEPTH24_STENCIL8-readpixels-24_8
    EXT_packed_depth_stencil/fbo-depthstencil-GL_DEPTH24_STENCIL8-readpixels-FLOAT-and-USHORT
    EXT_packed_depth_stencil/fbo-stencil-GL_DEPTH24_STENCIL8-readpixels

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-15 06:42:09 -08:00
Chad Versace
5365ba19db intel: Fix software detiling of system stencil buffers
If a window system stencil buffer had a region with odd height, then the
calculated y offset needed for software detiling was off by one.  The bug
existed in intel_{map,unmap}_renderbuffer_s8() and in the intel_span.c
accessors.

Fixes the following Piglit tests on gen7:
    general/depthstencil-default_fb-readpixels-24_8
    general/depthstencil-default_fb-readpixels-FLOAT-and-USHORT

Fixes SIGABRT in the following Piglit tests on gen7:
    general/depthstencil-default_fb-blit
    general/depthstencil-default_fb-copypixels
    general/depthstencil-default_fb-drawpixels-24_8
    general/depthstencil-default_fb-drawpixels-FLOAT-and-USHORT

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-15 06:42:05 -08:00
Chad Versace
87d6b35974 intel: Fix intel_unmap_renderbuffer_s8()
When gathering the temporary buffer's pixles into the gem buffer, we had
the two buffers juxtaposed. Oops.

Fixes the following Piglit tests on gen7:
   general/GL_SELECT - alpha-test enabled
   general/GL_SELECT - depth-test enabled
   general/GL_SELECT - no test function
   general/GL_SELECT - scissor-test enabled
   general/GL_SELECT - stencil-test enabled

Fixes SIGABRT in Piglit tests EXT_framebuffer_object/fbo-stencil-* on
gen7.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-15 06:42:00 -08:00
Chad Versace
f911cac7a7 intel: Refactor intel_map_renderbuffer()
The function already implements 3 cases (map through GTT, blit to
a temporary, and detile stencil buffer to temporary), and a 4th will be
added soon: scatter/gather for depthstencil buffers using separate
stencil.  For sanity's sake, this factors each case out into its own
function.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-15 06:41:49 -08:00
Yuanhan Liu
9d4d9d34d8 ir_to_mesa: don't init unfirom if link failed
Don't call set_unfiform_initializers if link failed, or it would trigger
a GL_INVALID_OPERATION error. That's not an expected behavior of
glLinkProgram function.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2011-11-15 16:25:40 +08:00
Kenneth Graunke
f1a677cefb glsl: Always search for an exact function signature match.
Previously, we would fail to compile the following shader due to a bug
in lazy built-in importing:

    #version 130
    void main() {
        float f = abs(5.0);
        int i = abs(5);
    }

The first call, abs(5.0), would fail to find a local signature, look
through the built-ins, and import "float abs(float)".

The second call, abs(5), would find the newly imported float signature
in the local shader, and settle for that.  Unfortunately, it failed to
search the built-ins for the correct/exact signature, "int abs(int)".

Thus, abs(5) ended up being a float, causing a bizarre type error when
we tried to assign it to an int.

Fixes piglit test builtin-overload-matching.frag.

This is /not/ a candidate for stable branches, as it should only be
possible to trigger this bug using GLSL 1.30's built-in functions that
take integer arguments.  Plus, the changes are fairly invasive.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-14 17:18:12 -08:00
Kenneth Graunke
cdc9408266 glsl: Split code to generate an ir_call out from match_function_by_name.
match_function_by_name performs two fairly separate tasks:
1. Hunt down the appropriate ir_function_signature for the callee.
2. Generate the actual ir_call (assuming we found the callee).

Both of these are complicated.  The first has to handle exact/inexact
matches, lazy importing of built-in prototypes, different scoping rules
for 1.10, 1.20+, and ES.  Not to mention printing a user-friendly error
message with pretty-printed "maybe you meant this" candidate signatures.

The second has to deal with void/non-void functions, pre-call implicit
conversions for "in" parmeters, and post-call "out" call conversions.

Trying to do both in one function is just too unwieldy.  Time to split.

This patch purely moves the code to generate an ir_call into a separate
function and reindents it.  Otherwise, the code is identical.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2011-11-14 17:18:03 -08:00
Kenneth Graunke
861d0a5e12 glsl: Add a new matching_signature() variant that returns exact/inexact.
When matching function signatures across multiple linked shaders, we
often want to see if the current shader has _any_ match, but also know
whether or not it was exact.  (If not, we may want to keep looking.)

This could be done via the existing mechanisms:

   sig = f->exact_matching_signature(params);
   if (sig != NULL) {
      exact = true;
   } else {
      sig = f->matching_signature(params);
      exact = false;
   }

However, this requires walking the list of function signatures twice,
which also means walking each signature's formal parameter lists twice.
This could be rather expensive.

Since matching_signature already internally knows whether a match was
exact or not, we can just return it to get that information for free.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2011-11-14 17:17:39 -08:00
Marek Olšák
4f7c21899a r600g: fix the representation of control-flow instructions
We need something that looks like a compiler and not like some hacker
put some functions together. /rant

This is a band-aid for these two problems:
- The R600 and EG control-flow instructions appear in switch statements
  next to each other, causing conflicts when adding new instructions.
- The ALU control-flow instructions are bitshifted by 3 (from CF_INST 26:29
  to CF_INST 23:29, as is defined by r600 ISA) even for EG, where CF_INST
  is 22:29.

To fix this mess, the 'inst' field is bitshifted to the left either by 22, 23,
or 26 (directly in the definitions), such that it can be just or'd when making
bytecode without any shifting. All switch statements have been divided into
two, one for R600 and the other for EG.

Of course, there is a better way to do this, but that is left for future
work.

Tested on RV730 and REDWOOD with no regressions.

v2: minor cleanup as per Alex's comment.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2011-11-15 00:04:43 +01:00
Ian Romanick
fa704cc558 glsl: Remove resource count checks from ir_to_mesa and st_glsl_to_tgsi
These checks are now performed by the linker.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-14 11:08:53 -08:00
Ian Romanick
92f8159045 linker: Validate resource usage in the linker
This is also done in ir_to_mesa and st_glsl_to_tgsi, but that code
will be removed soon.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-14 11:08:51 -08:00
Ian Romanick
6ac895a664 linker: Count the number of uniform components used by a shader during linking
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-14 11:08:49 -08:00
Ian Romanick
812aa88393 linker: Count the number of samplers used by a shader during linking
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-14 11:08:28 -08:00
Eric Anholt
196c6d4adf meta: Fix restoring of fixed function texture enables.
If they were disabled on entry, and we enabled one (like for
BlitFramebuffer), we wouldn't disable it on the way out.  Retain the
attempted optimization here (don't keep calling to set each bit for
changes that won't matter) by just setting the bits directly with
appropriate flushing.

Fixes misrendering on the second draw of piglit fbo-blit.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-11-14 09:26:53 -08:00
Eric Anholt
95a826bed3 meta: Don't forget to flag state when restoring texobjects.
It's unlikely that we changed the object but no other texture
parameter, but be correct anyway.  Noticed by inspection.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-11-14 09:26:53 -08:00
Christoph Bumiller
da1544b39e st/mesa: fix system value to semantic mapping
Broken by addition of SYSTEM_VALUE_VERTEX_ID in
919c53e87a.
2011-11-14 18:14:02 +01:00
Christoph Bumiller
e7ccd703a2 gallium: add TGSI_SEMANTIC_VERTEXID 2011-11-14 18:12:46 +01:00
Vadim Girlin
a2bcaba1cd r600g: mask write for fake VS export components 2011-11-14 11:11:54 -05:00
Vadim Girlin
dcdc062dda r600g: fix op3 & write in merge_inst_groups 2011-11-14 11:11:31 -05:00
Alex Deucher
ebecbbc2e6 r600g: set max max tex/vtx instructions count to 16 for cayman
Cayman is 16 as well.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2011-11-14 11:01:00 -05:00
Vadim Girlin
c32ca6d9c1 r600g: set max tex/vtx instructions count to 16 for evergreen
According to evergreen-isa doc 16 is max value for evergreen.
More than 16 doesn't work for me.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
2011-11-14 10:59:53 -05:00
Fabio Pedretti
8f55f5b77b radeon: further cleanup of shared code
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2011-11-14 10:54:19 -05:00
Alex Deucher
494d005390 radeon: add some missing FireMV pci ids
Note: this is a candidate for the stable branches.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2011-11-14 09:57:05 -05:00
José Fonseca
8f9fc8b9d2 mesa/st: Flush stdout after pritingin the GLSL.
Otherwise it gets all garbled with stderr.
2011-11-14 14:43:25 +00:00
José Fonseca
b0cdeda4f2 glsl: Add missing ';' in action statement.
Addresses the warnings:

  warning: a `;' might be needed at the end of action code
  warning: future versions of Bison will not add the `;'
2011-11-14 14:14:45 +00:00
José Fonseca
ab3ace56c4 llvmpipe: Silent warnings about undeclared llvmpipe_check_render_cond. 2011-11-14 13:50:33 +00:00
José Fonseca
6246c217ec util: Avoid signed/unsigned comparison in u_trim_pipe_prim(). 2011-11-14 10:06:01 +00:00
José Fonseca
d7edd5db31 llvmpipe: Remove unused variables.
Reviewed-by: Brian Paul <brianp@vmware.com>
2011-11-14 10:06:01 +00:00
José Fonseca
c88f3e0374 llvmpipe: Make more resilient to out-of-memory situations.
Most of the code was alright, but we were missing a few paths.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-11-14 10:06:01 +00:00
José Fonseca
9e29cdbe95 draw: Handle failure to allocate aligned_constant_storage.
Also, actually update const_storage_size, therefore avoiding to
unnecessarily reallocate aligned_constant_storage every single time
draw_vs_set_constants() is called.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-11-14 10:06:00 +00:00
José Fonseca
e21c5157b6 gallivm: Remove duplicate statement.
ary_ge_arx_arz is already set earlier.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-11-14 10:06:00 +00:00
José Fonseca
34930facfe gallivm: Include stddef.h before the LLVM C++ headers.
Necessary with build against LLVM 2.6, with recent gcc, as LLVM headers
depend on ptrdiff_t but don't properly include stddef.h
2011-11-14 10:06:00 +00:00
Dave Airlie
b04d19da10 llvmpipe: fix unswizzle of packed float types.
I messed up adding the ubyte->float conversion.

This fixes getteximage-formats

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

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-11-14 09:35:17 +00:00
Alex Deucher
579c04e42e r600g: properly handle cayman in is_alu_vec_unit_inst()
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2011-11-13 17:46:01 -05:00
Vadim Girlin
3d441153a1 r600g: fix cb offset for flushed_depth_texture
Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
2011-11-13 17:27:16 -05:00
Vadim Girlin
d5e91a2364 r600g: fix stencil buffer ref counting on evergreen
Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
2011-11-13 17:25:16 -05:00
Vadim Girlin
8e366dc365 r600g: lazy load for AR register
Emit MOVA* instruction only when AR is used.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
2011-11-13 17:10:02 -05:00
Vadim Girlin
88a140cd19 r600g: include INTERP_[XY|ZW] in is_alu_vec_unit_inst
This will disallow moving them to the trans slot in merge_inst_groups

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
2011-11-13 17:09:59 -05:00