11 years agoprogs/samples: silence warnings
Brian Paul [Wed, 17 Mar 2010 16:11:09 +0000 (10:11 -0600)]
progs/samples: silence warnings

11 years agoglapi: fix assorted warnings
Brian Paul [Wed, 17 Mar 2010 14:44:09 +0000 (08:44 -0600)]
glapi: fix assorted warnings

And replace some instances of GLuint with unsigned int to avoid pulling in

11 years agost/mesa: Fix build breakage.
Corbin Simpson [Wed, 17 Mar 2010 11:35:14 +0000 (04:35 -0700)]
st/mesa: Fix build breakage.

Nearly certain this is what was intended; it compiles, but I'm not sure
this path is ever hit in my tests.

11 years agoMerge branch '7.8' into master
Pauli Nieminen [Wed, 17 Mar 2010 09:26:48 +0000 (11:26 +0200)]
Merge branch '7.8' into master


11 years agocell: build identity driver too
Brian Paul [Tue, 16 Mar 2010 22:45:54 +0000 (16:45 -0600)]
cell: build identity driver too

11 years agocell: add missing semicolon
Brian Paul [Tue, 16 Mar 2010 22:45:36 +0000 (16:45 -0600)]
cell: add missing semicolon

11 years agonv50: support more formats in surface_copy,fill
Christoph Bumiller [Tue, 16 Mar 2010 21:32:42 +0000 (22:32 +0100)]
nv50: support more formats in surface_copy,fill

Fixes corrupted fonts in bzFlag, where we've been silently
failing to copy I8 mipmaps to a new miptree.

Print an error message on unsupported format now, since we
can't return failure.

11 years agoi965: Fix readpixels from ReadBuffer != DrawBuffer.
Eric Anholt [Tue, 16 Mar 2010 20:23:23 +0000 (13:23 -0700)]
i965: Fix readpixels from ReadBuffer != DrawBuffer.

Fixes piglit fbo-readdrawpix.

11 years agoi965: Fix inversion for glCopyPixels to/from FBOs.
Eric Anholt [Tue, 16 Mar 2010 20:14:38 +0000 (13:14 -0700)]
i965: Fix inversion for glCopyPixels to/from FBOs.

fixes piglit fbo-copypix.

11 years agointel: Remove more code for x8z24 visuals, since we only do s8z24.
Eric Anholt [Tue, 16 Mar 2010 19:59:59 +0000 (12:59 -0700)]
intel: Remove more code for x8z24 visuals, since we only do s8z24.

11 years agoRevert "i965: Do VS SGT, SLT, and friends using CMP, SEL instead of CMP, MOV, MOV."
Eric Anholt [Tue, 16 Mar 2010 18:23:08 +0000 (11:23 -0700)]
Revert "i965: Do VS SGT, SLT, and friends using CMP, SEL instead of CMP, MOV, MOV."

This reverts commit 8ef3b1834a896927bdd4f2aea552cdb732849da9.  Fixes
piglit glsl-vs-if.

11 years agoRevert "i965: Do FS SLT, SGT, and friends using CMP, SEL instead of CMP, MOV, MOV."
Eric Anholt [Tue, 16 Mar 2010 18:22:29 +0000 (11:22 -0700)]
Revert "i965: Do FS SLT, SGT, and friends using CMP, SEL instead of CMP, MOV, MOV."

This reverts commit 46450c1f3f93bf4dc96696fc7e0f0eb808d9c08a.  I was
wrong about null reg behavior -- it reads undefined, not 0.  And
they're not kidding.

11 years agometa: Fix up restoration of state if _mesa_map_pbo_source() fails.
Eric Anholt [Sat, 13 Mar 2010 01:12:14 +0000 (17:12 -0800)]
meta: Fix up restoration of state if _mesa_map_pbo_source() fails.

11 years agometa: Properly refcount our saved programs and texobjs.
Eric Anholt [Sat, 13 Mar 2010 01:09:51 +0000 (17:09 -0800)]
meta: Properly refcount our saved programs and texobjs.

Found while debugging bug #24119.

11 years agogallium: add target-helpers/wrap_screen.c to C_SOURCES
Brian Paul [Tue, 16 Mar 2010 19:31:42 +0000 (13:31 -0600)]
gallium: add target-helpers/wrap_screen.c to C_SOURCES

Was commented out before.

11 years agoi965: Fix ENDLOOP to only patch up this loop's BREAK and CONT.
Eric Anholt [Tue, 9 Mar 2010 22:22:51 +0000 (14:22 -0800)]
i965: Fix ENDLOOP to only patch up this loop's BREAK and CONT.

Corresponds to d225a25e21a24508aea3b877c78beb35502e942d and fixes
piglit glsl-fs-loop-nested.  Bug #25173.
(cherry picked from commit a81836ee2fe5092d695b717addf8cec91f569777)

11 years agoi965: Unalias all GLSL source regs from the destination regs used.
Eric Anholt [Tue, 9 Mar 2010 19:56:14 +0000 (11:56 -0800)]
i965: Unalias all GLSL source regs from the destination regs used.

We were doing it ad-hoc before, as instructions with potential
aliasing problems were identified.  But thanks to swizzling basically
anything can have aliasing, so just do it generally at source reg
setup time.  This is somewhat inefficient, because sometimes an
operation doesn't need unaliasing protection if the swizzling is safe,
but the unaliasing before didn't cover those cases either.

Fixes piglit glsl-fs-loop.
(cherry picked from commit 6b194dab6b4d9f12cdd54c699b23c0d3420a49c2)

11 years agoi965: Fix nested loops in the VS.
Eric Anholt [Tue, 9 Mar 2010 17:56:42 +0000 (09:56 -0800)]
i965: Fix nested loops in the VS.

We were patching up all the break and continues between the start of
our loop and the end of our loop, even if they were breaks/continues
for an inner loop.  Avoiding patching already patched breaks/continues
fixes piglit glsl-vs-loop-nested.
(cherry picked from commit f6f547d87ea68f44c50a0b0231b7360ca94b2975)

11 years agoi965: Fix up VP constbuf leak on program delete.
Eric Anholt [Tue, 9 Mar 2010 00:08:33 +0000 (16:08 -0800)]
i965: Fix up VP constbuf leak on program delete.
(cherry picked from commit 7f6d2754d586545ab6c970acffdd897294879039)

11 years agoi965: Fix up the handling of point sprite coordinate replacement.
Eric Anholt [Mon, 8 Mar 2010 20:12:31 +0000 (12:12 -0800)]
i965: Fix up the handling of point sprite coordinate replacement.

The code was walking over the regs of pairs of attributes and checking
whether the attribute with a given reg index had point sprite enabled.
So the point sprite setup code was rarely even getting executed.
Instead, we need to determine which channels of a reg need point
sprite coordinate replacement.  In addition, it was multiplying the
attribute by 1/w, when it's supposed to cover (0, 1) in each direction
regardless of w, and it wasn't filling in the Z and W components of
the texcoord as specified.

Fixes piglit point-sprite and the spriteblast demo.  Bug #24431, #22245.
(cherry picked from commit bc632d04370566c1156cbd0345fe303834f0b910)

11 years agoi965: Add support for the CMP opcode in the GLSL path.
Eric Anholt [Wed, 10 Mar 2010 19:00:40 +0000 (11:00 -0800)]
i965: Add support for the CMP opcode in the GLSL path.

This would be triggered by use of sqrt() along with control flow.
Fixes piglit-fs-sqrt-branch and a bug in Yo Frankie!.
(cherry picked from commit 48dca99feb394febc3af44e14f23fb12a9cc9204)

11 years agoi965: Fix the response len of masked sampler messages for 8-wide dispatch.
Eric Anholt [Wed, 10 Mar 2010 18:38:20 +0000 (10:38 -0800)]
i965: Fix the response len of masked sampler messages for 8-wide dispatch.

The bad response length would hang the GPU with a masked sample in a
shader using control flow.  For 8-wide, the response length is always
4, and masked slots are just not written to.  brw_wm_glsl.c already
allocates registers in the right locations.

Fixes piglit glsl-fs-bug25902 (fd.o bug #25902).
(cherry picked from commit f6d210c284751ac50a8d6358de7e75a1ff1e4ac7)
(cherry picked from commit dc8c0359448cdae7b367552ba58783c04b199778)

11 years agost/mesa: Invalidate sampler view when texture object changes.
Michal Krol [Tue, 16 Mar 2010 18:39:09 +0000 (19:39 +0100)]
st/mesa: Invalidate sampler view when texture object changes.

11 years agoRemove nonexistant files from tarballs rule of Makefile
Ian Romanick [Tue, 16 Mar 2010 14:48:14 +0000 (07:48 -0700)]
Remove nonexistant files from tarballs rule of Makefile

The Makefile should eventually be fixed to stop building tarballs if
one of the individual calls to tar fails.

11 years agomesa: set version string to 7.8-rc1
Ian Romanick [Tue, 16 Mar 2010 14:38:51 +0000 (07:38 -0700)]
mesa: set version string to 7.8-rc1

11 years agoCorrect GL_EQUIV code in r67/7xx.
Matthew W. S. Bell [Mon, 15 Mar 2010 01:18:02 +0000 (01:18 +0000)]
Correct GL_EQUIV code in r67/7xx.

From 247e121106e8d3e389f2e5a6edf13ea70ac18df7 Mon Sep 17 00:00:00 2001

These seem to be documented in

11 years agost/xorg: fix up xorg state tracker to use cso changes
Roland Scheidegger [Tue, 16 Mar 2010 14:49:23 +0000 (15:49 +0100)]
st/xorg: fix up xorg state tracker to use cso changes

use cso_set_fragment_sampler_views instead of cso_set_sampler_textures

11 years agoradeon: Fix buffer object unmap to be called only once for dma buffers.
Pauli Nieminen [Mon, 15 Mar 2010 08:30:18 +0000 (10:30 +0200)]
radeon: Fix buffer object unmap to be called only once for dma buffers.

If flush happens inside radeonRefillCurrentMaRegion the last dma buffer would
be unmapped twice. Unmapping buffer when moving buffer to wait list fixes the
mapping error.

11 years agoregenerate gl_mangle.h to get new EGLImage functions
Brian Paul [Tue, 16 Mar 2010 13:56:56 +0000 (07:56 -0600)]
regenerate gl_mangle.h to get new EGLImage functions

11 years agolibgl-xlib: Use a simple GALLIUM_DRIVER env var to select the pipe driver.
José Fonseca [Tue, 16 Mar 2010 13:48:09 +0000 (13:48 +0000)]
libgl-xlib: Use a simple GALLIUM_DRIVER env var to select the pipe driver.

GALLIUM_DRIVER is being used in many other places, and it easier to
memorizing and understand than all the GALLIUM_NO_XXX.

11 years agogallium: Silence warning.
José Fonseca [Tue, 16 Mar 2010 13:46:10 +0000 (13:46 +0000)]
gallium: Silence warning.

11 years agogallium: change remaining util functions to use cso sampler views
Roland Scheidegger [Mon, 15 Mar 2010 20:55:08 +0000 (21:55 +0100)]
gallium: change remaining util functions to use cso sampler views

changes arguments of util_blit_pixels_tex and util_gen_mipmap to
struct pipe_sampler_view * instead of struct pipe_texture *.

11 years agogallium/docs: Create a separate section for Sampler Views.
Michal Krol [Tue, 16 Mar 2010 09:58:33 +0000 (10:58 +0100)]
gallium/docs: Create a separate section for Sampler Views.

11 years agoMerge commit 'origin/master' into gallium-sampler-view
Keith Whitwell [Tue, 16 Mar 2010 09:02:38 +0000 (09:02 +0000)]
Merge commit 'origin/master' into gallium-sampler-view

This branch already seems to have the nv50_tex.c fix.


11 years agoi965g: Fix use of an uninitialized variable.
Chia-I Wu [Tue, 16 Mar 2010 07:48:03 +0000 (15:48 +0800)]
i965g: Fix use of an uninitialized variable.

11 years agoMerge remote branch 'origin/gallium-st-api'
Chia-I Wu [Tue, 16 Mar 2010 07:12:46 +0000 (15:12 +0800)]
Merge remote branch 'origin/gallium-st-api'

11 years agonv50: fix texturing from >=4GiB mark
Ben Skeggs [Tue, 16 Mar 2010 03:18:39 +0000 (13:18 +1000)]
nv50: fix texturing from >=4GiB mark

11 years agollvmpipe: Fix rebase typo
Jakob Bornecrantz [Tue, 16 Mar 2010 01:17:33 +0000 (01:17 +0000)]
llvmpipe: Fix rebase typo

11 years agowinsys/sw: Add a software winsys layered on a pipe
Jakob Bornecrantz [Thu, 11 Mar 2010 03:33:03 +0000 (03:33 +0000)]
winsys/sw: Add a software winsys layered on a pipe

11 years agoi965g: Fix after context transfers
Jakob Bornecrantz [Tue, 16 Mar 2010 00:12:37 +0000 (00:12 +0000)]
i965g: Fix after context transfers

11 years agogallivm: checkpoint: stencil test code
Brian Paul [Tue, 16 Mar 2010 00:19:04 +0000 (18:19 -0600)]
gallivm: checkpoint: stencil test code

11 years agogallivm/llvmpipe: rename some constant building functions
Brian Paul [Mon, 15 Mar 2010 20:00:23 +0000 (14:00 -0600)]
gallivm/llvmpipe: rename some constant building functions

11 years agogallivm: fix up some #includes
Brian Paul [Mon, 15 Mar 2010 19:54:43 +0000 (13:54 -0600)]
gallivm: fix up some #includes

11 years agogallivm/llvmpipe: rename os_llvm.h to lp_bld.h
Brian Paul [Mon, 15 Mar 2010 19:50:40 +0000 (13:50 -0600)]
gallivm/llvmpipe: rename os_llvm.h to lp_bld.h

The llvm wrapper wasn't really an OS thing.

Use lp_bld.h for now but we eventually should rename/re-prefix all the
files/functions in the gallivm/ directory.

11 years agolibgl-xlib: Obey GALLIUM_SOFTPIPE define.
José Fonseca [Mon, 15 Mar 2010 21:03:59 +0000 (21:03 +0000)]
libgl-xlib: Obey GALLIUM_SOFTPIPE define.

11 years agogallium: fix frontbuffer rendering with r300g
Dave Airlie [Mon, 15 Mar 2010 20:49:38 +0000 (06:49 +1000)]
gallium: fix frontbuffer rendering with r300g

No idea if this is the correct fix, but it makes it work again at least.

Signed-off-by: Dave Airlie <>
11 years agollvmpipe: updated status in README file
Brian Paul [Mon, 15 Mar 2010 17:46:41 +0000 (11:46 -0600)]
llvmpipe: updated status in README file

11 years agoprogs/objviewer: remove debug code
Brian Paul [Mon, 15 Mar 2010 17:31:59 +0000 (11:31 -0600)]
progs/objviewer: remove debug code

11 years agogallivm: fix typo/bug in lp_build_sgn()
Brian Paul [Mon, 15 Mar 2010 17:27:24 +0000 (11:27 -0600)]
gallivm: fix typo/bug in lp_build_sgn()

We were never returning -1 as a result.  This fixes some inverted/flipped
faces with cube mapping.

11 years agocso: Do not hold references to bound textures.
Keith Whitwell [Mon, 15 Mar 2010 16:56:19 +0000 (17:56 +0100)]
cso: Do not hold references to bound textures.

Sampler views already hold references to those.

11 years agogallivm: add min_lod==max_lod special-case code in lp_build_lod_selector()
Brian Paul [Mon, 15 Mar 2010 16:51:56 +0000 (10:51 -0600)]
gallivm: add min_lod==max_lod special-case code in lp_build_lod_selector()

When min_lod==max_lod we don't need to go through all the work of
computing the lod from partial derivatives.  This is hit by the mipmap
generation utility code.

11 years agogallivm: asst clean-ups, comments, etc.
Brian Paul [Mon, 15 Mar 2010 16:43:05 +0000 (10:43 -0600)]
gallivm: asst clean-ups, comments, etc.

11 years agogallivm: implement minification/magnification selection
Brian Paul [Mon, 15 Mar 2010 16:36:56 +0000 (10:36 -0600)]
gallivm: implement minification/magnification selection

Use the LOD value to determine whether to use the minification vs.
magnification filter.

All mipmap sampling modes work now.

11 years agogallivm: fix incorrect clamp in lp_build_linear_mip_levels()
Brian Paul [Mon, 15 Mar 2010 16:31:20 +0000 (10:31 -0600)]
gallivm: fix incorrect clamp in lp_build_linear_mip_levels()

11 years agogallivm: fix incorrect floor(), itrunc()
Brian Paul [Mon, 15 Mar 2010 16:29:04 +0000 (10:29 -0600)]
gallivm: fix incorrect floor(), itrunc()

LLVMBuildFPTrunc() should be used for double->float conversion, not
float->int conversion.

There should be a better way to compute floor(), ceil(), etc that doesn't
involve float->int->float conversion.

11 years agoReplace _mesa_strtod with _mesa_strtof.
Marcin Baczyński [Sat, 13 Mar 2010 13:26:45 +0000 (14:26 +0100)]
Replace _mesa_strtod with _mesa_strtof.

Reviewed-by: Ian Romanick <>
11 years agost/mesa: Fix a call to st_get_stobj_sampler_view().
Michal Krol [Mon, 15 Mar 2010 14:04:12 +0000 (15:04 +0100)]
st/mesa: Fix a call to st_get_stobj_sampler_view().

11 years agost/mesa: Pass in correct sampler view object to blitter.
Michal Krol [Mon, 15 Mar 2010 14:03:44 +0000 (15:03 +0100)]
st/mesa: Pass in correct sampler view object to blitter.

11 years agoutil: Fix nil pointer reference.
Michal Krol [Mon, 15 Mar 2010 13:42:44 +0000 (14:42 +0100)]
util: Fix nil pointer reference.

11 years agonv40: remove leftover nv40_transfer.c from unification into nvfx
Luca Barbieri [Mon, 15 Mar 2010 13:35:41 +0000 (14:35 +0100)]
nv40: remove leftover nv40_transfer.c from unification into nvfx

11 years agogallium: util_blit_pixels() takes source sampler view as argument.
Michal Krol [Mon, 15 Mar 2010 12:20:37 +0000 (13:20 +0100)]
gallium: util_blit_pixels() takes source sampler view as argument.

11 years agost/mesa: Cache FBO texture's sampler view object.
Michal Krol [Mon, 15 Mar 2010 12:18:30 +0000 (13:18 +0100)]
st/mesa: Cache FBO texture's sampler view object.

11 years agost/mesa: Update the comments in st_manager.c.
Chia-I Wu [Mon, 15 Mar 2010 11:15:29 +0000 (19:15 +0800)]
st/mesa: Update the comments in st_manager.c.

11 years agonvfx: fix up after merge
Keith Whitwell [Mon, 15 Mar 2010 10:27:25 +0000 (10:27 +0000)]
nvfx: fix up after merge

11 years agor300g: fix up after merge
Keith Whitwell [Mon, 15 Mar 2010 10:24:55 +0000 (10:24 +0000)]
r300g: fix up after merge

11 years agoMerge commit 'origin/master' into gallium-sampler-view
Keith Whitwell [Mon, 15 Mar 2010 09:44:52 +0000 (09:44 +0000)]
Merge commit 'origin/master' into gallium-sampler-view


11 years agor300g: rebuild screen/winsys interface
Dave Airlie [Fri, 12 Feb 2010 05:39:51 +0000 (15:39 +1000)]
r300g: rebuild screen/winsys interface

This creates a cleaner winsys and drop the simple screen stuff.

It makes r300g use pb_bufmgr structs.

It also tries to avoid overheads from mapping too often.

v5: clean warnings

v6: break out of cache check on first buffer - since most likely
the first busy one implies all after it are busy.

v7: cleanup a bit

v8-merged: drop cman for now to just get all the interface changes in first.
rework to changes that happened upstream

Signed-off-by: Dave Airlie <>
11 years agonv50: reset vbo_fifo before each validate
Ben Skeggs [Mon, 15 Mar 2010 06:52:25 +0000 (16:52 +1000)]
nv50: reset vbo_fifo before each validate

11 years agonvfx: remove src_native_swz, which was a no-op
Luca Barbieri [Sat, 13 Mar 2010 16:42:57 +0000 (17:42 +0100)]
nvfx: remove src_native_swz, which was a no-op

src_native_swz was used to translate 0/1 swizzles back when Gallium
supported them.

That support was later removed from Gallium, and the function currently
always returns true.

Remove it.

11 years agonvfx: clean up shader header
Luca Barbieri [Sun, 21 Feb 2010 17:17:03 +0000 (18:17 +0100)]
nvfx: clean up shader header

Currently the behavior of shader.h depends on some constants that
are defined differently in vertex and fragment programs.

This patch cleans that up by splitting the relevant symbols in
vertex program and fragment program variants

11 years agonvfx: draw: make swtnl draw_elements actually work.
Luca Barbieri [Mon, 22 Feb 2010 12:22:24 +0000 (13:22 +0100)]
nvfx: draw: make swtnl draw_elements actually work.

It was totally broken: the index buffer was passed as NULL!

11 years agonvfx: draw: emit color as floating point
Luca Barbieri [Mon, 22 Feb 2010 12:18:10 +0000 (13:18 +0100)]
nvfx: draw: emit color as floating point

Don't lose precision by converting to u8.

11 years agonvfx: draw: make perspective corrective texturing work
Luca Barbieri [Mon, 22 Feb 2010 12:15:24 +0000 (13:15 +0100)]
nvfx: draw: make perspective corrective texturing work

We must divide everything in the position by w, and emit position as
a 4-component vector.

Not sure why we must divide, but it works (see progs/redbook/checker).

11 years agonvfx: draw: create draw vp with ureg
Luca Barbieri [Mon, 22 Feb 2010 11:35:18 +0000 (12:35 +0100)]
nvfx: draw: create draw vp with ureg

This avoids duplicating the vertex program generation logic and
makes the same code work for both nv30 and nv40.

11 years agonvfx: add NOUVEAU_SWTNL to force swtnl at runtime
Luca Barbieri [Mon, 22 Feb 2010 10:44:31 +0000 (11:44 +0100)]
nvfx: add NOUVEAU_SWTNL to force swtnl at runtime

Replace the FORCE_SWTNL macro with a NOUVEAU_SWTNL environment variable.

11 years agonvfx: move nv04_surface_2d.c into nvfx directory
Luca Barbieri [Mon, 22 Feb 2010 19:14:32 +0000 (20:14 +0100)]
nvfx: move nv04_surface_2d.c into nvfx directory

It is only used on pre-nv50 and nvfx is the only Gallium pre-nv50 driver.

11 years agonvfx: fix quads drawing
Luca Barbieri [Mon, 22 Feb 2010 13:13:17 +0000 (14:13 +0100)]
nvfx: fix quads drawing

The primitive splitting code is totally broken and will be rewritten.

Fix the most important bug now though.

11 years agonvfx: fix viewport state after bypass removal for swtnl
Luca Barbieri [Tue, 2 Mar 2010 21:51:39 +0000 (22:51 +0100)]
nvfx: fix viewport state after bypass removal for swtnl

The adjustment of nv30/nv40 after the removal of bypass incorrectly
removed the hardware viewport bypass code, which we still need for
swtnl and also forgot to remove NVFX_NEW_RAST from pipe.

11 years agonv30, nv40: move last files to nvfx/ and rm -rf nv30 nv40
Luca Barbieri [Sun, 21 Feb 2010 14:13:12 +0000 (15:13 +0100)]
nv30, nv40: move last files to nvfx/ and rm -rf nv30 nv40

This is the last nvfx unification patch.

nv[34]0_fragtex.c are moved to the common directory
nv[34]0_shader.h are renamed to nv[34]0_vertprog.h and moved to
the common directory

The separate nv30 and nv40 directories are removed from the build

11 years agonv30, nv40: partially non-trivially unify sampler state in nv[34]0_state.c
Luca Barbieri [Wed, 24 Feb 2010 14:08:48 +0000 (15:08 +0100)]
nv30, nv40: partially non-trivially unify sampler state in nv[34]0_state.c

Many things, like texture wrap modes and min/mag filters are common.

Some others, like annisotropy and lod settings, are not.

11 years agonv30, nv40: partially non-trivially unify nv[34]0_fragtex.c
Luca Barbieri [Sun, 21 Feb 2010 14:07:17 +0000 (15:07 +0100)]
nv30, nv40: partially non-trivially unify nv[34]0_fragtex.c

The bulk files cannot be unified, but the frontend can and allows to
share some code and simplify state_emit.c

11 years agonv30, nv40: unify nv[34]0_context.c
Luca Barbieri [Sun, 21 Feb 2010 13:40:32 +0000 (14:40 +0100)]
nv30, nv40: unify nv[34]0_context.c

They are now almost identical, except for nv30 vs nv40 fragtex

11 years agonv30, nv40: fully unify nv[34]0_context.h
Luca Barbieri [Sun, 21 Feb 2010 13:38:04 +0000 (14:38 +0100)]
nv30, nv40: fully unify nv[34]0_context.h

Move the remaining content to the common header.

11 years agonv30, nv40: non-trivially unify nv[34]0_screen.c
Luca Barbieri [Sun, 21 Feb 2010 13:31:27 +0000 (14:31 +0100)]
nv30, nv40: non-trivially unify nv[34]0_screen.c

The files have the same structure but are substantially different.

They are unified with appropriate conditionals.

11 years agonv30, nv40: non-trivially unify nv[34]0_vertprog.c
Luca Barbieri [Sun, 21 Feb 2010 12:33:48 +0000 (13:33 +0100)]
nv30, nv40: non-trivially unify nv[34]0_vertprog.c

vertprog.c is similar but has substantial differences:
1. nv40 supports clip planes
2. nv40 uses a more advanced register allocator
3. Some register setup is different
4. Constants with the same name have different values

This patch unifies the two files.
nv30 gains clip plane support and the nv40 register allocator.

A new NVFX_VP(x) macro is introduced that at runtime resolved to
either the nv30 or the nv40 constant value.

nv30 clip planes are not tested and might not work

11 years agonv30, nv40: partially unify nv[34]0_state.c
Luca Barbieri [Sun, 21 Feb 2010 11:39:21 +0000 (12:39 +0100)]
nv30, nv40: partially unify nv[34]0_state.c

state.c is identical except for:
1. Sampler state creation is different
2. nv40 swtnl support
3. Separate blend equations on nv40

This patch unifies nv[34]0_state.c, except the sampler state creation code.

11 years agonv30, nv40: unify nv[34]0_vbo.c
Luca Barbieri [Sun, 21 Feb 2010 10:12:08 +0000 (11:12 +0100)]
nv30, nv40: unify nv[34]0_vbo.c

The files are identical, except for swtnl support which is commented
out on nv30 and restart being initialized on nv30 to avoid a compiler

11 years agonv30, nv40: non-trivially unify nv[34]0_draw.c
Luca Barbieri [Sun, 21 Feb 2010 10:17:55 +0000 (11:17 +0100)]
nv30, nv40: non-trivially unify nv[34]0_draw.c

nv30_draw.c is a stub.

This patch makes both nv30 and nv40 use the nv40 swtnl path.

Note that this doesn't actually work on nv30 because the vertex program is
encoded in the nv40-only layout.

However, swtnl was unimplemented before on nv30, so this is not a regression.
Furthermore, a patch to fix this is available near the end of the patchset.

11 years agonv30, nv40: non-trivially unify nv[34]0_fragprog.c
Luca Barbieri [Sun, 21 Feb 2010 09:55:41 +0000 (10:55 +0100)]
nv30, nv40: non-trivially unify nv[34]0_fragprog.c

The files are mostly the same except:
1. On NV40, some TGSI instructions are emulated with several hardware ones
2. Some instructions such as DDX/DDY, and STR were missing from nv30
3. NV40 has more sophisticated register management

nv30 now supports all instructions and uses the nv40 register management.

11 years agonv30, nv40: non-trivially partially unify nv[34]0_shader.h
Luca Barbieri [Sun, 21 Feb 2010 01:26:25 +0000 (02:26 +0100)]
nv30, nv40: non-trivially partially unify nv[34]0_shader.h

shader.h is similar, except for the following differences:
1. The instruction sets are not exactly the same, but mostly similar
2. Vertex program fields are in different bit positions

This patch unifies all parts of nv[34]0_shader.h except the vertex
program fields.

Vertex opcodes are also changed so that the constant names includes
SCA if it is a scalar opcode and VEC if it is a vector opcode.

11 years agonv30, nv40: non-trivially unify nv[34]0_state_fb.c
Luca Barbieri [Sat, 20 Feb 2010 23:59:30 +0000 (00:59 +0100)]
nv30, nv40: non-trivially unify nv[34]0_state_fb.c

The files are significantly different due to:
1. nv30 support 2 render targets, nv40 4
2. z-buffer pitch is set differently
3. nv30 has a limitation of colour_bits >= zeta_bits. This may not
   actually exist in the driver though
4. nv30 points color0 at depth in the depth-only case
5. nv30 sets NV34TCL_VIEWPORT_TX_ORIGIN to 0. This is probably

This patch attempts to unify the two files and preserve the existing

11 years agonv30, nv40: unify nv[34]0_state_viewport.c
Luca Barbieri [Sat, 20 Feb 2010 22:30:59 +0000 (23:30 +0100)]
nv30, nv40: unify nv[34]0_state_viewport.c

The files are identical, except for an extra comment in nv30.

11 years agonv30, nv40: unify nv[34]0_query.c
Luca Barbieri [Sat, 20 Feb 2010 18:39:24 +0000 (19:39 +0100)]
nv30, nv40: unify nv[34]0_query.c

The files are identical except formatting.

11 years agonv30, nv40: unify nv[34]0_miptree.c
Luca Barbieri [Sat, 20 Feb 2010 18:32:29 +0000 (19:32 +0100)]
nv30, nv40: unify nv[34]0_miptree.c

The only difference between nv30 and nv40 is that nv30 allowed swizzling
for more texture types.

This patch preserves the existing behavior, using conditional code.

Note however that this does not make sense, since all texture types can
be swizzled on nv40 and probably on nv30 too.

However, the handling of swizzled surfaces in the current 2D code is
partially broken, so it's best not to touch this.

A whole rewrite of the 2D code will be submitted, which will solve this

11 years agonv30, nv40: unify nv[34]0_state_stipple.c
Luca Barbieri [Sat, 20 Feb 2010 18:22:57 +0000 (19:22 +0100)]
nv30, nv40: unify nv[34]0_state_stipple.c

The files are identical, except for the fact that the nv40 version
forgets to unreference the stateobj.

Unified to the correct nv30 version.

11 years agonv30, nv40: unify identical nv[34]0_state_zsa.c
Luca Barbieri [Sat, 20 Feb 2010 22:19:40 +0000 (23:19 +0100)]
nv30, nv40: unify identical nv[34]0_state_zsa.c

11 years agonv30, nv40: unify identical nv[34]0_state_scissor.c
Luca Barbieri [Sat, 20 Feb 2010 22:17:41 +0000 (23:17 +0100)]
nv30, nv40: unify identical nv[34]0_state_scissor.c

11 years agonv30, nv40: unify identical nv[34]0_state_rasterizer.c
Luca Barbieri [Sat, 20 Feb 2010 22:16:01 +0000 (23:16 +0100)]
nv30, nv40: unify identical nv[34]0_state_rasterizer.c

11 years agonv30, nv40: unify identical nv[34]0_state_blend.c
Luca Barbieri [Sat, 20 Feb 2010 19:37:17 +0000 (20:37 +0100)]
nv30, nv40: unify identical nv[34]0_state_blend.c

11 years agonv30, nv40: non-trivially unify nv[34]0_state_emit.c
Luca Barbieri [Sun, 21 Feb 2010 10:33:15 +0000 (11:33 +0100)]
nv30, nv40: non-trivially unify nv[34]0_state_emit.c

The files are the same except for swtnl support on nv40 and for
texture cache flushing on nv40.

Unify them, and use a macro to define 4 versions of render_states,
for all combinations of nvfx and hwtnl/swtnl.