Commit graph

48156 commits

Author SHA1 Message Date
Ian Romanick
2bf30b1ccc intel: Remove redundant GL_ARB_window_pos enable
This extension is enabled by default in _mesa_init_extensions, so
drivers don't need to enable it again.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-09-26 12:14:13 -07:00
Ian Romanick
5e4f42b017 dri: Remove redundant GL_SGIS_texture_edge_clamp enables
This extension is enabled by default in _mesa_init_extensions, so
drivers don't need to enable it again.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-09-26 12:14:12 -07:00
Kenneth Graunke
8bd27a5b08 i965: Emit depth stalls and flushes before changing depth state on Gen6+.
Fixes OpenArena on Gen7.  Technically, adding only the first depth stall
fixes it, but the documentation says to do all three, and the Windows
driver seems to do it.

Not observed to fix anything on Gen6 yet.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38863
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-09-26 11:54:03 -07:00
Kenneth Graunke
490e6470a0 intel: Introduce a new intel_context::gt field to go along with gen.
It seems that GT1/GT2 sorts of variations are here to stay, and more
special cases will likely be required in the future.  Checking by PCI ID
via the IS_xxx_GTx macros is cumbersome; introducing a new 'gt' field
analogous to intel->gen will make this easier.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-09-26 11:50:31 -07:00
Kenneth Graunke
3f9f1b3659 intel: Remove intel_context::has_xrgb_textures/has_luminance_srgb.
Seeing as they were only used once (in the same function they were
defined), having them as context members seemed rather pointless.

Remove them entirely (rather than using local variables) since the
chipset generation checks are actually just as straightforward.

While we're at it, clean up the remainder of the if-tree that set them.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-09-26 11:50:31 -07:00
Kenneth Graunke
01dda0758e i965: Fix incorrect maximum PS thread count shift on Ivybridge.
At one point, the documentation said that max thread count in 3DSTATE_PS
was at bit offset 23, but it's actually 24 on Ivybridge.  Not only did
this halve our thread count, it caused us to write 1 into a bit 23, which
is marked as MBZ (must be zero).  Furthermore, it made us write an even
number into this field, which is apparently not allowed.  Apparently we
were just lucky it worked.

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-09-26 11:48:27 -07:00
Marek Olšák
44afac04ea r600g: add index_bias to index buffer bounds
This fixes ARB_draw_elements_base_vertex with max_index != ~0.

NOTE: This is a candidate for the 7.11 branch.
2011-09-26 15:25:05 +02:00
Marek Olšák
60a77cf316 u_vbuf_mgr: fix uploading with a non-zero index bias
Also don't rely on pipe_draw_info being set correctly.

NOTE: This is a candidate for the 7.11 branch.
2011-09-26 15:25:05 +02:00
Marek Olšák
21f71b6c05 u_vbuf_mgr: dereference some pointers only once etc. 2011-09-26 15:25:05 +02:00
Marek Olšák
cd9bbb3935 u_vbuf_mgr: rework user buffer uploads
- first determine the buffer range to upload for each buffer by walking over
  vertex elements
- take buffer_offset into account
- take src_offset into account
- take src_format into account in more places
- don't just blindly upload (stride*count) bytes

NOTE: This is a candidate for the 7.11 branch.
2011-09-26 15:25:05 +02:00
Marek Olšák
315300e444 u_vbuf_mgr: remove unused flag U_VBUF_UPLOAD_FLUSHED 2011-09-26 15:25:04 +02:00
Marek Olšák
28fb798911 u_vbuf_mgr: s/u_vbuf_mgr_/u_vbuf_ 2011-09-26 15:25:04 +02:00
Marek Olšák
f214e1c999 u_vbuf_mgr: fix max_index computation for large src_offset
NOTE: This is a candidate for the 7.11 branch.
2011-09-26 15:25:04 +02:00
Marek Olšák
4b5bf5a2a2 u_vbuf_mgr: don't take per-instance attribs into acc. when computing max index
NOTE: This is a candidate for the 7.11 branch.
2011-09-26 15:25:04 +02:00
Marek Olšák
0b3270b9b7 u_vbuf_mgr: cleanup original vs real vertex buffer arrays
It can now override both buffer offsets and strides in additions to resources.
Overriding buffer offsets was kinda hackish and could cause issues with
non-native vertex formats.
2011-09-26 15:25:04 +02:00
Yuanhan Liu
455a19b1b3 intel: fix potential segfault error at intel_(un)map_texture_image
intel_image->mt might be NULL, say with border width set. It then would
trigger a segfault at intel_map/unmap_texture_image function.

This would fix the oglc misctest(basic.textureBorderIgnore) fail.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
2011-09-26 09:23:06 +08:00
Marcin Slusarz
65b8eea064 nouveau: fix crash during fence emission
Fence emission can flush the push buffer, which through flush_notify
unreferences recently emitted fence. If ref count is increased after
fence emission, unreference deletes the fence, which causes SIGSEGV.

Backtrace:
nouveau_fence_del
nouveau_fence_ref
nouveau_fence_next
nouveau_pushbuf_flush
MARK_RING
nv50_screen_fence_emit
nouveau_fence_emit
nv50_flush

This bug manifested as an assertion failure in nouveau_fence.c, because
SIGSEGV handler tried to shutdown the application and used messed up
fence.

This issue was reported by Maxim Levitsky.

Note: This is a candidate for the 7.11 branch.
2011-09-25 19:18:45 +02:00
Henri Verbeet
a4d72189b2 mesa: Also set the remaining draw buffers to GL_NONE when updating just the first buffer in _mesa_drawbuffers().
Without this we'd miss the last update in a sequence like {COLOR0, COLOR1},
{COLOR0}, {COLOR0, COLOR1}. I originally had a patch for this that called
updated_drawbuffers() when the buffer count changed, but later realized that
was wrong. The ARB_draw_buffers spec explicitly says "The draw buffer for
output colors beyond <n> is set to NONE.", and this is queryable state.
This fixes piglit arb_draw_buffers-state_change.

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-09-25 15:00:21 +02:00
José Fonseca
4703f50e96 postprocess: Portability fixes. 2011-09-25 12:18:55 +01:00
José Fonseca
785b9e7c78 noop: Always use memory allocation macros. 2011-09-25 12:18:55 +01:00
José Fonseca
6921d4cd57 llvmpipe: Always use memory allocation macros. 2011-09-25 12:18:55 +01:00
José Fonseca
f32c9c2108 softpipe: Use memory allocation macros.
Fixes segfault with memory debugging on.
2011-09-25 12:18:55 +01:00
Emeric Grange
1f23ac8082 st/vdpau: Link vdpau targets with librt to avoid unresolved symbols error related to the use of the clock_gettime() function
This patch fix a "Unresolved Symbols" run time error when using G3DVL
through the VDPAU state tracker, by linking the vdpau targets with librt.
Reported by Arkadiusz Miśkiewicz.

Caused by this commit :
commit e911dbb563
Author: Emeric Grange <emeric.grange@gmail.com>
Date:   Mon Sep 12 23:39:33 2011 +0200

Signed-off-by: Emeric Grange <emeric.grange@gmail.com>
2011-09-25 12:50:12 +02:00
Christian König
86f97f7dc0 g3dvl: Don't use SCALED types for iDCT
This should bring g3dvl back to work until we figured out
how SCALED types should really work.

Signed-off-by: Christian König <deathsimple@vodafone.de>
2011-09-25 12:49:06 +02:00
José Fonseca
102bf6e2a7 draw: Never allocate duplicate extra vertex attribs.
Prevents mismatches when the VS outputs generic attributes not used by
the FS.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-09-25 11:04:31 +01:00
José Fonseca
fc31f9a3f2 draw: Make copy of the TGSI tokens.
There is no guarantee that the tokens TGSI will persist beyond the
create_fs_state. The pipe driver (and therefore the draw module) is
responsible for making copies of the TGSI tokens when it needs them.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-09-25 11:04:29 +01:00
Chad Versace
06ae4a62b1 glsl: Fix Android build
Add lower_clip_distance.cpp to list of source files.

Signed-off-by: Chad Versace <chad@chad-versace.us>
2011-09-24 19:37:13 -07:00
Kenneth Graunke
d7cdbc3c54 intel: Remove pointless boolean return value from *_miptree_layout.
i915_miptree_layout, i945_miptree_layout, and brw_miptree_layout always
just return GL_TRUE, so there's really no point to it.  Change them to
void functions and remove the (dead) error checking code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-09-23 22:42:18 -07:00
Kenneth Graunke
0d949a51bb glsl: Free all S-Expressions immediately after reading IR.
For some reason I thought subexpressions were chained off the top-level
one.  This isn't the case, so just create a temporary context and free
it.  All of this memory would be eventually freed, but now is freed
much sooner.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2011-09-23 17:12:47 -07:00
Kenneth Graunke
0fabf8e8dc glsl: Defer initialization of built-in functions until they're needed.
Very simple shaders don't actually use GLSL built-ins.  For example:
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_FragColor = vec4(0.0);
Both of the shaders used by _mesa_meta_glsl_Clear() also qualify.

By waiting to initialize the built-ins until the first time we need to
look for a signature, we can avoid the overhead entirely in these cases.

Makes piglit run roughly 18% faster (255 vs. 312 seconds).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-09-23 17:12:47 -07:00
Paul Berry
604173fb1c i965: Increase MaxClipPlanes to 8 for gen6+.
This is necessary for GLSL 1.30 compliance.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-09-23 15:32:46 -07:00
Paul Berry
2a6d432040 i965: Allow clip distances to be read back in fragment shaders.
Previously, we conditionally set up the SF pipline stage with a
urb_entry_read_offset of 2 when clipping was in use, and 1 otherwise,
causing the clip distance VUE slots to be skipped if present.  This
was an extremely minor savings (it saved the SF unit from reading 2
vec4s out of the URB, but it didn't affect any computation, since we
only instruct the SF unit to perform interpolation on VUE slots that
are actually used by the fragment shader).

GLSL 1.30 requires an interpolated version of gl_ClipDistance to be
available for reading in the fragment shader, so we need the SF's
urb_entry_read_offset to be 1 when the fragment shader reads from
gl_ClipDistance.

This patch just unconditionally sets the urb_entry_read_offset to 1 in
all cases; this is sufficient to make gl_ClipDistance available to the
fragment shader when it is needed, and the performance loss should be
negligible when it isn't.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-09-23 15:32:42 -07:00
Paul Berry
62bad54727 i965: Set up clip distance VUE slots appropriately for gl_ClipDistance.
When gl_ClipDistance is in use, the contents of the gl_ClipDistance
array just need to be copied directly into the clip distance VUE
slots, so we re-use the code that copies all other generic VUE slots
(this has been extracted to its own method).  When gl_ClipDistance is
not in use, the vertex shader needs to calculate the clip distances
based on user-specified clipping planes.

This patch also removes the i965-specific enum values
BRW_VERT_RESULT_CLIP[01], since we now have generic Mesa enums that
serve the same purpose (VERT_RESULT_CLIP_DIST[01]).

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-09-23 15:32:39 -07:00
Paul Berry
d9cb683f81 i965: Don't upload clip planes when gl_ClipDistance is in use.
When the vertex shader writes to gl_ClipDistance, we do clipping based
on clip distances rather than user clip planes, so don't waste push
constant space storing user clip planes that won't be used.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-09-23 15:32:37 -07:00
Paul Berry
b9ef2b85b4 i965: Enable lower_clip_distance.
i965 requires gl_ClipDistance to be formatted as an array of 2 vec4's
(as opposed to an array of 8 floats), so enable the lowering pass that
performs this conversion.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-09-23 15:32:33 -07:00
Paul Berry
2d686fe911 mesa: Decode GL_CLIP_DISTANCE[67] properly in _mesa_set_enable().
In order to support 8 clip distances, we need to properly decode when
the user sets the GL_CLIP_DISTANCE6 and GL_CLIP_DISTANCE7 enable
flags.

For clarity, this patch changes the names GL_CLIP_PLANE[0-5] in the
switch statement to the equivalent names GL_CLIP_DISTANCE[0-5], since
the GL_CLIP_PLANE names are deprecated.

Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Brian Paul <brianp@vmware.com>
2011-09-23 13:30:08 -07:00
Paul Berry
3d7c5a4f6f mesa: set up gl_vert_result and gl_frag_attrib values for gl_ClipDistance.
This patch assigns enumerated values for gl_ClipDistance in the
gl_vert_result and gl_frag_attrib enums, so that driver back-ends can
assign gl_ClipDistance to the appropriate hardware registers.  It also
adjusts the functions _mesa_vert_result_to_frag_attrib() and
_mesa_frag_attrib_to_vert_result() (which translate between the two
enums) to correctly translate the new enumerated values.

Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Brian Paul <brianp@vmware.com>
2011-09-23 13:30:03 -07:00
Paul Berry
1ad54ae0b1 mesa: Add a flag to indicate whether a program uses gl_ClipDistance.
GLSL 1.30 requires us to use gl_ClipDistance for clipping if the
vertex shader contains a static write to it, and otherwise use
user-defined clipping planes.  Since the driver needs to behave
differently in these two cases, we need a flag to record whether the
shader has written to gl_ClipDistance.

The new flag is called UsesClipDistance.  We initially store it in
gl_shader_program (since that is the data structure that is available
when we check to see whethe gl_ClipDistance was written to), and we
later copy it to a flag with the same name in gl_vertex_program, since
that is a more convenient place for the driver to access it (in i965,
at least).

Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Brian Paul <brianp@vmware.com>
2011-09-23 13:28:51 -07:00
Paul Berry
c06e325967 glsl: Implement a lowering pass for gl_ClipDistance.
In i965 GEN6+ (and I suspect most other hardware), gl_ClipDistance
needs to be laid out as a pair of vec4's (the first containing clip
distances 0-3, and the second containing clip distances 4-7).
However, it is declared in GLSL as an array of 8 floats.

This lowering pass acts at the GLSL level, modifying the declaration
of gl_ClipDistance so that it is an array of vec4's rather than an
array of floats, and renaming it to gl_ClipDistanceMESA.  In addition,
it modifies all accesses to the array so that they access the
appropiate component of one of the vec4's.

Since some hardware may not internally represent gl_ClipDistance as a
pair of vec4's, this lowering pass is optional.  To enable it, set the
LowerClipDistance flag in gl_shader_compiler_options to true.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-09-23 13:28:43 -07:00
Paul Berry
cc81eb09b9 glsl hierarchical visitor: Do not overwrite base_ir for parameter lists.
This patch fixes a bug in ir_hirearchical_visitor: when traversing an
exec_list representing the formal or actual parameters of a function,
it modified base_ir to point to each parameter in turn, rather than
leaving it as a pointer to the enclosing statement.  This was a
problem, since base_ir is used by visitor classes to locate the
statement containing the node being visited (usually so that
additional statements can be inserted before or after it).  Without
this fix, visitors might attempt to insert statements into parameter
lists.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-09-23 13:28:00 -07:00
Chad Versace
deff7fff49 mesa: Add missing includes to meta.h
Include mtypes.h.

Signed-off-by: Chad Versace <chad@chad-versace.us>
2011-09-23 10:54:25 -07:00
Brian Paul
be928ecd8d docs: mention VMware svga driver updates in 7.12 release notes 2011-09-23 08:05:36 -06:00
Brian Paul
ea0cedce6a svga: indentation/formatting fixes 2011-09-23 07:59:21 -06:00
Brian Paul
2c308c66e2 svga: remove emit_consts() offset parameter
It was always zero.
2011-09-23 07:59:00 -06:00
Brian Paul
7c6a5134ba svga: s/int/unsigned/ in svga_state_constants.c
Be consistent with other functions in the file.  And add some comments.
2011-09-23 07:59:00 -06:00
Brian Paul
c27f24f6f0 svga: s/unit/shader/ and related clean-ups
'shader' is more intuitive.  Also s/int/unsigned/ and add assertions.
2011-09-23 07:59:00 -06:00
Brian Paul
5f053bf4ae svga: clean up return values and error codes
Previously we were using a hodge podge of int vs. pipe_enum and
0 vs. PIPE_OK.  Some functions that always returned PIPE_OK were
made void.
2011-09-23 07:59:00 -06:00
Brian Paul
681f92140c svga: add format translation for DXT/sRGB formats
Without this, apps/tests that tried to use a DXT/sRGB format would die on
a failed assertion (st_texture.c:80).
2011-09-23 07:58:48 -06:00
Brian Paul
2b2a69e088 svga: test register W component in emit_kil()
Only the XYZ components are checked to be negative by SVGA3DOP_TEXKILL.
GL_ARB_fp requires all four components be checked.  Emit a second texkill
for W if needed.
2011-09-23 07:58:48 -06:00
Brian Paul
7d09df0cbc svga: fix depth/shadow compare for non-projected texcoords
We only need to do the divide by Q step for TXP instructions.
This fixes the incorrectly rendered soft shadow test in Lightsmark.
Along with the previous texture swizzle commit, this also fixes all
the piglit glsl-fs-shadow2d-XX.shader_test failures.
2011-09-23 07:58:48 -06:00