Commit Graph

42166 Commits

Author SHA1 Message Date
Dave Airlie b13b7b86b2 r600g: rework dirty / depth texture tracking.
this adds a flag to keep track of whether the depth texture structure
is the flushed texture or not, so we can avoid doing flushes when
we do a hw rendering from one to the other.

it also renames flushed to dirty_db which tracks if the DB copy
has been dirtied by being bound to the hw.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-03 14:17:05 +10:00
Dave Airlie d0293290ad r600g: set correct pitch/offset for depth textures in flushed state.
This fixes zreaddraw in tiling mode
2011-02-03 14:12:32 +10:00
Brian Paul 4629be0509 softpipe: rename sampler[] -> fragment_samplers[] 2011-02-02 20:43:56 -07:00
Brian Paul 843f206a34 softpipe: rename fragment sampler/view fields
To be consistant with vertex, geometry sampler fields.
2011-02-02 20:30:56 -07:00
Brian Paul c06fa98c86 cso: refactor texture sampler and sampler view code
This consolidates the code duplicated between the fragment sampler
and vertex sampler functions.  Plus, it'll make adding support for
geometry shader samplers trivial.
2011-02-02 20:28:00 -07:00
Brian Paul 5f30e0b231 cso: rename fragment sampler-related fields
To better distinguish from vertex sampler fields.
2011-02-02 18:14:48 -07:00
Brian Paul d087cfaabf cso: fix loop bound in cso_set_vertex_samplers()
Before we were looping to nr_samplers, which is the number of fragment
samplers, not vertex samplers.

NOTE: This is a candidate for the 7.9 and 7.10 branches.
2011-02-02 18:11:30 -07:00
Chad Versace fd1252ab67 glcpp: Raise error when modulus is zero
For example, this now raises an error:
   #define XXX 1 / 0

Fixes bug: https://bugs.freedesktop.org//show_bug.cgi?id=33507
Fixes Piglit test: spec/glsl-1.10/preprocessor/modulus-by-zero.vert

NOTE: This is a candidate for the 7.9 and 7.10 branches.
2011-02-02 10:19:51 -08:00
Chad Versace e7c1f058d1 glsl: Avoid division-by-zero during constant-folding
Avoid division-by-zero when constant-folding the following expression
types:
    ir_unop_rsq
    ir_binop_div
    ir_binop_mod

Fixes bugs:
https://bugs.freedesktop.org//show_bug.cgi?id=33306
https://bugs.freedesktop.org//show_bug.cgi?id=33508

Fixes Piglit tests:
glslparsertest/glsl2/div-by-zero-01.frag
glslparsertest/glsl2/div-by-zero-02.frag
glslparsertest/glsl2/div-by-zero-03.frag
glslparsertest/glsl2/modulus-zero-01.frag
glslparsertest/glsl2/modulus-zero-02.frag

NOTE: This is a candidate for the 7.9 and 7.10 branches.
2011-02-02 09:55:35 -08:00
Chad Versace b3cf92aa91 glsl: Fix constant-folding for reciprocal expressions
Do not constant-fold a reciprocal if any component of the reciprocated
expression is 0. For example, do not constant-fold `1 / vec4(0, 1, 2, 3)`.

Incorrect, previous behavior
----------------------------
Reciprocals were constant-folded even when some component of the
reciprocated expression was 0. The incorrectly applied arithmetic was:
   1 / 0 := 0
For example,
   1 / vec4(0, 1, 2, 3) = vec4(0, 1, 1/2, 1/3)

NOTE: This is a candidate for the 7.9 and 7.10 branches.
2011-02-02 09:54:52 -08:00
José Fonseca 50278c0901 svga: Flush upload buffers or we get asserts
Based on work from Jakob Bornecrantz, Michel Dänzer, and Brian Paul.
2011-02-02 11:28:41 +00:00
Kenneth Graunke dfdb9fda82 glsl: Fix use of uninitialized values in _mesa_glsl_parse_state ctor.
This has probably existed since e5e34ab18e or so.

NOTE: This is a candidate for the 7.9 and 7.10 branches.
2011-02-01 23:53:39 -08:00
Kenneth Graunke cfd8d45ccd glsl: Fix invalid use of ralloc_asprintf in prototype_string.
This was my mistake when converting from talloc to ralloc.  I was
confused because the other calls in the function are to asprintf_append
and the original code used str as the context rather than NULL.

Fixes bug #33823.
2011-02-01 23:31:35 -08:00
Christian König 8ca3b140eb r600g: use burst exports in shaders
Join multiple exports into just one instruction
instead of exporting each register separately.
2011-02-02 01:33:03 +01:00
Alex Deucher 8503cffc4c r200: remove 0x4243 pci id
There's no such device.  0x4243 is a pci bridge id,
not a GPU.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
2011-02-01 19:13:54 -05:00
Ian Romanick a04582739e i915: Only mark a register as available if all components are written
Previously a register would be marked as available if any component
was written.  This caused shaders such as this:

  0: TEX TEMP[0].xyz, INPUT[14].xyyy, texture[0], 2D;
  1: MUL TEMP[1], UNIFORM[0], TEMP[0].xxxx;
  2: MAD TEMP[2], UNIFORM[1], TEMP[0].yyyy, TEMP[1];
  3: MAD TEMP[1], UNIFORM[2], TEMP[0].zzzz, TEMP[2];
  4: ADD TEMP[0].xyz, TEMP[1].xyzx, UNIFORM[3].xyzx;
  5: TEX TEMP[1].w, INPUT[14].xyyy, texture[0], 2D;
  6: MOV TEMP[0].w, TEMP[1].wwww;
  7: MOV OUTPUT[2], TEMP[0];
  8: END

to produce incorrect code such as this:

  BEGIN
  DCL S[0]
  DCL T_TEX0
  R[0] = MOV T_TEX0.xyyy
  U[0] = TEXLD S[0],R[0]
  R[0].xyz = MOV U[0]
  R[1] = MUL CONST[0], R[0].xxxx
  R[2] = MAD CONST[1], R[0].yyyy, R[1]
  R[1] = MAD CONST[2], R[0].zzzz, R[2]
  R[0].xyz = ADD R[1].xyzx, CONST[3].xyzx
  R[0] = MOV T_TEX0.xyyy
  U[0] = TEXLD S[0],R[0]
  R[1].w = MOV U[0]
  R[0].w = MOV R[1].wwww
  oC = MOV R[0]
  END

Note that T_TEX0 is copied to R[0], but the xyz components of R[0] are
still expected to hold a calculated value.

Fixes piglit tests draw-elements-vs-inputs, fp-kill, and
glsl-fs-color-matrix.  It also fixes Meego bugzilla #13005.

NOTE: This is a candidate for the 7.9 and 7.10 branches.
2011-02-01 13:43:36 -08:00
Ian Romanick 20d278a7ff mesa: glGetUniform only returns a single element of an array
Also return it as the correct type.  Previously the whole array would
be returned and each element would be expanded to a vec4.

Fixes piglit test getuniform-01 and bugzilla #29823.
2011-02-01 09:48:41 -08:00
José Fonseca 3c701f1d61 glsl: Fix printf_length() on MSVC. 2011-02-01 10:41:46 +00:00
Kenneth Graunke a7d350790b glsl: Fix memory error when creating the supported version string.
Passing ralloc_vasprintf_append a 0-byte allocation doesn't work.  If
passed a non-NULL argument, ralloc calls strlen to find the end of the
string.  Since there's no terminating '\0', it runs off the end.

Fixes a crash introduced in 14880a510a.
2011-02-01 00:20:01 -08:00
Dave Airlie 11bc8991e9 r600g: just change tile type when buffer is set to depth.
Not 100% sure on this one, but this is how it should work,
the question is whether it will uncover other bugs elsewhere.
2011-02-01 14:38:45 +10:00
Dave Airlie a112cc283d r600g: align the tiling modes with what the DDX and kernel expects.
If we see a MACRO bit on r600g its 2D tiled,
if don't see a MACRO bit and we do see a MICRO bit then its 1D tiled.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-01 14:23:35 +10:00
Dave Airlie 8b5a50b31c r600g: fix evergreen for depth decompress test 2011-02-01 13:06:35 +10:00
Dave Airlie aee5f1e40c r600: only decompress depth when its tile type is wrong.
If the tile type for the buffer is 1 then its been bound to the
DB at some point, we need to decompress it, otherwise its only
been bound as texture/cb so don't do anything.

This fixes 5 piglit tests here on r600g.
2011-02-01 13:02:56 +10:00
Kenneth Graunke 3ef397dafc texture_builtins.py: Fix a warning about mixed tabs/spaces. 2011-01-31 16:41:34 -08:00
Dave Airlie 42b5f68198 r600g: start looking at evergreen tiling.
this just adds the ioctl interface and sets the tile type
and array mode in the correct place.

This seems to bring eg 1D tiling to the same level, and issues
as on r600. No idea how to address 2D yet.
2011-02-01 10:36:57 +10:00
Henri Verbeet d171ae086b r600g: Actually use the info from the flushed depth texture when creating a sampler view on a depth texture.
R600/R700 was using incorrect tiling information from the (compressed) depth
buffer. Evergreen worked anyway because tiling doesn't work.
2011-02-01 01:19:16 +01:00
Ian Romanick 5e19b5ad16 glsl: Refresh autogenerated lexer and parser files.
For the previous commit.
2011-01-31 15:32:56 -08:00
Ian Romanick 14880a510a glsl: Reject shader versions not supported by the implementation
Previously we'd happily compile GLSL 1.30 shaders on any driver.  We'd
also happily compile GLSL 1.10 and 1.20 shaders in an ES2 context.
This has been a long standing FINISHME in the compiler.

NOTE: This is a candidate for the 7.9 and 7.10 branches
2011-01-31 15:32:56 -08:00
Ian Romanick e5e34ab18e glsl: Ensure that all GLSL versions are supported in the stand-alone compiler
NOTE: This is a candidate for the 7.9 and 7.10 branches
2011-01-31 15:32:56 -08:00
Ian Romanick bf9850db22 glsl: Fix dependencies / linkage for glsl_compiler 2011-01-31 15:32:55 -08:00
Ian Romanick 09e15ac76a mesa: Initial size for secondary color array is 3
See table 6.7 on page 347 of the OpenGL 3.0 specification.
2011-01-31 15:32:55 -08:00
Christian König 7fb722c35c r600g: fix invalid ref count handling in r600_set_constant_buffer
Only decrement ref count if r600_upload_const_buffer
really changes the buffer.
2011-01-31 23:38:10 +01:00
Brian Paul a8c144a388 llvmpipe: fix incorrect array index in image dump code 2011-01-31 14:09:24 -07:00
Brian Paul a1f5c46d24 glsl: regerated files 2011-01-31 14:09:24 -07:00
Brian Paul aacd07d623 glsl: make _token_list_is_empty_ignoring_space() static
To silence warning about missing prototype.
2011-01-31 14:09:24 -07:00
Brian Paul 3b8c7d70b3 scons/glsl: add top-level 'include' dir to CPPPATH
To avoid using the /usr/include/GL/gl.h file which may be lacking
some special #defines.
2011-01-31 14:09:24 -07:00
Brian Paul 59c957b688 glsl: add cast to silence signed/unsigned comparison warning 2011-01-31 14:09:24 -07:00
José Fonseca 3ae7aa3403 glsl: Define va_copy on MSVC. 2011-01-31 20:53:03 +00:00
Kenneth Graunke 0f7325b890 i965: Emit texel offsets in sampler messages. 2011-01-31 11:10:59 -08:00
Kenneth Graunke ca418cbde6 glsl/builtins: Uncomment prototypes for texture*Offset functions. 2011-01-31 11:10:59 -08:00
Kenneth Graunke ba3de801ec texture_builtins.py: Generate texture*Offset functions. 2011-01-31 11:10:59 -08:00
Kenneth Graunke 4c63f2de2f texture_builtins.py: Generalize the "use_proj" field to support offsets.
Rather than passing "True", pass a bitfield describing the particular
variant's features - either projection or offset.

This should make the code a bit more readable ("Proj" instead of "True")
and make it easier to support offsets in the future.
2011-01-31 11:10:59 -08:00
Kenneth Graunke 99f36486eb texture_builtins.py: Refactor coordinate dimension calculations.
For offsets, we'll want the straight sampler dimensionality, without the
+1 for array types.  Create a new function to do that; refactor.
2011-01-31 11:10:59 -08:00
Kenneth Graunke 819d57fce9 glsl: Introduce a new "const_in" variable mode.
This annotation is for an "in" function parameter for which it is only legal
to pass constant expressions.  The only known example of this, currently,
is the textureOffset functions.

This should never be used for globals.
2011-01-31 11:10:59 -08:00
Kenneth Graunke c5a27b5939 glsl: Change texel offsets to a single vector rvalue.
Having these as actual integer values makes it difficult to implement
the texture*Offset built-in functions, since the offset is actually a
function parameter (which doesn't have a constant value).

The original rationale was that some hardware needs these offset baked
into the instruction opcode.  However, at least i965 should be able to
support non-constant offsets.  Others should be able to rely on inlining
and constant propagation.
2011-01-31 11:10:59 -08:00
Kenneth Graunke 60c8e91c79 glsl: Re-synchronize ir_variable_mode and the printer's string array.
Since the introduction of ir_var_system_value, system variables would be
printed as "temporary" and temporaries would result in out-of-bounds
array access, showing up as garbage in printed IR.
2011-01-31 11:04:37 -08:00
Vinson Lee 8c115aa247 scons: Gracefully handle pkg-config errors with libdrm_radeon.
Print warnings and continue build.
2011-01-31 10:50:06 -08:00
Kenneth Graunke 1568b19e3b Remove the talloc sources from the Mesa repository. 2011-01-31 10:17:10 -08:00
Kenneth Graunke 8aac5d123c Remove talloc from the SCons build system. 2011-01-31 10:17:10 -08:00
Kenneth Graunke d1d8120545 Remove talloc from the make and automake build systems. 2011-01-31 10:17:09 -08:00