Mesa (master): r600g: Removed debug code.

2010-09-21 Thread Tilman Sauerbeck
Module: Mesa
Branch: master
Commit: 894a307a91d6437ec418800952da2ec174e092f5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=894a307a91d6437ec418800952da2ec174e092f5

Author: Tilman Sauerbeck til...@code-monkey.de
Date:   Tue Sep 21 08:13:03 2010 +0200

r600g: Removed debug code.

Signed-off-by: Tilman Sauerbeck til...@code-monkey.de

---

 src/gallium/drivers/r600/r600_shader.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index e1e2891..e18c6ce 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -969,7 +969,6 @@ static int tgsi_scs(struct r600_shader_ctx *ctx)
 
/* dst.z = 0.0; */
if (inst-Dst[0].Register.WriteMask  TGSI_WRITEMASK_Z) {
-   fprintf(stderr, writing z\n);
memset(alu, 0, sizeof(struct r600_bc_alu));
 
alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): d3d1x: add new Direct3D 10/11 COM state tracker for Gallium

2010-09-21 Thread Luca Barbieri
Module: Mesa
Branch: master
Commit: 92617aeac109481258f0c3863d09c1b8903d438b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=92617aeac109481258f0c3863d09c1b8903d438b

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Sun Sep 12 02:49:36 2010 +0200

d3d1x: add new Direct3D 10/11 COM state tracker for Gallium

This is a new implementation of the Direct3D 11 COM API for Gallium.

Direct3D 10 and 10.1 implementations are also provided, which are
automatically generated with s/D3D11/D3D10/g plus a bunch of #ifs.

While this is an initial version, most of the code is there (limited
to what Gallium can express), and tri, gears and texturing demos
are working.

The primary goal is to realize Gallium's promise of multiple API
support, and provide an API that can be easily implemented with just
a very thin wrapper over Gallium, instead of the enormous amount of
complex code needed for OpenGL.

The secondary goal is to run Windows Direct3D 10/11 games on Linux
using Wine.
Wine dlls are currently not provided, but adding them should be
quite easy.

Fglrx and nvidia drivers can also be supported by writing a Gallium
driver that talks to them using OpenGL, which is a relatively easy
task.
Thanks to the great design of Direct3D 10/11 and closeness to Gallium,
this approach should not result in detectable overhead, and is the
most maintainable way to do it, providing a path to switch to the
open Gallium drivers once they are on par with the proprietary ones.

Currently Wine has a very limited Direct3D 10 implementation, and
completely lacks a Direct3D 11 implementation.

Note that Direct3D 10/11 are completely different from Direct3D 9
and earlier, and thus warrant a fully separate implementation.

The third goal is to provide a superior alternative to OpenGL for
graphics programming on non-Windows systems, particularly Linux
and other free and open systems.

Thanks to a very clean and well-though design done from scratch,
the Direct3D 10/11 APIs are vastly better than OpenGL and can be
supported with orders of magnitude less code and development time,
as you can see by comparing the lines of code of this commit and
those in the existing Mesa OpenGL implementation.

This would have been true for the Longs Peak proposal as well, but
unfortunately it was abandoned by Khronos, leaving the OpenGL
ecosystem without a graphics API with a modern design.

A binding of Direct3D 10/11 to EGL would solve this issue in the
most economical way possible, and this would be great to provide
in Mesa, since DXGI, the API used to bind Direct3D 10/11 to Windows,
is a bit suboptimal, especially on non-Windows platforms.

Finally, a mature Direct3D 10/11 implementation is intrinsically going
to be faster and more reliable than an OpenGL implementation, thanks
to the dramatically smaller API and the segregation of all nontrivial
work to object creation that the application must perform ahead of
time.

Currently, this commit contains:
- Independently created headers for Direct3D 10, 10.1, 11 and DXGI 1.1,
  partially based on the existing Wine headers for D3D10 and DXGI 1.0
- A parser for Direct3D 10/11 DXBC and TokenizedProgramFormat (TPF)
- A shader translator from TokenizedProgramFormat to TGSI
- Implementation of the Direct3D 11 core interfaces
- Automatically generated implementation of Direct3D 10 and 10.1
- Implementation of DXGI using the native framework of the EGL st
- Demos, usable either on Windows or on this implementation
  - d3d11tri, a clone of tri
  - d3d11tex, a (multi)texturing demo
  - d3d11gears, an improved version of glxgears
  - d3d11spikysphere, a D3D11 tessellation demo (currently Windows-only)
- A downloader for the Microsoft HLSL compiler, needed to recompile
  the shaders (compiled shader bytecode is also included)

To compile this, configure at least with these options:
--with-state-trackers=egl,d3d1x --with-egl-platforms=x11
plus some gallium drivers (such as softpipe with --enable-gallium-swrast)

The Wine headers (usually from a wine-dev or wine-devel package) must
be installed.
Only x86-32 has been tested.

You may need to run make in the subdirectories of src/gallium/winsys/sw
and you may need to manually run sudo make install in
src/gallium/targets/egl

To test it, run the demos in the progs directory.
Windows binaries are included to find out how demos should work, and to
test Wine integration when it will be done.

Enjoy, and let me know if you manage to compile and run this, or
which issues you are facing if not.

Using softpipe is recommended for now, and your mileage with hardware
drivers may vary.
However, getting this to work on hardware drivers is also obviously very
important.

Note that currently llvmpipe is buggy and causes all 3 gears to be
drawn with the same color.
Use export GALLIUM_DRIVER=softpipe to avoid this.

Thanks to all the Gallium contributors and especially the VMware
team, whose work made it possible to implement Direct3D 10/11 much
more easily than it would have been 

Mesa (master): llvmpipe: fix flatshading in new line code

2010-09-21 Thread Keith Whitwell
Module: Mesa
Branch: master
Commit: 2ec86793bd43fe15d8f79d04e32d6c524e8ad844
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2ec86793bd43fe15d8f79d04e32d6c524e8ad844

Author: Keith Whitwell kei...@vmware.com
Date:   Tue Sep 21 14:28:51 2010 +0100

llvmpipe: fix flatshading in new line code

Calculate interpolants before rearranging the vertices.

---

 src/gallium/drivers/llvmpipe/lp_setup_line.c |   19 +--
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c 
b/src/gallium/drivers/llvmpipe/lp_setup_line.c
index 9f090d1..829eb8a 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_line.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c
@@ -292,6 +292,7 @@ try_setup_line( struct lp_setup_context *setup,
float x2diff;
float y2diff;
float dx, dy;
+   float area;
 
boolean draw_start;
boolean draw_end;
@@ -311,6 +312,18 @@ try_setup_line( struct lp_setup_context *setup,
 
dx = v1[0][0] - v2[0][0];
dy = v1[0][1] - v2[0][1];
+   area = (dx * dx  + dy * dy);
+   if (area == 0) {
+  LP_COUNT(nr_culled_tris);
+  return TRUE;
+   }
+
+   info.oneoverarea = 1.0f / area;
+   info.dx = dx;
+   info.dy = dy;
+   info.v1 = v1;
+   info.v2 = v2;
+
   
/* X-MAJOR LINE */
if (fabsf(dx) = fabsf(dy)) {
@@ -573,12 +586,6 @@ try_setup_line( struct lp_setup_context *setup,
line-plane[3].dcdx = y[3] - y[0];
 
 
-   info.oneoverarea = 1.0f / (dx * dx  + dy * dy);
-   info.dx = dx;
-   info.dy = dy;
-   info.v1 = v1;
-   info.v2 = v2;
-
/* Setup parameter interpolants:
 */
setup_line_coefficients( setup, line, info); 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (7.9): llvmpipe: fix flatshading in new line code

2010-09-21 Thread Keith Whitwell
Module: Mesa
Branch: 7.9
Commit: 141dbbfc7856d8e33cf6d628758ef3ef2654de93
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=141dbbfc7856d8e33cf6d628758ef3ef2654de93

Author: Keith Whitwell kei...@vmware.com
Date:   Tue Sep 21 14:28:51 2010 +0100

llvmpipe: fix flatshading in new line code

Calculate interpolants before rearranging the vertices.

---

 src/gallium/drivers/llvmpipe/lp_setup_line.c |   19 +--
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c 
b/src/gallium/drivers/llvmpipe/lp_setup_line.c
index 9f090d1..829eb8a 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_line.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c
@@ -292,6 +292,7 @@ try_setup_line( struct lp_setup_context *setup,
float x2diff;
float y2diff;
float dx, dy;
+   float area;
 
boolean draw_start;
boolean draw_end;
@@ -311,6 +312,18 @@ try_setup_line( struct lp_setup_context *setup,
 
dx = v1[0][0] - v2[0][0];
dy = v1[0][1] - v2[0][1];
+   area = (dx * dx  + dy * dy);
+   if (area == 0) {
+  LP_COUNT(nr_culled_tris);
+  return TRUE;
+   }
+
+   info.oneoverarea = 1.0f / area;
+   info.dx = dx;
+   info.dy = dy;
+   info.v1 = v1;
+   info.v2 = v2;
+
   
/* X-MAJOR LINE */
if (fabsf(dx) = fabsf(dy)) {
@@ -573,12 +586,6 @@ try_setup_line( struct lp_setup_context *setup,
line-plane[3].dcdx = y[3] - y[0];
 
 
-   info.oneoverarea = 1.0f / (dx * dx  + dy * dy);
-   info.dx = dx;
-   info.dy = dy;
-   info.v1 = v1;
-   info.v2 = v2;
-
/* Setup parameter interpolants:
 */
setup_line_coefficients( setup, line, info); 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): d3d1x: fix compilation with recent Wine versions installed

2010-09-21 Thread Luca Barbieri
Module: Mesa
Branch: master
Commit: cb7cc36fff63e1bbdf4820538a8133f150541be4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cb7cc36fff63e1bbdf4820538a8133f150541be4

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Tue Sep 21 15:39:42 2010 +0200

d3d1x: fix compilation with recent Wine versions installed

Recent Wine versions provide a d3d11shader.h, which is however empty
and was getting used instead of our non-empty one.

Correct the include path order to fix this.

---

 .../state_trackers/d3d1x/d3d1xshader/Makefile  |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile 
b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile
index 6ac74d1..8c8e2fb 100644
--- a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile
@@ -1,6 +1,6 @@
 LIBNAME=d3d1xshader
 CPP_SOURCES=$(wildcard src/*.cpp)
-LIBRARY_INCLUDES=-Iinclude -I../w32api -I../d3dapi
+LIBRARY_INCLUDES=-Iinclude -I../d3dapi -I../w32api
 PROGS=tools/fxdis
 LIBS=libd3d1xshader.a
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): d3d1x: add blob and signature extraction APIs

2010-09-21 Thread Luca Barbieri
Module: Mesa
Branch: master
Commit: 70fed0b0ec8a3ec4f6b9b47f1fe98cc54c6037f0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=70fed0b0ec8a3ec4f6b9b47f1fe98cc54c6037f0

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Tue Sep 21 02:39:52 2010 +0200

d3d1x: add blob and signature extraction APIs

NOTE: untested, needs a testing tool!

---

 .../d3d1x/d3d1xshader/include/dxbc.h   |   11 
 .../d3d1x/d3d1xshader/src/dxbc_assemble.cpp|   59 
 .../d3d1x/d3d1xshader/src/dxbc_parse.cpp   |   15 +
 .../d3d1x/d3d1xstutil/include/d3d1xstutil.h|   34 +++
 .../state_trackers/d3d1x/d3dapi/d3dcommon.idl  |4 +
 src/gallium/state_trackers/d3d1x/gd3d10/Makefile   |5 +-
 src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp  |1 +
 7 files changed, 116 insertions(+), 13 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h 
b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h
index 44fce81..06a078a 100644
--- a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/dxbc.h
@@ -75,6 +75,15 @@ struct dxbc_container
std::mapunsigned, unsigned chunk_map;
 };
 
+struct dxbc_container_header
+{
+   unsigned fourcc;
+   uint32_t unk[4];
+   uint32_t one;
+   uint32_t total_size;
+   uint32_t chunk_count;
+};
+
 dxbc_container* dxbc_parse(const void* data, int size);
 std::ostream operator (std::ostream out, const dxbc_container container);
 
@@ -98,4 +107,6 @@ struct _D3D11_SIGNATURE_PARAMETER_DESC;
 typedef struct _D3D11_SIGNATURE_PARAMETER_DESC D3D11_SIGNATURE_PARAMETER_DESC;
 int dxbc_parse_signature(dxbc_chunk_signature* sig, 
D3D11_SIGNATURE_PARAMETER_DESC** params);
 
+std::pairvoid*, size_t dxbc_assemble(struct dxbc_chunk_header** chunks, 
unsigned num_chunks);
+
 #endif /* DXBC_H_ */
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_assemble.cpp 
b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_assemble.cpp
new file mode 100644
index 000..1021a8a
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_assemble.cpp
@@ -0,0 +1,59 @@
+/**
+ *
+ * Copyright 2010 Luca Barbieri
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * Software), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **/
+
+#include stdlib.h
+#include string.h
+#include dxbc.h
+
+std::pairvoid*, size_t dxbc_assemble(struct dxbc_chunk_header** chunks, 
unsigned num_chunks)
+{
+   size_t data_size = 0;
+   for(unsigned i = 0; i  num_chunks; ++i)
+   data_size += sizeof(uint32_t) + sizeof(dxbc_chunk_header) + 
bswap_le32(chunks[i]-size);
+
+   size_t total_size = sizeof(dxbc_container_header) + data_size;
+   dxbc_container_header* header = 
(dxbc_container_header*)malloc(total_size);
+   if(!header)
+   return std::make_pair((void*)0, 0);
+
+   header-fourcc = bswap_le32(FOURCC_DXBC);
+   memset(header-unk, 0, sizeof(header-unk));
+   header-one = bswap_le32(1);
+   header-total_size = bswap_le32(total_size);
+   header-chunk_count = num_chunks;
+
+   uint32_t* chunk_offsets = (uint32_t*)(header + 1);
+   uint32_t off = sizeof(struct dxbc_container_header) + num_chunks * 
sizeof(uint32_t);
+   for(unsigned i = 0; i  num_chunks; ++i)
+   {
+   chunk_offsets[i] = bswap_le32(off);
+   unsigned chunk_full_size = sizeof(dxbc_chunk_header) + 
bswap_le32(chunks[i]-size);
+   memcpy((char*)header + off, chunks[i], chunk_full_size);
+   off += chunk_full_size;
+   }
+
+   return std::make_pair((void*)header, total_size);
+}
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/dxbc_parse.cpp 

Mesa (master): d3d1x: add missing file

2010-09-21 Thread Luca Barbieri
Module: Mesa
Branch: master
Commit: f815b57b888d00228dcb355cbd34ed0f4c44a620
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f815b57b888d00228dcb355cbd34ed0f4c44a620

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Tue Sep 21 15:51:02 2010 +0200

d3d1x: add missing file

---

 .../state_trackers/d3d1x/gd3d11/d3d11_misc.h   |   87 
 1 files changed, 87 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h 
b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h
new file mode 100644
index 000..239a5bb
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h
@@ -0,0 +1,87 @@
+#if API  10
+HRESULT D3D10CreateBlob(
+   __in   SIZE_T NumBytes,
+   __out  LPD3D10BLOB *ppBuffer
+)
+{
+   void* data = malloc(NumBytes);
+   if(!data)
+   return E_OUTOFMEMORY;
+   *ppBuffer = new GalliumD3DBlob(data, NumBytes);
+   return S_OK;
+}
+
+LPCSTR STDMETHODCALLTYPE D3D10GetPixelShaderProfile(
+   __in  ID3D10Device *pDevice
+)
+{
+   return ps_4_0;
+}
+
+LPCSTR STDMETHODCALLTYPE D3D10GetVertexShaderProfile(
+   __in  ID3D10Device *pDevice
+)
+{
+   return vs_4_0;
+}
+
+LPCSTR STDMETHODCALLTYPE D3D10GetGeometryShaderProfile(
+   __in  ID3D10Device *pDevice
+)
+{
+   return gs_4_0;
+}
+
+static HRESULT dxbc_assemble_as_blob(struct dxbc_chunk_header** chunks, 
unsigned num_chunks, ID3D10Blob** blob)
+{
+   std::pairvoid*, size_t p = dxbc_assemble(chunks, num_chunks);
+   if(!p.first)
+   return E_OUTOFMEMORY;
+   *blob = return new GalliumD3DBlob(p.first, p.second);
+   return S_OK;
+}
+
+HRESULT  D3D10GetInputSignatureBlob(
+   __in   const void *pShaderBytecode,
+   __in   SIZE_T BytecodeLength,
+   __out  ID3D10Blob **ppSignatureBlob
+)
+{
+   dxbc_chunk_signature* sig = dxbc_find_signature(pShaderBytecode, 
BytecodeLength, false);
+   if(!sig)
+   return E_FAIL;
+
+   return dxbc_assemble_as_blob(sig, 1, ppSignatureBlob);
+}
+
+HRESULT  D3D10GetOutputSignatureBlob(
+   __in   const void *pShaderBytecode,
+   __in   SIZE_T BytecodeLength,
+   __out  ID3D10Blob **ppSignatureBlob
+)
+{
+   dxbc_chunk_signature* sig = dxbc_find_signature(pShaderBytecode, 
BytecodeLength, true);
+   if(!sig)
+   return E_FAIL;
+
+   return dxbc_assemble_as_blob(sig, 1, ppSignatureBlob);
+}
+
+HRESULT  D3D10GetInputOutputSignatureBlob(
+   __in   const void *pShaderBytecode,
+   __in   SIZE_T BytecodeLength,
+   __out  ID3D10Blob **ppSignatureBlob
+)
+{
+   dxbc_chunk_signature* sigs[2];
+   sigs[0] = dxbc_find_signature(pShaderBytecode, BytecodeLength, false);
+   if(!sigs[0])
+   return E_FAIL;
+   sigs[1] = dxbc_find_signature(pShaderBytecode, BytecodeLength, true);
+   if(!sigs[1])
+   return E_FAIL;
+
+   return dxbc_assemble_as_blob(sigs, 2, ppSignatureBlob);
+}
+
+#endif

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): d3d1x: actually enable and fix blob apis

2010-09-21 Thread Luca Barbieri
Module: Mesa
Branch: master
Commit: bb26272beaf1d2bddffaad5341235e70abcf483b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bb26272beaf1d2bddffaad5341235e70abcf483b

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Tue Sep 21 16:00:45 2010 +0200

d3d1x: actually enable and fix blob apis

---

 .../d3d1x/d3d1xstutil/include/d3d1xstutil.h|3 ++-
 .../state_trackers/d3d1x/gd3d11/d3d11_misc.h   |   10 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h 
b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
index 47bf842..f79cc72 100644
--- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
+++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
@@ -1049,6 +1049,7 @@ class GalliumD3DBlob : public GalliumComObjectID3DBlob
void* data;
size_t size;
 
+public:
GalliumD3DBlob(void* data, size_t size)
: data(data), size(size)
{}
@@ -1057,7 +1058,7 @@ class GalliumD3DBlob : public GalliumComObjectID3DBlob
{
free(data);
}
-public:
+
virtual LPVOID STDMETHODCALLTYPE GetBufferPointer()
{
return data;
diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h 
b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h
index 239a5bb..39e41f1 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h
@@ -1,4 +1,4 @@
-#if API  10
+#if API  11
 HRESULT D3D10CreateBlob(
__in   SIZE_T NumBytes,
__out  LPD3D10BLOB *ppBuffer
@@ -37,7 +37,7 @@ static HRESULT dxbc_assemble_as_blob(struct 
dxbc_chunk_header** chunks, unsigned
std::pairvoid*, size_t p = dxbc_assemble(chunks, num_chunks);
if(!p.first)
return E_OUTOFMEMORY;
-   *blob = return new GalliumD3DBlob(p.first, p.second);
+   *blob = new GalliumD3DBlob(p.first, p.second);
return S_OK;
 }
 
@@ -51,7 +51,7 @@ HRESULT  D3D10GetInputSignatureBlob(
if(!sig)
return E_FAIL;
 
-   return dxbc_assemble_as_blob(sig, 1, ppSignatureBlob);
+   return dxbc_assemble_as_blob((dxbc_chunk_header**)sig, 1, 
ppSignatureBlob);
 }
 
 HRESULT  D3D10GetOutputSignatureBlob(
@@ -64,7 +64,7 @@ HRESULT  D3D10GetOutputSignatureBlob(
if(!sig)
return E_FAIL;
 
-   return dxbc_assemble_as_blob(sig, 1, ppSignatureBlob);
+   return dxbc_assemble_as_blob((dxbc_chunk_header**)sig, 1, 
ppSignatureBlob);
 }
 
 HRESULT  D3D10GetInputOutputSignatureBlob(
@@ -81,7 +81,7 @@ HRESULT  D3D10GetInputOutputSignatureBlob(
if(!sigs[1])
return E_FAIL;
 
-   return dxbc_assemble_as_blob(sigs, 2, ppSignatureBlob);
+   return dxbc_assemble_as_blob((dxbc_chunk_header**)sigs, 2, 
ppSignatureBlob);
 }
 
 #endif

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): glx: Hold on to drawables if we' re just switching to another context

2010-09-21 Thread Kristian Høgsberg
Module: Mesa
Branch: master
Commit: 441344ba7ed2a1d162ee33ac4bac4bf645188ceb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=441344ba7ed2a1d162ee33ac4bac4bf645188ceb

Author: Kristian Høgsberg k...@bitplanet.net
Date:   Tue Sep 21 09:56:05 2010 -0400

glx: Hold on to drawables if we're just switching to another context

https://bugs.freedesktop.org/show_bug.cgi?id=30234

---

 src/glx/dri2_glx.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 8247588..911298b 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -118,6 +118,8 @@ dri2_destroy_context(struct glx_context *context)
struct dri2_context *pcp = (struct dri2_context *) context;
struct dri2_screen *psc = (struct dri2_screen *) context-psc;
 
+   driReleaseDrawables(pcp-base);
+
if (context-xid)
   glx_send_destroy_context(psc-base.dpy, context-xid);
 
@@ -158,7 +160,8 @@ dri2_unbind_context(struct glx_context *context, struct 
glx_context *new)
 
(*psc-core-unbindContext) (pcp-driContext);
 
-   driReleaseDrawables(pcp-base);
+   if (context == new)
+  driReleaseDrawables(pcp-base);
 }
 
 static struct glx_context *

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): gallium: better docs for pipe_rasterizer_state:: sprite_coord_enable

2010-09-21 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 49cb978aa46af0d86ab609013d7883c8105a6d1d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=49cb978aa46af0d86ab609013d7883c8105a6d1d

Author: Brian Paul bri...@vmware.com
Date:   Fri Sep 17 18:41:05 2010 -0600

gallium: better docs for pipe_rasterizer_state::sprite_coord_enable

---

 src/gallium/docs/source/cso/rasterizer.rst |   18 +-
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/gallium/docs/source/cso/rasterizer.rst 
b/src/gallium/docs/source/cso/rasterizer.rst
index ee3419c..d547055 100644
--- a/src/gallium/docs/source/cso/rasterizer.rst
+++ b/src/gallium/docs/source/cso/rasterizer.rst
@@ -124,17 +124,24 @@ Points
 sprite_coord_enable
 ^^^
 
-Specifies if a texture unit has its texture coordinates replaced or not. This
-is a packed bitfield containing the enable for all texcoords -- if all bits
-are zero, point sprites are effectively disabled. 
+Controls automatic texture coordinate generation for rendering sprite points.
+
+When bit k in the sprite_coord_enable bitfield is set, then generic
+input k to the fragment shader will get an automatically computed
+texture coordinate.
+
+The texture coordinate will be of the form (s, t, 0, 1) where s varies
+from 0 to 1 from left to right while t varies from 0 to 1 according to
+the state of 'sprite_coord_mode' (see below).
 
 If any bit is set, then point_smooth MUST be disabled (there are no
 round sprites) and point_quad_rasterization MUST be true (sprites are
 always rasterized as quads).  Any mismatch between these states should
 be considered a bug in the state-tracker.
 
-If enabled, the four vertices of the resulting quad will be assigned
-texture coordinates, according to sprite_coord_mode.
+This feature is implemented in the :ref:`Draw` module but may also be
+implemented natively by GPUs or implemented with a geometry shader.
+
 
 sprite_coord_mode
 ^
@@ -145,6 +152,7 @@ have coordinates (0,0,0,1). For 
PIPE_SPRITE_COORD_UPPER_LEFT, the upper-left
 vertex will have coordinates (0,0,0,1).
 This state is used by :ref:`Draw` to generate texcoords.
 
+
 point_quad_rasterization
 
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): gallium: rework handling of sprite_coord_enable state

2010-09-21 Thread Brian Paul
Module: Mesa
Branch: master
Commit: e22e3927b056806e9bbb089734132ad0bcb98df1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e22e3927b056806e9bbb089734132ad0bcb98df1

Author: Brian Paul bri...@vmware.com
Date:   Fri Sep 17 18:41:30 2010 -0600

gallium: rework handling of sprite_coord_enable state

Implement the pipe_rasterizer_state::sprite_coord_enable field
in the draw module (and softpipe) according to what's specified
in the documentation.

The draw module can now add any number of extra vertex attributes
to a post-transformed vertex and generate texcoords for those
attributes per sprite_coord_enable.  Auto-generated texcoords
for sprites only worked for one texcoord unit before.

The frag shader gl_PointCoord input is now implemented like any
other generic/texcoord attribute.

The draw module now needs to be informed about fragment shaders
since we need to look at the fragment shader's inputs to know
which ones need auto-generated texcoords.

Only softpipe has been updated so far.

---

 src/gallium/auxiliary/Makefile|1 +
 src/gallium/auxiliary/SConscript  |1 +
 src/gallium/auxiliary/draw/draw_context.c |   56 +--
 src/gallium/auxiliary/draw/draw_context.h |   12 ++
 src/gallium/auxiliary/draw/draw_pipe_aaline.c |9 +-
 src/gallium/auxiliary/draw/draw_pipe_aapoint.c|8 +-
 src/gallium/auxiliary/draw/draw_pipe_wide_point.c |  114 ++---
 src/gallium/auxiliary/draw/draw_private.h |   17 +++-
 src/gallium/drivers/softpipe/sp_state.h   |2 +
 src/gallium/drivers/softpipe/sp_state_fs.c|   15 +++-
 src/mesa/state_tracker/st_atom_rasterizer.c   |   14 +++
 src/mesa/state_tracker/st_program.c   |   17 +--
 12 files changed, 172 insertions(+), 94 deletions(-)

diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile
index 2de764c..f05538b 100644
--- a/src/gallium/auxiliary/Makefile
+++ b/src/gallium/auxiliary/Makefile
@@ -8,6 +8,7 @@ C_SOURCES = \
cso_cache/cso_context.c \
cso_cache/cso_hash.c \
draw/draw_context.c \
+   draw/draw_fs.c \
draw/draw_gs.c \
draw/draw_pipe.c \
draw/draw_pipe_aaline.c \
diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript
index 294df30..baaa26f 100644
--- a/src/gallium/auxiliary/SConscript
+++ b/src/gallium/auxiliary/SConscript
@@ -54,6 +54,7 @@ source = [
 'cso_cache/cso_context.c',
 'cso_cache/cso_hash.c',
 'draw/draw_context.c',
+'draw/draw_fs.c',
 'draw/draw_gs.c',
 'draw/draw_pipe.c',
 'draw/draw_pipe_aaline.c',
diff --git a/src/gallium/auxiliary/draw/draw_context.c 
b/src/gallium/auxiliary/draw/draw_context.c
index 937b093..b07de76 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -413,6 +413,42 @@ draw_set_force_passthrough( struct draw_context *draw, 
boolean enable )
 }
 
 
+
+/**
+ * Allocate an extra vertex/geometry shader vertex attribute.
+ * This is used by some of the optional draw module stages such
+ * as wide_point which may need to allocate additional generic/texcoord
+ * attributes.
+ */
+int
+draw_alloc_extra_vertex_attrib(struct draw_context *draw,
+   uint semantic_name, uint semantic_index)
+{
+   const int num_outputs = draw_current_shader_outputs(draw);
+   const int n = draw-extra_shader_outputs.num;
+
+   assert(n  Elements(draw-extra_shader_outputs.semantic_name));
+
+   draw-extra_shader_outputs.semantic_name[n] = semantic_name;
+   draw-extra_shader_outputs.semantic_index[n] = semantic_index;
+   draw-extra_shader_outputs.slot[n] = num_outputs + n;
+   draw-extra_shader_outputs.num++;
+
+   return draw-extra_shader_outputs.slot[n];
+}
+
+
+/**
+ * Remove all extra vertex attributes that were allocated with
+ * draw_alloc_extra_vertex_attrib().
+ */
+void
+draw_remove_extra_vertex_attribs(struct draw_context *draw)
+{
+   draw-extra_shader_outputs.num = 0;
+}
+
+
 /**
  * Ask the draw module for the location/slot of the given vertex attribute in
  * a post-transformed vertex.
@@ -446,12 +482,12 @@ draw_find_shader_output(const struct draw_context *draw,
  return i;
}
 
-   /* XXX there may be more than one extra vertex attrib.
-* For example, simulated gl_FragCoord and gl_PointCoord.
-*/
-   if (draw-extra_shader_outputs.semantic_name == semantic_name 
-   draw-extra_shader_outputs.semantic_index == semantic_index) {
-  return draw-extra_shader_outputs.slot;
+   /* Search the extra vertex attributes */
+   for (i = 0; i  draw-extra_shader_outputs.num; i++) {
+  if (draw-extra_shader_outputs.semantic_name[i] == semantic_name 
+  draw-extra_shader_outputs.semantic_index[i] == semantic_index) {
+ return draw-extra_shader_outputs.slot[i];
+  }
}
 
return 0;
@@ -470,16 +506,18 @@ draw_find_shader_output(const struct draw_context *draw,
 uint
 

Mesa (master): gallium/docs: added new pipeline.txt diagram

2010-09-21 Thread Brian Paul
Module: Mesa
Branch: master
Commit: f964f92bcc7d4fbbceb16ea972fbbdd278953d75
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f964f92bcc7d4fbbceb16ea972fbbdd278953d75

Author: Brian Paul bri...@vmware.com
Date:   Fri Sep 17 18:48:50 2010 -0600

gallium/docs: added new pipeline.txt diagram

This diagram shows the rendering pipeline with an emphasis on
the inputs/outputs for each stage.  Some stages emit new vertex
attributes and others consume some attributes.

---

 src/gallium/docs/source/pipeline.txt |  128 ++
 1 files changed, 128 insertions(+), 0 deletions(-)

diff --git a/src/gallium/docs/source/pipeline.txt 
b/src/gallium/docs/source/pipeline.txt
new file mode 100644
index 000..fd1fbe9
--- /dev/null
+++ b/src/gallium/docs/source/pipeline.txt
@@ -0,0 +1,128 @@
+XXX this could be converted/formatted for Sphinx someday.
+XXX do not use tabs in this file.
+
+
+
+position ]
+primary/secondary colors ]
+generics (normals,   ]
+   texcoords, fog)   ] User vertices / arrays
+point size   ]
+edge flag]
+primitive ID } System-generated values
+vertex ID}
+  | | |
+  V V V
+  +---+
+  |  Vertex shader|
+  +---+
+  | | |
+  V V V
+position
+clip distance
+generics
+front/back  primary/secondary colors
+point size
+edge flag
+primitive ID
+  | | |
+  V V V
+  ++
+  | Geometry shader|
+  | (consume vertex ID)|
+  | (may change prim type) |
+  ++
+  | | |
+  V V V
+[...]
+fb layer
+  | | |
+  V V V
+  +--+
+  | Clipper  |
+  | (consume clip distances) |
+  +--+
+  | | |
+  V V V
+  +---+
+  |  Polygon Culling  |
+  +---+
+  | | |
+  V V V
+  +---+
+  |Choose front or|
+  |back face color|
+  | (consume other color) |
+  +---+
+  | | |
+  V V V
+[...]
+primary/secondary colors only
+  | | |
+  V V V
+  +---+
+  |   Polygon Offset  |
+  +---+
+  | | |
+  V V V
+  +--+
+  | Unfilled polygons|
+  | (consume edge flags) |
+  | (change prim type)   |
+  +--+
+  | | |
+  V V V
+position
+generics
+primary/secondary colors
+point size
+primitive ID
+fb layer
+  | | |
+  V V V
+  +-+ 
+  | Optional Draw module helpers|
+  | * Polygon Stipple   |
+  | * Line Stipple  |
+  | * Line AA/smooth (as tris)  |
+  | * Wide lines (as tris)  |
+  | * Wide points/sprites (as tris) |
+  | * Point AA/smooth (as tris) |
+  | (NOTE: these stages may emit|
+  |  new/extra generic attributes   |
+  |  such as texcoords) |
+  +-+
+  | | |
+  V V V
+position ]
+generics (+ new/extra ones)  ]
+primary/secondary colors ] Software rast vertices
+point size   ]
+primitive ID ]
+fb layer ]
+  | | |
+  V V V
+  +-+
+  | Triangle/Line/Point |
+  |Rasterization|
+  +-+
+  | | |
+  V V V
+generic attribs
+primary/secondary colors
+primitive ID
+fragment win coord pos   } System-generated values
+front/back face flag }
+  | | |
+  V V V
+  +---+
+  |  Fragment shader  |
+  +---+
+  | | |
+  V V V
+zero or more colors
+zero or one Z value
+
+
+NOTE: The instance ID is not shown.  It can be imagined to be a global variable
+accessible to all shader stages.

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): llvmpipe: maintain fragment shader state for draw module

2010-09-21 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 955d76c3d2004c058c326d68eddc5a06d1611a41
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=955d76c3d2004c058c326d68eddc5a06d1611a41

Author: Brian Paul bri...@vmware.com
Date:   Mon Sep 20 12:52:16 2010 -0600

llvmpipe: maintain fragment shader state for draw module

---

 src/gallium/drivers/llvmpipe/lp_state_fs.c |   12 
 src/gallium/drivers/llvmpipe/lp_state_fs.h |2 ++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c 
b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index e54dd9f..fb673db 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -886,6 +886,7 @@ static void *
 llvmpipe_create_fs_state(struct pipe_context *pipe,
  const struct pipe_shader_state *templ)
 {
+   struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
struct lp_fragment_shader *shader;
int nr_samplers;
 
@@ -902,6 +903,12 @@ llvmpipe_create_fs_state(struct pipe_context *pipe,
/* we need to keep a local copy of the tokens */
shader-base.tokens = tgsi_dup_tokens(templ-tokens);
 
+   shader-draw_data = draw_create_fragment_shader(llvmpipe-draw, templ);
+   if (shader-draw_data == NULL) {
+  FREE((void *) shader-base.tokens);
+  return NULL;
+   }
+
nr_samplers = shader-info.file_max[TGSI_FILE_SAMPLER] + 1;
 
shader-variant_key_size = Offset(struct lp_fragment_shader_variant_key,
@@ -938,6 +945,9 @@ llvmpipe_bind_fs_state(struct pipe_context *pipe, void *fs)
 
draw_flush(llvmpipe-draw);
 
+   draw_bind_fragment_shader(llvmpipe-draw,
+ (llvmpipe-fs ? llvmpipe-fs-draw_data : NULL));
+
llvmpipe-fs = fs;
 
llvmpipe-dirty |= LP_NEW_FS;
@@ -995,6 +1005,8 @@ llvmpipe_delete_fs_state(struct pipe_context *pipe, void 
*fs)
   li = next;
}
 
+   draw_delete_fragment_shader(llvmpipe-draw, shader-draw_data);
+
assert(shader-variants_cached == 0);
FREE((void *) shader-base.tokens);
FREE(shader);
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.h 
b/src/gallium/drivers/llvmpipe/lp_state_fs.h
index 2914e7d..4999b8d 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.h
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.h
@@ -100,6 +100,8 @@ struct lp_fragment_shader
 
struct lp_fs_variant_list_item variants;
 
+   struct draw_fragment_shader *draw_data;
+
/* For debugging/profiling purposes */
unsigned variant_key_size;
unsigned no;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): llvmpipe: indentation fix

2010-09-21 Thread Brian Paul
Module: Mesa
Branch: master
Commit: ebba92875aca586b661f6547888a2ed95e70e0ff
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ebba92875aca586b661f6547888a2ed95e70e0ff

Author: Brian Paul bri...@vmware.com
Date:   Mon Sep 20 12:55:29 2010 -0600

llvmpipe: indentation fix

---

 src/gallium/drivers/llvmpipe/lp_state_rasterizer.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c 
b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c
index 0bad732..b81c2cf 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c
@@ -79,7 +79,7 @@ llvmpipe_bind_rasterizer_state(struct pipe_context *pipe, 
void *handle)
llvmpipe-rasterizer-point_size,
llvmpipe-rasterizer-point_size_per_vertex,
llvmpipe-rasterizer-sprite_coord_enable);
-   }
+   }
 
llvmpipe-dirty |= LP_NEW_RASTERIZER;
 }

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): llvmpipe: implement sprite coord origin modes

2010-09-21 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 61fcd9aaa2bf91eb400eeb4df2ab2c7e48b3bb6c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=61fcd9aaa2bf91eb400eeb4df2ab2c7e48b3bb6c

Author: Brian Paul bri...@vmware.com
Date:   Mon Sep 20 13:48:02 2010 -0600

llvmpipe: implement sprite coord origin modes

---

 src/gallium/drivers/llvmpipe/lp_setup_point.c |   18 --
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c 
b/src/gallium/drivers/llvmpipe/lp_setup_point.c
index f8f411f..bb6b880 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_point.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c
@@ -71,7 +71,8 @@ perspective_coef(struct lp_setup_context *setup,
  const struct point_info *info,
  unsigned slot,
  unsigned vert_attr,
- unsigned i)
+ unsigned i,
+ unsigned sprite_coord_origin)
 {
if (i == 0) {
   float dadx = FIXED_ONE / (float)info-dx12;
@@ -83,14 +84,18 @@ perspective_coef(struct lp_setup_context *setup,
dady * ((float)info-v0[0][1] - 
setup-pixel_offset)));
}
else if (i == 1) {
-  float dadx =  0.0f;
-  float dady =  FIXED_ONE / (float)info-dx12;
+  float dadx = 0.0f;
+  float dady = FIXED_ONE / (float)info-dx12;
+
+  if (sprite_coord_origin == PIPE_SPRITE_COORD_LOWER_LEFT) {
+ dady = -dady;
+  }
 
   point-inputs.dadx[slot][i] = dadx;
   point-inputs.dady[slot][i] = dady;
   point-inputs.a0[slot][i] = (0.5 -
-  (dadx * ((float)info-v0[0][0] - 
setup-pixel_offset) +
-   dady * ((float)info-v0[0][1] - 
setup-pixel_offset)));
+   (dadx * ((float)info-v0[0][0] - 
setup-pixel_offset) +
+dady * ((float)info-v0[0][1] - 
setup-pixel_offset)));
}
else if (i == 2) {
   point-inputs.a0[slot][i] = 0.0f;
@@ -187,7 +192,8 @@ setup_point_coefficients( struct lp_setup_context *setup,
 if (setup-sprite_coord_enable  (1  index)) {
for (i = 0; i  NUM_CHANNELS; i++)
   if (usage_mask  (1  i))
- perspective_coef(setup, point, info, slot+1, vert_attr, 
i);
+ perspective_coef(setup, point, info, slot+1, vert_attr, i,
+  setup-sprite_coord_origin);
fragcoord_usage_mask |= TGSI_WRITEMASK_W;
break; 
 }

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): llvmpipe: clean-up, comments in setup_point_coefficient()

2010-09-21 Thread Brian Paul
Module: Mesa
Branch: master
Commit: b7a5eac1f3723a369885bad369a04c456bdf1565
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b7a5eac1f3723a369885bad369a04c456bdf1565

Author: Brian Paul bri...@vmware.com
Date:   Mon Sep 20 13:26:27 2010 -0600

llvmpipe: clean-up, comments in setup_point_coefficient()

---

 src/gallium/drivers/llvmpipe/lp_setup_point.c |   15 ++-
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c 
b/src/gallium/drivers/llvmpipe/lp_setup_point.c
index 5521cbb..fb4fb2c 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_point.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c
@@ -152,6 +152,7 @@ setup_point_coefficients( struct lp_setup_context *setup,
   struct lp_rast_triangle *point,
   const struct point_info *info)
 {
+   const struct lp_fragment_shader *shader = setup-fs.current.variant-shader;
unsigned fragcoord_usage_mask = TGSI_WRITEMASK_XYZ;
unsigned slot;
 
@@ -172,12 +173,16 @@ setup_point_coefficients( struct lp_setup_context *setup,
  fragcoord_usage_mask |= usage_mask;
  break;
 
+  case LP_INTERP_LINEAR:
+ /* Sprite tex coords may use linear interpolation someday */
+ /* fall-through */
+
   case LP_INTERP_PERSPECTIVE:
- /* For point sprite textures */
- if (setup-fs.current.variant-shader-info.input_semantic_name[slot] 
- == TGSI_SEMANTIC_GENERIC) 
- {
-int index = 
setup-fs.current.variant-shader-info.input_semantic_index[slot];
+ /* check if the sprite coord flag is set for this attribute.
+  * If so, set it up so it up so x any y vary from 0 to 1.
+  */
+ if (shader-info.input_semantic_name[slot] == TGSI_SEMANTIC_GENERIC) {
+const int index = shader-info.input_semantic_index[slot];
 
 if (setup-sprite  (1  index)) {
for (i = 0; i  NUM_CHANNELS; i++)

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): llvmpipe: reformatting, remove trailing whitespace, etc

2010-09-21 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 924c18da95bbc62492f8e54bd8273a4981a919dc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=924c18da95bbc62492f8e54bd8273a4981a919dc

Author: Brian Paul bri...@vmware.com
Date:   Mon Sep 20 13:07:59 2010 -0600

llvmpipe: reformatting, remove trailing whitespace, etc

---

 src/gallium/drivers/llvmpipe/lp_setup_point.c |   44 +
 1 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c 
b/src/gallium/drivers/llvmpipe/lp_setup_point.c
index 5538987..5521cbb 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_point.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c
@@ -52,26 +52,29 @@ struct point_info {
 /**
  * Compute a0 for a constant-valued coefficient (GL_FLAT shading).
  */
-static void constant_coef( struct lp_setup_context *setup,
-   struct lp_rast_triangle *point,
-   unsigned slot,
-   const float value,
-   unsigned i )
+static void
+constant_coef(struct lp_setup_context *setup,
+  struct lp_rast_triangle *point,
+  unsigned slot,
+  const float value,
+  unsigned i)
 {
point-inputs.a0[slot][i] = value;
point-inputs.dadx[slot][i] = 0.0f;
point-inputs.dady[slot][i] = 0.0f;
 }
 
-static void perspective_coef( struct lp_setup_context *setup,
-  struct lp_rast_triangle *point,
-  const struct point_info *info,
-  unsigned slot,
-  unsigned vert_attr,
-  unsigned i)
+
+static void
+perspective_coef(struct lp_setup_context *setup,
+ struct lp_rast_triangle *point,
+ const struct point_info *info,
+ unsigned slot,
+ unsigned vert_attr,
+ unsigned i)
 {
-   if (i == 0) {   
-  float dadx = FIXED_ONE / (float)info-dx12;  
+   if (i == 0) {
+  float dadx = FIXED_ONE / (float)info-dx12;
   float dady =  0.0f;
   point-inputs.dadx[slot][i] = dadx;
   point-inputs.dady[slot][i] = dady;
@@ -79,30 +82,26 @@ static void perspective_coef( struct lp_setup_context 
*setup,
   (dadx * ((float)info-v0[0][0] - 
setup-pixel_offset) +
dady * ((float)info-v0[0][1] - 
setup-pixel_offset)));
}
-
else if (i == 1) {
-  float dadx =  0.0f; 
+  float dadx =  0.0f;
   float dady =  FIXED_ONE / (float)info-dx12;
-   
+
   point-inputs.dadx[slot][i] = dadx;
   point-inputs.dady[slot][i] = dady;
   point-inputs.a0[slot][i] = (0.5 -
   (dadx * ((float)info-v0[0][0] - 
setup-pixel_offset) +
dady * ((float)info-v0[0][1] - 
setup-pixel_offset)));
}
-
else if (i == 2) {
   point-inputs.a0[slot][i] = 0.0f;
   point-inputs.dadx[slot][i] = 0.0f;
   point-inputs.dady[slot][i] = 0.0f;
}
-  
else if (i == 3) {
   point-inputs.a0[slot][i] = 1.0f;
   point-inputs.dadx[slot][i] = 0.0f;
   point-inputs.dady[slot][i] = 0.0f;
}
-
 }
 
 
@@ -144,6 +143,7 @@ setup_point_fragcoord_coef(struct lp_setup_context *setup,
}
 }
 
+
 /**
  * Compute the point-coef[] array dadx, dady, a0 values.
  */
@@ -203,6 +203,7 @@ setup_point_coefficients( struct lp_setup_context *setup,
   fragcoord_usage_mask);
 }
 
+
 static INLINE int
 subpixel_snap(float a)
 {
@@ -322,8 +323,9 @@ try_setup_point( struct lp_setup_context *setup,
 }
 
 
-static void lp_setup_point( struct lp_setup_context *setup,
-   const float (*v0)[4] )
+static void 
+lp_setup_point(struct lp_setup_context *setup,
+   const float (*v0)[4])
 {
if (!try_setup_point( setup, v0 ))
{

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): llvmpipe: rename sprite field, add sprite_coord_origin

2010-09-21 Thread Brian Paul
Module: Mesa
Branch: master
Commit: c3982c6bcdeb88f7fb1b20f8bd300db31cd7288d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c3982c6bcdeb88f7fb1b20f8bd300db31cd7288d

Author: Brian Paul bri...@vmware.com
Date:   Mon Sep 20 13:29:55 2010 -0600

llvmpipe: rename sprite field, add sprite_coord_origin

---

 src/gallium/drivers/llvmpipe/lp_setup.c|6 --
 src/gallium/drivers/llvmpipe/lp_setup.h|3 ++-
 src/gallium/drivers/llvmpipe/lp_setup_context.h|2 +-
 src/gallium/drivers/llvmpipe/lp_setup_point.c  |2 +-
 src/gallium/drivers/llvmpipe/lp_state_rasterizer.c |3 ++-
 5 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c 
b/src/gallium/drivers/llvmpipe/lp_setup.c
index 6674d28..ea7002a 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -490,12 +490,14 @@ void
 lp_setup_set_point_state( struct lp_setup_context *setup,
   float point_size,  
   boolean point_size_per_vertex,
-  uint sprite)
+  uint sprite_coord_enable,
+  uint sprite_coord_origin)
 {
LP_DBG(DEBUG_SETUP, %s\n, __FUNCTION__);
 
setup-point_size = point_size;
-   setup-sprite = sprite;
+   setup-sprite_coord_enable = sprite_coord_enable;
+   setup-sprite_coord_origin = sprite_coord_origin;
setup-point_size_per_vertex = point_size_per_vertex;
 }
 
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h 
b/src/gallium/drivers/llvmpipe/lp_setup.h
index b94061b..81ff43f 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup.h
@@ -107,7 +107,8 @@ void
 lp_setup_set_point_state( struct lp_setup_context *setup,
   float point_size,  
   boolean point_size_per_vertex,
-  uint sprite);
+  uint sprite_coord_enable,
+  uint sprite_coord_origin);
 
 void
 lp_setup_set_fs_inputs( struct lp_setup_context *setup,
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h 
b/src/gallium/drivers/llvmpipe/lp_setup_context.h
index 80b3564..8506ed2 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_context.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h
@@ -73,7 +73,7 @@ struct lp_setup_context
uint prim;
uint vertex_size;
uint nr_vertices;
-   uint sprite;
+   uint sprite_coord_enable, sprite_coord_origin;
uint vertex_buffer_size;
void *vertex_buffer;
 
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c 
b/src/gallium/drivers/llvmpipe/lp_setup_point.c
index fb4fb2c..f8f411f 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_point.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c
@@ -184,7 +184,7 @@ setup_point_coefficients( struct lp_setup_context *setup,
  if (shader-info.input_semantic_name[slot] == TGSI_SEMANTIC_GENERIC) {
 const int index = shader-info.input_semantic_index[slot];
 
-if (setup-sprite  (1  index)) {
+if (setup-sprite_coord_enable  (1  index)) {
for (i = 0; i  NUM_CHANNELS; i++)
   if (usage_mask  (1  i))
  perspective_coef(setup, point, info, slot+1, vert_attr, 
i);
diff --git a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c 
b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c
index b81c2cf..dbd7381 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c
@@ -78,7 +78,8 @@ llvmpipe_bind_rasterizer_state(struct pipe_context *pipe, 
void *handle)
   lp_setup_set_point_state( llvmpipe-setup,
llvmpipe-rasterizer-point_size,
llvmpipe-rasterizer-point_size_per_vertex,
-   llvmpipe-rasterizer-sprite_coord_enable);
+   llvmpipe-rasterizer-sprite_coord_enable,
+   llvmpipe-rasterizer-sprite_coord_mode);
}
 
llvmpipe-dirty |= LP_NEW_RASTERIZER;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): draw: fix test for using the wide-point stage

2010-09-21 Thread Brian Paul
Module: Mesa
Branch: master
Commit: a7ea4d11fb5a2a39daaad8752706291ac93013f7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a7ea4d11fb5a2a39daaad8752706291ac93013f7

Author: Brian Paul bri...@vmware.com
Date:   Mon Sep 20 13:48:29 2010 -0600

draw: fix test for using the wide-point stage

As it was, we weren't obeying the draw-pipeline.point_sprite state.
Fixes point sprites in llvmpipe driver.

---

 src/gallium/auxiliary/draw/draw_pipe_validate.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pipe_validate.c 
b/src/gallium/auxiliary/draw/draw_pipe_validate.c
index 8b92543..c575a8a 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_validate.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_validate.c
@@ -172,7 +172,7 @@ static struct draw_stage *validate_pipeline( struct 
draw_stage *stage )
wide_lines = (rast-line_width  draw-pipeline.wide_line_threshold
   !rast-line_smooth);
 
-   /* drawing large points? */
+   /* drawing large/sprite points (but not AA points)? */
if (rast-sprite_coord_enable  draw-pipeline.point_sprite)
   wide_points = TRUE;
else if (rast-point_smooth  draw-pipeline.aapoint)
@@ -207,7 +207,7 @@ static struct draw_stage *validate_pipeline( struct 
draw_stage *stage )
   precalc_flat = TRUE;
}
 
-   if (wide_points || rast-sprite_coord_enable) {
+   if (wide_points) {
   draw-pipeline.wide_point-next = next;
   next = draw-pipeline.wide_point;
}

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): draw: check bitshift against PIPE_MAX_SHADER_OUTPUS

2010-09-21 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 77af10955462819d973a395270777c5b8217f6ae
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=77af10955462819d973a395270777c5b8217f6ae

Author: Brian Paul bri...@vmware.com
Date:   Mon Sep 20 15:34:02 2010 -0600

draw: check bitshift against PIPE_MAX_SHADER_OUTPUS

---

 src/gallium/auxiliary/draw/draw_pipe_wide_point.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c 
b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
index 40843c5..3646c6a 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
@@ -237,7 +237,11 @@ widepoint_first_point(struct draw_stage *stage,
   for (i = 0; i  fs-info.num_inputs; i++) {
  if (fs-info.input_semantic_name[i] == TGSI_SEMANTIC_GENERIC) {
 const int generic_index = fs-info.input_semantic_index[i];
-if (rast-sprite_coord_enable  (1  generic_index)) {
+/* Note that sprite_coord enable is a bitfield of
+ * PIPE_MAX_SHADER_OUTPUTS bits.
+ */
+if (generic_index  PIPE_MAX_SHADER_OUTPUTS 
+(rast-sprite_coord_enable  (1  generic_index))) {
/* OK, this generic attribute needs to be replaced with a
 * texcoord (see above).
 */

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): llvmpipe: check bitshift against PIPE_MAX_SHADER_OUTPUTS

2010-09-21 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 1662c317032cf280701d7e55b028b7f0dc8afc65
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1662c317032cf280701d7e55b028b7f0dc8afc65

Author: Brian Paul bri...@vmware.com
Date:   Mon Sep 20 15:33:49 2010 -0600

llvmpipe: check bitshift against PIPE_MAX_SHADER_OUTPUTS

---

 src/gallium/drivers/llvmpipe/lp_setup_point.c |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c 
b/src/gallium/drivers/llvmpipe/lp_setup_point.c
index bb6b880..774a3c8 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_point.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c
@@ -188,8 +188,11 @@ setup_point_coefficients( struct lp_setup_context *setup,
   */
  if (shader-info.input_semantic_name[slot] == TGSI_SEMANTIC_GENERIC) {
 const int index = shader-info.input_semantic_index[slot];
-
-if (setup-sprite_coord_enable  (1  index)) {
+/* Note that sprite_coord enable is a bitfield of
+ * PIPE_MAX_SHADER_OUTPUTS bits.
+ */
+if (index  PIPE_MAX_SHADER_OUTPUTS 
+(setup-sprite_coord_enable  (1  index))) {
for (i = 0; i  NUM_CHANNELS; i++)
   if (usage_mask  (1  i))
  perspective_coef(setup, point, info, slot+1, vert_attr, i,

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): Merge branch 'sprite-coord'

2010-09-21 Thread Brian Paul
Module: Mesa
Branch: master
Commit: d49f153ab36fec16f687f35f3a9aaf19fb7254be
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d49f153ab36fec16f687f35f3a9aaf19fb7254be

Author: Brian Paul bri...@vmware.com
Date:   Tue Sep 21 09:57:25 2010 -0600

Merge branch 'sprite-coord'

---



___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (sprite-coord): llvmpipe: check bitshift against PIPE_MAX_SHADER_OUTPUTS

2010-09-21 Thread Brian Paul
Module: Mesa
Branch: sprite-coord
Commit: 1662c317032cf280701d7e55b028b7f0dc8afc65
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1662c317032cf280701d7e55b028b7f0dc8afc65

Author: Brian Paul bri...@vmware.com
Date:   Mon Sep 20 15:33:49 2010 -0600

llvmpipe: check bitshift against PIPE_MAX_SHADER_OUTPUTS

---

 src/gallium/drivers/llvmpipe/lp_setup_point.c |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c 
b/src/gallium/drivers/llvmpipe/lp_setup_point.c
index bb6b880..774a3c8 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_point.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c
@@ -188,8 +188,11 @@ setup_point_coefficients( struct lp_setup_context *setup,
   */
  if (shader-info.input_semantic_name[slot] == TGSI_SEMANTIC_GENERIC) {
 const int index = shader-info.input_semantic_index[slot];
-
-if (setup-sprite_coord_enable  (1  index)) {
+/* Note that sprite_coord enable is a bitfield of
+ * PIPE_MAX_SHADER_OUTPUTS bits.
+ */
+if (index  PIPE_MAX_SHADER_OUTPUTS 
+(setup-sprite_coord_enable  (1  index))) {
for (i = 0; i  NUM_CHANNELS; i++)
   if (usage_mask  (1  i))
  perspective_coef(setup, point, info, slot+1, vert_attr, i,

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (sprite-coord): draw: check bitshift against PIPE_MAX_SHADER_OUTPUS

2010-09-21 Thread Brian Paul
Module: Mesa
Branch: sprite-coord
Commit: 77af10955462819d973a395270777c5b8217f6ae
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=77af10955462819d973a395270777c5b8217f6ae

Author: Brian Paul bri...@vmware.com
Date:   Mon Sep 20 15:34:02 2010 -0600

draw: check bitshift against PIPE_MAX_SHADER_OUTPUS

---

 src/gallium/auxiliary/draw/draw_pipe_wide_point.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c 
b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
index 40843c5..3646c6a 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c
@@ -237,7 +237,11 @@ widepoint_first_point(struct draw_stage *stage,
   for (i = 0; i  fs-info.num_inputs; i++) {
  if (fs-info.input_semantic_name[i] == TGSI_SEMANTIC_GENERIC) {
 const int generic_index = fs-info.input_semantic_index[i];
-if (rast-sprite_coord_enable  (1  generic_index)) {
+/* Note that sprite_coord enable is a bitfield of
+ * PIPE_MAX_SHADER_OUTPUTS bits.
+ */
+if (generic_index  PIPE_MAX_SHADER_OUTPUTS 
+(rast-sprite_coord_enable  (1  generic_index))) {
/* OK, this generic attribute needs to be replaced with a
 * texcoord (see above).
 */

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): draw: new draw_fs.[ch] files

2010-09-21 Thread Brian Paul
Module: Mesa
Branch: master
Commit: b3a647276e5fae570628826961c9b86612c2a2c6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b3a647276e5fae570628826961c9b86612c2a2c6

Author: Brian Paul bri...@vmware.com
Date:   Tue Sep 21 10:07:52 2010 -0600

draw: new draw_fs.[ch] files

---

 src/gallium/auxiliary/draw/draw_fs.c |   73 ++
 src/gallium/auxiliary/draw/draw_fs.h |   42 +++
 2 files changed, 115 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_fs.c 
b/src/gallium/auxiliary/draw/draw_fs.c
new file mode 100644
index 000..1543bd8
--- /dev/null
+++ b/src/gallium/auxiliary/draw/draw_fs.c
@@ -0,0 +1,73 @@
+/**
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * Software), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **/
+
+#include pipe/p_shader_tokens.h
+
+#include util/u_math.h
+#include util/u_memory.h
+#include util/u_prim.h
+
+#include tgsi/tgsi_parse.h
+
+#include draw_fs.h
+#include draw_private.h
+#include draw_context.h
+
+
+struct draw_fragment_shader *
+draw_create_fragment_shader(struct draw_context *draw,
+const struct pipe_shader_state *shader)
+{
+   struct draw_fragment_shader *dfs;
+
+   dfs = CALLOC_STRUCT(draw_fragment_shader);
+   if (dfs) {
+  dfs-base = *shader;
+  tgsi_scan_shader(shader-tokens, dfs-info);
+   }
+
+   return dfs;
+}
+
+
+void
+draw_bind_fragment_shader(struct draw_context *draw,
+  struct draw_fragment_shader *dfs)
+{
+   draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE);
+
+   draw-fs.fragment_shader = dfs;
+}
+
+
+void
+draw_delete_fragment_shader(struct draw_context *draw,
+struct draw_fragment_shader *dfs)
+{
+   FREE(dfs);
+}
+
diff --git a/src/gallium/auxiliary/draw/draw_fs.h 
b/src/gallium/auxiliary/draw/draw_fs.h
new file mode 100644
index 000..44995b8
--- /dev/null
+++ b/src/gallium/auxiliary/draw/draw_fs.h
@@ -0,0 +1,42 @@
+/**
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * Software), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **/
+
+#ifndef DRAW_FS_H
+#define DRAW_FS_H
+
+
+#include tgsi/tgsi_scan.h
+
+
+struct draw_fragment_shader
+{
+   struct pipe_shader_state base;
+   struct tgsi_shader_info info;
+};
+
+
+#endif /* DRAW_FS_H */

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): llvmpipe: Describe how to profile llvmpipe.

2010-09-21 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 388c94195af41c2084f4882ab414c86b575818fb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=388c94195af41c2084f4882ab414c86b575818fb

Author: José Fonseca jfons...@vmware.com
Date:   Tue Sep 21 17:50:30 2010 +0100

llvmpipe: Describe how to profile llvmpipe.

---

 src/gallium/drivers/llvmpipe/README |   38 +++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/README 
b/src/gallium/drivers/llvmpipe/README
index 8b5539d..ec30d4d 100644
--- a/src/gallium/drivers/llvmpipe/README
+++ b/src/gallium/drivers/llvmpipe/README
@@ -131,6 +131,44 @@ replacing the native ICD driver, but it's quite an 
advanced usage, so if you
 need to ask, don't even try it.
 
 
+Profiling
+=
+
+To profile llvmpipe you should pass the options
+
+  scons debug=no profile=yes same-as-before
+
+This will ensure that frame pointers are used both in C and JIT functions, and
+that no tail call optimizations are done by gcc.
+
+
+To better profile JIT code you'll need to build LLVM with oprofile integration.
+
+  source_dir=$PWD/llvm-2.6
+  build_dir=$source_dir/build/profile
+  install_dir=$source_dir-profile
+
+  mkdir -p $build_dir
+  cd $build_dir  \
+  $source_dir/configure \
+  --prefix=$install_dir \
+  --enable-optimized \
+  --disable-profiling \
+  --enable-targets=host-only \
+  --with-oprofile
+
+  make -C $build_dir
+  make -C $build_dir install
+
+  find $install_dir/lib -iname '*.a' -print0 | xargs -0 strip --strip-debug
+
+The you should define
+
+  export LLVM=/path/to/llvm-2.6-profile
+
+and rebuild.
+
+
 Unit testing
 
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): llvmpipe: When failing free fs shader too.

2010-09-21 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: b556bb7c44236a9fae54f58cc03e1d05eaa2124f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b556bb7c44236a9fae54f58cc03e1d05eaa2124f

Author: José Fonseca jfons...@vmware.com
Date:   Tue Sep 21 17:51:06 2010 +0100

llvmpipe: When failing free fs shader too.

---

 src/gallium/drivers/llvmpipe/lp_state_fs.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c 
b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index fb673db..4277c47 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -906,6 +906,7 @@ llvmpipe_create_fs_state(struct pipe_context *pipe,
shader-draw_data = draw_create_fragment_shader(llvmpipe-draw, templ);
if (shader-draw_data == NULL) {
   FREE((void *) shader-base.tokens);
+  FREE(shader);
   return NULL;
}
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): glsl: Add definition of gl_TextureMatrix inverse/ transpose builtins.

2010-09-21 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: b5bb21562942dab7571ef748c3ca562a66f25b33
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b5bb21562942dab7571ef748c3ca562a66f25b33

Author: Eric Anholt e...@anholt.net
Date:   Tue Sep 21 10:08:38 2010 -0700

glsl: Add definition of gl_TextureMatrix inverse/transpose builtins.

Fixes glsl2/builtin-texturematrix.
Bug #30196.

---

 src/glsl/ir_variable.cpp |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp
index 3fed4d9..1eff740 100644
--- a/src/glsl/ir_variable.cpp
+++ b/src/glsl/ir_variable.cpp
@@ -162,6 +162,9 @@ generate_110_uniforms(exec_list *instructions,
state-Const.MaxTextureCoords);
 
add_uniform(instructions, state, gl_TextureMatrix, mat4_array_type);
+   add_uniform(instructions, state, gl_TextureMatrixInverse, 
mat4_array_type);
+   add_uniform(instructions, state, gl_TextureMatrixTranspose, 
mat4_array_type);
+   add_uniform(instructions, state, gl_TextureMatrixInverseTranspose, 
mat4_array_type);
 
add_uniform(instructions, state, gl_DepthRange,
state-symbols-get_type(gl_DepthRangeParameters));

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): r600g: directly allocate bo for user buffer

2010-09-21 Thread Jerome Glisse
Module: Mesa
Branch: master
Commit: 6048be89697fe27e30ef0f45594daba4e896362c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6048be89697fe27e30ef0f45594daba4e896362c

Author: Jerome Glisse jgli...@redhat.com
Date:   Tue Sep 21 14:36:44 2010 -0400

r600g: directly allocate bo for user buffer

Signed-off-by: Jerome Glisse jgli...@redhat.com

---

 src/gallium/drivers/r600/r600.h   |4 ++-
 src/gallium/drivers/r600/r600_state2.c|   38 +-
 src/gallium/winsys/r600/drm/r600_state2.c |   49 +++-
 src/gallium/winsys/r600/drm/radeon_priv.h |2 +-
 4 files changed, 66 insertions(+), 27 deletions(-)

diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h
index a123eb6..8879efc 100644
--- a/src/gallium/drivers/r600/r600.h
+++ b/src/gallium/drivers/r600/r600.h
@@ -192,6 +192,8 @@ struct r600_reloc {
 };
 #pragma pack()
 
+struct radeon_bo;
+
 struct r600_context {
struct radeon   *radeon;
unsignedngroups;
@@ -203,7 +205,7 @@ struct r600_context {
unsignednreloc;
unsignedcreloc;
struct r600_reloc   *reloc;
-   struct radeon_ws_bo **bo;
+   struct radeon_bo**bo;
u32 *pm4;
 };
 
diff --git a/src/gallium/drivers/r600/r600_state2.c 
b/src/gallium/drivers/r600/r600_state2.c
index 5269e6d..36a3376 100644
--- a/src/gallium/drivers/r600/r600_state2.c
+++ b/src/gallium/drivers/r600/r600_state2.c
@@ -677,7 +677,7 @@ static void r600_flush2(struct pipe_context *ctx, unsigned 
flags,
struct pipe_fence_handle **fence)
 {
struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
-#if 0
+#if 1
static int dc = 0;
char dname[256];
 #endif
@@ -2174,11 +2174,44 @@ static int r600_get_shader_param(struct pipe_screen* 
pscreen, unsigned shader, e
}
 }
 
+struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,
+const struct pipe_resource *templ);
+struct pipe_resource *r600_user_buffer_create2(struct pipe_screen *screen,
+   void *ptr, unsigned bytes,
+   unsigned bind)
+{
+   struct pipe_resource *resource;
+   struct r600_resource *rresource;
+   struct pipe_resource desc;
+   struct radeon *radeon = (struct radeon *)screen-winsys;
+   void *rptr;
+
+   desc.screen = screen;
+   desc.target = PIPE_BUFFER;
+   desc.format = PIPE_FORMAT_R8_UNORM;
+   desc.usage = PIPE_USAGE_IMMUTABLE;
+   desc.bind = bind;
+   desc.width0 = bytes;
+   desc.height0 = 1;
+   desc.depth0 = 1;
+   desc.flags = 0;
+   resource = r600_buffer_create(screen, desc);
+   if (resource == NULL) {
+   return NULL;
+   }
+
+   rresource = (struct r600_resource *)resource;
+   rptr = radeon_ws_bo_map(radeon, rresource-bo, 0, NULL);
+   memcpy(rptr, ptr, bytes);
+   radeon_ws_bo_unmap(radeon, rresource-bo);
+
+   return resource;
+}
+
 void r600_init_screen_texture_functions(struct pipe_screen *screen);
 struct pipe_screen *r600_screen_create2(struct radeon *radeon)
 {
struct r600_screen *rscreen;
-   enum radeon_family family = r600_get_family(radeon);
 
rscreen = CALLOC_STRUCT(r600_screen);
if (rscreen == NULL) {
@@ -2197,6 +2230,7 @@ struct pipe_screen *r600_screen_create2(struct radeon 
*radeon)
rscreen-screen.context_create = r600_create_context2;
r600_init_screen_texture_functions(rscreen-screen);
r600_init_screen_resource_functions(rscreen-screen);
+   rscreen-screen.user_buffer_create = r600_user_buffer_create2;
 
return rscreen-screen;
 }
diff --git a/src/gallium/winsys/r600/drm/r600_state2.c 
b/src/gallium/winsys/r600/drm/r600_state2.c
index b3d6187..e32071b 100644
--- a/src/gallium/winsys/r600/drm/r600_state2.c
+++ b/src/gallium/winsys/r600/drm/r600_state2.c
@@ -39,8 +39,8 @@
 #include pipebuffer/pb_bufmgr.h
 
 struct radeon_ws_bo {
-   struct pipe_reference reference;
-   struct pb_buffer *pb;
+   struct pipe_reference   reference;
+   struct pb_buffer*pb;
 };
 
 struct radeon_bo {
@@ -54,6 +54,9 @@ struct radeon_bo {
 struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf);
 int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo);
 void radeon_bo_unmap(struct radeon *radeon, struct radeon_bo *bo);
+void radeon_bo_reference(struct radeon *radeon,
+struct radeon_bo **dst,
+struct radeon_bo *src);
 
 unsigned radeon_ws_bo_get_handle(struct radeon_ws_bo *pb_bo);
 
@@ -694,14 +697,13 @@ out_err:
return r;
 }
 
-static void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct 
radeon_ws_bo *bo)
+static void r600_context_bo_reloc(struct 

Mesa (master): i965: Share the KIL_NV implementation between glsl and non-glsl.

2010-09-21 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 23c507f1358833585de330ed313dffafabbbd3cd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=23c507f1358833585de330ed313dffafabbbd3cd

Author: Eric Anholt e...@anholt.net
Date:   Tue Sep 21 10:35:50 2010 -0700

i965: Share the KIL_NV implementation between glsl and non-glsl.

---

 src/mesa/drivers/dri/i965/brw_wm.h  |1 +
 src/mesa/drivers/dri/i965/brw_wm_emit.c |2 +-
 src/mesa/drivers/dri/i965/brw_wm_glsl.c |   17 +
 3 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm.h 
b/src/mesa/drivers/dri/i965/brw_wm.h
index 2639d4f..c28acad 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.h
+++ b/src/mesa/drivers/dri/i965/brw_wm.h
@@ -373,6 +373,7 @@ void emit_fb_write(struct brw_wm_compile *c,
 void emit_frontfacing(struct brw_compile *p,
  const struct brw_reg *dst,
  GLuint mask);
+void emit_kil_nv(struct brw_wm_compile *c);
 void emit_linterp(struct brw_compile *p,
  const struct brw_reg *dst,
  GLuint mask,
diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c 
b/src/mesa/drivers/dri/i965/brw_wm_emit.c
index f3ad01b..a4754ca 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c
@@ -1223,7 +1223,7 @@ static void emit_kil( struct brw_wm_compile *c,
 /* KIL_NV kills the pixels that are currently executing, not based on a test
  * of the arguments.
  */
-static void emit_kil_nv( struct brw_wm_compile *c )
+void emit_kil_nv( struct brw_wm_compile *c )
 {
struct brw_compile *p = c-func;
struct brw_reg r0uw = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW);
diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c 
b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
index 7d6724d..7c05e45 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
@@ -614,21 +614,6 @@ static void emit_arl(struct brw_wm_compile *c,
 brw_set_saturate(p, 0);
 }
 
-/**
- * For GLSL shaders, this KIL will be unconditional.
- * It may be contained inside an IF/ENDIF structure of course.
- */
-static void emit_kil(struct brw_wm_compile *c)
-{
-struct brw_compile *p = c-func;
-struct brw_reg depth = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW);
-brw_push_insn_state(p);
-brw_set_mask_control(p, BRW_MASK_DISABLE);
-brw_NOT(p, c-emit_mask_reg, brw_mask_reg(1)); /* IMASK */
-brw_AND(p, depth, c-emit_mask_reg, depth);
-brw_pop_insn_state(p);
-}
-
 static INLINE struct brw_reg high_words( struct brw_reg reg )
 {
 return stride( suboffset( retype( reg, BRW_REGISTER_TYPE_W ), 1 ),
@@ -898,7 +883,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, 
struct brw_wm_compile *c)
 c-fp-program.Base.SamplerUnits[inst-TexSrcUnit]);
break;
case OPCODE_KIL_NV:
-   emit_kil(c);
+   emit_kil_nv(c);
break;
case OPCODE_IF:
assert(if_depth  MAX_IF_DEPTH);

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965: Also enable CC statistics when doing OQs.

2010-09-21 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 4a0bc4716db7bbcbcd65c0f993704733f47d41f7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4a0bc4716db7bbcbcd65c0f993704733f47d41f7

Author: Eric Anholt e...@anholt.net
Date:   Tue Sep 21 10:53:34 2010 -0700

i965: Also enable CC statistics when doing OQs.

This is required by the spec, so respect that.

---

 src/mesa/drivers/dri/i965/brw_cc.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_cc.c 
b/src/mesa/drivers/dri/i965/brw_cc.c
index cfce5d3..8430ee0 100644
--- a/src/mesa/drivers/dri/i965/brw_cc.c
+++ b/src/mesa/drivers/dri/i965/brw_cc.c
@@ -90,6 +90,7 @@ static void prepare_cc_unit(struct brw_context *brw)
  */
 static void upload_cc_unit(struct brw_context *brw)
 {
+   struct intel_context *intel = brw-intel;
GLcontext *ctx = brw-intel.ctx;
struct brw_cc_unit_state cc;
void *map;
@@ -203,12 +204,12 @@ static void upload_cc_unit(struct brw_context *brw)
   cc.cc2.depth_write_enable = ctx-Depth.Mask;
}
 
+   if (intel-stats_wm || (INTEL_DEBUG  DEBUG_STATS))
+  cc.cc5.statistics_enable = 1;
+
/* CACHE_NEW_CC_VP */
cc.cc4.cc_viewport_state_offset = brw-cc.vp_bo-offset  5; /* reloc */
 
-   if (INTEL_DEBUG  DEBUG_STATS)
-  cc.cc5.statistics_enable = 1;
-
map = brw_state_batch(brw, sizeof(cc), 64,
 brw-cc.state_bo, brw-cc.state_offset);
memcpy(map, cc, sizeof(cc));

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965: Track the windowizer's dispatch for kill pixel, promoted, and OQ

2010-09-21 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: dd9a88f4ddf4e5fa384792f891a1cc3d8ff73946
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dd9a88f4ddf4e5fa384792f891a1cc3d8ff73946

Author: Eric Anholt e...@anholt.net
Date:   Tue Sep 21 12:05:37 2010 -0700

i965: Track the windowizer's dispatch for kill pixel, promoted, and OQ

Looks like the problem was we weren't passing the depth to the render
target as expected, so the chip would wedge.  Fixes GPU hang in
occlusion-query-discard.

Bug #30097

---

 src/mesa/drivers/dri/i965/brw_wm.c|4 +++-
 src/mesa/drivers/dri/i965/brw_wm.h|3 ++-
 src/mesa/drivers/dri/i965/brw_wm_iz.c |   22 ++
 3 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm.c 
b/src/mesa/drivers/dri/i965/brw_wm.c
index d70be7b..17ff3e2 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -215,6 +215,7 @@ static void do_wm_prog( struct brw_context *brw,
 static void brw_wm_populate_key( struct brw_context *brw,
 struct brw_wm_prog_key *key )
 {
+   struct intel_context *intel = brw-intel;
GLcontext *ctx = brw-intel.ctx;
/* BRW_NEW_FRAGMENT_PROGRAM */
const struct brw_fragment_program *fp = 
@@ -279,7 +280,8 @@ static void brw_wm_populate_key( struct brw_context *brw,
   }
}
 
-   brw_wm_lookup_iz(line_aa,
+   brw_wm_lookup_iz(intel,
+   line_aa,
lookup,
uses_depth,
key);
diff --git a/src/mesa/drivers/dri/i965/brw_wm.h 
b/src/mesa/drivers/dri/i965/brw_wm.h
index c28acad..fed1372 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.h
+++ b/src/mesa/drivers/dri/i965/brw_wm.h
@@ -299,7 +299,8 @@ void brw_wm_print_insn( struct brw_wm_compile *c,
 void brw_wm_print_program( struct brw_wm_compile *c,
   const char *stage );
 
-void brw_wm_lookup_iz( GLuint line_aa,
+void brw_wm_lookup_iz( struct intel_context *intel,
+  GLuint line_aa,
   GLuint lookup,
   GLboolean ps_uses_depth,
   struct brw_wm_prog_key *key );
diff --git a/src/mesa/drivers/dri/i965/brw_wm_iz.c 
b/src/mesa/drivers/dri/i965/brw_wm_iz.c
index 8505ef1..62e5566 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_iz.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_iz.c
@@ -120,24 +120,38 @@ const struct {
  * \param line_aa  AA_NEVER, AA_ALWAYS or AA_SOMETIMES
  * \param lookup  bitmask of IZ_* flags
  */
-void brw_wm_lookup_iz( GLuint line_aa,
+void brw_wm_lookup_iz( struct intel_context *intel,
+  GLuint line_aa,
   GLuint lookup,
   GLboolean ps_uses_depth,
   struct brw_wm_prog_key *key )
 {
GLuint reg = 2;
+   GLboolean kill_stats_promoted_workaround = GL_FALSE;
 
assert (lookup  IZ_BIT_MAX);
-  
+
+   /* Crazy workaround in the windowizer, which we need to track in
+* our register allocation and render target writes.  See the If
+* statistics are enabled... paragraph of 11.5.3.2: Early Depth
+* Test Cases [Pre-DevGT] of the 3D Pipeline - Windower B-Spec.
+*/
+   if (intel-stats_wm 
+   (lookup  IZ_PS_KILL_ALPHATEST_BIT) 
+   wm_iz_table[lookup].mode == P) {
+  kill_stats_promoted_workaround = GL_TRUE;
+   }
+
if (lookup  IZ_PS_COMPUTES_DEPTH_BIT)
   key-computes_depth = 1;
 
-   if (wm_iz_table[lookup].sd_present || ps_uses_depth) {
+   if (wm_iz_table[lookup].sd_present || ps_uses_depth ||
+   kill_stats_promoted_workaround) {
   key-source_depth_reg = reg;
   reg += 2;
}
 
-   if (wm_iz_table[lookup].sd_to_rt)
+   if (wm_iz_table[lookup].sd_to_rt || kill_stats_promoted_workaround)
   key-source_depth_to_render_target = 1;
 
if (wm_iz_table[lookup].ds_present || line_aa != AA_NEVER) {

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): gallium/docs: The RET opcode may appear anywhere in a subroutine.

2010-09-21 Thread Tilman Sauerbeck
Module: Mesa
Branch: master
Commit: 1bcdc504d10b7776cc96d63efd9e9432a66a2a90
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1bcdc504d10b7776cc96d63efd9e9432a66a2a90

Author: Tilman Sauerbeck til...@code-monkey.de
Date:   Tue Sep 21 21:57:35 2010 +0200

gallium/docs: The RET opcode may appear anywhere in a subroutine.

Signed-off-by: Tilman Sauerbeck til...@code-monkey.de

---

 src/gallium/docs/source/tgsi.rst |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst
index 4c1f47a..9e02d43 100644
--- a/src/gallium/docs/source/tgsi.rst
+++ b/src/gallium/docs/source/tgsi.rst
@@ -678,8 +678,6 @@ This instruction replicates its result.
 
   pc = pop()
 
-  Potential restrictions:  
-  * Only occurs at end of function.
 
 .. opcode:: SSG - Set Sign
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): d3d1x: fix build with compilers other than GCC 4.5

2010-09-21 Thread Luca Barbieri
Module: Mesa
Branch: master
Commit: 82c346673a78e6cc32e7a1451f2b127128246ef3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=82c346673a78e6cc32e7a1451f2b127128246ef3

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Tue Sep 21 22:08:37 2010 +0200

d3d1x: fix build with compilers other than GCC 4.5

There was some libstdc++-specific code that would only build with GCC 4.5
Now it should be much more compatible, at the price of reimplementing
the generic hash function.

---

 .../d3d1x/d3d1xstutil/include/d3d1xstutil.h|   40 ---
 1 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h 
b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
index f79cc72..ab195f1 100644
--- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
+++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
@@ -748,21 +748,48 @@ static inline bool operator !=(const c_string a, const 
c_string b)
return strcmp(a.p, b.p);
 }
 
-#ifdef __GLIBCXX__
+static inline size_t raw_hash(const char* p, size_t size)
+{
+   size_t res;
+   if(sizeof(size_t) = 8)
+   res = (size_t)14695981039346656037ULL;
+   else
+   res = (size_t)2166136261UL;
+   const char* end = p + size;
+   for(; p != end; ++p)
+   {
+   res ^= (size_t)*p++;
+   if(sizeof(size_t) = 8)
+   res *= (size_t)1099511628211ULL;
+   else
+   res *= (size_t)16777619UL;
+   }
+   return res;
+};
+
+templatetypename T
+static inline size_t raw_hash(const T t)
+{
+   return raw_hash((const char*)t, sizeof(t));
+}
+
+// TODO: only tested with the gcc libstdc++, might not work elsewhere
 namespace std
 {
+#ifndef _MSC_VER
namespace tr1
{
+#endif
template
inline size_t hashGUID::operator()(GUID __val) const
{
-   return _Fnv_hash::hash(__val);
+   return raw_hash(__val);
}
 
template
inline size_t hashc_string::operator()(c_string __val) const
{
-   return _Fnv_hash::hash(__val.p, strlen(__val.p));
+   return raw_hash(__val.p, strlen(__val.p));
}
 
templatetypename T, typename U
@@ -777,13 +804,12 @@ namespace std
std::pairsize_t, size_t p;
p.first = hashT()(__val.first);
p.second = hashU()(__val.second);
-   return _Fnv_hash::hash(p);
+   return raw_hash(p);
}
+#ifndef _MSC_VER
}
-}
-#else
-#warning You probably need to add a pair, C string and GUID hash 
implementation for your C++ library
 #endif
+}
 
 templatetypename Base, typename RefCnt = refcnt_t
 struct GalliumPrivateDataComObject : public GalliumComObjectBase, RefCnt

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): d3d1x: add template parameters to base class ctor calls for GCC 4.4

2010-09-21 Thread Luca Barbieri
Module: Mesa
Branch: master
Commit: b4b2091655676ec3b898d3ae7298192aa7f9147f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b4b2091655676ec3b898d3ae7298192aa7f9147f

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Tue Sep 21 22:34:40 2010 +0200

d3d1x: add template parameters to base class ctor calls for GCC 4.4

GCC 4.5 is fine without them, but GCC 4.4 requires them.
Should fully fix the build on GCC 4.4

---

 .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp  |6 ++--
 src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp  |   22 ++-
 .../state_trackers/d3d1x/gd3d11/d3d11_context.h|4 +-
 .../state_trackers/d3d1x/gd3d11/d3d11_objects.h|6 ++--
 4 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp 
b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
index 69ddbc5..41c8f29 100644
--- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
+++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
@@ -77,7 +77,7 @@ struct GalliumDXGIFactory : public 
GalliumDXGIObjectIDXGIFactory1, IUnknown
void* resolver_cookie;
 
 GalliumDXGIFactory(const struct native_platform* platform, void* 
display, PFNHWNDRESOLVER resolver, void* resolver_cookie)
-: GalliumDXGIObject((IUnknown*)NULL), platform(platform), 
display(display), resolver(resolver ? resolver : identity_resolver), 
resolver_cookie(resolver_cookie)
+: GalliumDXGIObjectIDXGIFactory1, IUnknown((IUnknown*)NULL), 
platform(platform), display(display), resolver(resolver ? resolver : 
identity_resolver), resolver_cookie(resolver_cookie)
 {}
 
 virtual HRESULT STDMETHODCALLTYPE EnumAdapters(
@@ -316,7 +316,7 @@ struct GalliumDXGIOutput : public 
GalliumDXGIObjectIDXGIOutput, GalliumDXGIAdap
DXGI_GAMMA_CONTROL* gamma;
 
GalliumDXGIOutput(GalliumDXGIAdapter* adapter, std::string name, const 
struct native_connector* connector = 0)
-   : GalliumDXGIObject(adapter), connector(connector)
+   : GalliumDXGIObjectIDXGIOutput, GalliumDXGIAdapter(adapter), 
connector(connector)
{
memset(desc, 0, sizeof(desc));
for(unsigned i = 0; i  std::min(name.size(), 
sizeof(desc.DeviceName) - 1); ++i)
@@ -818,7 +818,7 @@ struct GalliumDXGISwapChain : public 
GalliumDXGIObjectIDXGISwapChain, GalliumDX
bool formats_compatible;
 
GalliumDXGISwapChain(GalliumDXGIFactory* factory, IUnknown* p_device, 
const DXGI_SWAP_CHAIN_DESC p_desc)
-   : GalliumDXGIObject(factory), desc(p_desc)
+   : GalliumDXGIObjectIDXGISwapChain, GalliumDXGIFactory(factory), 
desc(p_desc)
{
HRESULT hr;
 
diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp 
b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp
index 69dfd40..46a3905 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp
@@ -126,20 +126,22 @@ struct GalliumD3D11Caps
unsigned stages;
 };
 
-// used to avoid needing to have forward declarations of functions
-// this is called screen because in the D3D10 case it's only part of the 
device
-struct GalliumD3D11Screen
-   : public GalliumDXGIDevice
-   GalliumMultiComObject
+typedef GalliumDXGIDevice
+   GalliumMultiComObject
 #if API = 11
-   GalliumPrivateDataComObjectID3D11Device,
+   GalliumPrivateDataComObjectID3D11Device,
 #else
-   GalliumPrivateDataComObjectID3D10Device1,
+   GalliumPrivateDataComObjectID3D10Device1,
 #endif
-   IGalliumDevice
-   
+   IGalliumDevice

+ GalliumD3D11ScreenBase;
+
+// used to avoid needing to have forward declarations of functions
+// this is called screen because in the D3D10 case it's only part of the 
device
+struct GalliumD3D11Screen : public GalliumD3D11ScreenBase
 {
+
pipe_screen* screen;
pipe_context* immediate_pipe;
GalliumD3D11Caps screen_caps;
@@ -159,7 +161,7 @@ struct GalliumD3D11Screen
 
 
GalliumD3D11Screen(pipe_screen* screen, struct pipe_context* 
immediate_pipe, IDXGIAdapter* adapter)
-   : GalliumDXGIDevice(adapter), screen(screen), 
immediate_pipe(immediate_pipe)
+   : GalliumD3D11ScreenBase(adapter), screen(screen), 
immediate_pipe(immediate_pipe)
{
}
 
diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h 
b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
index a8573cd..032cb0e 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
@@ -119,7 +119,7 @@ struct GalliumD3D10Device : public 
GalliumD3D10ScreenImplthreadsafe
 #define SYNCHRONIZED do {} while(0)
 
GalliumD3D11DeviceContext(GalliumD3D11Screen* device, pipe_context* 
pipe, bool owns_pipe, unsigned context_flags = 0)
-   : 

Mesa (master): glsl2: fix typo in error msg

2010-09-21 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 2b95525429935474ee4b507348507da45adc6872
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b95525429935474ee4b507348507da45adc6872

Author: Brian Paul bri...@vmware.com
Date:   Tue Sep 21 14:56:58 2010 -0600

glsl2: fix typo in error msg

---

 src/glsl/linker.cpp |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index c2c6621..53e18a0 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -457,7 +457,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program 
*prog,
  */
 if (input-type != output-type) {
linker_error_printf(prog,
-   %s shader output `%s' delcared as 
+   %s shader output `%s' declared as 
type `%s', but %s shader input declared 
as type `%s'\n,
producer_stage, output-name,

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): r600g: fix multi buffer rendering

2010-09-21 Thread Jerome Glisse
Module: Mesa
Branch: master
Commit: 45d10c7d5910ada45b3bf7c34f9fb98c80c72664
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=45d10c7d5910ada45b3bf7c34f9fb98c80c72664

Author: Jerome Glisse jgli...@redhat.com
Date:   Tue Sep 21 16:56:59 2010 -0400

r600g: fix multi buffer rendering

Signed-off-by: Jerome Glisse jgli...@redhat.com

---

 src/gallium/drivers/r600/r600_state2.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_state2.c 
b/src/gallium/drivers/r600/r600_state2.c
index 36a3376..f29aa0f 100644
--- a/src/gallium/drivers/r600/r600_state2.c
+++ b/src/gallium/drivers/r600/r600_state2.c
@@ -234,10 +234,10 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, 
struct r600_pipe_shade
if (rshader-output[i].name == TGSI_SEMANTIC_POSITION)
exports_ps |= 1;
else if (rshader-output[i].name == TGSI_SEMANTIC_COLOR) {
-   exports_ps |= (1  (num_cout+1));
num_cout++;
}
}
+   exports_ps |= S_028854_EXPORT_COLORS(num_cout);
if (!exports_ps) {
/* always at least export 1 component per pixel */
exports_ps = 2;
@@ -687,7 +687,7 @@ static void r600_flush2(struct pipe_context *ctx, unsigned 
flags,
 
 #if 0
sprintf(dname, gallium-%08d.bof, dc);
-   if (dc  2) {
+   if (dc  20) {
r600_context_dump_bof(rctx-ctx, dname);
R600_ERR(dumped %s\n, dname);
}

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (7.9): glsl2: fix typo in error msg

2010-09-21 Thread Brian Paul
Module: Mesa
Branch: 7.9
Commit: 2606105cc5c452f32e3b3418e474e3c71702534a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2606105cc5c452f32e3b3418e474e3c71702534a

Author: Brian Paul bri...@vmware.com
Date:   Tue Sep 21 14:58:24 2010 -0600

glsl2: fix typo in error msg

(cherry picked from commit 2b95525429935474ee4b507348507da45adc6872)

---

 src/glsl/linker.cpp |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index c2c6621..53e18a0 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -457,7 +457,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program 
*prog,
  */
 if (input-type != output-type) {
linker_error_printf(prog,
-   %s shader output `%s' delcared as 
+   %s shader output `%s' declared as 
type `%s', but %s shader input declared 
as type `%s'\n,
producer_stage, output-name,

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): d3d1x: ignore errors while building docs

2010-09-21 Thread Luca Barbieri
Module: Mesa
Branch: master
Commit: 83ea4878db8768b6e892009d80247d4374b7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=83ea4878db8768b6e892009d80247d4374b7

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Tue Sep 21 23:21:35 2010 +0200

d3d1x: ignore errors while building docs

Some versions of dot apparently lack pdf output.

---

 src/gallium/state_trackers/d3d1x/docs/Makefile |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/docs/Makefile 
b/src/gallium/state_trackers/d3d1x/docs/Makefile
index ca1e3ce..7f38fa7 100644
--- a/src/gallium/state_trackers/d3d1x/docs/Makefile
+++ b/src/gallium/state_trackers/d3d1x/docs/Makefile
@@ -1,4 +1,5 @@
 all: module_dependencies.svg module_dependencies.pdf
+.IGNORE: module_dependencies.svg module_dependencies.pdf
 
 include ../Makefile.inc
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): gallivm: fix lp_build_sample_compare()

2010-09-21 Thread Brian Paul
Module: Mesa
Branch: master
Commit: ffa2d203fb71d54dc8dfa5d17aa1637d2f2bb5b5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ffa2d203fb71d54dc8dfa5d17aa1637d2f2bb5b5

Author: Brian Paul bri...@vmware.com
Date:   Tue Sep 21 15:25:31 2010 -0600

gallivm: fix lp_build_sample_compare()

The old code didn't really make sense.  We only need to compare the
X channel of the texture (depth) against the texcoord.

For (bi)linear sampling we should move the calls to this function
and compute the final result as (s1+s2+s3+s4) * 0.25.  Someday.

This fixes the glean glsl1 shadow2D() tests.  See fd.o bug 29307.

---

 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |   40 -
 1 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index f86d055..91fab18 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -47,6 +47,7 @@
 #include lp_bld_arit.h
 #include lp_bld_bitarit.h
 #include lp_bld_logic.h
+#include lp_bld_printf.h
 #include lp_bld_swizzle.h
 #include lp_bld_flow.h
 #include lp_bld_gather.h
@@ -1057,6 +1058,11 @@ lp_build_sample_general(struct lp_build_sample_context 
*bld,
 }
 
 
+/**
+ * Do shadow test/comparison.
+ * \param p  the texcoord Z (aka R, aka P) component
+ * \param texel  the texel to compare against (use the X channel)
+ */
 static void
 lp_build_sample_compare(struct lp_build_sample_context *bld,
 LLVMValueRef p,
@@ -1064,30 +1070,30 @@ lp_build_sample_compare(struct lp_build_sample_context 
*bld,
 {
struct lp_build_context *texel_bld = bld-texel_bld;
LLVMValueRef res;
-   unsigned chan;
+   const unsigned chan = 0;
 
-   if(bld-static_state-compare_mode == PIPE_TEX_COMPARE_NONE)
+   if (bld-static_state-compare_mode == PIPE_TEX_COMPARE_NONE)
   return;
 
-   /* TODO: Compare before swizzling, to avoid redundant computations */
-   res = NULL;
-   for(chan = 0; chan  4; ++chan) {
-  LLVMValueRef cmp;
-  cmp = lp_build_cmp(texel_bld, bld-static_state-compare_func, p, 
texel[chan]);
-  cmp = lp_build_select(texel_bld, cmp, texel_bld-one, texel_bld-zero);
-
-  if(res)
- res = lp_build_add(texel_bld, res, cmp);
-  else
- res = cmp;
+   /* debug code */
+   if (0) {
+  LLVMValueRef indx = lp_build_const_int32(0);
+  LLVMValueRef coord = LLVMBuildExtractElement(bld-builder, p, indx, );
+  LLVMValueRef tex = LLVMBuildExtractElement(bld-builder,
+ texel[chan], indx, );
+  lp_build_printf(bld-builder, shadow compare coord %f to texture %f\n,
+  coord, tex);
}
 
-   assert(res);
-   res = lp_build_mul(texel_bld, res, lp_build_const_vec(texel_bld-type, 
0.25));
+   /* result = (p FUNC texel) ? 1 : 0 */
+   res = lp_build_cmp(texel_bld, bld-static_state-compare_func,
+  p, texel[chan]);
+   res = lp_build_select(texel_bld, res, texel_bld-one, texel_bld-zero);
 
/* XXX returning result for default GL_DEPTH_TEXTURE_MODE = GL_LUMINANCE */
-   for(chan = 0; chan  3; ++chan)
-  texel[chan] = res;
+   texel[0] =
+   texel[1] =
+   texel[2] = res;
texel[3] = texel_bld-one;
 }
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): softpipe: add missing calls to set draw vertex samplers/ views

2010-09-21 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 9e8d9f456f6c03ac135fd7a1a1443279358494fc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9e8d9f456f6c03ac135fd7a1a1443279358494fc

Author: Brian Paul bri...@vmware.com
Date:   Tue Sep 21 15:29:26 2010 -0600

softpipe: add missing calls to set draw vertex samplers/views

Part of the fix for running softpipe w/ LLVM-enabled draw module.

---

 src/gallium/drivers/softpipe/sp_state_sampler.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c 
b/src/gallium/drivers/softpipe/sp_state_sampler.c
index 79d9516..1be5136 100644
--- a/src/gallium/drivers/softpipe/sp_state_sampler.c
+++ b/src/gallium/drivers/softpipe/sp_state_sampler.c
@@ -118,6 +118,10 @@ softpipe_bind_vertex_sampler_states(struct pipe_context 
*pipe,
 
softpipe-num_vertex_samplers = num_samplers;
 
+   draw_set_samplers(softpipe-draw,
+ softpipe-vertex_samplers,
+ softpipe-num_vertex_samplers);
+
softpipe-dirty |= SP_NEW_SAMPLER;
 }
 
@@ -234,6 +238,10 @@ softpipe_set_vertex_sampler_views(struct pipe_context 
*pipe,
 
softpipe-num_vertex_sampler_views = num;
 
+   draw_set_sampler_views(softpipe-draw,
+  softpipe-vertex_sampler_views,
+  softpipe-num_vertex_sampler_views);
+
softpipe-dirty |= SP_NEW_TEXTURE;
 }
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): glut: Define markWindowHidden for non-Windows only.

2010-09-21 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 13cd131b0f713c468c3cf3b12f6439288d5a3161
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=13cd131b0f713c468c3cf3b12f6439288d5a3161

Author: Vinson Lee v...@vmware.com
Date:   Tue Sep 21 15:11:00 2010 -0700

glut: Define markWindowHidden for non-Windows only.

Fixes this GCC warning on MinGW build.
glut_event.c:255: warning: 'markWindowHidden' defined but not used

---

 src/glut/glx/glut_event.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/glut/glx/glut_event.c b/src/glut/glx/glut_event.c
index 4cdb814..c450ee9 100644
--- a/src/glut/glx/glut_event.c
+++ b/src/glut/glx/glut_event.c
@@ -251,6 +251,8 @@ __glutRegisterEventParser(GLUTeventParser * parser)
   eventParserList = parser;
 }
 
+
+#if !defined(_WIN32)
 static void
 markWindowHidden(GLUTwindow * window)
 {
@@ -272,8 +274,6 @@ markWindowHidden(GLUTwindow * window)
   }
 }
 
-#if !defined(_WIN32)
-
 static void
 purgeStaleWindow(Window win)
 {

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): glut: Define eventParser for non-Windows only.

2010-09-21 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 3642ca2f66efa8e078062f566b8f9975928d9f44
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3642ca2f66efa8e078062f566b8f9975928d9f44

Author: Vinson Lee v...@vmware.com
Date:   Tue Sep 21 15:17:52 2010 -0700

glut: Define eventParser for non-Windows only.

Fixes this GCC warning on MinGW build.
glut_input.c:295: warning: 'eventParser' defined but not used

---

 src/glut/glx/glut_input.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glut/glx/glut_input.c b/src/glut/glx/glut_input.c
index 7d2eda0..53f9dc5 100644
--- a/src/glut/glx/glut_input.c
+++ b/src/glut/glx/glut_input.c
@@ -292,10 +292,10 @@ __glutProcessDeviceEvents(XEvent * event)
   return 0;
 }
 
+#if !defined(_WIN32)
 static GLUTeventParser eventParser =
 {__glutProcessDeviceEvents, NULL};
 
-#if !defined(_WIN32)
 static void
 addDeviceEventParser(void)
 {

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: don' t advertise bogus GL_ARB_shading_language_120 extension

2010-09-21 Thread Brian Paul
Module: Mesa
Branch: master
Commit: e7087175f8a04f777403366fb34b58edd00f4d60
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e7087175f8a04f777403366fb34b58edd00f4d60

Author: Brian Paul bri...@vmware.com
Date:   Tue Sep 21 18:13:02 2010 -0600

mesa: don't advertise bogus GL_ARB_shading_language_120 extension

Instead of using the invalid GL_ARB_shading_language_120 extension to
determine the GLSL version, use a new ctx-Const.GLSLVersion field.
Updated the intel and r600 drivers, but untested.

See fd.o bug 29910

NOTE: This is a candidate for the 7.9 branch (but let's wait and see if
there's any regressions).

---

 src/mesa/drivers/dri/i965/brw_context.c   |   10 +++
 src/mesa/drivers/dri/intel/intel_extensions.c |1 -
 src/mesa/drivers/dri/r600/r600_context.c  |3 +-
 src/mesa/main/context.c   |   15 +++
 src/mesa/main/extensions.c|7 -
 src/mesa/main/getstring.c |   34 ++--
 src/mesa/main/mtypes.h|3 +-
 src/mesa/main/version.c   |2 +-
 src/mesa/state_tracker/st_extensions.c|6 +++-
 9 files changed, 60 insertions(+), 21 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index d08538e..49be289 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -42,6 +42,12 @@
 #include tnl/t_pipeline.h
 
 
+static const struct dri_extension gl_21_extension[] = {
+  {GL_VERSION_2_1, GL_VERSION_2_1_functions },
+};
+
+
+
 /***
  * Mesa's Driver Functions
  ***/
@@ -88,6 +94,8 @@ GLboolean brwCreateContext( int api,
 
TNL_CONTEXT(ctx)-Driver.RunPipeline = _tnl_run_pipeline;
 
+   ctx-Const.GLSLVersion = 120;
+
ctx-Const.MaxDrawBuffers = BRW_MAX_DRAW_BUFFERS;
ctx-Const.MaxTextureImageUnits = BRW_MAX_TEX_UNIT;
ctx-Const.MaxTextureCoordUnits = 8; /* Mesa limit */
@@ -152,6 +160,8 @@ GLboolean brwCreateContext( int api,
   MIN2(ctx-Const.FragmentProgram.MaxNativeParameters,
   ctx-Const.FragmentProgram.MaxEnvParams);
 
+   driInitExtensions(ctx, gl_21_extension, GL_TRUE);
+
if (intel-is_g4x || intel-gen = 5) {
   brw-CMD_VF_STATISTICS = CMD_VF_STATISTICS_GM45;
   brw-CMD_PIPELINE_SELECT = CMD_PIPELINE_SELECT_GM45;
diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c 
b/src/mesa/drivers/dri/intel/intel_extensions.c
index bf22a42..a066b5b 100644
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -89,7 +89,6 @@ static const struct dri_extension card_extensions[] = {
{ GL_ARB_point_sprite,   NULL },
{ GL_ARB_shader_objects, GL_ARB_shader_objects_functions },
{ GL_ARB_shading_language_100,   GL_VERSION_2_0_functions },
-   { GL_ARB_shading_language_120,   GL_VERSION_2_1_functions },
{ GL_ARB_sync,   GL_ARB_sync_functions },
{ GL_ARB_texture_border_clamp,   NULL },
{ GL_ARB_texture_cube_map,   NULL },
diff --git a/src/mesa/drivers/dri/r600/r600_context.c 
b/src/mesa/drivers/dri/r600/r600_context.c
index 9c8fe2a..f4e6716 100644
--- a/src/mesa/drivers/dri/r600/r600_context.c
+++ b/src/mesa/drivers/dri/r600/r600_context.c
@@ -166,7 +166,6 @@ static const struct dri_extension mm_extensions[] = {
 static const struct dri_extension gl_20_extension[] = {
 #ifdef R600_ENABLE_GLSL_TEST
 {GL_ARB_shading_language_100,
GL_VERSION_2_0_functions },
-{GL_ARB_shading_language_120,
GL_VERSION_2_1_functions },
 #else
   {GL_VERSION_2_0,   GL_VERSION_2_0_functions },
 #endif /* R600_ENABLE_GLSL_TEST */
@@ -266,6 +265,8 @@ static void r600InitConstValues(GLcontext *ctx, 
radeonScreenPtr screen)
 r700-bShaderUseMemConstant = GL_FALSE;
 }
 
+ctx-Const.GLSLVersion = 120;
+
ctx-Const.MaxTextureImageUnits = 16;
/* 8 per clause on r6xx, 16 on r7xx
 * but I think mesa only supports 8 at the moment
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index b1f800f..3bddf25 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -597,6 +597,21 @@ _mesa_init_constants(GLcontext *ctx)
ctx-Const.MaxVarying = MAX_VARYING;
 #endif
 
+   /* Shading language version */
+   if (ctx-API == API_OPENGL) {
+#if FEATURE_ARB_shading_language_120
+  ctx-Const.GLSLVersion = 120;
+#else
+  ctx-Const.GLSLVersion = 110;
+#endif
+   }
+   else if (ctx-API == API_OPENGLES2) {
+  ctx-Const.GLSLVersion = 100;
+   }
+   else if (ctx-API == API_OPENGLES) {
+  ctx-Const.GLSLVersion = 0; /* GLSL not supported */
+   }
+
/* GL_ARB_framebuffer_object */
ctx-Const.MaxSamples = 0;
 
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 50b97f5..080fa98 100644
--- 

Mesa (master): r600g: occlusion query for new design

2010-09-21 Thread Jerome Glisse
Module: Mesa
Branch: master
Commit: ca35292a4456fec1c584d40bf9b4197fe733f609
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ca35292a4456fec1c584d40bf9b4197fe733f609

Author: Jerome Glisse jgli...@redhat.com
Date:   Tue Sep 21 20:24:51 2010 -0400

r600g: occlusion query for new design

Signed-off-by: Jerome Glisse jgli...@redhat.com

---

 src/gallium/drivers/r600/r600.h   |   38 +++-
 src/gallium/drivers/r600/r600_state2.c|   47 +
 src/gallium/winsys/r600/drm/r600_priv.h   |7 +-
 src/gallium/winsys/r600/drm/r600_state2.c |  151 -
 4 files changed, 237 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h
index 8879efc..6d87220 100644
--- a/src/gallium/drivers/r600/r600.h
+++ b/src/gallium/drivers/r600/r600.h
@@ -28,6 +28,8 @@
 
 #include stdint.h
 #include stdio.h
+#include util/u_double_list.h
+#include pipe/p_compiler.h
 
 #define RADEON_CTX_MAX_PM4 (64 * 1024 / 4)
 
@@ -183,6 +185,9 @@ struct r600_group {
unsigned*offset_block_id;
 };
 
+/*
+ * relocation
+ */
 #pragma pack(1)
 struct r600_reloc {
uint32_thandle;
@@ -192,7 +197,29 @@ struct r600_reloc {
 };
 #pragma pack()
 
-struct radeon_bo;
+/*
+ * query
+ */
+struct r600_query {
+   u64 result;
+   /* The kind of query. Currently only OQ is supported. */
+   unsignedtype;
+   /* How many results have been written, in dwords. It's incremented
+* after end_query and flush. */
+   unsignednum_results;
+   /* if we've flushed the query */
+   unsignedstate;
+   /* The buffer where query results are stored. */
+   struct radeon_ws_bo *buffer;
+   unsignedbuffer_size;
+   /* linked list of queries */
+   struct list_headlist;
+};
+
+#define R600_QUERY_STATE_STARTED   (1  0)
+#define R600_QUERY_STATE_ENDED (1  1)
+#define R600_QUERY_STATE_SUSPENDED (1  2)
+
 
 struct r600_context {
struct radeon   *radeon;
@@ -207,6 +234,7 @@ struct r600_context {
struct r600_reloc   *reloc;
struct radeon_bo**bo;
u32 *pm4;
+   struct list_headquery_list;
 };
 
 struct r600_draw {
@@ -229,4 +257,12 @@ void r600_context_flush(struct r600_context *ctx);
 void r600_context_dump_bof(struct r600_context *ctx, const char *file);
 void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw);
 
+struct r600_query *r600_context_query_create(struct r600_context *ctx, 
unsigned query_type);
+void r600_context_query_destroy(struct r600_context *ctx, struct r600_query 
*query);
+boolean r600_context_query_result(struct r600_context *ctx,
+   struct r600_query *query,
+   boolean wait, void *vresult);
+void r600_query_begin(struct r600_context *ctx, struct r600_query *query);
+void r600_query_end(struct r600_context *ctx, struct r600_query *query);
+
 #endif
diff --git a/src/gallium/drivers/r600/r600_state2.c 
b/src/gallium/drivers/r600/r600_state2.c
index f29aa0f..0343704 100644
--- a/src/gallium/drivers/r600/r600_state2.c
+++ b/src/gallium/drivers/r600/r600_state2.c
@@ -2089,6 +2089,52 @@ static void r600_init_config2(struct r600_pipe_context 
*rctx)
r600_context_pipe_state_set(rctx-ctx, rstate);
 }
 
+static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned 
query_type)
+{
+   struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+
+   return (struct pipe_query*)r600_context_query_create(rctx-ctx, 
query_type);
+}
+
+static void r600_destroy_query(struct pipe_context *ctx, struct pipe_query 
*query)
+{
+   struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+
+   r600_context_query_destroy(rctx-ctx, (struct r600_query *)query);
+}
+
+static void r600_begin_query(struct pipe_context *ctx, struct pipe_query 
*query)
+{
+   struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+
+   r600_query_begin(rctx-ctx, (struct r600_query *)query);
+}
+
+static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query)
+{
+   struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+
+   r600_query_end(rctx-ctx, (struct r600_query *)query);
+}
+
+static boolean r600_get_query_result(struct pipe_context *ctx,
+   struct pipe_query *query,
+   boolean wait, void *vresult)
+{
+   struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+
+   return r600_context_query_result(rctx-ctx, (struct r600_query 
*)query, wait, vresult);
+}
+
+static void r600_init_query_functions2(struct r600_pipe_context 

Mesa (master): r600g: fix typo in struct member name

2010-09-21 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: 6e901e330aa7f0d186dad19bcc886bf45a76e50b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6e901e330aa7f0d186dad19bcc886bf45a76e50b

Author: Dave Airlie airl...@redhat.com
Date:   Tue Sep 21 13:16:32 2010 +1000

r600g: fix typo in struct member name

---

 src/gallium/drivers/r600/eg_hw_states.c   |4 ++--
 src/gallium/drivers/r600/r600_hw_states.c |4 ++--
 src/gallium/drivers/r600/r600_resource.h  |2 +-
 src/gallium/drivers/r600/r600_state2.c|2 +-
 src/gallium/drivers/r600/r600_texture.c   |2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/r600/eg_hw_states.c 
b/src/gallium/drivers/r600/eg_hw_states.c
index 3d10095..6ad350b 100644
--- a/src/gallium/drivers/r600/eg_hw_states.c
+++ b/src/gallium/drivers/r600/eg_hw_states.c
@@ -164,7 +164,7 @@ static void eg_db(struct r600_context *rctx, struct 
radeon_state *rstate,
return;
 
rtex = (struct r600_resource_texture*)state-zsbuf-texture;
-   rtex-tilled = 1;
+   rtex-tiled = 1;
rtex-array_mode = 2;
rtex-tile_type = 1;
rtex-depth = 1;
@@ -1107,7 +1107,7 @@ static void eg_texture_state_db(struct r600_screen 
*rscreen, struct r600_resourc
 
radeon_state_init(rstate, rscreen-rw, R600_STATE_DB, 0, 0);
rbuffer = rtexture-resource;
-   rtexture-tilled = 1;
+   rtexture-tiled = 1;
rtexture-array_mode = 2;
rtexture-tile_type = 1;
rtexture-depth = 1;
diff --git a/src/gallium/drivers/r600/r600_hw_states.c 
b/src/gallium/drivers/r600/r600_hw_states.c
index 271bd1a..13abd17 100644
--- a/src/gallium/drivers/r600/r600_hw_states.c
+++ b/src/gallium/drivers/r600/r600_hw_states.c
@@ -165,7 +165,7 @@ static void r600_db(struct r600_context *rctx, struct 
radeon_state *rstate,
return;
 
rtex = (struct r600_resource_texture*)state-zsbuf-texture;
-   rtex-tilled = 1;
+   rtex-tiled = 1;
rtex-array_mode = 2;
rtex-tile_type = 1;
rtex-depth = 1;
@@ -1178,7 +1178,7 @@ static void r600_texture_state_db(struct r600_screen 
*rscreen, struct r600_resou
 
radeon_state_init(rstate, rscreen-rw, R600_STATE_DB, 0, 0);
rbuffer = rtexture-resource;
-   rtexture-tilled = 1;
+   rtexture-tiled = 1;
rtexture-array_mode = 2;
rtexture-tile_type = 1;
rtexture-depth = 1;
diff --git a/src/gallium/drivers/r600/r600_resource.h 
b/src/gallium/drivers/r600/r600_resource.h
index cd1c31e..5d56910 100644
--- a/src/gallium/drivers/r600/r600_resource.h
+++ b/src/gallium/drivers/r600/r600_resource.h
@@ -50,7 +50,7 @@ struct r600_resource_texture {
unsigned long   pitch_override;
unsigned long   bpt;
unsigned long   size;
-   unsignedtilled;
+   unsignedtiled;
unsignedarray_mode;
unsignedtile_type;
unsigneddepth;
diff --git a/src/gallium/drivers/r600/r600_state2.c 
b/src/gallium/drivers/r600/r600_state2.c
index 0343704..b93bdd3 100644
--- a/src/gallium/drivers/r600/r600_state2.c
+++ b/src/gallium/drivers/r600/r600_state2.c
@@ -1563,7 +1563,7 @@ static void r600_db(struct r600_pipe_context *rctx, 
struct r600_pipe_state *rsta
return;
 
rtex = (struct r600_resource_texture*)state-zsbuf-texture;
-   rtex-tilled = 1;
+   rtex-tiled = 1;
rtex-array_mode = 2;
rtex-tile_type = 1;
rtex-depth = 1;
diff --git a/src/gallium/drivers/r600/r600_texture.c 
b/src/gallium/drivers/r600/r600_texture.c
index f60fe9f..4aabae1 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -267,7 +267,7 @@ struct pipe_transfer* r600_texture_get_transfer(struct 
pipe_context *ctx,
trans-transfer.box = *box;
trans-transfer.stride = rtex-pitch[sr.level];
trans-offset = r600_texture_get_offset(rtex, sr.level, box-z, 
sr.face);
-   if (rtex-tilled  !rtex-depth) {
+   if (rtex-tiled  !rtex-depth) {
resource.target = PIPE_TEXTURE_2D;
resource.format = texture-format;
resource.width0 = box-width;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): r600g: cleanup some of the DB blit code

2010-09-21 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: 41ef78c5af9a8b0ac80d9bd5375700a8bd0643f8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=41ef78c5af9a8b0ac80d9bd5375700a8bd0643f8

Author: Dave Airlie airl...@redhat.com
Date:   Wed Sep 22 12:57:45 2010 +1000

r600g: cleanup some of the DB blit code

add cb/db flush states to the blit code.
add support for the rv6xx that need special treatment.
according to R6xx_7xx_3D.pdf

set r700 CB_SHADER_CONTROL reg in blit code
docs say dual export should be disabled for DB-CB

---

 src/gallium/drivers/r600/r600_blit.c |   62 +++--
 src/gallium/drivers/r600/r600d.h |7 
 2 files changed, 65 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_blit.c 
b/src/gallium/drivers/r600/r600_blit.c
index 0506e82..e1f226c 100644
--- a/src/gallium/drivers/r600/r600_blit.c
+++ b/src/gallium/drivers/r600/r600_blit.c
@@ -160,6 +160,8 @@ struct r600_blit_states {
struct radeon_state vs_shader;
struct radeon_state vs_resource0;
struct radeon_state vs_resource1;
+   struct radeon_state cb_flush;
+   struct radeon_state db_flush;
 };
 
 static int r600_blit_state_vs_resources(struct r600_screen *rscreen, struct 
r600_blit_states *bstates)
@@ -445,6 +447,7 @@ static void r600_blit_state_rasterizer(struct r600_screen 
*rscreen, struct radeo
 
 static void r600_blit_state_dsa(struct r600_screen *rscreen, struct 
radeon_state *rstate)
 {
+   uint32_t db_render_override, db_shader_control;
radeon_state_init(rstate, rscreen-rw, R600_STATE_DSA, 0, 0);
 
/* set states (most default value are 0 and struct already
@@ -453,8 +456,16 @@ static void r600_blit_state_dsa(struct r600_screen 
*rscreen, struct radeon_state
rstate-states[R600_DSA__DB_ALPHA_TO_MASK] = 0xAA00;
rstate-states[R600_DSA__DB_DEPTH_CLEAR] = 0x3F80;
rstate-states[R600_DSA__DB_RENDER_CONTROL] = 0x0060;
-   rstate-states[R600_DSA__DB_RENDER_OVERRIDE] = 0x002A;
-   rstate-states[R600_DSA__DB_SHADER_CONTROL] = 0x0210;
+
+   db_render_override = S_028D10_FORCE_HIZ_ENABLE(V_028D10_FORCE_DISABLE) |
+   S_028D10_FORCE_HIS_ENABLE0(V_028D10_FORCE_DISABLE) |
+   S_028D10_FORCE_HIS_ENABLE1(V_028D10_FORCE_DISABLE);
+
+   db_shader_control = S_02880C_DUAL_EXPORT_ENABLE(0) |
+   S_02880C_Z_ORDER(V_02880C_EARLY_Z_THEN_LATE_Z);
+
+   rstate-states[R600_DSA__DB_RENDER_OVERRIDE] = db_render_override;
+   rstate-states[R600_DSA__DB_SHADER_CONTROL] = db_shader_control;
 
radeon_state_pm4(rstate);
 }
@@ -475,6 +486,25 @@ static void r600_blit_state_cb_cntl(struct r600_screen 
*rscreen, struct radeon_s
rstate-states[R600_CB_CNTL__CB_SHADER_MASK] = 0x000F;
rstate-states[R600_CB_CNTL__CB_TARGET_MASK] = 0x000F;
rstate-states[R600_CB_CNTL__PA_SC_AA_MASK] = 0x;
+   rstate-states[R600_CB_CNTL__CB_SHADER_CONTROL] = 0x1;
+   radeon_state_pm4(rstate);
+}
+
+static void r600_blit_state_cb_flush(struct r600_screen *rscreen, struct 
radeon_state *rstate, struct r600_resource_texture *rtexture, unsigned cb, 
unsigned level)
+{
+   radeon_state_init(rstate, rscreen-rw, R600_STATE_CB_FLUSH, 0, 0);
+
+   radeon_ws_bo_reference(rscreen-rw, rstate-bo[0], 
rtexture-uncompressed);
+   rstate-nbo = 1;
+   radeon_state_pm4(rstate);
+}
+
+static void r600_blit_state_db_flush(struct r600_screen *rscreen, struct 
radeon_state *rstate, struct r600_resource_texture *rtexture, unsigned cb, 
unsigned level)
+{
+   radeon_state_init(rstate, rscreen-rw, R600_STATE_DB_FLUSH, 0, 0);
+
+   radeon_ws_bo_reference(rscreen-rw, rstate-bo[0], 
rtexture-resource.bo);
+   rstate-nbo = 1;
radeon_state_pm4(rstate);
 }
 
@@ -512,6 +542,7 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, 
struct r600_resource_te
struct r600_context *rctx = r600_context(ctx);
struct radeon_draw draw;
struct r600_blit_states bstates;
+   enum radeon_family family;
int r;
 
r = r600_texture_scissor(ctx, rtexture, level);
@@ -535,8 +566,29 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, 
struct r600_resource_te
if (r) {
return r;
}
-   bstates.dsa.states[R600_DSA__DB_RENDER_CONTROL] = 0x008C;
-   bstates.cb_cntl.states[R600_CB_CNTL__CB_TARGET_MASK] = 0x0001;
+
+   /* for some gpus we need special cases */
+   family = radeon_get_family(rscreen-rw);
+   /* according to R6xx_R7xx_3D.pdf section 6.3.1, these GPUs needs 
special handling */
+   if (family == CHIP_RV610 || family == CHIP_RV630 || family == 
CHIP_RV620 ||
+   family == CHIP_RV635) {
+   bstates.dsa.states[R600_DSA__DB_DEPTH_CONTROL] = 
S_028800_Z_ENABLE(1) |
+   S_028800_STENCIL_ENABLE(1) | 
S_028800_ZFUNC(PIPE_FUNC_LEQUAL) |
+   

Mesa (master): r600g: disable dirty handling on texture from depth code.

2010-09-21 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: 2b1ea90342a8fb912f3a5a40ebcd7c1ec488a4bb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b1ea90342a8fb912f3a5a40ebcd7c1ec488a4bb

Author: Dave Airlie airl...@redhat.com
Date:   Wed Sep 22 14:27:58 2010 +1000

r600g: disable dirty handling on texture from depth code.

nothing was every dirtying the object again, the mesa-demos
reflect test was just stalling.

this fixes glean readPixSanity.

---

 src/gallium/drivers/r600/r600_texture.c |9 +
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_texture.c 
b/src/gallium/drivers/r600/r600_texture.c
index 4aabae1..3782290 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -650,14 +650,7 @@ int r600_texture_from_depth(struct pipe_context *ctx, 
struct r600_resource_textu
struct r600_screen *rscreen = r600_screen(ctx-screen);
int r;
 
-   if (!rtexture-depth) {
-   /* This shouldn't happen maybe print a warning */
-   return 0;
-   }
-   if (rtexture-uncompressed  !rtexture-dirty) {
-   /* Uncompressed bo already in good state */
-   return 0;
-   }
+   /* TODO possible dirty handling */
 
/* allocate uncompressed texture */
if (rtexture-uncompressed == NULL) {

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit