Marek Olšák [Tue, 27 Sep 2011 20:22:06 +0000 (22:22 +0200)]
gallium: add and use PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS
This removes:
- PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS
- PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS
in favor of the that new per-shader cap.
Reviewed-by: Brian Paul <brianp@vmware.com>
Marek Olšák [Mon, 26 Sep 2011 20:50:00 +0000 (22:50 +0200)]
gallium: remove PIPE_CAP_TEXTURE_MIRROR_REPEAT
All drivers support it (well, except Cell). The boolean option is going away
from core Mesa too.
This is a follow-up to Ian Romanick's patch
"mesa: Remove ARB_texture_mirrored_repeat extension enable flag".
Reviewed-by: Brian Paul <brianp@vmware.com>
Chris Wilson [Fri, 30 Sep 2011 21:10:33 +0000 (22:10 +0100)]
i915: out-of-bounds write in calc_live_regs()
From a Coverity defect report.
src/mesa/drivers/dri/i915/i915_fragprog.c
301 /*
302 * TODO: consider moving this into core
303 */
304 static bool calc_live_regs( struct i915_fragment_program *p )
305 {
306 const struct gl_fragment_program *program = &p->FragProg;
307 GLuint regsUsed = 0xffff0000;
-> 308 uint8_t live_components[16] = { 0, };
309 GLint i;
310
311 for (i = program->Base.NumInstructions - 1; i >= 0; i--) {
312 struct prog_instruction *inst =
&program->Base.Instructions[i];
313 int opArgs = _mesa_num_inst_src_regs(inst->Opcode);
314 int a;
315
316 /* Register is written to: unmark as live for this and
preceeding ops */
317 if (inst->DstReg.File == PROGRAM_TEMPORARY) {
-> 318 if (inst->DstReg.Index > 16)
319 return false;
320
-> 321 live_components[inst->DstReg.Index] &= ~inst->DstReg.WriteMask;
322 if (live_components[inst->DstReg.Index] == 0)
323 regsUsed &= ~(1 << inst->DstReg.Index);
324 }
325
326 for (a = 0; a < opArgs; a++) {
327 /* Register is read from: mark as live for this and preceeding ops */
328 if (inst->SrcReg[a].File == PROGRAM_TEMPORARY) {
329 unsigned c;
330
331 if (inst->SrcReg[a].Index > 16)
332 return false;
333
334 regsUsed |= 1 << inst->SrcReg[a].Index;
335
336 for (c = 0; c < 4; c++) {
337 const unsigned field = GET_SWZ(inst->SrcReg[a].Swizzle, c);
338
339 if (field <= SWIZZLE_W)
340 live_components[inst->SrcReg[a].Index] |= (1U << field);
341 }
342 }
343 }
344
345 p->usedRegs[i] = regsUsed;
346 }
Reported-by: Vinson Lee <vlee@vmware.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40022
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Chris Wilson [Fri, 30 Sep 2011 20:58:59 +0000 (21:58 +0100)]
i965: Assign instead of compare inside assert
This is from a Coverity defect report.
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
1314 void
1315 vec4_visitor::emit_block_move(dst_reg *dst, src_reg *src,
1316 const struct glsl_type *type, bool
predicated)
...
1351 /* Do we need to worry about swizzling a swizzle? */
->1352 assert(src->swizzle = BRW_SWIZZLE_NOOP);
1353 src->swizzle = swizzle_for_size(type->vector_elements);
Reported-by: Vinson Lee <vlee@vmware.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40158
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Chris Wilson [Fri, 30 Sep 2011 20:48:18 +0000 (21:48 +0100)]
i965/gen6: Fix assign instead of compare in assert
This is from a Coverity defect report.
src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
268 static void
269 check_gen6_math_src_arg(struct brw_reg src)
270 {
271 /* Source swizzles are ignored. */
272 assert(!src.abs);
273 assert(!src.negate);
-> 274 assert(src.dw1.bits.swizzle = BRW_SWIZZLE_XYZW);
275 }
Reported-by: Vinson Lee <vlee@vmware.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40214
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Carl Worth [Fri, 30 Sep 2011 05:24:18 +0000 (22:24 -0700)]
glcpp: Add a test for #elif with an undefined macro.
As written, this test correctly raises an error for #elif being used
with an undefined macro (and not as an argument to "defined"). If the
preceding #if were '#if 1' then this diagnositc would correctly be
hidden. That allows code such as the following to not raise an error:
#ifndef MAYBE_UNDEFINED
#elif MAYBE_UNDEFINED < 5
...
#endif
So this test case is working as expected already. We add it here just
to improve test coverage.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Carl Worth <cworth@cworth.org>
Carl Worth [Fri, 30 Sep 2011 04:44:52 +0000 (21:44 -0700)]
glcpp: Raise error if defining any macro containing two consecutive underscores
The specification reserves any macro name containing two consecutive
underscores, (anywhere within the name). Previously, we only raised
this error for macro names that started with two underscores.
Fix the implementation to check for two underscores anywhere, and also
update the corresponding 086-reserved-macro-names test.
This also fixes the following two piglit tests:
spec/glsl-1.30/preprocessor/reserved/double-underscore-02.frag
spec/glsl-1.30/preprocessor/reserved/double-underscore-03.frag
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Carl Worth <cworth@cworth.org>
Carl Worth [Fri, 30 Sep 2011 00:04:47 +0000 (17:04 -0700)]
glcpp: Implement token pasting for non-function-like macros
This is as simple as abstracting one existing block of code into a
function call and then adding a single call to that function for the
case of a non-function-like macro.
This fixes the recently-added 097-paste-with-non-function-macro test
as well as the following piglit tests:
spec/glsl-1.30/preprocessor/concat/concat-01.frag
spec/glsl-1.30/preprocessor/concat/concat-02.frag
Also, the concat-04.frag test now passes for the right reason. The
test is intended to fail the compilation, but before this commit it
was failing compilation (and hence passing the test) for the wrong
reason.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Carl Worth <cworth@cworth.org>
Carl Worth [Fri, 30 Sep 2011 00:04:09 +0000 (17:04 -0700)]
glcpp: Test a non-function-like macro using the token paste operator
Apparently we never implemented this, (but we've got a GLSL 1.30 test
in piglit that is exercising this case).
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Carl Worth <cworth@cworth.org>
Carl Worth [Thu, 29 Sep 2011 23:51:08 +0000 (16:51 -0700)]
glcpp: Fix two (or more) successive applications of token pasting
There was already a loop here to look for multiple token pastes, but
it was mistakenly incrementing the iterator counter after performing
one paste.
Instead, leave the loop iterator in place to coalesce as many tokens
as necessary into one.
This fixes the recently add 096-paste-twice test as well as the
following piglit test:
spec/glsl-1.30/preprocessor/concat/concat-03.frag
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Carl Worth <cworth@cworth.org>
Carl Worth [Thu, 29 Sep 2011 23:50:40 +0000 (16:50 -0700)]
glcpp: Add a test for a macro that implements token pasting twice.
This is something that piglit is exercising that currently fails.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Carl Worth <cworth@cworth.org>
Chad Versace [Wed, 28 Sep 2011 23:59:08 +0000 (16:59 -0700)]
mesa: Remove unused tnl items from dd_functions
Remove NeedValidate and ValidateTnlModule.
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad@chad-versace.us>
Brian Paul [Fri, 30 Sep 2011 14:15:30 +0000 (08:15 -0600)]
meta: fix GetTexImage() for luminance, l/a, intensity formats
The GL spec says that luminance values are returned as (l, 0, 0, 1),
L/A values as (l, 0, 0, a) and intensity values as (i, 0, 0, 1).
Use the pixel transfer scale controls to implement that.
This fixes a few failures in the new piglit getteximage-formats
test when getting a compressed L or L/A image.
Brian Paul [Fri, 30 Sep 2011 14:15:30 +0000 (08:15 -0600)]
mesa: add _NEW_CURRENT_ATTRIB in _mesa_program_state_flags()
If color material mode is enabled, constant buffer entries related
to the material coefficients will depend on glColor. So add
_NEW_CURRENT_ATTRIB to the bitset returned for material-related
constants in _mesa_program_state_flags().
This fixes a bug exercised by the new piglit draw-arrays-colormaterial
test.
Note: This is a candidate for the 7.11 branch.
Brian Paul [Fri, 30 Sep 2011 14:15:30 +0000 (08:15 -0600)]
st/mesa: implement AllocTextureImageBuffer() driver hook
This hasn't been needed so far since none of the core Mesa code paths
that call ctx->Driver.AllocTextureImageBuffer() are used with the
state tracker. That will change in upcoming patches.
Note that this function duplicates some code seen in the st_TexImage()
function. That can be cleaned up later.
Brian Paul [Fri, 30 Sep 2011 14:15:30 +0000 (08:15 -0600)]
mesa: simplify parameters to GetTexImage() driver hook
The target, level and texObj can be obtained through the texImage
parameter. We could make similar changes for the TexImage() hooks too.
Reviewed-by: Eric Anholt <eric@anholt.net>
Thomas Hellstrom [Thu, 29 Sep 2011 19:41:21 +0000 (21:41 +0200)]
xorg/vmwgfx: Kill this target. It's not used anymore.
This fixes a build error introduced with commit
"winsys/svga: Update to vmwgfx kernel module 2.1"
if both the svga driver and the xorg state tracker was enabled
at the same time.
If needed we can re-add a minimal target for basic functionality.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Brian Paul [Thu, 29 Sep 2011 22:29:30 +0000 (16:29 -0600)]
intel: include version.h to get _mesa_override_glsl_version() prototype
Simon Farnsworth [Thu, 29 Sep 2011 13:51:41 +0000 (14:51 +0100)]
gallium: Set renderbuffer's InternalFormat when rendering to texture
When an FBO is rendering to a texture (rather than a renderbuffer),
Gallium sets up an internal renderbuffer to handle the rendering, and
copies over enough texture state to make this work.
InternalFormat was missed out, causing glTexCopyImage to take a slow
path unnecessarily.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=41263
Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Signed-off-by: Brian Paul <brianp@vmware.com>
Thomas Hellstrom [Wed, 28 Sep 2011 07:13:50 +0000 (09:13 +0200)]
winsys/svga: Update to vmwgfx kernel module 2.1
Introduces fence objecs and a size limit on query buffers.
The possibility to map the fifo from user-space is gone, and
replaced by an ioctl that reads the 3D capabilities.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecranz <jakob@vmware.com>
Thomas Hellstrom [Thu, 1 Sep 2011 09:19:02 +0000 (11:19 +0200)]
st/xa: Don't call fence_reference with an unitialized fence handle as dst
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Thomas Hellstrom [Fri, 8 Jul 2011 08:03:07 +0000 (10:03 +0200)]
st/xa: surfaces and sampler views are per context
Don't store references to these on the surface but on the context.
References to transfers are still stored on the surface since we allow
only a single map of a surface at a time.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Ian Romanick [Wed, 31 Aug 2011 01:04:41 +0000 (18:04 -0700)]
mesa: Remove ARB_texture_mirrored_repeat extension enable flag
All drivers remaining in Mesa support this extension. This extension
is either required or optional features in desktop OpenGL, OpenGL ES
1.x, and OpenGL ES 2.x.
This extension was previously not supported on mach64, mga, and savage
(Savage3D and other pre-Savage4).
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Ian Romanick [Wed, 31 Aug 2011 00:55:26 +0000 (17:55 -0700)]
mesa: Remove EXT_blend_subtract extension enable flag
All drivers remaining in Mesa support this extension. This extension
is either required or optional features in desktop OpenGL, OpenGL ES
1.x, and OpenGL ES 2.x.
This extension was previously not supported on i810, mach64, mga,
savage, sis, and tdfx (Voodoo Banshee and Voodoo3).
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Ian Romanick [Wed, 31 Aug 2011 00:48:11 +0000 (17:48 -0700)]
mesa: Remove EXT_stencil_wrap extension enable flag
All drivers remaining in Mesa support this extension. This extension
is either required or optional features in desktop OpenGL, OpenGL ES
1.x, and OpenGL ES 2.x.
This extension was previously not supported on mach64.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Ian Romanick [Wed, 31 Aug 2011 00:33:51 +0000 (17:33 -0700)]
mesa: Remove EXT_texture_lod_bias extension enable flag
All drivers remaining in Mesa support this extension. This extension
is either required or optional features in desktop OpenGL, OpenGL ES
1.x, and OpenGL ES 2.x.
This extension was previously not supported on mach64, mga, or r128.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Ian Romanick [Wed, 31 Aug 2011 00:24:13 +0000 (17:24 -0700)]
mesa: Remove EXT_texture_env_combine extension enable flag
All drivers remaining in Mesa support this extension. This extension
is either required or optional features in desktop OpenGL, OpenGL ES
1.x, and OpenGL ES 2.x. The existing support is already partially
broken in Mesa (e.g., querying GL_TEXTURE_ENV_MODE in OpenGL ES 2.x).
This patch does not change the situation in any way.
It looks like the only hardware supported by Mesa that cannot do
ARB_texture_env_combine is pre-NV10 NVIDA chips. It appears that
these chips cannot do the GL_SUBTRACT mode. Based on looking at older
copies of nvOpenGLspecs.pdf found on the net, NVIDIA never supported
ARB_texture_env_combine on those chips either.
This extension was previously not supported on mach64, mga (G200),
r128, savage, sis, and tdfx (Voodoo Banshee and Voodoo3).
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Ian Romanick [Tue, 30 Aug 2011 23:51:57 +0000 (16:51 -0700)]
mesa: Remove EXT_texture_env_add extension enable flag
All drivers remaining in Mesa support this extension. This extension
is either required or optional features in desktop OpenGL, OpenGL ES
1.x, and OpenGL ES 2.x. The existing support is already partially
broken in Mesa (e.g., querying GL_TEXTURE_ENV_MODE in OpenGL ES 2.x).
This patch does not change the situation in any way.
This extension was previously not supported on mach64, mga (G200),
savage (Savage3D and other pre-Savage4), sis, and tdfx (Voodoo
Banshee).
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Ian Romanick [Tue, 30 Aug 2011 23:45:50 +0000 (16:45 -0700)]
mesa: Remove ARB_multitexture extension enable flag
All drivers remaining in Mesa support this extension. This extension
is either required or optional features in desktop OpenGL, OpenGL ES
1.x, and OpenGL ES 2.x. The existing support is already partially
broken in Mesa (e.g., querying GL_CLIENT_ACTIVE_TEXTURE in OpenGL ES
2.x). This patch does not change the situation in any way.
This extension was previously not supported on i810, mga (G200), or
tdfx (Voodoo Banshee).
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
José Fonseca [Thu, 29 Sep 2011 10:07:24 +0000 (11:07 +0100)]
llvmpipe: Convert some of the null checks back to asserts.
This turns some of the null check warnings in commit
023ca40d80670ac0eee8c755ca5f54b1e7c2712e back to asserts, as
the underlying cause of fdo bug 40591 should be fixed now.
José Fonseca [Thu, 29 Sep 2011 09:54:29 +0000 (10:54 +0100)]
llvmpipe: Also reset the state in lp_scene_bin_reset
Prevents segfaults when a opaque tile is found without state change.
José Fonseca [Wed, 28 Sep 2011 19:23:13 +0000 (20:23 +0100)]
llvmpipe: Prevent segfault during fs variant cache shrinking.
José Fonseca [Wed, 28 Sep 2011 19:25:40 +0000 (20:25 +0100)]
tools/trace: Dump NULL literally.
Instead of None.
Brian Paul [Thu, 29 Sep 2011 15:18:20 +0000 (09:18 -0600)]
st/mesa: remove some old GetTexImage() code
We can use the core Mesa code for glGetTexImage() since it handles the
image mapping/unmapping now. We'll keep the decompress_with_blit() path
in the hope that it's faster than core Mesa's software decompression code.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=41312
Marek Olšák [Tue, 27 Sep 2011 02:03:07 +0000 (04:03 +0200)]
winsys/radeon: remove redundant member radeon_bo::size
It's part of pb_buffer already.
Marek Olšák [Tue, 27 Sep 2011 01:10:33 +0000 (03:10 +0200)]
winsys/radeon: simplify updating GEM domains for relocations
Marek Olšák [Tue, 27 Sep 2011 00:55:30 +0000 (02:55 +0200)]
winsys/radeon: simplify passing GEM domains through to GEM_CREATE
Marek Olšák [Tue, 27 Sep 2011 00:04:02 +0000 (02:04 +0200)]
r300g: remove useless variables in some structures
Marek Olšák [Mon, 26 Sep 2011 21:46:42 +0000 (23:46 +0200)]
r300g: simplify the immd_is_good_idea function
Marek Olšák [Tue, 27 Sep 2011 14:51:05 +0000 (16:51 +0200)]
configure.ac: unduplicate gallium directories
It may happen when two drivers share one winsys.
Marek Olšák [Tue, 27 Sep 2011 22:11:57 +0000 (00:11 +0200)]
r600g: convert if (query->type) into switch statements
Marek Olšák [Tue, 27 Sep 2011 19:30:13 +0000 (21:30 +0200)]
gallium/docs: update d3d11ddi.txt
Marek Olšák [Sun, 25 Sep 2011 12:19:46 +0000 (14:19 +0200)]
st/mesa: don't compute index buffer bounds for per-instance data
Paul Berry [Mon, 26 Sep 2011 22:51:39 +0000 (15:51 -0700)]
glsl 1.30: Fix numerical instabilities in asinh
The formula we were previously using for asinh:
asinh x = ln(x + sqrt(x * x + 1))
is numerically unstable: when x is a large negative value, the quantity
x + sqrt(x * x + 1)
is a small positive value (on the order of 1/(2|x|)). Since the
logarithm function is very sensitive in this range, any error in the
computation of the square root manifests as a large error in the
result.
This patch changes to the equivalent formula:
asinh x = sign(x) * ln(abs(x) + sqrt(x * x + 1))
which is only slightly more expensive to compute, and is numerically
stable for all x.
Fixes piglit tests
spec/glsl-1.30/execution/built-in-functions/[fv]s-asinh-*.
Reviewed-by: Chad Versace <chad@chad-versace.us>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Brian Paul [Wed, 28 Sep 2011 19:16:45 +0000 (13:16 -0600)]
mesa: fix signed/unsigned sscanf() warning in _mesa_override_glsl_version()
Brian Paul [Wed, 28 Sep 2011 19:16:25 +0000 (13:16 -0600)]
st/mesa: include version.h and fix _mesa_override_glsl_version() call
Eric Anholt [Tue, 27 Sep 2011 21:50:45 +0000 (14:50 -0700)]
glsl: Add support for constant expression evaluation on trunc().
Fixes the glsl-1.30/compiler/built-in-functions/trunc-* tests under 1.30.
Reviewed-by: Chad Versace <chad@chad-versace.us>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Eric Anholt [Tue, 27 Sep 2011 21:48:56 +0000 (14:48 -0700)]
i965/vs: Add support for bit-shift operations.
Reviewed-by: Chad Versace <chad@chad-versace.us>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Eric Anholt [Tue, 27 Sep 2011 21:36:07 +0000 (14:36 -0700)]
mesa: Add missing _mesa_sizeof_glsl_type() for UNSIGNED_INT.
Somehow we managed to get the unsigned int vectors, but not scalar.
Fixes _mesa_problem complaints in piglit's uint tests.
Reviewed-by: Chad Versace <chad@chad-versace.us>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Eric Anholt [Tue, 27 Sep 2011 21:32:42 +0000 (14:32 -0700)]
i965/fs: Add support for bit-shift operations.
Reviewed-by: Chad Versace <chad@chad-versace.us>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Eric Anholt [Tue, 27 Sep 2011 21:27:58 +0000 (14:27 -0700)]
glsl: Fix assertion checking types of constant bitshift expressions.
Bitshifts are one of the rare places that GLSL allows mixed base types
without an implicit conversion occurring.
Reviewed-by: Chad Versace <chad@chad-versace.us>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Eric Anholt [Tue, 27 Sep 2011 21:26:02 +0000 (14:26 -0700)]
ir_to_mesa: Don't assertion fail on remaining GLSL 1.30 ops.
For hardware drivers, we only have ir_to_mesa called for the purposes
of potential swrast fallbacks (basically never on a 1.30 driver),
which we don't really care about. This will allow 1.30 to be
implemented without rewriting swrast for it.
Reviewed-by: Chad Versace <chad@chad-versace.us>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Sat, 24 Sep 2011 04:55:20 +0000 (21:55 -0700)]
i965: don't intepolate clip distances on pre-GEN6.
On pre-GEN6 chips, the VUE slots set aside for clip distance aren't
actually used, so there is no reason for the clipper to waste time
interpolating them.
When commit
62bad54727690bff5ed42a74272e7822fd36cdb6 changed the enum
value used to represent these VUE slots, that caused the clipper to
start interpolating them as an accidental side effect. This patch
reverts to the old clipper behavior.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Sat, 24 Sep 2011 04:36:17 +0000 (21:36 -0700)]
i965 new VS: Fix bugs in pre-GEN6 psiz/flags computation
This patch corrects two errors in the computation of the psiz/flags
VUE slot on pre-GEN5 when using the new VS backend:
- The clip flags (which should be stored in the w component of the
first VUE slot) were being accidentally duplicated in all other
components of that VUE slot, causing partially clipped triangles to
sometimes disappear completely.
- The OR instruction wasn't being stored in "inst", causing the
BRW_PREDICATE_NORMAL flag to be applied to the wrong instruction.
This patch fixes regressions in clipping behavior when using shaders
on GEN4-5.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Sat, 24 Sep 2011 04:35:18 +0000 (21:35 -0700)]
i965 new VS: Fix src_reg(uint32_t) constructor.
This constructor was storing its argument in the wrong field of the
"imm" enum, resulting in it being converted to a float when it should
have remained an unsigned integer. This was preventing clipping from
working properly on pre-GEN6.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Sat, 24 Sep 2011 04:33:50 +0000 (21:33 -0700)]
i965 new VS: don't share clip plane constants in pre-GEN6
In pre-GEN6, when using clip planes, both the vertex shader and the
clipper need access to the client-supplied clip planes, since the
vertex shader needs them to set the clip flags, and the clipper needs
them to determine where to insert new vertices.
With the old VS backend, we used a clever optimization to avoid
placing duplicate copies of these planes in the CURBE: we used the
same block of memory for both the clipper and vertex shader constants,
with the clip planes at the front of it, and then we instructed the
clipper to read just the initial part of this block containing the
clip planes.
This optimization was tricky, of dubious value, and not completely
working in the new VS backend, so I've removed it. Now, when using
the new VS backend, separate parts of the CURBE are used for the
clipper and the vertex shader. Note that this doesn't affect the
number of push constants available to the vertex shader, it simply
causes the CURBE to occupy a few more bytes of URB memory.
The old VS backend is unaffected. GEN6+, which does clipping entirely
in hardware, is also unaffected.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Sat, 24 Sep 2011 04:27:00 +0000 (21:27 -0700)]
i965: Fix a hardcoded user clip plane count.
Now that i965 supports 8 clip planes instead of 6, the size of the
brw_vs_compile::userplane array needs to be increased to 8. Changed
the array size to MAX_CLIP_PLANES so that if the number changes again
in the future, this array size won't be missed.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Tue, 20 Sep 2011 23:43:06 +0000 (16:43 -0700)]
i965: allow for nonconsecutive elements of gl_ClipDistance to be enabled.
When using user-defined clipping planes, the i965 driver compacts the
array of clipping planes so that disabled clipping planes do not
appear in it--this saves precious push constant space and makes it
easier to generate the pre-GEN6 clip program. As a result, when
enabling clipping planes in GEN6+ hardware, we always enable clipping
planes 0 through n-1 (where n is the number of clipping planes
enabled), regardless of which clipping planes the user actually
requested.
However, we can't do this when using gl_ClipDistance, because it would
be prohibitively complex to compact the gl_ClipDistance array inside
the user-supplied vertex shader. So, when enabling clipping planes in
GEN6+ hardware, if gl_ClipDistance is in use, we need to pass the
user-supplied enable flags directly through to the hardware rather
than just enabling the first n planes.
Fixes Piglit test vs-clip-distance-enables.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Tue, 20 Sep 2011 23:20:32 +0000 (16:20 -0700)]
i965: Use 4 bits to store nr_userclip in brw_clip.h.
Since the i965 driver supports 8 clipping planes now, we need 4 bits
to store the number of user clipping planes, not 3.
In theory this isn't strictly necessary, since brw_clip.h is only used
on pre-GEN6, and pre-GEN6 only advertises support for 6 clipping
planes, but it seems wise to err on the safe side.
In the process I removed the pad0 element of struct
brw_clip_prog_key--it doesn't seem necessary because the compiler
automatically inserts padding if needed.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Chad Versace [Tue, 27 Sep 2011 20:56:49 +0000 (13:56 -0700)]
intel: Remove unused function get_glsl_version()
It was replaced by _mesa_override_glsl_version().
Reviewed-by: Dave Airlie <airlied@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
Chad Versace [Tue, 27 Sep 2011 20:53:11 +0000 (13:53 -0700)]
mesa: Allow overriding GLSL version with environment variable
Override the context's GLSL version if the environment variable
MESA_GLSL_VERSION_OVERRIDE is set. Valid values for
MESA_GLSL_VERSION_OVERRIDE are integers, such as "130".
MESA_GLSL_VERSION_OVERRIDE has the same behavior as INTEL_GLSL_VERSION,
except that it applies to all drivers, not just Intel's. Since the former
supercedes the latter, this patch disables the latter.
Reviewed-by: Dave Airlie <airlied@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
Brian Paul [Wed, 28 Sep 2011 16:37:22 +0000 (10:37 -0600)]
st/mesa: substitute argument to guess_base_level_size() call
stObj->base.BaseLevel and firstImage->base.Level have the same value
but the later looks more consistent in the function call.
Brian Paul [Wed, 28 Sep 2011 16:09:56 +0000 (10:09 -0600)]
mesa: fix signed/unsigned warning in sscanf()
Brian Paul [Wed, 28 Sep 2011 15:51:36 +0000 (09:51 -0600)]
scons: insert 'git-' into MESA_GIT_SHA1 string
To match makefile build.
Brian Paul [Wed, 28 Sep 2011 15:04:03 +0000 (09:04 -0600)]
scons: fix write_git_sha1_h_file() issue on Windows
Unlike on Unix, os.rename(src, dst) will fail on Windows if the dst file
already exists. Remove it first.
Christoph Bumiller [Sat, 24 Sep 2011 11:27:08 +0000 (13:27 +0200)]
d3d1x: propagate DepthBiasClamp to rasterizer cso
Christoph Bumiller [Sat, 24 Sep 2011 13:37:32 +0000 (15:37 +0200)]
d3d1x: fix uninitialized const color union black
Broken by
6dd284f7c8fac22f64c13fdf9909094f5ec59086.
Christoph Bumiller [Sat, 24 Sep 2011 13:42:46 +0000 (15:42 +0200)]
nv50,nvc0: support polygon offset clamp state
Christoph Bumiller [Sat, 24 Sep 2011 13:41:25 +0000 (15:41 +0200)]
r600: support polygon offset clamp state
Christoph Bumiller [Sat, 24 Sep 2011 11:22:29 +0000 (13:22 +0200)]
gallium: add polygon offset clamp state
This is required for D3D1x and supported by hardware.
Brian Paul [Wed, 28 Sep 2011 14:15:22 +0000 (08:15 -0600)]
scons: generate git_sha1.h file as with Makefile build
So that GL_VERSION includes the git head hash id when building with scons.
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Kenneth Graunke [Tue, 27 Sep 2011 06:57:40 +0000 (23:57 -0700)]
i965: Allow SIMD16 color writes on Ivybridge.
Again, the check was needlessly specific: this works fine on Gen7.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Kenneth Graunke [Tue, 27 Sep 2011 06:57:39 +0000 (23:57 -0700)]
i965/fs: Allow SIMD16 with control flow on Ivybridge.
The check was designed to forbid it on old generations (Gen5/Ironlake),
not on new ones. It just works on Gen7/Ivybridge.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Eric Anholt [Tue, 27 Sep 2011 22:17:50 +0000 (15:17 -0700)]
intel: Fix compiler warnings from the depth stall flush commit.
Eric Anholt [Mon, 1 Aug 2011 04:09:04 +0000 (21:09 -0700)]
radeon: Drop mapping we were doing around glGetTexImage().
It's handled by MapTextureImage() now.
Eric Anholt [Mon, 1 Aug 2011 04:07:00 +0000 (21:07 -0700)]
nouveau: Drop mapping we were doing around glGetTexImage().
It's handled by MapTextureImage() now.
Eric Anholt [Mon, 1 Aug 2011 04:02:46 +0000 (21:02 -0700)]
intel: Drop our custom glGetTexImage() code.
The mesa core code uses MapTextureImage() like we need now.
v2: Drop mapping around _mesa_generate_mipmap for compressed, since
the whole path ends up going through MapTextureImage(), and the
meta decompression code ended up causing us to lose track of the
region that was originally mapped and assertion fail.
Brian Paul [Mon, 1 Aug 2011 04:00:21 +0000 (21:00 -0700)]
mesa: Finally, convert RGBA glGetTexImage() to using MapTextureImage().
v2: Changes by Brian to MapTexImage in the decompression path.
v3: Changes by anholt to fix srcRowStride for decompression of NPOT.
Tested-by: Brian Paul <brianp@vmware.com> (v2)
Brian Paul [Mon, 1 Aug 2011 03:59:16 +0000 (20:59 -0700)]
mesa: Convert depth glGetTexImage() to using MapTextureImage().
Tested-by: Brian Paul <brianp@vmware.com>
Brian Paul [Mon, 1 Aug 2011 03:48:24 +0000 (20:48 -0700)]
mesa: Convert depth/stencil glGetTexImage() to using MapTextureImage().
Note that the implementation before and after appears to be broken in
its handling of Z24_S8 vs S8_Z24.
Tested-by: Brian Paul <brianp@vmware.com>
Brian Paul [Mon, 1 Aug 2011 03:39:14 +0000 (20:39 -0700)]
mesa: Switch ycbcr glGetTexImage() to using MapTextureImage().
Tested-by: Brian Paul <brianp@vmware.com>
Brian Paul [Mon, 1 Aug 2011 03:37:54 +0000 (20:37 -0700)]
mesa: Switch memcpy fast-path of glGetTexImage() to using MapTextureImage().
Tested-by: Brian Paul <brianp@vmware.com>
Brian Paul [Mon, 1 Aug 2011 04:00:55 +0000 (21:00 -0700)]
mesa: Update comments/assertions about buffer mapping for glGetTexImage().
This code is about to stop needing ->Data and using MapTextureImage().
Tested-by: Brian Paul <brianp@vmware.com>
Brian Paul [Sat, 30 Jul 2011 00:14:34 +0000 (17:14 -0700)]
mesa: Convert GetCompressedTexImage to using MapTextureImage().
This changes drivers to not map the texture on their own before
calling _mesa_get_compressed_teximage().
Tested-by: Brian Paul <brianp@vmware.com>
Dave Airlie [Tue, 27 Sep 2011 09:08:34 +0000 (10:08 +0100)]
gallium: move border color to be a color union
EXT_texture_integer also specifies border color should be a color
union, the values are used according to the texture sampler format.
(update docs)
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Chad Versace [Mon, 26 Sep 2011 18:48:46 +0000 (11:48 -0700)]
mesa: Allow override of GL version with environment variable
It is necessary to manually set the GL version to 3.0 in order to run
Piglit tests that use glGetUniform*().
This patch allows one to override the version of the OpenGL context by
setting the environment variable MESA_GL_VERSION_OVERRIDE.
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad@chad-versace.us>
Paul Berry [Sun, 25 Sep 2011 18:55:41 +0000 (11:55 -0700)]
mesa: Make enable.c and get.c properly range check clip flags.
This is a follow-up to commit
2d686fe911a89fa477ee3848da41ebfb100500bf, which added decoding of
GL_CLIP_DISTANCE[67] to the _mesa_set_enable() function. This patch
makes the following additional fixes:
- Uses GL_CLIP_DISTANCEi enums consistently within enable.c rather
than the deprecated GL_CLIP_PLANEi enums.
- Generates an error if the user tries to access a clip flag that is
unsupported by the hardware.
- Applies the same change to _mesa_IsEnabled(), so that querying clip
flags using glIsEnabled() works properly.
- Applies corresponding changes to get.c, so that querying clip flags
using glGet*() works properly.
Fixes piglit test clip-flag-behavior.
Reviewed-by: Brian Paul <brianp@vmware.com>
Brian Paul [Tue, 27 Sep 2011 02:44:09 +0000 (20:44 -0600)]
mesa: fix indentation in mipmap.c (3 spaces)
Eric Anholt [Fri, 23 Sep 2011 20:52:47 +0000 (13:52 -0700)]
i965/vs: Fix access beyond array bounds for non-GRF operands.
Caught by valgrind. I never saw a segfault from it (probably because
it's hard to have much more of any other file than GRF).
Eric Anholt [Thu, 22 Sep 2011 18:58:37 +0000 (11:58 -0700)]
intel: Rename region->buffer to region->bo, and remove accessor function.
We call all the other drm_intel_bo pointers in intel/*.h "bo", so this
one was rather out of place.
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Eric Anholt [Wed, 21 Sep 2011 23:43:08 +0000 (16:43 -0700)]
intel: Drop stale comment about CopyTexSubImage.
We get called for TexImage higher up, and in a relatively normal way
(pixels == NULL is common for FBO setup).
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Eric Anholt [Wed, 21 Sep 2011 22:56:04 +0000 (15:56 -0700)]
intel: Rely on AllocTextureImageBuffer for our teximage fallbacks.
It will do a more reliable job at getting the image size for
_mesa_texstore right than us.
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Eric Anholt [Wed, 21 Sep 2011 22:47:59 +0000 (15:47 -0700)]
intel: Rely on mesa core for compressed texture image uploading.
There's nothing in our normal texture path we need for this. We don't
PBO upload blit it. We don't need to worry about flushing because
MapTextureImage handles it. hiz scattergather doesn't apply, but MTI
handles it too.
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Eric Anholt [Wed, 21 Sep 2011 22:38:32 +0000 (15:38 -0700)]
intel: Allow src == NULL and *dst != NULL in intel_miptree_reference().
This makes this API consistent with intel_region_reference, and the
consumers wanted it this way.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Eric Anholt [Wed, 21 Sep 2011 22:34:35 +0000 (15:34 -0700)]
intel: Drop the "intel" argument to intel_miptree_release().
We don't have it in the other refcounting functions, and it was
totally unused.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Eric Anholt [Wed, 21 Sep 2011 22:20:20 +0000 (15:20 -0700)]
intel: Drop the immediate validation of the texture object in TFP.
It's totally gratuitous -- the image's miptree will be checked for
binding to the object later, anyway, with zero-copy or blitting as
appropriate.
Tested-by: Kristian Høgsberg <krh@bitplanet.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Eric Anholt [Wed, 21 Sep 2011 22:17:36 +0000 (15:17 -0700)]
intel: Fix improper freeing of texture data in TFP.
If there happened to be ->Data present, we assertion failed instead of
handling it correctly.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=35234
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Eric Anholt [Wed, 21 Sep 2011 22:13:57 +0000 (15:13 -0700)]
intel: Refactor texture_from_pixmap and EGL_image region binding.
Tested-by: Kristian Høgsberg <krh@bitplanet.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Eric Anholt [Wed, 21 Sep 2011 21:47:39 +0000 (14:47 -0700)]
intel: Drop some extra equality checks on reference/release functions.
_mesa_reference_renderbuffer already short-circuits equality, and
intel_miptree_release does nothing on NULL.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Eric Anholt [Fri, 9 Sep 2011 21:03:41 +0000 (14:03 -0700)]
i965: Set the pre/post-blend color clamp flags.
No change in piglit results on gen6, but the spec demands it so let's
do it.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>