Commit graph

47237 commits

Author SHA1 Message Date
Brian Paul
27de26073b st/glx: fix mixed declarations and code, remove unused var 2011-10-26 16:45:04 -06:00
Brian Paul
2997b45896 st/mesa: tell VBO module to always unmap buffers before drawing
Without this it's possible to wind up in a draw call with the
glBegin/End VBO still in a mapped state.  This is a problem for
the SVGA3D driver and probably not good for other HW drivers.
2011-10-26 16:45:03 -06:00
Eric Anholt
4fc9a98a0e glsl: Rename remaining internal builtins from gl_MESA* to gl_*MESA.
This matches the usual convention for extension builtin variables.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-10-26 12:52:11 -07:00
Eric Anholt
4ad8a0adec intel: Drop texture border support code.
Now that texture borders are gone, we never need to allocate our
textures through non-miptrees, which simplifies some irritating paths.

v2: Remove the !mt support case from intel_map_texture_image()

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
Reviewed-by: Brian Paul <brianp@vmware.com>
2011-10-26 12:42:28 -07:00
Eric Anholt
96db07e28c intel: Enable stripping of texture borders.
This replaces software rendering of textures with the deprecated
1-pixel border (which is always bad, since mipmapping is rather broken
in swrast, and GLSL 1.30 is unsupported) with hardware rendering that
just pretends there was never a border (so you have potential seams on
apps that actually intentionally used the 1-pixel borders, but correct
rendering otherwise).

This doesn't regress any piglit tests on gen6 (since the texwrap
border/bordercolor cases already failed due to broken border color
handling), but regresses texwrap border cases on original gen4 since
those end up sampling the border color instead of the border pixels.
It's a small price to pay for not thinking about texture borders any
more.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
2011-10-26 12:42:23 -07:00
Eric Anholt
638b657f83 mesa: Apply StripTextureBorder to CopyTexImage as well.
Reviewed-by: Brian Paul <brianp@vmware.com>
2011-10-26 12:42:20 -07:00
Eric Anholt
9c4b025287 mesa: Fold gallium's texture border stripping into a core Mesa option.
We wanted to reuse this in the Intel driver.

v2: Move the flag to ctx->Const

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
Reviewed-by: Brian Paul <brianp@vmware.com>
2011-10-26 12:42:17 -07:00
Eric Anholt
b31104e318 mesa: Skip texstore for 0-sized texture data.
The intel driver (and gallium, it looks like, though it doesn't use
these texstore functions at this point) doesn't bother making storage
for textures with 0 width, height, or depth.  This avoids them having
to deal with returning a mapping for that nonexistent data.

Fixes assertion failures with an upcoming intel driver change.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-10-26 12:42:13 -07:00
Marek Olšák
69e48e7220 r600g: remove redundant assignment of pipe_draw_info in draw_vbo 2011-10-26 15:54:30 +02:00
Dave Airlie
d404f60693 llvmpipe: llvmpipe doesn't support pure integers yet.
Should fix: https://bugs.freedesktop.org/show_bug.cgi?id=42240

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-26 15:51:31 +02:00
Marek Olšák
344039d81d r600g: cleanup draw_vbo and add comments 2011-10-26 15:15:57 +02:00
Vinson Lee
20a20c781a ralloc: Move declaration before code.
Fixes build error with MSVC.
2011-10-25 20:31:14 -07:00
Vinson Lee
a936b206a0 scons: Add link_uniforms.cpp to SConscript. 2011-10-25 20:19:07 -07:00
Ian Romanick
6437a71d41 ir_to_mesa: Use uniform_field_visitor to add all struct fields to parameter list
Previously the uniform was passed as single, whole structure to
_mesa_add_parameter.  This was completely bogus and resulted in a
DataType of 0 (instead of a valid GLSL type enum).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41980
Tested-by: Brian Paul <brianp@vmware.com>
Cc: Bryan Cain <bryancain3@gmail.com>
Cc: Vinson Lee <vlee@vmware.com>
Cc: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-10-25 17:51:57 -07:00
Ian Romanick
747e59c759 linker: Add uniform_field_visitor class to process leaf fields of a uniform
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2011-10-25 17:51:57 -07:00
Kenneth Graunke
ca95593d49 ralloc: Add new [v]asprintf_rewrite_tail functions.
This can be useful if you want to create a bunch of temporary strings
with a common prefix.  For example, when iterating over uniform
structure fields, one might want to create temporary strings like
"pallete.primary", "palette.outline", and "pallette.shadow".

This could be done by overwriting the '.' with a null-byte and calling
ralloc_asprintf_append, but that incurs the cost of strlen("pallete")
every time...when this is already known.

These new functions allow you rewrite the tail of the string, given a
starting index.  If the starting index is the length of the string, this
is equivalent to appending.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-10-25 17:51:43 -07:00
Ian Romanick
960d722bf7 linker: Eliminate more dead code after demoting shader inputs and outputs
Consider the following vertex shader and fragment shader:

// vertex shader
varying vec4 v;
uniform vec4 u;

void main() { gl_Position = vec4(0.0); v = u; }

// fragment shader
void main() { gl_FragColor = vec4(0.0); }

Since the fragment shader does not use 'v', it is demoted from a
varying to a simple global variable.  Once that happens, the
assignment to 'v' is useless, and it should be removed.  In addition,
'u' is no longer active, and it should also be removed.

Performing extra dead code elimination after demoting shader inputs
and outputs takes care of this.  This elimination must occur before
assigning uniform locations, or the declaration of 'u' cannot be
removed.

This change *breaks* the piglit test getuniform-01, but that test is
already incorrect.  The test uses a vertex shader that assigns to a
user-defined varying, but it has no fragment shader.  Since Mesa does
not support ARB_separate_shader_objects (we only support the EXT
version), the linker correctly eliminates the user-defined varying.
The cascading effect is that the uniform queried by the C code of the
test is also (correctly) eliminated.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41980
Tested-by: Brian Paul <brianp@vmware.com>
Cc: Bryan Cain <bryancain3@gmail.com>
Cc: Vinson Lee <vlee@vmware.com>
Cc: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
2011-10-25 17:51:43 -07:00
Ian Romanick
1d5d67f8ad glsl: Add uniform_locations_assigned parameter to do_dead_code opt pass
Setting this flag prevents declarations of uniforms from being removed
from the IR.  Since the IR is directly used by several API functions
that query uniforms in shaders, uniform declarations cannot be removed
after the locations have been set.  However, it should still be safe
to reorder the declarations (this is not tested).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41980
Tested-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Bryan Cain <bryancain3@gmail.com>
Cc: Vinson Lee <vlee@vmware.com>
Cc: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
2011-10-25 17:51:43 -07:00
Kenneth Graunke
384ad987a1 i965: Add more #defines for Gen6+ 3DSTATE_GS fields.
These should be useful for doing transform feedback on Sandybridge.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-10-25 17:09:35 -07:00
Kenneth Graunke
f1694eabdd i965: Add new brw_context::max_gs_threads constant.
These are correct to the best of my knowledge, gleaned from a variety of
internal sources.  Sadly, the Sandybridge PRM has incorrect limits.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-10-25 17:09:32 -07:00
Kenneth Graunke
db6dd6d88f i965: Rename (vs|wm)_max_threads to max_(vs|wm)_threads for consistency.
The inconsistency between vs_max_threads and max_vs_entries was rather
annoying.  I could never seem to remember which one was reversed, which
made it harder to find quickly.  "Max __ Threads" seems more natural.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-10-25 17:09:30 -07:00
Kenneth Graunke
47f1d9deff i965: Remove "single threaded" INTEL_DEBUG mode.
According to the docs for 3DSTATE_PS (Gen7+) and 3DSTATE_WM (Gen6),
there is a platform dependent value for the minimum number of pixel
shader threads.  It may also vary based on whether WIZ Hashing is on.

For example, Ivybridge requires at least 4 threads if WIZ hashing is
disabled, and 8 if it's enabled.  Programming it to use less threads is
illegal.  Sandybridge appears to have similar restrictions.

So on newer platforms, INTEL_DEBUG=sing will probably just hang the GPU.
Rather than try to patch it up for newer platforms and extend it to
support geometry shaders, just remove it as it isn't that useful anyway.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-10-25 17:09:21 -07:00
Kenneth Graunke
7a86bf816c mesa: Remove unnecessary and incorrect TexEnv parameter validation.
For GL_RGB_SCALE and GL_ALPHA_SCALE targets, the API wrapper code
attempts to ensure the parameter is 1.0, 2.0, or 4.0.

This is unnecessary: set_combiner_scale in texenv.c (called by
_mesa_TexEnvfv) already checks this and raises an appropriate error.

It's also incorrect: For glTexEnvx, the API validation code directly
compares the GLfixed input parameter with a floating point constant,
prior to converting fixed-point to floating point.

Fixes an issue in the OpenGL ES 1.1 conformance suite.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-10-25 16:25:39 -07:00
Stéphane Marchesin
00ddc7ea47 st/glx: Implement texture_from_pixmap without DRI.
Makes texture_from_pixmap work with non-DRI llvmpipe.
2011-10-25 14:35:46 -07:00
Stéphane Marchesin
b1d93d2aa8 i915g: Cleanup the vertex sampler interface a bit. 2011-10-25 14:30:08 -07:00
Stéphane Marchesin
2b4ab1435f i915g: Flesh out TODO idea. 2011-10-25 14:30:07 -07:00
Chad Versace
882c83377d intel: Kill dead code in intel_miptree_copy_teximage()
Kill the code paths taken when src_mt is null. It is never null, otherwise
there would be a segfault on line 4 of this function:
    GLuint width = src_mt->level[level].width;

(Some interleaved lines in the diff make the real diff non-obvious. All
I did was delete some code and then left-shifted what remained to correct
the indentation.)

Reviewed-by: Eric Anholt <eric@aholt.net>
Signed-off-by: Chad Versace <chad@chad-versace.us>
2011-10-25 11:28:32 -07:00
Vinson Lee
265f55e627 tgsi: Fix memory leak in out-of-memory path.
Fixes Coverity resource leak defect.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-10-25 11:12:51 -07:00
Vinson Lee
c81b441ba2 swrast: Fix memory leak in out-of-memory path.
Fixes Coverity resource leak defect.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-10-25 11:09:45 -07:00
Brian Paul
e8d0d7893a swrast: use _mesa_ffs() instead of ffs()
Fixes MSVC build.
2011-10-25 11:26:26 -06:00
Marek Olšák
765503bb5d r600g: move some code out of draw_vbo into new r600_update_derived_state 2011-10-25 19:21:49 +02:00
Marek Olšák
3d79347609 r600g: cleanup some magic numbers 2011-10-25 19:12:33 +02:00
Marek Olšák
dc651aff0c r600g: don't render if pipe_draw_info::count is 0
Also call r600_conv_pipe_prim earlier.
2011-10-25 19:12:33 +02:00
Brian Paul
05720e14ba mesa: fix comment language 2011-10-25 08:45:58 -06:00
Vinson Lee
ca1b60057a pp: Fix memory leak on error path.
Fixes Coverity resource leak defect.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2011-10-25 07:38:53 -07:00
Marek Olšák
faa16dc456 r600g: set correct tiling flags in depth info
The kernel currently overwrites the flags, but if we stopped doing that,
this would break badly.
2011-10-25 01:47:03 +02:00
Jeremy Huddleston
5c44c1348e apple: Implement applegl_unbind_context
glXMakeCurrent(dpy, None, NULL) would not correctly unbind the context
causing subsequent GLX requests to fail in peculiar ways

http://xquartz.macosforge.org/trac/ticket/514

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-24 16:21:28 -07:00
Brian Paul
9dc7df1fea util: handle failed mapping in u_upload_alloc()
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2011-10-24 16:39:58 -06:00
Brian Paul
19961da4cb util: handle failed mapping in u_upload_alloc_buffer()
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2011-10-24 16:39:58 -06:00
Vinson Lee
4e6a0b40c5 mesa: Fix memory leak in out-of-memory path.
Fixes Coverity resource leak defect.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-10-24 14:13:01 -07:00
Eric Anholt
cc4ddc3a1e glsl: Fix gl_NormalMatrix swizzle setup to match i965's invariants.
A driver trying to set up builtin uniforms is faced with a problem:
How do I walk the ir_variable structure (representing an array of
structs, or array of matrices, or struct, or whatever), and set up
driver structures so that dereference of that uniform gets the
corresponding ParameterValues[] entry.  The rule in general is that
each corresponding vector-sized field of an array of structs is one
builtin uniform state slot.  i965 relied on another invariant: each
state slot has a number of unique channel swizzles corresponding to
the number of elements in the field's vector, to avoid needing to walk
the glsl_type in parallel to get at vector_elements.

All of the builtin uniforms followed this behavior, except for
gl_NormalMatrix.  That's a mat3 (so 3 vec3s), but it was swizzled as 3
vec4s.

Fixes piglit glsl-fs-normalmatrix.
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2011-10-24 13:43:02 -07:00
Eric Anholt
2ecfa88548 glsl: Add gl_MaxVaryingComponents in GLSL 1.30.
This is the new name for gl_MaxVaryingFloats now that non-float
varyings exist.  Fixes piglit
glsl-1.30/execution/maximums/gl_MaxVaryingFloats

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-10-24 13:43:02 -07:00
Kenneth Graunke
3cc0a7be23 i965: Apply post-sync non-zero workaround to homebrew workaround.
In commit 3e5d3626, Eric added a homebrew workaround to fix GPU hangs in
the Mesa "engine" demo and oglc's api-texcoord test.

Unfortunately, his PIPE_CONTROL contains a Depth Stall, which
necessitates the post-sync non-zero workaround,

Fixes GPU hangs in Civilization 4, PlaneShift, and 3DMMES.
Hopefully Heroes of Newerth as well, though I haven't tested that.

NOTE: This is candidate for the 7.11 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40324
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41096
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-and-tested-by: Eric Anholt <eric@anholt.net>
2011-10-24 13:32:33 -07:00
Marek Olšák
56ac7ccae6 docs: update relnotes-7.12 2011-10-24 21:08:13 +02:00
Marek Olšák
cdaf9b89e4 r300g: expose ARB_ES2_compatibility by claiming FIXED format support 2011-10-24 21:05:38 +02:00
Adel Gadllah
fc8196f7a6 nv50: fix max texture levels
MAX_TEXTURE_2D_LEVELS and MAX_TEXTURE_CUBE_LEVELS are supposed to be
14 not 13, while MAX_TEXTURE_3D_LEVELS should be 12 not 10.
2011-10-24 20:07:22 +02:00
Marek Olšák
ef64da8f01 winsys/radeon: don't use the new GEM_WAIT ioctl for now 2011-10-24 20:01:14 +02:00
Tom Fogal
cbb2b4149b Only use gcc visibility support with gcc4+.
I had a colleague hitting issues compiling with an old gcc3.2
system.  These patches got them through.

NOTE: This is a candidate for the 7.11 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-10-24 10:22:52 -06:00
Mathias Fröhlich
2717b8f034 winsys/radeon: restore the old r600g winsys memory characteristics.
Use VRAM for static and immutable buffers. This restores the
recently removed r600g winsys behaviour for memory locations.
This also improoves rendering times on the gpu for some
OpenSceneGraph based test cases by about 15%.

Signed-off-by: Marek Olšák <maraeo@gmail.com>
2011-10-24 18:20:07 +02:00
Brian Paul
50b0069fc1 util: remove gotos in u_upload_mgr.c
We can trivially remove the gotos in two places in this code and make
it a bit more readable.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2011-10-24 09:31:01 -06:00