Mesa (master): gallium: add $(PROGS_DEPS) as dependencies for $(PROGS)

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Mon Sep 27 14:04:39 2010 +0200

gallium: add $(PROGS_DEPS) as dependencies for $(PROGS)

Commit 80ee3a440cd3c0403004cf35e0638fc52088b9ff added a PROGS_DEPS
definition, but no uses, even though it seems clearly intended
to be a set of additional dependencies for $(PROGS).

Correct this.

---

 src/gallium/Makefile.template |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/Makefile.template b/src/gallium/Makefile.template
index bff399e..036c119 100644
--- a/src/gallium/Makefile.template
+++ b/src/gallium/Makefile.template
@@ -40,7 +40,7 @@ depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) 
$(SYMLINKS) $(GENERATED_SOURC
touch depend
$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(C_SOURCES) $(CPP_SOURCES) 
$(ASM_SOURCES) $(GENERATED_SOURCES) 2 /dev/null
 
-$(PROGS): % : %.o
+$(PROGS): % : %.o $(PROGS_DEPS)
$(LD) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group  $(LIBS) 
-Wl,--end-group
 
 # Emacs tags

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


Mesa (master): mesa: make makedepend an hard requirement

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Fri Sep 24 10:10:09 2010 +0200

mesa: make makedepend an hard requirement

Currently makedepend is used by the Mesa Makefile-based build system,
but not required.

Unfortunately, not having it makes dependency resolution non-existent,
which is a source of subtle bugs, and is a rarely tested
configuration, since all Mesa developers likely have it installed.

Furthermore some idioms require dependency resolution to work at all,
such as making headers depend on generated files.

---

 configure.ac |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2b8296d..e75224d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,6 +33,10 @@ AC_CHECK_PROGS([MAKE], [gmake make])
 AC_PATH_PROG([MKDEP], [makedepend])
 AC_PATH_PROG([SED], [sed])
 
+if test x$MKDEP = x; then
+AC_MSG_ERROR([makedepend is required to build Mesa])
+fi
+
 dnl Our fallback install-sh is a symlink to minstall. Use the existing
 dnl configuration in that case.
 AC_PROG_INSTALL

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


Mesa (master): d3d1x: add private gitignore file

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Mon Sep 27 14:16:31 2010 +0200

d3d1x: add private gitignore file

---

 src/gallium/state_trackers/d3d1x/.gitignore |   20 
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/.gitignore 
b/src/gallium/state_trackers/d3d1x/.gitignore
new file mode 100644
index 000..f23bac7
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/.gitignore
@@ -0,0 +1,20 @@
+d3d1xshader/include/sm4_defs.h
+d3d1xshader/src/sm4_text.cpp
+d3d1xshader/tools/fxdis
+d3dapi/*.h
+docs/module_dependencies.svg
+docs/module_dependencies.pdf
+gd3d10/*.generated.*
+gd3d1x/tools/dxbc2tgsi
+gd3dapi/*.h
+mstools/DXSDK
+mstools/*.dll
+mstools/*.exe
+progs/bin/*
+winedlls/*/version.res
+winedlls/*/*.def
+*.suo
+*.vcxproj.filters
+*.vcxproj.user
+Debug
+Release

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


Mesa (master): d3d1x: fix progs linking if not all EGL platforms are enabled

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Mon Sep 27 14:23:33 2010 +0200

d3d1x: fix progs linking if not all EGL platforms are enabled

---

 src/gallium/state_trackers/d3d1x/progs/Makefile |   22 ++
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/progs/Makefile 
b/src/gallium/state_trackers/d3d1x/progs/Makefile
index bb37012..2f54079 100644
--- a/src/gallium/state_trackers/d3d1x/progs/Makefile
+++ b/src/gallium/state_trackers/d3d1x/progs/Makefile
@@ -9,15 +9,29 @@ LIBS= \
../../../winsys/sw/wrapper/libwsw.a \
../../../winsys/sw/xlib/libws_xlib.a \
../../../winsys/sw/dri/libswdri.a \
-   ../../../winsys/sw/fbdev/libfbdev.a \
../../../../../lib/libEGL.so
-LIBS_D3D10 = ../dxgid3d10/libdxgid3d10.a ../gd3d10/libgd3d10.a $(LIBS)
-LIBS_D3D11 = ../dxgid3d11/libdxgid3d11.a ../gd3d11/libgd3d11.a $(LIBS)
-LDADD=-lXext -lXfixes -lX11 -ldrm -ldl
+
+LDADD=-ldl
 
 all: bin/d3d10tri bin/d3d11tri bin/d3d11tex bin/d3d11gears
 include ../Makefile.inc
 
+ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),)
+LIBS += ../../../winsys/sw/fbdev/libfbdev.a
+endif
+
+ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
+LDADD += -lX11 -lXext -lXfixes
+LIBS += ../../../winsys/sw/xlib/libws_xlib.a
+endif
+
+ifneq ($(findstring kms, $(EGL_PLATFORMS)),)
+LDADD += -ldrm
+endif
+
+LIBS_D3D10 = ../dxgid3d10/libdxgid3d10.a ../gd3d10/libgd3d10.a $(LIBS)
+LIBS_D3D11 = ../dxgid3d11/libdxgid3d11.a ../gd3d11/libgd3d11.a $(LIBS)
+
 bin/d3d10tri: d3d10app/d3d10x11main.o d3d10tri/d3d10tri.o $(LIBS_D3D10)
$(CXX) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group  
$(LIBS_D3D10) -Wl,--end-group $(LDADD)
 

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


Mesa (master): d3d1x: link progs with CXXFLAGS

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Mon Sep 27 14:26:12 2010 +0200

d3d1x: link progs with CXXFLAGS

---

 src/gallium/state_trackers/d3d1x/progs/Makefile |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/progs/Makefile 
b/src/gallium/state_trackers/d3d1x/progs/Makefile
index 2f54079..938c77c 100644
--- a/src/gallium/state_trackers/d3d1x/progs/Makefile
+++ b/src/gallium/state_trackers/d3d1x/progs/Makefile
@@ -33,14 +33,14 @@ LIBS_D3D10 = ../dxgid3d10/libdxgid3d10.a 
../gd3d10/libgd3d10.a $(LIBS)
 LIBS_D3D11 = ../dxgid3d11/libdxgid3d11.a ../gd3d11/libgd3d11.a $(LIBS)
 
 bin/d3d10tri: d3d10app/d3d10x11main.o d3d10tri/d3d10tri.o $(LIBS_D3D10)
-   $(CXX) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group  
$(LIBS_D3D10) -Wl,--end-group $(LDADD)
+   $(CXX) $(CXXFLAGS) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group  
$(LIBS_D3D10) -Wl,--end-group $(LDADD)
 
 bin/d3d11tri: d3d11app/d3d11x11main.o d3d11tri/d3d11tri.o $(LIBS_D3D11)
-   $(CXX) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group  
$(LIBS_D3D11) -Wl,--end-group $(LDADD)
+   $(CXX) $(CXXFLAGS) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group  
$(LIBS_D3D11) -Wl,--end-group $(LDADD)
 
 bin/d3d11tex: d3d11app/d3d11x11main.o d3d11tex/d3d11tex.o $(LIBS_D3D11)
-   $(CXX) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group  
$(LIBS_D3D11) -Wl,--end-group $(LDADD)
+   $(CXX) $(CXXFLAGS) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group  
$(LIBS_D3D11) -Wl,--end-group $(LDADD)
 
 bin/d3d11gears: d3d11app/d3d11x11main.o d3d11gears/d3d11gears.o $(LIBS_D3D11)
-   $(CXX) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group  
$(LIBS_D3D11) -Wl,--end-group $(LDADD)
+   $(CXX) $(CXXFLAGS) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group  
$(LIBS_D3D11) -Wl,--end-group $(LDADD)
 

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


Mesa (master): d3d11: advertise IDXGIDevice1, not just IDXGIDevice

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Mon Sep 27 15:34:26 2010 +0200

d3d11: advertise IDXGIDevice1, not just IDXGIDevice

Fixes failure to create device in DirectX SDK samples.

---

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

diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h 
b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
index 2b613b8..af355f0 100644
--- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
+++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
@@ -1008,7 +1008,7 @@ COM_INTERFACE(IDXGIAdapter1, IDXGIAdapter)
 COM_INTERFACE(IDXGIFactory1, IDXGIFactory)
 
 templatetypename Base
-struct GalliumDXGIDevice : public GalliumMultiPrivateDataComObjectBase, 
IDXGIDevice
+struct GalliumDXGIDevice : public GalliumMultiPrivateDataComObjectBase, 
IDXGIDevice1
 {
ComPtrIDXGIAdapter adapter;
int priority;

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


Mesa (master): d3d11: ignore StructureByteStride

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Mon Sep 27 15:40:41 2010 +0200

d3d11: ignore StructureByteStride

D3D11 applications are allowed to pass a random value if the buffer
is not structured

---

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

diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h 
b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
index 1ecd67c..b7c6a44 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
@@ -804,10 +804,6 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
{
SYNCHRONIZED;
 
-#if API = 11
-   if(desc-StructureByteStride  1)
-   return E_NOTIMPL;
-#endif
struct pipe_resource* resource;
DXGI_USAGE dxgi_usage = d3d_to_dxgi_usage(desc-BindFlags, 
desc-MiscFlags);
HRESULT hr = create_resource(PIPE_BUFFER, desc-ByteWidth, 1, 
1, 1, 1, DXGI_FORMAT_R8_UNORM, 0, desc-Usage, desc-BindFlags, 
desc-CPUAccessFlags, desc-MiscFlags, initial_data, dxgi_usage, out_buffer ? 
resource : 0);

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


Mesa (master): d3d1x: link to libdrm for X11 platform too

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Mon Sep 27 16:15:44 2010 +0200

d3d1x: link to libdrm for X11 platform too

Thanks to Xavier Chantry.

---

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

diff --git a/src/gallium/state_trackers/d3d1x/progs/Makefile 
b/src/gallium/state_trackers/d3d1x/progs/Makefile
index 938c77c..143e531 100644
--- a/src/gallium/state_trackers/d3d1x/progs/Makefile
+++ b/src/gallium/state_trackers/d3d1x/progs/Makefile
@@ -21,7 +21,7 @@ LIBS += ../../../winsys/sw/fbdev/libfbdev.a
 endif
 
 ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
-LDADD += -lX11 -lXext -lXfixes
+LDADD += -ldrm -lX11 -lXext -lXfixes
 LIBS += ../../../winsys/sw/xlib/libws_xlib.a
 endif
 

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


Mesa (master): ureg: support centroid interpolation

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Mon Sep 27 18:07:45 2010 +0200

ureg: support centroid interpolation

---

 src/gallium/auxiliary/tgsi/tgsi_ureg.c |   16 +++-
 src/gallium/auxiliary/tgsi/tgsi_ureg.h |   24 
 2 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 3cf6893..7d13a17 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -96,7 +96,8 @@ struct ureg_program
   unsigned semantic_name;
   unsigned semantic_index;
   unsigned interp;
-  unsigned cylindrical_wrap;
+  unsigned char cylindrical_wrap;
+  unsigned char centroid;
} fs_input[UREG_MAX_INPUT];
unsigned nr_fs_inputs;
 
@@ -286,11 +287,12 @@ ureg_property_fs_coord_pixel_center(struct ureg_program 
*ureg,
 
 
 struct ureg_src
-ureg_DECL_fs_input_cyl(struct ureg_program *ureg,
+ureg_DECL_fs_input_cyl_centroid(struct ureg_program *ureg,
unsigned semantic_name,
unsigned semantic_index,
unsigned interp_mode,
-   unsigned cylindrical_wrap)
+   unsigned cylindrical_wrap,
+   unsigned centroid)
 {
unsigned i;
 
@@ -306,6 +308,7 @@ ureg_DECL_fs_input_cyl(struct ureg_program *ureg,
   ureg-fs_input[i].semantic_index = semantic_index;
   ureg-fs_input[i].interp = interp_mode;
   ureg-fs_input[i].cylindrical_wrap = cylindrical_wrap;
+  ureg-fs_input[i].centroid = centroid;
   ureg-nr_fs_inputs++;
} else {
   set_bad(ureg);
@@ -1126,7 +1129,8 @@ emit_decl_fs(struct ureg_program *ureg,
  unsigned semantic_name,
  unsigned semantic_index,
  unsigned interpolate,
- unsigned cylindrical_wrap)
+ unsigned cylindrical_wrap,
+ unsigned centroid)
 {
union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, 3);
 
@@ -1138,6 +1142,7 @@ emit_decl_fs(struct ureg_program *ureg,
out[0].decl.Interpolate = interpolate;
out[0].decl.Semantic = 1;
out[0].decl.CylindricalWrap = cylindrical_wrap;
+   out[0].decl.Centroid = centroid;
 
out[1].value = 0;
out[1].decl_range.First = index;
@@ -1287,7 +1292,8 @@ static void emit_decls( struct ureg_program *ureg )
   ureg-fs_input[i].semantic_name,
   ureg-fs_input[i].semantic_index,
   ureg-fs_input[i].interp,
-  ureg-fs_input[i].cylindrical_wrap);
+  ureg-fs_input[i].cylindrical_wrap,
+  ureg-fs_input[i].centroid);
   }
} else {
   for (i = 0; i  ureg-nr_gs_inputs; i++) {
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
index 07fb01a..acc4632 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
@@ -158,11 +158,27 @@ ureg_property_fs_coord_pixel_center(struct ureg_program 
*ureg,
  */
 
 struct ureg_src
-ureg_DECL_fs_input_cyl(struct ureg_program *,
+ureg_DECL_fs_input_cyl_centroid(struct ureg_program *,
unsigned semantic_name,
unsigned semantic_index,
unsigned interp_mode,
-   unsigned cylindrical_wrap);
+   unsigned cylindrical_wrap,
+   unsigned centroid);
+
+static INLINE struct ureg_src
+ureg_DECL_fs_input_cyl(struct ureg_program *ureg,
+   unsigned semantic_name,
+   unsigned semantic_index,
+   unsigned interp_mode,
+   unsigned cylindrical_wrap)
+{
+   return ureg_DECL_fs_input_cyl_centroid(ureg,
+ semantic_name,
+ semantic_index,
+ interp_mode,
+ cylindrical_wrap,
+ 0);
+}
 
 static INLINE struct ureg_src
 ureg_DECL_fs_input(struct ureg_program *ureg,
@@ -170,11 +186,11 @@ ureg_DECL_fs_input(struct ureg_program *ureg,
unsigned semantic_index,
unsigned interp_mode)
 {
-   return ureg_DECL_fs_input_cyl(ureg,
+   return ureg_DECL_fs_input_cyl_centroid(ureg,
  semantic_name,
  semantic_index,
  interp_mode,
- 0);
+ 0, 0);
 }
 
 struct ureg_src

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

Mesa (master): d3d1x: support centroid interpolation

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Mon Sep 27 18:08:58 2010 +0200

d3d1x: support centroid interpolation

---

 .../state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp|   26 ---
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp 
b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp
index 66b6866..615ce8c 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp
+++ b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp
@@ -37,18 +37,24 @@
 #define fail(x) throw(x)
 #endif
 
-static unsigned sm4_to_pipe_interpolation[] =
+struct tgsi_interpolation
 {
-   TGSI_INTERPOLATE_PERSPECTIVE, /* UNDEFINED */
-   TGSI_INTERPOLATE_CONSTANT,
-   TGSI_INTERPOLATE_PERSPECTIVE, /* LINEAR */
-   TGSI_INTERPOLATE_PERSPECTIVE, /* LINEAR_CENTROID */
-   TGSI_INTERPOLATE_LINEAR, /* LINEAR_NOPERSPECTIVE */
-   TGSI_INTERPOLATE_LINEAR, /* LINEAR_NOPERSPECTIVE_CENTROID */
+   unsigned interpolation;
+   bool centroid;
+};
+
+static tgsi_interpolation sm4_to_pipe_interpolation[] =
+{
+   {TGSI_INTERPOLATE_PERSPECTIVE, false}, /* UNDEFINED */
+   {TGSI_INTERPOLATE_CONSTANT, false},
+   {TGSI_INTERPOLATE_PERSPECTIVE, false}, /* LINEAR */
+   {TGSI_INTERPOLATE_PERSPECTIVE, true}, /* LINEAR_CENTROID */
+   {TGSI_INTERPOLATE_LINEAR, false}, /* LINEAR_NOPERSPECTIVE */
+   {TGSI_INTERPOLATE_LINEAR, true}, /* LINEAR_NOPERSPECTIVE_CENTROID */
 
// Added in D3D10.1
-   TGSI_INTERPOLATE_PERSPECTIVE, /* LINEAR_SAMPLE */
-   TGSI_INTERPOLATE_LINEAR, /* LINEAR_NOPERSPECTIVE_SAMPLE */
+   {TGSI_INTERPOLATE_PERSPECTIVE, true}, /* LINEAR_SAMPLE */
+   {TGSI_INTERPOLATE_LINEAR, true}, /* LINEAR_NOPERSPECTIVE_SAMPLE */
 };
 
 static int sm4_to_pipe_sv[] =
@@ -741,7 +747,7 @@ next:;
check(idx = 0);
if(inputs.size() = (unsigned)idx)
inputs.resize(idx + 1);
-   inputs[idx] = ureg_DECL_fs_input(ureg, 
TGSI_SEMANTIC_GENERIC, idx, 
sm4_to_pipe_interpolation[dcl.dcl_input_ps.interpolation]);
+   inputs[idx] = 
ureg_DECL_fs_input_cyl_centroid(ureg, TGSI_SEMANTIC_GENERIC, idx, 
sm4_to_pipe_interpolation[dcl.dcl_input_ps.interpolation].interpolation, 0, 
sm4_to_pipe_interpolation[dcl.dcl_input_ps.interpolation].centroid);
break;
case SM4_OPCODE_DCL_OUTPUT:
check(idx = 0);

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


Mesa (master): d3d1x: put proper calling convention in headers, fixes 64-bit builds

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Mon Sep 27 19:30:34 2010 +0200

d3d1x: put proper calling convention in headers, fixes 64-bit builds

---

 .../d3d1x/gd3dapi/galliumd3d10_1.idl   |2 +-
 .../state_trackers/d3d1x/gd3dapi/galliumd3d11.idl  |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl 
b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl
index d2b72f5..40a0d6a 100644
--- a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl
+++ b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl
@@ -27,4 +27,4 @@
 import ocidl.idl;
 import d3d10_1.idl;
 
-HRESULT GalliumD3D10DeviceCreate1(struct pipe_screen* screen, struct 
pipe_context* context, BOOL owns_context, unsigned creation_flags, 
IDXGIAdapter* adapter, ID3D10Device1** ppDevice);
+HRESULT __stdcall GalliumD3D10DeviceCreate1(struct pipe_screen* screen, struct 
pipe_context* context, BOOL owns_context, unsigned creation_flags, 
IDXGIAdapter* adapter, ID3D10Device1** ppDevice);
diff --git a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl 
b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl
index 640cbfa..4dca1bc 100644
--- a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl
+++ b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl
@@ -27,5 +27,5 @@
 import ocidl.idl;
 import d3d11.idl;
 
-HRESULT GalliumD3D11DeviceCreate(struct pipe_screen* screen, struct 
pipe_context* context, BOOL owns_context, unsigned creation_flags, 
IDXGIAdapter* adapter, ID3D11Device** ppDevice);
+HRESULT __stdcall GalliumD3D11DeviceCreate(struct pipe_screen* screen, struct 
pipe_context* context, BOOL owns_context, unsigned creation_flags, 
IDXGIAdapter* adapter, ID3D11Device** ppDevice);
 

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


Mesa (master): d3d1x: rework DXGI for occlusion testing and default width/ height

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Mon Sep 27 20:25:17 2010 +0200

d3d1x: rework DXGI for occlusion testing and default width/height

---

 .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp  |   89 ++-
 .../state_trackers/d3d1x/gd3dapi/galliumdxgi.idl   |   26 +-
 .../state_trackers/d3d1x/winedlls/dxgi/dxgi_dll.c  |   88 +++
 3 files changed, 174 insertions(+), 29 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 a75a953..e1c3461 100644
--- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
+++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
@@ -65,10 +65,12 @@ struct GalliumDXGIObject : public 
GalliumPrivateDataComObjectBase
 
 COM_INTERFACE(IGalliumDXGIBackend, IUnknown)
 
+// TODO: somehow check whether the window is fully obscured or not
 struct GalliumDXGIIdentityBackend : public 
GalliumComObjectIGalliumDXGIBackend
 {
-   virtual void * STDMETHODCALLTYPE BeginPresent(
+   virtual HRESULT STDMETHODCALLTYPE BeginPresent(
HWND hwnd,
+   void** present_cookie,
void** window,
RECT *rect,
RGNDATA **rgndata,
@@ -84,7 +86,8 @@ struct GalliumDXGIIdentityBackend : public 
GalliumComObjectIGalliumDXGIBackend
 
// yes, because we like things looking good
*preserve_aspect_ratio = TRUE;
-   return 0;
+   *present_cookie = 0;
+   return S_OK;
}
 
virtual void STDMETHODCALLTYPE EndPresent(
@@ -92,6 +95,45 @@ struct GalliumDXGIIdentityBackend : public 
GalliumComObjectIGalliumDXGIBackend
void* present_cookie
)
{}
+
+   virtual HRESULT STDMETHODCALLTYPE TestPresent(HWND hwnd)
+   {
+   return S_OK;
+   }
+
+virtual HRESULT STDMETHODCALLTYPE GetPresentSize(
+HWND hwnd,
+unsigned* width,
+unsigned* height
+)
+{
+*width = 0;
+*height = 0;
+return S_OK;
+}
+};
+
+// TODO: maybe install an X11 error hook, so we can return errors properly
+struct GalliumDXGIX11IdentityBackend : public GalliumDXGIIdentityBackend
+{
+   Display* dpy;
+
+   GalliumDXGIX11IdentityBackend(Display* dpy)
+   : dpy(dpy)
+   {}
+
+   virtual HRESULT STDMETHODCALLTYPE GetPresentSize(
+   HWND hwnd,
+   unsigned* width,
+   unsigned* height
+   )
+{
+   XWindowAttributes xwa;
+   XGetWindowAttributes(dpy, (Window)hwnd, xwa);
+   *width = xwa.width;
+   *height = xwa.height;
+   return S_OK;
+}
 };
 
 struct GalliumDXGIFactory : public GalliumDXGIObjectIDXGIFactory1, IUnknown
@@ -107,6 +149,8 @@ struct GalliumDXGIFactory : public 
GalliumDXGIObjectIDXGIFactory1, IUnknown
 {
if(p_backend)
backend = p_backend;
+   else if(!strcmp(platform-name, X11))
+   backend.reset(new 
GalliumDXGIX11IdentityBackend((Display*)display));
else
backend.reset(new GalliumDXGIIdentityBackend());
}
@@ -887,6 +931,10 @@ struct GalliumDXGISwapChain : public 
GalliumDXGIObjectIDXGISwapChain, GalliumDX
 
blitter.reset(new dxgi_blitter(pipe));
window = 0;
+
+   hr = resolve_zero_width_height(true);
+   if(!SUCCEEDED(hr))
+   throw hr;
}
 
void init_for_window()
@@ -1006,12 +1054,36 @@ struct GalliumDXGISwapChain : public 
GalliumDXGIObjectIDXGISwapChain, GalliumDX
return true;
}
 
+   HRESULT resolve_zero_width_height(bool force = false)
+   {
+   if(!force  desc.BufferDesc.Width  desc.BufferDesc.Height)
+   return S_OK;
+
+   unsigned width, height;
+   HRESULT hr = parent-backend-GetPresentSize(desc.OutputWindow, 
width, height);
+   if(!SUCCEEDED(hr))
+   return hr;
+
+   // On Windows, 8 is used, and a debug message saying so gets 
printed
+   if(!width)
+   width = 8;
+   if(!height)
+   height = 8;
+
+   if(!desc.BufferDesc.Width)
+   desc.BufferDesc.Width = width;
+   if(!desc.BufferDesc.Height)
+   desc.BufferDesc.Height = height;
+   return S_OK;
+   }
+
virtual HRESULT STDMETHODCALLTYPE Present(
UINT sync_interval

Mesa (master): d3d1x: fix Map

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Mon Sep 27 21:40:13 2010 +0200

d3d1x: fix Map

---

 .../state_trackers/d3d1x/gd3d11/d3d11_context.h|   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h 
b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
index 4abb4ac..3611059 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
@@ -1433,6 +1433,10 @@ changed:
return sr;
}
 
+   /* TODO: deferred contexts will need a different implementation of this,
+* because we can't put the transfer info into the resource itself.
+* Also, there are very different restrictions, for obvious reasons.
+*/
virtual HRESULT STDMETHODCALLTYPE Map(
ID3D11Resource *iresource,
unsigned subresource,
@@ -1445,8 +1449,7 @@ changed:
if(resource-transfers.count(subresource))
return E_FAIL;
pipe_subresource sr = 
d3d11_to_pipe_subresource(resource-resource, subresource);
-   pipe_box box;
-   d3d11_to_pipe_box(resource-resource, sr.level, 0);
+   pipe_box box = d3d11_to_pipe_box(resource-resource, sr.level, 
0);
unsigned usage = 0;
if(map_type == D3D11_MAP_READ)
usage = PIPE_TRANSFER_READ;
@@ -1470,8 +1473,7 @@ changed:
return E_FAIL;
}
resource-transfers[subresource] = transfer;
-   pipe-transfer_map(pipe, transfer);
-   mapped_resource-pData = transfer-data;
+   mapped_resource-pData = pipe-transfer_map(pipe, transfer);
mapped_resource-RowPitch = transfer-stride;
mapped_resource-DepthPitch = transfer-slice_stride;
return S_OK;

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


Mesa (d3d1x-addons): egl_g3d: don't drop single-buffered configs

2010-09-27 Thread Luca Barbieri
Module: Mesa
Branch: d3d1x-addons
Commit: 3cd630e81fc3d861cfd55c86d0724ea2fced6b08
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3cd630e81fc3d861cfd55c86d0724ea2fced6b08

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Fri Sep 24 14:53:34 2010 +0200

egl_g3d: don't drop single-buffered configs

This is needed to be able to use EGL on any existing X window, and
seems a good idea in general,

Rejecting single-buffered configs should be done in EGL itself if
necessary, and not in the native API.

---

 src/gallium/state_trackers/egl/x11/native_dri2.c |4 
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c 
b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 1be1e42..1169e27 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -518,10 +518,6 @@ dri2_display_convert_config(struct native_display *ndpy,
if (!(mode-renderType  GLX_RGBA_BIT) || !mode-rgbMode)
   return FALSE;
 
-   /* skip single-buffered configs */
-   if (!mode-doubleBufferMode)
-  return FALSE;
-
/* only interested in native renderable configs */
if (!mode-xRenderable || !mode-drawableType)
   return FALSE;

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


Mesa (master): d3d11: fix reference counting so devices get freed

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Mon Sep 27 22:52:34 2010 +0200

d3d11: fix reference counting so devices get freed

---

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

diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h 
b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
index 9852daf..95ea4e0 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
@@ -145,6 +145,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
 
 #if API = 11
immediate_context = 
GalliumD3D11ImmediateDeviceContext_Create(this, immediate_pipe, 
owns_immediate_pipe);
+   // release to the reference to ourselves that the immediate 
context took, to avoid a garbage cycle
+   immediate_context-Release();
 #endif
}
 

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


Mesa (master): d3d1x: work around crash in widl

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

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

d3d1x: work around crash in widl

---

 .../d3d1x/gd3dapi/galliumd3d10_1.idl   |7 ++-
 .../state_trackers/d3d1x/gd3dapi/galliumd3d11.idl  |7 ++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl 
b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl
index 40a0d6a..dddb343 100644
--- a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl
+++ b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d10_1.idl
@@ -27,4 +27,9 @@
 import ocidl.idl;
 import d3d10_1.idl;
 
-HRESULT __stdcall GalliumD3D10DeviceCreate1(struct pipe_screen* screen, struct 
pipe_context* context, BOOL owns_context, unsigned creation_flags, 
IDXGIAdapter* adapter, ID3D10Device1** ppDevice);
+// just adding __stdcall to the function makes at least one version of widl 
crash
+[object, local]
+interface IDummyInterfaceToPutWidlInComModeForGalliumD3D10
+{}
+
+HRESULT GalliumD3D10DeviceCreate1(struct pipe_screen* screen, struct 
pipe_context* context, BOOL owns_context, unsigned creation_flags, 
IDXGIAdapter* adapter, ID3D10Device1** ppDevice);
diff --git a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl 
b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl
index 4dca1bc..76f8a7f 100644
--- a/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl
+++ b/src/gallium/state_trackers/d3d1x/gd3dapi/galliumd3d11.idl
@@ -27,5 +27,10 @@
 import ocidl.idl;
 import d3d11.idl;
 
-HRESULT __stdcall GalliumD3D11DeviceCreate(struct pipe_screen* screen, struct 
pipe_context* context, BOOL owns_context, unsigned creation_flags, 
IDXGIAdapter* adapter, ID3D11Device** ppDevice);
+// just adding __stdcall to the function makes at least one version of widl 
crash
+[object, local]
+interface IDummyInterfaceToPutWidlInComModeForGalliumD3D11
+{}
+
+HRESULT GalliumD3D11DeviceCreate(struct pipe_screen* screen, struct 
pipe_context* context, BOOL owns_context, unsigned creation_flags, 
IDXGIAdapter* adapter, ID3D11Device** ppDevice);
 

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


Mesa (master): d3d1x: add shader dumping

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 18:03:06 2010 +0200

d3d1x: add shader dumping

---

 src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp  |1 +
 .../state_trackers/d3d1x/gd3d11/d3d11_screen.h |   10 ++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp 
b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp
index 962bea5..42678fa 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp
@@ -30,6 +30,7 @@ extern C
 {
 #include util/u_gen_mipmap.h
 #include tgsi/tgsi_ureg.h
+#include tgsi/tgsi_dump.h
 #include cso_cache/cso_context.h
 }
 
diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h 
b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
index 61b1ba2..c411170 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
@@ -24,6 +24,8 @@
  *
  **/
 
+DEBUG_GET_ONCE_BOOL_OPTION(dump_shaders, D3D1X_DUMP_SHADERS, FALSE);
+
 /* These cap sets are much more correct than the ones in u_caps.c */
 /* TODO: it seems cube levels should be the same as 2D levels */
 
@@ -1166,6 +1168,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
 #endif
)
{
+   bool dump = debug_get_option_dump_shaders();
+
dxbc_chunk_header* sm4_chunk = 
dxbc_find_shader_bytecode(shader_bytecode, bytecode_length);
if(!sm4_chunk)
return 0;
@@ -1174,12 +1178,18 @@ struct GalliumD3D11ScreenImpl : public 
GalliumD3D11Screen
if(!sm4.get())
return 0;
 
+   if(dump)
+   sm4-dump();
+
struct pipe_shader_state tgsi_shader;
memset(tgsi_shader, 0, sizeof(tgsi_shader));
tgsi_shader.tokens = (const tgsi_token*)sm4_to_tgsi(*sm4);
if(!tgsi_shader.tokens)
return 0;
 
+   if(dump)
+   tgsi_dump(tgsi_shader.tokens, 0);
+
void* shader_cso;
GalliumD3D11Shader* shader;
 

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


Mesa (master): d3d1x: add untested support for geometry shader translation

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 18:03:34 2010 +0200

d3d1x: add untested support for geometry shader translation

---

 .../d3d1x/d3d1xstutil/include/d3d1xstutil.h|6 +++
 .../d3d1x/d3d1xstutil/src/d3d_sm4_enums.cpp|   42 
 .../state_trackers/d3d1x/gd3d1x/d3d1x_private.h|3 -
 .../state_trackers/d3d1x/gd3d1x/d3d_enums.cpp  |   24 ---
 .../state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp|   31 +--
 5 files changed, 75 insertions(+), 31 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h 
b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
index 313aa10..2b613b8 100644
--- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
+++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
@@ -62,6 +62,12 @@ extern C
 #undef max
 #endif
 
+#define D3D_PRIMITIVE_TOPOLOGY_COUNT 65
+extern unsigned d3d_to_pipe_prim[D3D_PRIMITIVE_TOPOLOGY_COUNT];
+
+#define D3D_PRIMITIVE_COUNT 40
+extern unsigned d3d_to_pipe_prim_type[D3D_PRIMITIVE_COUNT];
+
 /* NOTE: this _depends_ on the vtable layout of the C++ compiler to be
  * binary compatible with Windows.
  * Furthermore some absurd vtable layout likely won't work at all, since
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/src/d3d_sm4_enums.cpp 
b/src/gallium/state_trackers/d3d1x/d3d1xstutil/src/d3d_sm4_enums.cpp
new file mode 100644
index 000..410a56c
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/src/d3d_sm4_enums.cpp
@@ -0,0 +1,42 @@
+#include d3d1xstutil.h
+
+unsigned d3d_to_pipe_prim[D3D_PRIMITIVE_TOPOLOGY_COUNT] =
+{
+   0,
+   PIPE_PRIM_POINTS,
+   PIPE_PRIM_LINES,
+   PIPE_PRIM_LINE_STRIP,
+   PIPE_PRIM_TRIANGLES,
+   PIPE_PRIM_TRIANGLE_STRIP,
+   PIPE_PRIM_LINES_ADJACENCY,
+   PIPE_PRIM_LINE_STRIP_ADJACENCY,
+   PIPE_PRIM_TRIANGLES_ADJACENCY,
+   PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY,
+   /* gap */
+   0, 0, 0, 0, 0, 0,
+   0, 0, 0, 0, 0, 0, 0, 0,
+   0, 0, 0, 0, 0, 0, 0, 0,
+   0,
+   /* patches */
+   0, 0, 0, 0, 0, 0, 0, 0,
+   0, 0, 0, 0, 0, 0, 0, 0,
+   0, 0, 0, 0, 0, 0, 0, 0,
+   0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+unsigned d3d_to_pipe_prim_type[D3D_PRIMITIVE_COUNT] =
+{
+   0,
+   PIPE_PRIM_POINTS,
+   PIPE_PRIM_LINES,
+   PIPE_PRIM_TRIANGLES,
+   0,
+   PIPE_PRIM_POINTS,
+   PIPE_PRIM_LINES_ADJACENCY,
+   PIPE_PRIM_TRIANGLES_ADJACENCY,
+   /* patches */
+   0, 0, 0, 0, 0, 0, 0, 0,
+   0, 0, 0, 0, 0, 0, 0, 0,
+   0, 0, 0, 0, 0, 0, 0, 0,
+   0, 0, 0, 0, 0, 0, 0, 0,
+};
diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h 
b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h
index d4b6a8f..977f0cd 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h
@@ -92,7 +92,4 @@ extern unsigned 
d3d11_to_pipe_wrap[D3D11_TEXTURE_ADDRESS_COUNT];
 extern unsigned d3d11_to_pipe_query[D3D11_QUERY_COUNT];
 extern unsigned d3d11_query_size[D3D11_QUERY_COUNT];
 
-#define D3D_PRIMITIVE_TOPOLOGY_COUNT 65
-extern unsigned d3d_to_pipe_prim[D3D_PRIMITIVE_TOPOLOGY_COUNT];
-
 #endif /* D3D1X_H_ */
diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp 
b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp
index 37113a6..853d114 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp
+++ b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d_enums.cpp
@@ -121,27 +121,3 @@ unsigned d3d11_query_size[D3D11_QUERY_COUNT] =
0,
0
 };
-
-unsigned d3d_to_pipe_prim[D3D_PRIMITIVE_TOPOLOGY_COUNT] =
-{
-   0,
-   PIPE_PRIM_POINTS,
-   PIPE_PRIM_LINES,
-   PIPE_PRIM_LINE_STRIP,
-   PIPE_PRIM_TRIANGLES,
-   PIPE_PRIM_TRIANGLE_STRIP,
-   PIPE_PRIM_LINES_ADJACENCY,
-   PIPE_PRIM_LINE_STRIP_ADJACENCY,
-   PIPE_PRIM_TRIANGLES_ADJACENCY,
-   PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY,
-   /* gap */
-   0, 0, 0, 0, 0, 0,
-   0, 0, 0, 0, 0, 0, 0, 0,
-   0, 0, 0, 0, 0, 0, 0, 0,
-   0,
-   /* patches */
-   0, 0, 0, 0, 0, 0, 0, 0,
-   0, 0, 0, 0, 0, 0, 0, 0,
-   0, 0, 0, 0, 0, 0, 0, 0,
-   0, 0, 0, 0, 0, 0, 0, 0,
-};
diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp 
b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp
index 4b43a33..7d03cec 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp
+++ b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp
@@ -24,6 +24,7 @@
  *
  **/
 
+#include d3d1xstutil.h
 #include sm4.h
 #include tgsi/tgsi_ureg.h
 #include vector

Mesa (master): d3d1x: fix CheckMultisampleQualityLevels

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 20:24:20 2010 +0200

d3d1x: fix CheckMultisampleQualityLevels

---

 .../state_trackers/d3d1x/gd3d11/d3d11_screen.h |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h 
b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
index c411170..528d32c 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
@@ -327,7 +327,10 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
{
SYNCHRONIZED;
 
-   *pcount = 0;
+   if(sample_count == 1)
+   *pcount = 1;
+   else
+   *pcount = 0;
return S_OK;
}
 

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


Mesa (master): d3d1x: don't assert on unsupported resource types

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 18:24:34 2010 +0200

d3d1x: don't assert on unsupported resource types

---

 .../state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp|   14 +++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp 
b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp
index 7d03cec..66b6866 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp
+++ b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp
@@ -720,14 +720,18 @@ next:;
break;
case SM4_OPCODE_DCL_INPUT:
check(idx = 0);
-   if(inputs.size() = (unsigned)idx)
-   inputs.resize(idx + 1);
if(processor == TGSI_PROCESSOR_VERTEX)
+   {
+   if(inputs.size() = (unsigned)idx)
+   inputs.resize(idx + 1);
inputs[idx] = ureg_DECL_vs_input(ureg, 
idx);
+   }
else if(processor == TGSI_PROCESSOR_GEOMETRY)
{
// TODO: is this correct?
unsigned gsidx = 
dcl.op-indices[1].disp;
+   if(inputs.size() = (unsigned)gsidx)
+   inputs.resize(gsidx + 1);
inputs[gsidx] = 
ureg_DECL_gs_input(ureg, gsidx, TGSI_SEMANTIC_GENERIC, gsidx);
}
else
@@ -789,7 +793,11 @@ next:;
targets[idx].second = 0;
break;
default:
-   check(0);
+   // HACK to make SimpleSample10 work
+   //check(0);
+   targets[idx].first = TGSI_TEXTURE_2D;
+   targets[idx].second = 
TGSI_TEXTURE_SHADOW2D;
+   break;
}
break;
case SM4_OPCODE_DCL_SAMPLER:

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


Mesa (master): d3d1x: draw to the correct buffer

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Fri Sep 24 09:12:33 2010 +0200

d3d1x: draw to the correct buffer

---

 .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp  |2 +-
 1 files changed, 1 insertions(+), 1 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 74bce59..ef256a8 100644
--- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
+++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
@@ -1045,7 +1045,7 @@ struct GalliumDXGISwapChain : public 
GalliumDXGIObjectIDXGISwapChain, GalliumDX
return DXGI_ERROR_DEVICE_REMOVED;
}
 
-   db = !!(config-buffer_mask  NATIVE_ATTACHMENT_BACK_LEFT);
+   db = !!(config-buffer_mask  (1  
NATIVE_ATTACHMENT_BACK_LEFT));
dst = resources[db ? NATIVE_ATTACHMENT_BACK_LEFT : 
NATIVE_ATTACHMENT_FRONT_LEFT];
src = gallium_buffer0;
dst_surface = 0;

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


Mesa (master): d3d1x: fix linking of dxbc2tgsi

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Fri Sep 24 09:49:51 2010 +0200

d3d1x: fix linking of dxbc2tgsi

---

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

diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile 
b/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile
index 924b2f1..a1ab425 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile
+++ b/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile
@@ -2,5 +2,5 @@ LIBNAME=gd3d1x
 CPP_SOURCES=$(wildcard *.cpp)
 LIBRARY_INCLUDES=-Iinclude -I../gd3dapi -I../d3dapi -I../w32api 
-I../d3d1xstutil/include -I../d3d1xshader/include -I../../../include 
-I../../../auxiliary -I../../../state_trackers/egl/common
 PROGS=tools/dxbc2tgsi
-LIBS=libgd3d1x.a ../d3d1xshader/libd3d1xshader.a 
../../../auxiliary/libgallium.a -ldl
+LIBS=libgd3d1x.a ../d3d1xshader/libd3d1xshader.a 
../d3d1xstutil/libd3d1xstutil.a ../../../auxiliary/libgallium.a -ldl
 include ../Makefile.inc

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


Mesa (d3d1x-addons): egl_g3d: don't drop single-buffered configs

2010-09-24 Thread Luca Barbieri
Module: Mesa
Branch: d3d1x-addons
Commit: 3cd630e81fc3d861cfd55c86d0724ea2fced6b08
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3cd630e81fc3d861cfd55c86d0724ea2fced6b08

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Fri Sep 24 14:53:34 2010 +0200

egl_g3d: don't drop single-buffered configs

This is needed to be able to use EGL on any existing X window, and
seems a good idea in general,

Rejecting single-buffered configs should be done in EGL itself if
necessary, and not in the native API.

---

 src/gallium/state_trackers/egl/x11/native_dri2.c |4 
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c 
b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 1be1e42..1169e27 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -518,10 +518,6 @@ dri2_display_convert_config(struct native_display *ndpy,
if (!(mode-renderType  GLX_RGBA_BIT) || !mode-rgbMode)
   return FALSE;
 
-   /* skip single-buffered configs */
-   if (!mode-doubleBufferMode)
-  return FALSE;
-
/* only interested in native renderable configs */
if (!mode-xRenderable || !mode-drawableType)
   return FALSE;

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


Mesa (master): nvfx: allow setting NULL constant buffers

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Fri Sep 24 14:12:24 2010 +0200

nvfx: allow setting NULL constant buffers

---

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

diff --git a/src/gallium/drivers/nvfx/nvfx_state.c 
b/src/gallium/drivers/nvfx/nvfx_state.c
index b767846..5461903 100644
--- a/src/gallium/drivers/nvfx/nvfx_state.c
+++ b/src/gallium/drivers/nvfx/nvfx_state.c
@@ -305,7 +305,7 @@ nvfx_set_constant_buffer(struct pipe_context *pipe, uint 
shader, uint index,
struct nvfx_context *nvfx = nvfx_context(pipe);
 
nvfx-constbuf[shader] = buf;
-   nvfx-constbuf_nr[shader] = buf-width0 / (4 * sizeof(float));
+   nvfx-constbuf_nr[shader] = buf ? (buf-width0 / (4 * sizeof(float))) : 
0;
 
if (shader == PIPE_SHADER_VERTEX) {
nvfx-dirty |= NVFX_NEW_VERTCONST;

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


Mesa (master): nvfx: add RGB framebuffer format support in addition to BGR

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Fri Sep 24 14:28:24 2010 +0200

nvfx: add RGB framebuffer format support in addition to BGR

---

 src/gallium/drivers/nvfx/nvfx_screen.c   |2 ++
 src/gallium/drivers/nvfx/nvfx_state_fb.c |6 ++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c 
b/src/gallium/drivers/nvfx/nvfx_screen.c
index 3f177b7..8024800 100644
--- a/src/gallium/drivers/nvfx/nvfx_screen.c
+++ b/src/gallium/drivers/nvfx/nvfx_screen.c
@@ -194,6 +194,8 @@ nvfx_screen_is_format_supported(struct pipe_screen *pscreen,
switch (format) {
case PIPE_FORMAT_B8G8R8A8_UNORM:
case PIPE_FORMAT_B8G8R8X8_UNORM:
+   case PIPE_FORMAT_R8G8B8A8_UNORM:
+   case PIPE_FORMAT_R8G8B8X8_UNORM:
case PIPE_FORMAT_B5G6R5_UNORM:
break;
case PIPE_FORMAT_R16G16B16A16_FLOAT:
diff --git a/src/gallium/drivers/nvfx/nvfx_state_fb.c 
b/src/gallium/drivers/nvfx/nvfx_state_fb.c
index 4ffc4de..30e48c8 100644
--- a/src/gallium/drivers/nvfx/nvfx_state_fb.c
+++ b/src/gallium/drivers/nvfx/nvfx_state_fb.c
@@ -140,6 +140,12 @@ nvfx_framebuffer_validate(struct nvfx_context *nvfx, 
unsigned prepare_result)
case 0:
rt_format |= NV30_3D_RT_FORMAT_COLOR_A8R8G8B8;
break;
+   case PIPE_FORMAT_R8G8B8X8_UNORM:
+   rt_format |= NV30_3D_RT_FORMAT_COLOR_X8B8G8R8;
+   break;
+   case PIPE_FORMAT_R8G8B8A8_UNORM:
+   rt_format |= NV30_3D_RT_FORMAT_COLOR_A8B8G8R8;
+   break;
case PIPE_FORMAT_B5G6R5_UNORM:
rt_format |= NV30_3D_RT_FORMAT_COLOR_R5G6B5;
break;

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


Mesa (master): d3d1x: don' t crash on drivers not supporting vertex or geometry sampling

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Fri Sep 24 14:28:31 2010 +0200

d3d1x: don't crash on drivers not supporting vertex or geometry sampling

---

 src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp  |1 +
 .../state_trackers/d3d1x/gd3d11/d3d11_context.h|   10 --
 .../state_trackers/d3d1x/gd3d11/d3d11_screen.h |4 
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp 
b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp
index 42678fa..27cfebc 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp
@@ -125,6 +125,7 @@ struct GalliumD3D11Caps
bool render_condition;
unsigned constant_buffers[D3D11_STAGES];
unsigned stages;
+   unsigned stages_with_sampling;
 };
 
 typedef GalliumDXGIDevice
diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h 
b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
index d7c1c92..4abb4ac 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
@@ -158,6 +158,12 @@ struct GalliumD3D10Device : public 
GalliumD3D10ScreenImplthreadsafe
}
if(!pipe-set_stream_output_buffers)
caps.so = false;
+   if(!pipe-set_geometry_sampler_views)
+   caps.stages_with_sampling =~ (1  
PIPE_SHADER_GEOMETRY);
+   if(!pipe-set_fragment_sampler_views)
+   caps.stages_with_sampling =~ (1  
PIPE_SHADER_FRAGMENT);
+   if(!pipe-set_vertex_sampler_views)
+   caps.stages_with_sampling =~ (1  PIPE_SHADER_VERTEX);
 
update_flags = 0;
 
@@ -505,7 +511,7 @@ struct GalliumD3D10Device : public 
GalliumD3D10ScreenImplthreadsafe
{
while(num_shader_resource_views[s]  
!sampler_views[s][num_shader_resource_views[s] - 1]) \
--num_shader_resource_views[s];
-   if(s  caps.stages)
+   if((1  s)  caps.stages_with_sampling)
{
struct pipe_sampler_view* 
views_to_bind[PIPE_MAX_SAMPLERS];
unsigned num_views_to_bind = shaders[s] ? 
shaders[s]-slot_to_resource.size() : 0;
@@ -532,7 +538,7 @@ struct GalliumD3D10Device : public 
GalliumD3D10ScreenImplthreadsafe
{
while(num_samplers[s]  
!sampler_csos[s].v[num_samplers[s] - 1])
--num_samplers[s];
-   if(s  caps.stages)
+   if((1  s)  caps.stages_with_sampling)
{
void* samplers_to_bind[PIPE_MAX_SAMPLERS];
unsigned num_samplers_to_bind = shaders[s] ? 
shaders[s]-slot_to_sampler.size() : 0;
diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h 
b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
index 528d32c..1ecd67c 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
@@ -101,6 +101,10 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
screen_caps.stages = i + 1;
}
 
+   screen_caps.stages_with_sampling = (1  screen_caps.stages) - 
1;
+   if(!screen-get_param(screen, 
PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS))
+   screen_caps.stages_with_sampling =~ (1  
PIPE_SHADER_VERTEX);
+
memset(format_support, 0xff, sizeof(format_support));
 
float default_level;

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


Mesa (master): d3d1x: stop using GLX in demos, just use the default visual

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Fri Sep 24 15:01:04 2010 +0200

d3d1x: stop using GLX in demos, just use the default visual

---

 src/gallium/state_trackers/d3d1x/progs/Makefile|2 +-
 .../d3d1x/progs/d3d10app/d3d10x11main.cpp  |   15 +++
 .../d3d1x/progs/d3d11app/d3d11x11main.cpp  |   15 +++
 3 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/progs/Makefile 
b/src/gallium/state_trackers/d3d1x/progs/Makefile
index 4766d36..bb37012 100644
--- a/src/gallium/state_trackers/d3d1x/progs/Makefile
+++ b/src/gallium/state_trackers/d3d1x/progs/Makefile
@@ -13,7 +13,7 @@ LIBS= \
../../../../../lib/libEGL.so
 LIBS_D3D10 = ../dxgid3d10/libdxgid3d10.a ../gd3d10/libgd3d10.a $(LIBS)
 LIBS_D3D11 = ../dxgid3d11/libdxgid3d11.a ../gd3d11/libgd3d11.a $(LIBS)
-LDADD=-lGL -lXext -lXfixes -lX11 -ldrm -ldl
+LDADD=-lXext -lXfixes -lX11 -ldrm -ldl
 
 all: bin/d3d10tri bin/d3d11tri bin/d3d11tex bin/d3d11gears
 include ../Makefile.inc
diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp 
b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp
index a8f24ae..efbe322 100755
--- a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp
+++ b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp
@@ -26,7 +26,6 @@
 
 #include d3d10app.h
 #include X11/Xlib.h
-#include GL/glx.h
 #include galliumdxgi.h
 #include sys/time.h
 
@@ -37,14 +36,6 @@ DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM;
 static ID3D10Device* dev;
 static ID3D10Device* ctx;
 
-static int attributeList[] = {
-   GLX_RGBA,
-   GLX_RED_SIZE, 8,
-   GLX_GREEN_SIZE, 8,
-   GLX_BLUE_SIZE, 8,
-   None
-};
-
 double get_time()
 {
struct timeval tv;
@@ -55,15 +46,15 @@ double get_time()
 int main(int argc, char** argv)
 {
Display* dpy = XOpenDisplay(0);
-   XVisualInfo* vi = glXChooseVisual(dpy, DefaultScreen(dpy), 
attributeList);
-   Colormap cmap = XCreateColormap(dpy, RootWindow(dpy, vi-screen), 
vi-visual, AllocNone);
+   Visual* visual = DefaultVisual(dpy, DefaultScreen(dpy));
+   Colormap cmap = XCreateColormap(dpy, RootWindow(dpy, 
DefaultScreen(dpy)), visual, AllocNone);
XSetWindowAttributes swa;
swa.colormap = cmap;
swa.border_pixel = 0;
swa.event_mask = StructureNotifyMask;
width = 512;
height = 512;
-   Window win = XCreateWindow(dpy, RootWindow(dpy, vi-screen), 0, 0, 
width, height, 0, vi-depth, InputOutput, vi-visual, CWBorderPixel | 
CWColormap| CWEventMask, swa);
+   Window win = XCreateWindow(dpy, RootWindow(dpy, DefaultScreen(dpy)), 0, 
0, width, height, 0, CopyFromParent, InputOutput, visual, CWBorderPixel | 
CWColormap| CWEventMask, swa);
XMapWindow(dpy, win);
 
GalliumDXGIUseX11Display(dpy, 0);
diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp 
b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp
index 8eb51d3..1271499 100755
--- a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp
+++ b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp
@@ -1,6 +1,5 @@
 #include d3d11app.h
 #include X11/Xlib.h
-#include GL/glx.h
 #include galliumdxgi.h
 #include sys/time.h
 
@@ -11,14 +10,6 @@ DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM;
 static ID3D11Device* dev;
 static ID3D11DeviceContext* ctx;
 
-static int attributeList[] = {
-   GLX_RGBA,
-   GLX_RED_SIZE, 8,
-   GLX_GREEN_SIZE, 8,
-   GLX_BLUE_SIZE, 8,
-   None
-};
-
 double get_time()
 {
struct timeval tv;
@@ -29,15 +20,15 @@ double get_time()
 int main(int argc, char** argv)
 {
Display* dpy = XOpenDisplay(0);
-   XVisualInfo* vi = glXChooseVisual(dpy, DefaultScreen(dpy), 
attributeList);
-   Colormap cmap = XCreateColormap(dpy, RootWindow(dpy, vi-screen), 
vi-visual, AllocNone);
+   Visual* visual = DefaultVisual(dpy, DefaultScreen(dpy));
+   Colormap cmap = XCreateColormap(dpy, RootWindow(dpy, 
DefaultScreen(dpy)), visual, AllocNone);
XSetWindowAttributes swa;
swa.colormap = cmap;
swa.border_pixel = 0;
swa.event_mask = StructureNotifyMask;
width = 512;
height = 512;
-   Window win = XCreateWindow(dpy, RootWindow(dpy, vi-screen), 0, 0, 
width, height, 0, vi-depth, InputOutput, vi-visual, CWBorderPixel | 
CWColormap| CWEventMask, swa);
+   Window win = XCreateWindow(dpy, RootWindow(dpy, DefaultScreen(dpy)), 0, 
0, width, height, 0, CopyFromParent, InputOutput, visual, CWBorderPixel | 
CWColormap| CWEventMask, swa);
XMapWindow(dpy, win);
 
GalliumDXGIUseX11Display(dpy, 0

Mesa (master): d3d1x: CRLF - LF in progs

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Fri Sep 24 15:08:57 2010 +0200

d3d1x: CRLF - LF in progs

---

 .../state_trackers/d3d1x/progs/d3d10app/d3d10app.h |  102 +-
 .../d3d1x/progs/d3d10app/d3d10winmain.cpp  |  376 +++---
 .../d3d1x/progs/d3d10app/d3d10x11main.cpp  |  308 +++---
 .../d3d1x/progs/d3d10tri/d3d10tri.cpp  |  236 ++--
 .../d3d1x/progs/d3d10tri/d3d10tri.hlsl.ps.h|  224 ++--
 .../d3d1x/progs/d3d10tri/d3d10tri.hlsl.vs.h|  256 ++--
 .../state_trackers/d3d1x/progs/d3d11app/d3d11app.h |  102 +-
 .../d3d1x/progs/d3d11app/d3d11blit.hlsl.ps.h   |  284 +++---
 .../d3d1x/progs/d3d11app/d3d11blit.hlsl.vs.h   |  260 ++--
 .../state_trackers/d3d1x/progs/d3d11app/d3d11u.h   |  848 +++---
 .../d3d1x/progs/d3d11app/d3d11winmain.cpp  |  344 +++---
 .../d3d1x/progs/d3d11app/d3d11x11main.cpp  |  228 ++--
 .../d3d1x/progs/d3d11gears/d3d11gears.cpp  | 1146 +-
 .../d3d1x/progs/d3d11gears/d3d11gears.hlsl.ps.h|  618 +-
 .../d3d1x/progs/d3d11gears/d3d11gears.hlsl.vs.h|  616 +-
 .../progs/d3d11spikysphere/d3d11spikysphere.cpp|  454 
 .../d3d11spikysphere/d3d11spikysphere.hlsl.ds.h| 1246 ++--
 .../d3d11spikysphere/d3d11spikysphere.hlsl.hs.h|  594 +-
 .../d3d11spikysphere/d3d11spikysphere.hlsl.ps.h|  422 
 .../d3d11spikysphere/d3d11spikysphere.hlsl.vs.h|  210 ++--
 .../d3d1x/progs/d3d11tex/d3d11tex.cpp  |  232 ++--
 .../d3d1x/progs/d3d11tex/d3d11tex.hlsl.ps.h|  468 
 .../d3d1x/progs/d3d11tex/d3d11tex.hlsl.vs.h|  306 +++---
 .../d3d1x/progs/d3d11tri/d3d11tri.cpp  |  240 ++--
 .../d3d1x/progs/d3d11tri/d3d11tri.hlsl.ps.h|  224 ++--
 .../d3d1x/progs/d3d11tri/d3d11tri.hlsl.vs.h|  256 ++--
 26 files changed, 5300 insertions(+), 5300 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=11547654295cadcfde69f6c2361f50a4cd17fc7a
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): d3d1x: fix deadlocks on non-recursive mutex

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 03:35:50 2010 +0200

d3d1x: fix deadlocks on non-recursive mutex

---

 .../state_trackers/d3d1x/gd3d11/d3d11_context.h|   20 +++-
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h 
b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
index 032cb0e..7e49c3a 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
@@ -901,7 +901,6 @@ struct GalliumD3D10Device : public 
GalliumD3D10ScreenImplthreadsafe
 
void set_clip()
{
-   SYNCHRONIZED;
pipe_clip_state clip;
clip.nr = 0;
clip.depth_clamp = depth_clamp;
@@ -1588,7 +1587,7 @@ changed:
}
 #endif
 
-   virtual void STDMETHODCALLTYPE RestoreGalliumStateBlitOnly()
+   void restore_gallium_state_blit_only()
{
pipe-bind_blend_state(pipe, blend_state.p ? 
blend_state.p-object : default_blend);
pipe-bind_depth_stencil_alpha_state(pipe, 
depth_stencil_state.p ? depth_stencil_state.p-object : default_depth_stencil);
@@ -1607,6 +1606,12 @@ changed:
update_flags |= UPDATE_VERTEX_BUFFERS | (1  
(UPDATE_SAMPLERS_SHIFT + D3D11_STAGE_PS)) | (1  (UPDATE_VIEWS_SHIFT + 
D3D11_STAGE_PS));
}
 
+   virtual void STDMETHODCALLTYPE RestoreGalliumStateBlitOnly()
+   {
+   SYNCHRONIZED;
+   restore_gallium_state_blit_only();
+   }
+
virtual void STDMETHODCALLTYPE GenerateMips(
__in  ID3D11ShaderResourceView *pShaderResourceView)
{
@@ -1620,13 +1625,13 @@ changed:
if(pipe-render_condition)
pipe-render_condition(pipe, 0, 0);
util_gen_mipmap(gen_mipmap, view-object, 0, 0, 
view-object-texture-last_level, PIPE_TEX_FILTER_LINEAR);
-   RestoreGalliumStateBlitOnly();
+   restore_gallium_state_blit_only();
}
 
virtual void STDMETHODCALLTYPE RestoreGalliumState()
{
SYNCHRONIZED;
-   RestoreGalliumStateBlitOnly();
+   restore_gallium_state_blit_only();
 
set_index_buffer();
set_stencil_ref();
@@ -1707,7 +1712,12 @@ changed:
 
virtual void STDMETHODCALLTYPE ClearState(void)
{
-   SYNCHRONIZED;
+   /* we don't take a lock here because we would deadlock otherwise
+* TODO: this is probably incorrect, because ClearState should 
likely be atomic.
+* However, I can't think of any correct usage that would be 
affected by this
+* being non-atomic, and making this atomic is quite expensive 
and complicates
+* the code
+*/
 
// we qualify all calls so that we avoid virtual dispatch and 
might get them inlined
// TODO: make sure all this gets inlined, which might require 
more compiler flags

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


Mesa (master): d3d1x: bind NULL CSOs before destroying default CSOs on context dtor

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 03:49:17 2010 +0200

d3d1x: bind NULL CSOs before destroying default CSOs on context dtor

Otherwise softpipe and llvmpipe assert.

---

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

diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h 
b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
index 7e49c3a..3c789d3 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
@@ -267,14 +267,32 @@ struct GalliumD3D10Device : public 
GalliumD3D10ScreenImplthreadsafe
{
util_destroy_gen_mipmap(gen_mipmap);
cso_destroy_context(cso_ctx);
+
+   pipe-bind_vertex_elements_state(pipe, 0);
pipe-delete_vertex_elements_state(pipe, default_input_layout);
+
+   pipe-bind_rasterizer_state(pipe, 0);
pipe-delete_rasterizer_state(pipe, default_rasterizer);
+
+   pipe-bind_depth_stencil_alpha_state(pipe, 0);
pipe-delete_depth_stencil_alpha_state(pipe, 
default_depth_stencil);
+
+   pipe-bind_blend_state(pipe, 0);
pipe-delete_blend_state(pipe, default_blend);
+
+   pipe-bind_fragment_sampler_states(pipe, 0, 0);
+   pipe-bind_vertex_sampler_states(pipe, 0, 0);
+   if(pipe-bind_geometry_sampler_states)
+   pipe-bind_geometry_sampler_states(pipe, 0, 0);
pipe-delete_sampler_state(pipe, default_sampler);
pipe-delete_sampler_state(pipe, ld_sampler);
+
+   pipe-bind_fs_state(pipe, 0);
pipe-delete_fs_state(pipe, 
default_shaders[PIPE_SHADER_FRAGMENT]);
+
+   pipe-bind_vs_state(pipe, 0);
pipe-delete_vs_state(pipe, 
default_shaders[PIPE_SHADER_VERTEX]);
+
if(owns_pipe)
pipe-destroy(pipe);
}

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


Mesa (master): d3d1x: initialize the mutex

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 11:58:09 2010 +0200

d3d1x: initialize the mutex

---

 .../d3d1x/d3d1xstutil/include/d3d1xstutil.h|5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h 
b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
index 7627720..974518a 100644
--- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
+++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
@@ -675,6 +675,11 @@ struct maybe_mutex_ttrue
 {
pipe_mutex mutex;
 
+   maybe_mutex_t()
+   {
+   pipe_mutex_init(mutex);
+   }
+
void lock()
{
pipe_mutex_lock(mutex);

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


Mesa (master): d3d1x: autogenerate shader enums and text from def files

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 13:17:45 2010 +0200

d3d1x: autogenerate shader enums and text from def files

This avoids the duplication in tpf.h and tpf_text.cpp

---

 .../state_trackers/d3d1x/d3d1xshader/Makefile  |6 +
 .../d3d1x/d3d1xshader/defs/files.txt   |   41 ++
 .../d3d1x/d3d1xshader/defs/interpolations.txt  |8 +
 .../d3d1x/d3d1xshader/defs/opcodes.txt |  207 ++
 .../d3d1x/d3d1xshader/defs/operand_compnums.txt|5 +
 .../d3d1x/d3d1xshader/defs/operand_index_reprs.txt |5 +
 .../d3d1x/d3d1xshader/defs/operand_modes.txt   |4 +
 .../d3d1x/d3d1xshader/defs/shortfiles.txt  |   41 ++
 .../state_trackers/d3d1x/d3d1xshader/defs/svs.txt  |   23 ++
 .../d3d1x/d3d1xshader/defs/targets.txt |   13 +
 .../defs/token_instruction_extended_types.txt  |4 +
 .../defs/token_operand_extended_types.txt  |2 +
 .../state_trackers/d3d1x/d3d1xshader/gen-header.sh |   13 +
 .../state_trackers/d3d1x/d3d1xshader/gen-text.sh   |   11 +
 .../state_trackers/d3d1x/d3d1xshader/include/tpf.h |  404 +---
 .../d3d1x/d3d1xshader/src/tpf_parse.cpp|   10 +-
 .../d3d1x/d3d1xshader/src/tpf_text.cpp |  385 ---
 17 files changed, 390 insertions(+), 792 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile 
b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile
index 8c8e2fb..866762e 100644
--- a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile
@@ -5,3 +5,9 @@ PROGS=tools/fxdis
 LIBS=libd3d1xshader.a
 
 include ../Makefile.inc
+
+include/tpf_defs.h: $(wildcard defs/*.txt)
+   ./gen-header.sh $^  $@
+
+src/tpf_text.cpp: $(wildcard defs/*.txt)
+   ./gen-text.sh $^  $@
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/files.txt 
b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/files.txt
new file mode 100644
index 000..c44a46b
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/files.txt
@@ -0,0 +1,41 @@
+temp
+input
+output
+indexable_temp
+immediate32
+immediate64
+sampler
+resource
+constant_buffer
+immediate_constant_buffer
+label
+input_primitiveid
+output_depth
+null
+rasterizer
+output_coverage_mask
+stream
+function_body
+function_table
+interface
+function_input
+function_output
+output_control_point_id
+input_fork_instance_id
+input_join_instance_id
+input_control_point
+output_control_point
+input_patch_constant
+input_domain_point
+this_pointer
+unordered_access_view
+thread_group_shared_memory
+input_thread_id
+input_thread_group_id
+input_thread_id_in_group
+input_coverage_mask
+input_thread_id_in_group_flattened
+input_gs_instance_id
+output_depth_greater_equal
+output_depth_less_equal
+cycle_counter
diff --git 
a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/interpolations.txt 
b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/interpolations.txt
new file mode 100644
index 000..4e52eec
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/interpolations.txt
@@ -0,0 +1,8 @@
+undefined
+constant
+linear
+linear centroid
+linear noperspective
+linear noperspective centroid
+linear sample
+linear noperspective sample
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/opcodes.txt 
b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/opcodes.txt
new file mode 100644
index 000..46ff28d
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/opcodes.txt
@@ -0,0 +1,207 @@
+add
+and
+break
+breakc
+call
+callc
+case
+continue
+continuec
+cut
+default
+deriv_rtx
+deriv_rty
+discard
+div
+dp2
+dp3
+dp4
+else
+emit
+emitthencut
+endif
+endloop
+endswitch
+eq
+exp
+frc
+ftoi
+ftou
+ge
+iadd
+if
+ieq
+ige
+ilt
+imad
+imax
+imin
+imul
+ine
+ineg
+ishl
+ishr
+itof
+label
+ld
+ld_ms
+log
+loop
+lt
+mad
+min
+max
+customdata
+mov
+movc
+mul
+ne
+nop
+not
+or
+resinfo
+ret
+retc
+round_ne
+round_ni
+round_pi
+round_z
+rsq
+sample
+sample_c
+sample_c_lz
+sample_l
+sample_d
+sample_b
+sqrt
+switch
+sincos
+udiv
+ult
+uge
+umul
+umad
+umax
+umin
+ushr
+utof
+xor
+dcl_resource
+dcl_constant_buffer
+dcl_sampler
+dcl_index_range
+dcl_gs_output_primitive_topology
+dcl_gs_input_primitive
+dcl_max_output_vertex_count
+dcl_input
+dcl_input_sgv
+dcl_input_siv
+dcl_input_ps
+dcl_input_ps_sgv
+dcl_input_ps_siv
+dcl_output
+dcl_output_sgv
+dcl_output_siv
+dcl_temps
+dcl_indexable_temp
+dcl_global_flags
+d3d10_count
+lod
+gather4
+sample_pos
+sample_info
+d3d10_1_count
+hs_decls
+hs_control_point_phase
+hs_fork_phase
+hs_join_phase
+emit_stream
+cut_stream
+emitthencut_stream
+interface_call
+bufinfo
+deriv_rtx_coarse
+deriv_rtx_fine
+deriv_rty_coarse
+deriv_rty_fine
+gather4_c
+gather4_po
+gather4_po_c
+rcp

Mesa (master): d3d1x: s/tpf/sm4/g

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 13:31:30 2010 +0200

d3d1x: s/tpf/sm4/g

---

 .../state_trackers/d3d1x/d3d1xshader/Makefile  |4 +-
 .../state_trackers/d3d1x/d3d1xshader/gen-header.sh |6 +-
 .../state_trackers/d3d1x/d3d1xshader/gen-text.sh   |2 +-
 .../d3d1x/d3d1xshader/include/{tpf.h = sm4.h} |  132 ++--
 .../src/{tpf_analyze.cpp = sm4_analyze.cpp}   |   54 +++---
 .../d3d1xshader/src/{tpf_dump.cpp = sm4_dump.cpp} |   86 
 .../src/{tpf_parse.cpp = sm4_parse.cpp}   |  192 +-
 .../d3d1x/d3d1xshader/tools/fxdis.cpp  |   14 +-
 .../state_trackers/d3d1x/gd3d11/d3d11_screen.h |   14 +-
 .../state_trackers/d3d1x/gd3d1x/d3d1x_private.h|4 +-
 .../gd3d1x/{tpf_to_tgsi.cpp = sm4_to_tgsi.cpp}|  216 ++--
 .../d3d1x/gd3d1x/{tpf_to_tgsi.h = sm4_to_tgsi.h}  |   10 +-
 .../d3d1x/gd3d1x/tools/dxbc2tgsi.cpp   |   16 +-
 13 files changed, 376 insertions(+), 374 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=e5ae4588d150a179974a812887f3b6445d8e2f34
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): d3d1x: normalize whitespace

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 13:44:22 2010 +0200

d3d1x: normalize whitespace

---

 .../d3d1x/d3d1xshader/include/dxbc.h   |4 +-
 .../state_trackers/d3d1x/d3d1xshader/include/sm4.h |2 +-
 .../d3d1x/d3d1xshader/src/sm4_analyze.cpp  |4 +-
 .../d3d1x/d3d1xstutil/include/d3d1xstutil.h|  260 
 .../state_trackers/d3d1x/d3dapi/d3d10_1.idl|   18 +-
 .../state_trackers/d3d1x/d3dapi/d3d10misc.h|   18 +-
 .../state_trackers/d3d1x/d3dapi/d3d10shader.idl|   24 +-
 src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl  |  628 ++--
 .../state_trackers/d3d1x/d3dapi/d3d11shader.idl|   36 +-
 .../state_trackers/d3d1x/d3dapi/d3dcommon.idl  |   28 +-
 src/gallium/state_trackers/d3d1x/d3dapi/dxgi.idl   |  520 
 .../state_trackers/d3d1x/d3dapi/dxgitype.idl   |   68 ++--
 .../state_trackers/d3d1x/docs/coding_style.txt |1 -
 .../state_trackers/d3d1x/dxgi/src/dxgi_loader.cpp  |  238 
 .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp  |  356 ++--
 .../state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp   |   24 +-
 .../state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp   |   22 +-
 src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp  |   26 +-
 .../state_trackers/d3d1x/gd3d11/d3d11_context.h|  352 ++--
 .../state_trackers/d3d1x/gd3d11/d3d11_misc.h   |   38 +-
 .../state_trackers/d3d1x/gd3d11/d3d11_objects.h|  206 
 .../state_trackers/d3d1x/gd3d11/d3d11_screen.h |  214 
 .../state_trackers/d3d1x/gd3d1x/d3d_enums.cpp  |2 +-
 .../state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp|2 +-
 .../state_trackers/d3d1x/gd3dapi/galliumcom.idl|2 +-
 .../state_trackers/d3d1x/gd3dapi/galliumdxgi.idl   |4 +-
 .../d3d1x/progs/d3d10app/d3d10x11main.cpp  |4 +-
 .../d3d1x/progs/d3d10tri/d3d10tri.cpp  |   28 +-
 .../state_trackers/d3d1x/progs/d3d11app/d3d11u.h   |2 +-
 .../d3d1x/progs/d3d11app/d3d11x11main.cpp  |2 +-
 .../d3d1x/progs/d3d11gears/d3d11gears.cpp  |8 +-
 .../d3d1x/progs/d3d11tri/d3d11tri.cpp  |   28 +-
 32 files changed, 1584 insertions(+), 1585 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=6c598c78bd17642d731cf57b8369cc794f64ba2f
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): d3d1x: remove specstrings

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 13:52:34 2010 +0200

d3d1x: remove specstrings

---

 .../state_trackers/d3d1x/d3d1xshader/include/sm4.h |2 +-
 .../d3d1x/d3d1xstutil/include/d3d1xstutil.h|   61 ++--
 .../state_trackers/d3d1x/d3dapi/specstrings.h  |   25 --
 .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp  |   84 +++---
 .../state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp   |   44 ++--
 .../state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp   |   34 +-
 src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp  |   26 +-
 .../state_trackers/d3d1x/gd3d11/d3d11_context.h|  348 ++--
 .../state_trackers/d3d1x/gd3d11/d3d11_misc.h   |   32 +-
 .../state_trackers/d3d1x/gd3d11/d3d11_objects.h|   80 +++---
 .../state_trackers/d3d1x/gd3d11/d3d11_screen.h |  188 ++--
 11 files changed, 449 insertions(+), 475 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=8224256946619fb25278718bbf4703e3b9d60c93
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): d3d1x: minifix

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 13:55:36 2010 +0200

d3d1x: minifix

---

 .../state_trackers/d3d1x/d3dapi/d3d10_1.idl|2 +-
 src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl  |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3d10_1.idl 
b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10_1.idl
index 94da622..7efcae5 100644
--- a/src/gallium/state_trackers/d3d1x/d3dapi/d3d10_1.idl
+++ b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10_1.idl
@@ -171,7 +171,7 @@ typedef HRESULT (* PFN_D3D10_CREATE_DEVICE_AND_SWAP_CHAIN1)(
D3D10_DRIVER_TYPE,
HMODULE,
UINT, 
-   D3D10_FEATURE_LEVEL1 HardwareLevels,
+   D3D10_FEATURE_LEVEL1,
UINT,
[in, optional] DXGI_SWAP_CHAIN_DESC*, 
[out,optional] IDXGISwapChain**,
diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl 
b/src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl
index d916c20..e23c2f8 100644
--- a/src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl
+++ b/src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl
@@ -2467,7 +2467,7 @@ typedef HRESULT (* 
PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN)(
HMODULE,
UINT, 
[in,optional] const D3D_FEATURE_LEVEL*, 
-   UINT FeatureLevels,
+   UINT,
UINT,
[in, optional] const DXGI_SWAP_CHAIN_DESC*, 
[out,optional] IDXGISwapChain**,

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


Mesa (master): d3d1x: rename context params

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 14:22:10 2010 +0200

d3d1x: rename context params

---

 .../state_trackers/d3d1x/gd3d11/d3d11_context.h|  774 ++--
 1 files changed, 387 insertions(+), 387 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h 
b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
index c2b3bf4..d7c1c92 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
@@ -304,10 +304,10 @@ struct GalliumD3D10Device : public 
GalliumD3D10ScreenImplthreadsafe
 #if API = 11
 #define SET_SHADER_EXTRA_ARGS , \
ID3D11ClassInstance *const *ppClassInstances, \
-   unsigned NumClassInstances
+   unsigned count
 #define GET_SHADER_EXTRA_ARGS , \
ID3D11ClassInstance **ppClassInstances, \
-   unsigned *pNumClassInstances
+   unsigned *out_count
 #else
 #define SET_SHADER_EXTRA_ARGS
 #define GET_SHADER_EXTRA_ARGS
@@ -410,55 +410,55 @@ struct GalliumD3D10Device : public 
GalliumD3D10ScreenImplthreadsafe
*ppShader = 
(ID3D11##Stage##Shader*)shaders[D3D11_STAGE_##XS].ref(); \
} \
virtual void STDMETHODCALLTYPE XS##SetConstantBuffers(\
-   unsigned StartSlot, \
-   unsigned NumBuffers, \
-   ID3D11Buffer *const *ppConstantBuffers) \
+   unsigned start, \
+   unsigned count, \
+   ID3D11Buffer *const* constant_buffers) \
{ \
SYNCHRONIZED; \
-   xs_set_constant_buffersD3D11_STAGE_##XS(StartSlot, 
NumBuffers, (GalliumD3D11Buffer *const *)ppConstantBuffers); \
+   xs_set_constant_buffersD3D11_STAGE_##XS(start, count, 
(GalliumD3D11Buffer *const *)constant_buffers); \
} \
virtual void STDMETHODCALLTYPE XS##GetConstantBuffers(\
-   unsigned StartSlot, \
-   unsigned NumBuffers, \
-   ID3D11Buffer **ppConstantBuffers) \
+   unsigned start, \
+   unsigned count, \
+   ID3D11Buffer **out_constant_buffers) \
{ \
SYNCHRONIZED; \
-   for(unsigned i = 0; i  NumBuffers; ++i) \
-   ppConstantBuffers[i] = 
constant_buffers[D3D11_STAGE_##XS][StartSlot + i].ref(); \
+   for(unsigned i = 0; i  count; ++i) \
+   out_constant_buffers[i] = 
constant_buffers[D3D11_STAGE_##XS][start + i].ref(); \
} \
virtual void STDMETHODCALLTYPE XS##SetShaderResources(\
-   unsigned StartSlot, \
-   unsigned NumViews, \
-   ID3D11ShaderResourceView *const *ppShaderResourceViews) \
+   unsigned start, \
+   unsigned count, \
+   ID3D11ShaderResourceView *const *new_shader_resource_views) \
{ \
SYNCHRONIZED; \
-   xs_set_shader_resourcesD3D11_STAGE_##XS(StartSlot, NumViews, 
(GalliumD3D11ShaderResourceView *const *)ppShaderResourceViews); \
+   xs_set_shader_resourcesD3D11_STAGE_##XS(start, count, 
(GalliumD3D11ShaderResourceView *const *)new_shader_resource_views); \
} \
virtual void STDMETHODCALLTYPE XS##GetShaderResources(\
-   unsigned StartSlot, \
-   unsigned NumViews, \
-   ID3D11ShaderResourceView **ppShaderResourceViews) \
+   unsigned start, \
+   unsigned count, \
+   ID3D11ShaderResourceView **out_shader_resource_views) \
{ \
SYNCHRONIZED; \
-   for(unsigned i = 0; i  NumViews; ++i) \
-   ppShaderResourceViews[i] = 
shader_resource_views[D3D11_STAGE_##XS][StartSlot + i].ref(); \
+   for(unsigned i = 0; i  count; ++i) \
+   out_shader_resource_views[i] = 
shader_resource_views[D3D11_STAGE_##XS][start + i].ref(); \
} \
virtual void STDMETHODCALLTYPE XS##SetSamplers(\
-   unsigned StartSlot, \
-   unsigned NumSamplers, \
-   ID3D11SamplerState *const *ppSamplers) \
+   unsigned start, \
+   unsigned count, \
+   ID3D11SamplerState *const *new_samplers) \
{ \
SYNCHRONIZED; \
-   xs_set_samplersD3D11_STAGE_##XS(StartSlot, NumSamplers, 
(GalliumD3D11SamplerState *const *)ppSamplers); \
+   xs_set_samplersD3D11_STAGE_##XS(start, count, 
(GalliumD3D11SamplerState *const *)new_samplers); \
} \
virtual void STDMETHODCALLTYPE XS##GetSamplers( \
-   unsigned StartSlot, \
-   unsigned NumSamplers, \
-   ID3D11SamplerState **ppSamplers

Mesa (master): d3d11: rename screen params

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 15:02:59 2010 +0200

d3d11: rename screen params

---

 .../state_trackers/d3d1x/gd3d11/d3d11_screen.h |  654 ++--
 1 files changed, 321 insertions(+), 333 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=4f700d23fd5d7277f4379454c0d85ff960e73810
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): d3d1x: rename params in misc and objects

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 15:22:54 2010 +0200

d3d1x: rename params in misc and objects

---

 .../state_trackers/d3d1x/gd3d11/d3d11_misc.h   |   50 +++---
 .../state_trackers/d3d1x/gd3d11/d3d11_objects.h|  182 ++--
 2 files changed, 117 insertions(+), 115 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h 
b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h
index 9ad293b..357f51b 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h
@@ -1,37 +1,37 @@
 #if API  11
 extern C HRESULT STDMETHODCALLTYPE D3D10CreateBlob(
-   SIZE_T NumBytes,
-   LPD3D10BLOB *ppBuffer
+   SIZE_T num_bytes,
+   LPD3D10BLOB *out_buffer
 );
 
 HRESULT STDMETHODCALLTYPE D3D10CreateBlob(
-   SIZE_T NumBytes,
-   LPD3D10BLOB *ppBuffer
+   SIZE_T num_bytes,
+   LPD3D10BLOB *out_buffer
 )
 {
-   void* data = malloc(NumBytes);
+   void* data = malloc(num_bytes);
if(!data)
return E_OUTOFMEMORY;
-   *ppBuffer = new GalliumD3DBlob(data, NumBytes);
+   *out_buffer = new GalliumD3DBlob(data, num_bytes);
return S_OK;
 }
 
 LPCSTR STDMETHODCALLTYPE D3D10GetPixelShaderProfile(
-   ID3D10Device *pDevice
+   ID3D10Device *device
 )
 {
return ps_4_0;
 }
 
 LPCSTR STDMETHODCALLTYPE D3D10GetVertexShaderProfile(
-   ID3D10Device *pDevice
+   ID3D10Device *device
 )
 {
return vs_4_0;
 }
 
 LPCSTR STDMETHODCALLTYPE D3D10GetGeometryShaderProfile(
-   ID3D10Device *pDevice
+   ID3D10Device *device
 )
 {
return gs_4_0;
@@ -47,46 +47,46 @@ static HRESULT dxbc_assemble_as_blob(struct 
dxbc_chunk_header** chunks, unsigned
 }
 
 HRESULT D3D10GetInputSignatureBlob(
-   const void *pShaderBytecode,
-   SIZE_T BytecodeLength,
-   ID3D10Blob **ppSignatureBlob
+   const void *shader_bytecode,
+   SIZE_T bytecode_length,
+   ID3D10Blob **signature_blob
 )
 {
-   dxbc_chunk_signature* sig = dxbc_find_signature(pShaderBytecode, 
BytecodeLength, false);
+   dxbc_chunk_signature* sig = dxbc_find_signature(shader_bytecode, 
bytecode_length, false);
if(!sig)
return E_FAIL;
 
-   return dxbc_assemble_as_blob((dxbc_chunk_header**)sig, 1, 
ppSignatureBlob);
+   return dxbc_assemble_as_blob((dxbc_chunk_header**)sig, 1, 
signature_blob);
 }
 
 HRESULT D3D10GetOutputSignatureBlob(
-   const void *pShaderBytecode,
-   SIZE_T BytecodeLength,
-   ID3D10Blob **ppSignatureBlob
+   const void *shader_bytecode,
+   SIZE_T bytecode_length,
+   ID3D10Blob **signature_blob
 )
 {
-   dxbc_chunk_signature* sig = dxbc_find_signature(pShaderBytecode, 
BytecodeLength, true);
+   dxbc_chunk_signature* sig = dxbc_find_signature(shader_bytecode, 
bytecode_length, true);
if(!sig)
return E_FAIL;
 
-   return dxbc_assemble_as_blob((dxbc_chunk_header**)sig, 1, 
ppSignatureBlob);
+   return dxbc_assemble_as_blob((dxbc_chunk_header**)sig, 1, 
signature_blob);
 }
 
 HRESULT D3D10GetInputAndOutputSignatureBlob(
-   const void *pShaderBytecode,
-   SIZE_T BytecodeLength,
-   ID3D10Blob **ppSignatureBlob
+   const void *shader_bytecode,
+   SIZE_T bytecode_length,
+   ID3D10Blob **signature_blob
 )
 {
dxbc_chunk_signature* sigs[2];
-   sigs[0] = dxbc_find_signature(pShaderBytecode, BytecodeLength, false);
+   sigs[0] = dxbc_find_signature(shader_bytecode, bytecode_length, false);
if(!sigs[0])
return E_FAIL;
-   sigs[1] = dxbc_find_signature(pShaderBytecode, BytecodeLength, true);
+   sigs[1] = dxbc_find_signature(shader_bytecode, bytecode_length, true);
if(!sigs[1])
return E_FAIL;
 
-   return dxbc_assemble_as_blob((dxbc_chunk_header**)sigs, 2, 
ppSignatureBlob);
+   return dxbc_assemble_as_blob((dxbc_chunk_header**)sigs, 2, 
signature_blob);
 }
 
 #endif
diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h 
b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h
index 1a55949..836603e 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h
@@ -71,11 +71,11 @@ struct GalliumD3D11DeviceChild : public 
GalliumPrivateDataComObjectBase, dual_r
}
 
virtual void STDMETHODCALLTYPE GetDevice(
-   ID3D11Device **ppDevice
+   ID3D11Device **out_device
 )
{
device-AddRef();
-   *ppDevice = device;
+   *out_device = device;
}
 };
 
@@ -137,9 +137,9 @@ struct GalliumD3D11DescribedObject : public 
GalliumD3D11ObjectBase, Object

Mesa (master): d3d1x: rename parameters in dxgi

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 15:38:33 2010 +0200

d3d1x: rename parameters in dxgi

---

 .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp  |  252 ++--
 .../state_trackers/d3d1x/dxgid3d10/dxgid3d10.cpp   |   98 
 .../state_trackers/d3d1x/dxgid3d11/dxgid3d11.cpp   |   88 
 3 files changed, 219 insertions(+), 219 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 98ea972..89be7f5 100644
--- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
+++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
@@ -40,9 +40,9 @@ struct GalliumDXGIAdapter;
 struct GalliumDXGISwapChain;
 struct GalliumDXGIFactory;
 
-static HRESULT GalliumDXGISwapChainCreate(GalliumDXGIFactory* factory, 
IUnknown* device, const DXGI_SWAP_CHAIN_DESC desc, IDXGISwapChain** 
ppSwapChain);
-static HRESULT GalliumDXGIAdapterCreate(GalliumDXGIFactory* adapter, const 
struct native_platform* platform, void* dpy, IDXGIAdapter1** ppAdapter);
-static HRESULT GalliumDXGIOutputCreate(GalliumDXGIAdapter* adapter, const 
std::string name, const struct native_connector* connector, IDXGIOutput** 
ppOutput);
+static HRESULT GalliumDXGISwapChainCreate(GalliumDXGIFactory* factory, 
IUnknown* device, const DXGI_SWAP_CHAIN_DESC desc, IDXGISwapChain** 
out_swap_chain);
+static HRESULT GalliumDXGIAdapterCreate(GalliumDXGIFactory* adapter, const 
struct native_platform* platform, void* dpy, IDXGIAdapter1** out_adapter);
+static HRESULT GalliumDXGIOutputCreate(GalliumDXGIAdapter* adapter, const 
std::string name, const struct native_connector* connector, IDXGIOutput** 
out_output);
 static void GalliumDXGISwapChainRevalidate(IDXGISwapChain* swap_chain);
 
 templatetypename Base = IDXGIObject, typename Parent = IDXGIObject
@@ -57,9 +57,9 @@ struct GalliumDXGIObject : public 
GalliumPrivateDataComObjectBase
 
virtual HRESULT STDMETHODCALLTYPE GetParent(
REFIID riid,
-   void **ppParent)
+   void **out_parent)
{
-   return parent-QueryInterface(riid, ppParent);
+   return parent-QueryInterface(riid, out_parent);
}
 };
 
@@ -112,32 +112,32 @@ struct GalliumDXGIFactory : public 
GalliumDXGIObjectIDXGIFactory1, IUnknown
}
 
virtual HRESULT STDMETHODCALLTYPE EnumAdapters(
-   UINT Adapter,
-   IDXGIAdapter **ppAdapter)
+   UINT adapter,
+   IDXGIAdapter **out_adapter)
{
-   return EnumAdapters1(Adapter, (IDXGIAdapter1**)ppAdapter);
+   return EnumAdapters1(adapter, (IDXGIAdapter1**)out_adapter);
}
 
virtual HRESULT STDMETHODCALLTYPE EnumAdapters1(
-   UINT Adapter,
-   IDXGIAdapter1 **ppAdapter)
+   UINT adapter,
+   IDXGIAdapter1 **out_adapter)
{
-   *ppAdapter = 0;
-   if(Adapter == 0)
+   *out_adapter = 0;
+   if(adapter == 0)
{
-   return GalliumDXGIAdapterCreate(this, platform, 
display, ppAdapter);
+   return GalliumDXGIAdapterCreate(this, platform, 
display, out_adapter);
}
 #if 0
// TODO: enable this
if(platform == native_get_x11_platform())
{
unsigned nscreens = ScreenCount((Display*)display);
-   if(Adapter  nscreens)
+   if(adapter  nscreens)
{
unsigned def_screen = DefaultScreen(display);
-   if(Adapter = def_screen)
-   --Adapter;
-   *ppAdapter = GalliumDXGIAdapterCreate(this, 
platform, display, Adapter);
+   if(adapter = def_screen)
+   --adapter;
+   *out_adapter = GalliumDXGIAdapterCreate(this, 
platform, display, adapter);
return S_OK;
}
}
@@ -153,35 +153,35 @@ struct GalliumDXGIFactory : public 
GalliumDXGIObjectIDXGIFactory1, IUnknown
 * Does this act for existing swapchains? For new swapchains?
 */
virtual HRESULT STDMETHODCALLTYPE MakeWindowAssociation(
-   HWND WindowHandle,
-   UINT Flags)
+   HWND window_handle,
+   UINT flags)
{
/* TODO: actually implement, for Wine, X11 and KMS*/
-   associated_window = WindowHandle;
+   associated_window = window_handle;
return S_OK

Mesa (master): d3d11: obliterate IDL parameter names

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 15:45:13 2010 +0200

d3d11: obliterate IDL parameter names

---

 .../state_trackers/d3d1x/d3dapi/d3d10_1.idl|   50 +-
 .../state_trackers/d3d1x/d3dapi/d3d10shader.idl|   34 +-
 src/gallium/state_trackers/d3d1x/d3dapi/d3d11.idl  |  948 ++--
 .../state_trackers/d3d1x/d3dapi/d3d11shader.idl|   62 +-
 .../state_trackers/d3d1x/d3dapi/d3dcommon.idl  |   12 +-
 src/gallium/state_trackers/d3d1x/d3dapi/dxgi.idl   |  176 ++--
 6 files changed, 641 insertions(+), 641 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=b6b3fbcdb14faf5a5be66112a06d3406e7a46998
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): d3d1x: remove specstrings.h include

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 16:02:45 2010 +0200

d3d1x: remove specstrings.h include

---

 .../state_trackers/d3d1x/gd3d1x/d3d1x_private.h|3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h 
b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h
index 0274a1b..d4b6a8f 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d1x/d3d1x_private.h
@@ -41,9 +41,6 @@
 #include d3d11.h
 #include d3d11shader.h
 
-
-#include specstrings.h
-
 extern C
 {
 #include pipe/p_defines.h

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


Mesa (master): d3d1x: flush the pipe context when presenting

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 16:02:58 2010 +0200

d3d1x: flush the pipe context when presenting

---

 .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp  |2 ++
 1 files changed, 2 insertions(+), 0 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 89be7f5..99d80ea 100644
--- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
+++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
@@ -1139,6 +1139,8 @@ struct GalliumDXGISwapChain : public 
GalliumDXGIObjectIDXGISwapChain, GalliumDX
if(dst_surface)
pipe-screen-tex_surface_destroy(dst_surface);
 
+   pipe-flush(pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME);
+
if(db)
{
if(!surface-swap_buffers(surface))

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


Mesa (master): d3d1x: remove another include specstrings.h

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 16:07:33 2010 +0200

d3d1x: remove another include specstrings.h

---

 .../state_trackers/d3d1x/dxgi/src/dxgi_private.h   |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_private.h 
b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_private.h
index 30a6932..187a0f9 100644
--- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_private.h
+++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_private.h
@@ -37,7 +37,6 @@
 #include d3d11.h
 #include galliumcom.h
 #include galliumdxgi.h
-#include specstrings.h
 
 struct native_display;
 

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


Mesa (master): d3d1x: flush properly

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 16:08:37 2010 +0200

d3d1x: flush properly

---

 .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp  |2 +-
 1 files changed, 1 insertions(+), 1 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 99d80ea..74bce59 100644
--- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
+++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
@@ -1139,7 +1139,7 @@ struct GalliumDXGISwapChain : public 
GalliumDXGIObjectIDXGISwapChain, GalliumDX
if(dst_surface)
pipe-screen-tex_surface_destroy(dst_surface);
 
-   pipe-flush(pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME);
+   pipe-flush(pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, 
0);
 
if(db)
{

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


Mesa (master): d3d1x: add missing guid.cpp

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 16:17:36 2010 +0200

d3d1x: add missing guid.cpp

---

 .../state_trackers/d3d1x/d3d1xstutil/src/guids.cpp |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/src/guids.cpp 
b/src/gallium/state_trackers/d3d1x/d3d1xstutil/src/guids.cpp
new file mode 100644
index 000..ec45035
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/src/guids.cpp
@@ -0,0 +1,6 @@
+#define INITGUID
+#include d3d1xstutil.h
+#include galliumd3d11.h
+#include galliumd3d10_1.h
+#include galliumdxgi.h
+#include galliumcom.h

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


Mesa (master): d3d1x: fix build without system EGL/egl.h

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 16:18:52 2010 +0200

d3d1x: fix build without system EGL/egl.h

---

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

diff --git a/src/gallium/state_trackers/d3d1x/dxgi/Makefile 
b/src/gallium/state_trackers/d3d1x/dxgi/Makefile
index 323f6f7..6cdc33b 100644
--- a/src/gallium/state_trackers/d3d1x/dxgi/Makefile
+++ b/src/gallium/state_trackers/d3d1x/dxgi/Makefile
@@ -1,5 +1,5 @@
 LIBNAME=dxgi
-LIBRARY_INCLUDES=-Iinclude -I../gd3dapi -I../d3dapi -I../w32api 
-I../d3d1xstutil/include -I../include -I../../../include -I../../../auxiliary 
-I../../../state_trackers/egl/common
+LIBRARY_INCLUDES=-I../../../../../include -Iinclude -I../gd3dapi -I../d3dapi 
-I../w32api -I../d3d1xstutil/include -I../include -I../../../include 
-I../../../auxiliary -I../../../state_trackers/egl/common
 LIBRARY_DEFINES=-DDXGI_DRIVER_SEARCH_DIR=\$(EGL_DRIVER_INSTALL_DIR)\
 CPP_SOURCES=$(wildcard src/*.cpp)
 

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


Mesa (master): d3d1x: add autogenerated files as prerequisites, so make builds them

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 16:21:14 2010 +0200

d3d1x: add autogenerated files as prerequisites, so make builds them

---

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

diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile 
b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile
index 4f67145..3754c23 100644
--- a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile
@@ -1,11 +1,13 @@
 LIBNAME=d3d1xshader
-CPP_SOURCES=$(wildcard src/*.cpp)
+CPP_SOURCES=$(wildcard src/*.cpp) src/sm4_text.cpp
 LIBRARY_INCLUDES=-Iinclude -I../d3dapi -I../w32api
 PROGS=tools/fxdis
 LIBS=libd3d1xshader.a
 
 include ../Makefile.inc
 
+include/sm4.h: include/sm4_defs.h
+
 include/sm4_defs.h: $(wildcard defs/*.txt)
./gen-header.sh $^  $@
 

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


Mesa (master): d3d1x: obliterate IDL parameter names from d3d10. idl from Wine too

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 23 16:29:29 2010 +0200

d3d1x: obliterate IDL parameter names from d3d10.idl from Wine too

---

 src/gallium/state_trackers/d3d1x/d3dapi/d3d10.idl |  582 ++--
 1 files changed, 291 insertions(+), 291 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/d3dapi/d3d10.idl 
b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10.idl
index c371bbe..91b1abc 100644
--- a/src/gallium/state_trackers/d3d1x/d3dapi/d3d10.idl
+++ b/src/gallium/state_trackers/d3d1x/d3dapi/d3d10.idl
@@ -912,18 +912,18 @@ interface ID3D10Device;
 interface ID3D10DeviceChild : IUnknown
 {
 void GetDevice(
-[out] ID3D10Device **ppDevice);
+[out] ID3D10Device **a);
 HRESULT GetPrivateData(
-[in] REFGUID guid,
-[in, out] UINT *pDataSize,
-[out] void *pData);
+[in] REFGUID a,
+[in, out] UINT *b,
+[out] void *c);
 HRESULT SetPrivateData(
-[in] REFGUID guid,
-[in] UINT DataSize,
-[in] const void *pData);
+[in] REFGUID a,
+[in] UINT b,
+[in] const void *c);
 HRESULT SetPrivateDataInterface(
-[in] REFGUID guid,
-[in] const IUnknown *pData);
+[in] REFGUID a,
+[in] const IUnknown *b);
 }
 
 /* Resource */
@@ -936,9 +936,9 @@ interface ID3D10DeviceChild : IUnknown
 interface ID3D10Resource : ID3D10DeviceChild
 {
 void GetType(
-[out] D3D10_RESOURCE_DIMENSION *rType);
+[out] D3D10_RESOURCE_DIMENSION *a);
 void SetEvictionPriority(
-[in] UINT EvictionPriority);
+[in] UINT a);
 UINT GetEvictionPriority();
 }
 
@@ -950,12 +950,12 @@ interface ID3D10Resource : ID3D10DeviceChild
 interface ID3D10Buffer : ID3D10Resource
 {
 HRESULT Map(
-[in] D3D10_MAP MapType,
-[in] UINT MapFlags,
-[out] void **ppData);
+[in] D3D10_MAP a,
+[in] UINT b,
+[out] void **c);
 void Unmap();
 void GetDesc(
-[out] D3D10_BUFFER_DESC *pDesc);
+[out] D3D10_BUFFER_DESC *a);
 }
 
 [
@@ -966,14 +966,14 @@ interface ID3D10Buffer : ID3D10Resource
 interface ID3D10Texture1D : ID3D10Resource
 {
 HRESULT Map(
-[in] UINT Subresource,
-[in] D3D10_MAP MapType,
-[in] UINT MapFlags,
-[out] void **ppData);
+[in] UINT a,
+[in] D3D10_MAP b,
+[in] UINT c,
+[out] void **d);
 void Unmap(
-[in] UINT Subresource);
+[in] UINT a);
 void GetDesc(
-[out] D3D10_TEXTURE1D_DESC *pDesc);
+[out] D3D10_TEXTURE1D_DESC *a);
 }
 
 [
@@ -984,14 +984,14 @@ interface ID3D10Texture1D : ID3D10Resource
 interface ID3D10Texture2D : ID3D10Resource
 {
 HRESULT Map(
-[in] UINT Subresource,
-[in] D3D10_MAP MapType,
-[in] UINT MapFlags,
-[out] D3D10_MAPPED_TEXTURE2D *pMappedTex2D);
+[in] UINT a,
+[in] D3D10_MAP b,
+[in] UINT c,
+[out] D3D10_MAPPED_TEXTURE2D *d);
 void Unmap(
-[in] UINT Subresource);
+[in] UINT a);
 void GetDesc(
-[out] D3D10_TEXTURE2D_DESC *pDesc);
+[out] D3D10_TEXTURE2D_DESC *a);
 }
 
 [
@@ -1002,14 +1002,14 @@ interface ID3D10Texture2D : ID3D10Resource
 interface ID3D10Texture3D : ID3D10Resource
 {
 HRESULT Map(
-[in] UINT Subresource,
-[in] D3D10_MAP MapType,
-[in] UINT MapFlags,
-[out] D3D10_MAPPED_TEXTURE3D *pMappedTex3D);
+[in] UINT a,
+[in] D3D10_MAP b,
+[in] UINT c,
+[out] D3D10_MAPPED_TEXTURE3D *d);
 void Unmap(
-[in] UINT Subresource);
+[in] UINT a);
 void GetDesc(
-[out] D3D10_TEXTURE3D_DESC *pDesc);
+[out] D3D10_TEXTURE3D_DESC *a);
 }
 
 [
@@ -1020,7 +1020,7 @@ interface ID3D10Texture3D : ID3D10Resource
 interface ID3D10View : ID3D10DeviceChild
 {
 void GetResource(
-[out] ID3D10Resource **ppResource);
+[out] ID3D10Resource **a);
 }
 
 [
@@ -1031,7 +1031,7 @@ interface ID3D10View : ID3D10DeviceChild
 interface ID3D10DepthStencilView : ID3D10View
 {
 void GetDesc(
-[out] D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc);
+[out] D3D10_DEPTH_STENCIL_VIEW_DESC *a);
 }
 
 
@@ -1043,7 +1043,7 @@ interface ID3D10DepthStencilView : ID3D10View
 interface ID3D10RenderTargetView : ID3D10View
 {
 void GetDesc(
-[out] D3D10_RENDER_TARGET_VIEW_DESC *pDesc

Mesa (master): d3d1x: attempt to fix/workaround bug #30322

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep 22 07:15:15 2010 +0200

d3d1x: attempt to fix/workaround bug #30322

This may just be hiding some other bug though, since the types are supposed
to be the same (and it compiles for me).

Anyway, this interface will likely need to changed, since it seems Wine needs
a more powerful one capable of expressing window subregions and called at
every Present.

---

 .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp  |2 +-
 1 files changed, 1 insertions(+), 1 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 41c8f29..c9db7b6 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)
-: GalliumDXGIObjectIDXGIFactory1, IUnknown((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 : 
(PFNHWNDRESOLVER)identity_resolver), resolver_cookie(resolver_cookie)
 {}
 
 virtual HRESULT STDMETHODCALLTYPE EnumAdapters(

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


Mesa (master): nvfx: remove gl_PointCoord hack

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep 22 07:17:38 2010 +0200

nvfx: remove gl_PointCoord hack

Now Gallium has the proper fix, thanks to Brian Paul.

---

 src/gallium/drivers/nvfx/nvfx_fragprog.c |   13 ++---
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c 
b/src/gallium/drivers/nvfx/nvfx_fragprog.c
index d97cab8..23fdb08 100644
--- a/src/gallium/drivers/nvfx/nvfx_fragprog.c
+++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c
@@ -1235,10 +1235,9 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx)
struct nouveau_channel* chan = nvfx-screen-base.channel;
struct nvfx_pipe_fragment_program *pfp = nvfx-fragprog;
struct nvfx_vertex_program* vp;
-   /* Gallium always puts the point coord in GENERIC[0]
-* TODO: this is wrong, Gallium needs to be fixed
-*/
-   unsigned sprite_coord_enable = 
nvfx-rasterizer-pipe.point_quad_rasterization * 
(nvfx-rasterizer-pipe.sprite_coord_enable | 1);
+
+   // TODO: the multiplication by point_quad_rasterization is probably 
superfluous
+   unsigned sprite_coord_enable = 
nvfx-rasterizer-pipe.point_quad_rasterization * 
nvfx-rasterizer-pipe.sprite_coord_enable;
 
boolean emulate_sprite_flipping = sprite_coord_enable  
nvfx-rasterizer-pipe.sprite_coord_mode;
unsigned key = emulate_sprite_flipping;
@@ -1297,7 +1296,7 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx)
unsigned used_texcoords = 0;
for(unsigned i = 0; i  fp-num_slots; ++i) {
unsigned generic = 
fp-slot_to_generic[i];
-   if(!((1  generic)  
sprite_coord_enable))
+   if((generic  32)  !((1  generic)  
sprite_coord_enable))
{
unsigned char slot_mask = 
vp-generic_to_fp_input[generic];
if(slot_mask = 0xf0)
@@ -1320,7 +1319,7 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx)
 
for(i = 0; i  fp-num_slots; ++i) {
unsigned generic = fp-slot_to_generic[i];
-   if((1  generic)  sprite_coord_enable)
+   if((generic  32)  ((1  generic)  
sprite_coord_enable))
{
if(fp-slot_to_fp_input[i] != 
sprite_reloc_input)
goto update_slots;
@@ -1346,7 +1345,7 @@ update_slots:
for(; i  fp-num_slots; ++i)
{
unsigned generic = fp-slot_to_generic[i];
-   if((1  generic)  sprite_coord_enable)
+   if((generic  32)  ((1  generic)  
sprite_coord_enable))
fp-slot_to_fp_input[i] = 
sprite_reloc_input;
else
fp-slot_to_fp_input[i] = 
vp-generic_to_fp_input[generic]  0xf;

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


Mesa (master): glx: decouple dri2.c and GLX, fixing Gallium EGL and d3d1x build

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep 22 07:44:59 2010 +0200

glx: decouple dri2.c and GLX, fixing Gallium EGL and d3d1x build

The Gallium EGL state tracker reuses dri2.c but not the GLX code.

Currently there is a bit of code in dri2.c that is incorrectly tied
to GLX: instead, make it call an helper that both GLX and Gallium EGL
implement, like dri2InvalidateBuffers.

This avoids a link error complaining that dri2GetGlxDrawableFromXDrawableId
is undefined.

Note that we might want to move the whole event translation elsewhere,
and probably stop using non-XCB DRI2 altogether, but this seems to be
the minimal fix.

---

 src/gallium/state_trackers/egl/x11/x11_screen.c |   11 +++
 src/glx/dri2.c  |9 +++--
 src/glx/dri2_glx.c  |   10 ++
 src/glx/glxclient.h |1 +
 4 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/src/gallium/state_trackers/egl/x11/x11_screen.c 
b/src/gallium/state_trackers/egl/x11/x11_screen.c
index c07ebb7..c919b79 100644
--- a/src/gallium/state_trackers/egl/x11/x11_screen.c
+++ b/src/gallium/state_trackers/egl/x11/x11_screen.c
@@ -432,4 +432,15 @@ dri2InvalidateBuffers(Display *dpy, XID drawable)
xscr-dri_invalidate_buffers(xscr, drawable, xscr-dri_user_data);
 }
 
+extern unsigned
+dri2GetSwapEventType(Display *dpy, XID drawable);
+
+/**
+ * This is also called from src/glx/dri2.c.
+ */
+unsigned dri2GetSwapEventType(Display *dpy, XID drawable)
+{
+   return 0;
+}
+
 #endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/dri2.c b/src/glx/dri2.c
index 30999c8..adfd3d1 100644
--- a/src/glx/dri2.c
+++ b/src/glx/dri2.c
@@ -98,16 +98,13 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
{
   GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event;
   xDRI2BufferSwapComplete *awire = (xDRI2BufferSwapComplete *)wire;
-  __GLXDRIdrawable *pdraw;
-  struct glx_display *glx_dpy = __glXInitialize(dpy);
 
   /* Ignore swap events if we're not looking for them */
-  pdraw = dri2GetGlxDrawableFromXDrawableId(dpy, awire-drawable);
-  if (!pdraw || !(pdraw-eventMask  GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
-return False;
+  aevent-type = dri2GetSwapEventType(dpy, awire-drawable);
+  if(!aevent-type)
+ return False;
 
   aevent-serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
-  aevent-type = glx_dpy-codes-first_event + GLX_BufferSwapComplete;
   aevent-send_event = (awire-type  0x80) != 0;
   aevent-display = dpy;
   aevent-drawable = awire-drawable;
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 911298b..88bb8b8 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -502,6 +502,16 @@ process_buffers(struct dri2_drawable * pdraw, DRI2Buffer * 
buffers,
 
 }
 
+unsigned dri2GetSwapEventType(Display* dpy, XID drawable)
+{
+  struct glx_display *glx_dpy = __glXInitialize(dpy);
+  __GLXDRIdrawable *pdraw;
+  pdraw = dri2GetGlxDrawableFromXDrawableId(dpy, drawable);
+  if (!pdraw || !(pdraw-eventMask  GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
+ return 0;
+  return glx_dpy-codes-first_event + GLX_BufferSwapComplete;
+}
+
 static int64_t
 dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
int64_t remainder)
diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
index b453e6d..324b5a6 100644
--- a/src/glx/glxclient.h
+++ b/src/glx/glxclient.h
@@ -150,6 +150,7 @@ extern __GLXDRIdisplay *driswCreateDisplay(Display * dpy);
 extern __GLXDRIdisplay *driCreateDisplay(Display * dpy);
 extern __GLXDRIdisplay *dri2CreateDisplay(Display * dpy);
 extern void dri2InvalidateBuffers(Display *dpy, XID drawable);
+extern unsigned dri2GetSwapEventType(Display *dpy, XID drawable);
 
 
 /*

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


Mesa (master): winsys: automatically build sw winsys needed by EGL and d3d1x

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep 22 09:37:23 2010 +0200

winsys: automatically build sw winsys needed by EGL and d3d1x

A cleaner solution would be preferable, but this does no harm and works.

---

 src/gallium/winsys/sw/Makefile |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/gallium/winsys/sw/Makefile b/src/gallium/winsys/sw/Makefile
index e9182ea..094e811 100644
--- a/src/gallium/winsys/sw/Makefile
+++ b/src/gallium/winsys/sw/Makefile
@@ -4,6 +4,16 @@ include $(TOP)/configs/current
 
 SUBDIRS = null wrapper
 
+# TODO: this should go through a further indirection level
+# (i.e. EGL should set a variable that is checked here)
+ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
+SUBDIRS += xlib
+endif
+
+ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),)
+SUBDIRS += fbdev
+endif
+
 default install clean:
@for dir in $(SUBDIRS) ; do \
if [ -d $$dir ] ; then \

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


Mesa (master): d3d1x: don't build progs automatically

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep 22 11:35:05 2010 +0200

d3d1x: don't build progs automatically

progs requires winsys, which hasn't yet been built by the time we
go into state_trackers.

It may be a good idea to also move it into tests.

After a normal build, run make in src/gallium/state_trackers/d3d1x/progs
to build them.

---

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

diff --git a/src/gallium/state_trackers/d3d1x/Makefile 
b/src/gallium/state_trackers/d3d1x/Makefile
index 6d55376..75076ee 100644
--- a/src/gallium/state_trackers/d3d1x/Makefile
+++ b/src/gallium/state_trackers/d3d1x/Makefile
@@ -1,4 +1,4 @@
-SUBDIRS=d3dapi gd3dapi docs d3d1xstutil d3d1xshader gd3d1x gd3d11 gd3d10 dxgi 
dxgid3d11 dxgid3d10 progs
+SUBDIRS=d3dapi gd3dapi docs d3d1xstutil d3d1xshader gd3d1x gd3d11 gd3d10 dxgi 
dxgid3d11 dxgid3d10
 
 all:
@for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir || exit $?; done

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


Mesa (master): d3d1x: add missing memory barrier

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep 22 13:21:13 2010 +0200

d3d1x: add missing memory barrier

---

 .../d3d1x/d3d1xstutil/include/d3d1xstutil.h|8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h 
b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
index 19ac53e..55cbd4a 100644
--- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
+++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
@@ -363,8 +363,12 @@ struct dual_refcnt_t
unsigned nonatomic_release()
{
//printf(%p nonatomic_release at %u %u\n, this, 
atomic_refcnt, nonatomic_refcnt);
-   if(!--nonatomic_refcnt  !atomic_refcnt  is_zero())
-   return 0;
+   if(!--nonatomic_refcnt)
+   {
+   __sync_synchronize();
+   if(!atomic_refcnt  is_zero())
+   return 0;
+   }
return 1;
}
 };

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


Mesa (master): d3d1x: link with CXXFLAGS

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep 22 13:22:00 2010 +0200

d3d1x: link with CXXFLAGS

Otherwise, -m32 doesn't make it there.

---

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

diff --git a/src/gallium/state_trackers/d3d1x/Makefile.inc 
b/src/gallium/state_trackers/d3d1x/Makefile.inc
index 1b9423b..303915d 100644
--- a/src/gallium/state_trackers/d3d1x/Makefile.inc
+++ b/src/gallium/state_trackers/d3d1x/Makefile.inc
@@ -3,7 +3,7 @@ include $(TOP)/configs/current
 
 IDL=$(wildcard *.idl include/*.idl)
 IDL_H=$(IDL:.idl=.h)
-LD=$(CXX)
+LD=$(CXX) $(CXXFLAGS)
 
 include ../../../Makefile.template
 

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


Mesa (master): d3d1x: fix warning

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep 22 13:25:45 2010 +0200

d3d1x: fix warning

---

 .../state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.cpp|2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.cpp 
b/src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.cpp
index 676c939..4d7c296 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.cpp
+++ b/src/gallium/state_trackers/d3d1x/gd3d1x/tpf_to_tgsi.cpp
@@ -441,7 +441,7 @@ struct tpf_to_tgsi_converter
case TPF_OPCODE_LD_MS:
{
unsigned texslot = _texslot(false);
-   unsigned dim;
+   unsigned dim = 0;
switch(targets[texslot].first)
{
case TGSI_TEXTURE_1D:

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


Mesa (master): d3d1x: fix segfault when hashing

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep 22 13:54:07 2010 +0200

d3d1x: fix segfault when hashing

---

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

diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h 
b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
index 55cbd4a..6c13a9c 100644
--- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
+++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
@@ -762,7 +762,7 @@ static inline size_t raw_hash(const char* p, size_t size)
const char* end = p + size;
for(; p != end; ++p)
{
-   res ^= (size_t)*p++;
+   res ^= (size_t)*p;
if(sizeof(size_t) = 8)
res *= (size_t)1099511628211ULL;
else

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


Mesa (master): d3d1x: fix GUID declarations

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep 22 19:04:36 2010 +0200

d3d1x: fix GUID declarations

---

 .../d3d1x/d3d1xstutil/include/d3d1xstutil.h|9 +
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h 
b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
index 6c13a9c..83cf0f2 100644
--- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
+++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
@@ -42,22 +42,23 @@ namespace std
 #include utility
 
 #define WIN32_LEAN_AND_MEAN
-#include objbase.h
+#define INITGUID
 #include guiddef.h
-#include specstrings.h
 
+// just replicate GUIDs in every object file to avoid the hassle of having to 
pull in a library for them
 #ifdef __GNUC__
 #define ATTRIBUTE_UNUSED __attribute__((unused))
 #else
 #define ATTRIBUTE_UNUSED
 #endif
-
-// just replicate GUIDs in every object file to avoid the hassle of having to 
pull in a library for them
 #undef DEFINE_GUID
 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
 static const GUID name ATTRIBUTE_UNUSED = \
{ l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }
 
+#include objbase.h
+#include specstrings.h
+
 #include galliumdxgi.h
 #include d3dcommon.h
 

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


Mesa (master): d3d1x: destroy native_display on adapter destruction

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep 22 16:29:36 2010 +0200

d3d1x: destroy native_display on adapter destruction

---

 .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp  |1 +
 1 files changed, 1 insertions(+), 0 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 c9db7b6..24a812f 100644
--- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
+++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
@@ -239,6 +239,7 @@ struct GalliumDXGIAdapter
 
~GalliumDXGIAdapter()
{
+   display-destroy(display);
free(configs);
free(connectors);
}

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


Mesa (master): d3d1x: redesign the HWND resolver interface

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep 22 13:51:53 2010 +0200

d3d1x: redesign the HWND resolver interface

This one should be powerful enough to hook up Wine.

---

 .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp  |  295 +---
 .../state_trackers/d3d1x/gd3d11/d3d11_misc.h   |7 +-
 .../state_trackers/d3d1x/gd3dapi/galliumdxgi.idl   |   49 +++-
 .../d3d1x/progs/d3d10app/d3d10x11main.cpp  |2 +-
 .../d3d1x/progs/d3d11app/d3d11x11main.cpp  |2 +-
 5 files changed, 250 insertions(+), 105 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 24a812f..3cbe056 100644
--- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
+++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
@@ -63,22 +63,53 @@ struct GalliumDXGIObject : public 
GalliumPrivateDataComObjectBase
 }
 };
 
-static void* STDMETHODCALLTYPE identity_resolver(void* cookie, HWND hwnd)
+COM_INTERFACE(IGalliumDXGIBackend, IUnknown)
+
+struct GalliumDXGIIdentityBackend : public 
GalliumComObjectIGalliumDXGIBackend
 {
-   return (void*)hwnd;
-}
+   virtual void * STDMETHODCALLTYPE BeginPresent(
+   HWND hwnd,
+   void** window,
+   RECT *rect,
+   RGNDATA **rgndata,
+   BOOL* preserve_aspect_ratio
+   )
+   {
+   *window = (void*)hwnd;
+   rect-left = 0;
+   rect-top = 0;
+   rect-right = INT_MAX;
+   rect-bottom = INT_MAX;
+   *rgndata = 0;
+
+   // yes, because we like things looking good
+   *preserve_aspect_ratio = TRUE;
+   return 0;
+   }
+
+   virtual void STDMETHODCALLTYPE EndPresent(
+   HWND hwnd,
+   void* present_cookie
+   )
+   {}
+};
 
 struct GalliumDXGIFactory : public GalliumDXGIObjectIDXGIFactory1, IUnknown
 {
 HWND associated_window;
const struct native_platform* platform;
void* display;
-   PFNHWNDRESOLVER resolver;
+   ComPtrIGalliumDXGIBackend backend;
void* resolver_cookie;
 
-GalliumDXGIFactory(const struct native_platform* platform, void* 
display, PFNHWNDRESOLVER resolver, void* resolver_cookie)
-: GalliumDXGIObjectIDXGIFactory1, IUnknown((IUnknown*)NULL), 
platform(platform), display(display), resolver(resolver ? resolver : 
(PFNHWNDRESOLVER)identity_resolver), resolver_cookie(resolver_cookie)
-{}
+   GalliumDXGIFactory(const struct native_platform* platform, void* 
display, IGalliumDXGIBackend* p_backend)
+   : GalliumDXGIObjectIDXGIFactory1, IUnknown((IUnknown*)NULL), 
platform(platform), display(display)
+ {
+   if(p_backend)
+   backend = p_backend;
+   else
+   backend.reset(new GalliumDXGIIdentityBackend());
+   }
 
 virtual HRESULT STDMETHODCALLTYPE EnumAdapters(
UINT Adapter,
@@ -678,6 +709,7 @@ struct dxgi_blitter
rasterizer = pipe-create_rasterizer_state(pipe, rs_state);
 
struct pipe_blend_state blendd;
+   memset(blendd, 0, sizeof(blendd));
blendd.rt[0].colormask = PIPE_MASK_RGBA;
blend = pipe-create_blend_state(pipe, blendd);
 
@@ -793,9 +825,12 @@ struct GalliumDXGISwapChain : public 
GalliumDXGIObjectIDXGISwapChain, GalliumDX
ComPtrGalliumDXGIAdapter adapter;
ComPtrIDXGIOutput target;
 
+   DXGI_SWAP_CHAIN_DESC desc;
+
struct native_surface* surface;
const struct native_config* config;
 
+   void* window;
struct pipe_resource* resources[NUM_NATIVE_ATTACHMENTS];
int width;
int height;
@@ -808,8 +843,6 @@ struct GalliumDXGISwapChain : public 
GalliumDXGIObjectIDXGISwapChain, GalliumDX
struct pipe_resource* gallium_buffer0;
struct pipe_sampler_view* gallium_buffer0_view;
 
-   DXGI_SWAP_CHAIN_DESC desc;
-
struct pipe_context* pipe;
bool owns_pipe;
 
@@ -819,7 +852,7 @@ struct GalliumDXGISwapChain : public 
GalliumDXGIObjectIDXGISwapChain, GalliumDX
bool formats_compatible;
 
GalliumDXGISwapChain(GalliumDXGIFactory* factory, IUnknown* p_device, 
const DXGI_SWAP_CHAIN_DESC p_desc)
-   : GalliumDXGIObjectIDXGISwapChain, GalliumDXGIFactory(factory), 
desc(p_desc)
+   : GalliumDXGIObjectIDXGISwapChain, GalliumDXGIFactory(factory), 
desc(p_desc), surface(0)
{
HRESULT hr;
 
@@ -835,13 +868,40 @@ struct GalliumDXGISwapChain : public 
GalliumDXGIObjectIDXGISwapChain, GalliumDX
if(!SUCCEEDED(hr))
throw hr

Mesa (master): d3d1x: fix API name

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep 22 19:31:34 2010 +0200

d3d1x: fix API name

---

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

diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h 
b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h
index 0d515e3..f31b54b 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_misc.h
@@ -72,7 +72,7 @@ HRESULT  D3D10GetOutputSignatureBlob(
return dxbc_assemble_as_blob((dxbc_chunk_header**)sig, 1, 
ppSignatureBlob);
 }
 
-HRESULT  D3D10GetInputOutputSignatureBlob(
+HRESULT  D3D10GetInputAndOutputSignatureBlob(
__in   const void *pShaderBytecode,
__in   SIZE_T BytecodeLength,
__out  ID3D10Blob **ppSignatureBlob

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


Mesa (master): d3d1x: add Wine dlls (tri, tex working, but no other testing )

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep 22 19:33:54 2010 +0200

d3d1x: add Wine dlls (tri, tex working, but no other testing)

---

 src/gallium/state_trackers/d3d1x/winedlls/Makefile |   11 +
 .../state_trackers/d3d1x/winedlls/Makefile.wine|   23 ++
 .../state_trackers/d3d1x/winedlls/d3d10/Makefile   |6 +
 .../state_trackers/d3d1x/winedlls/d3d10/d3d10.spec |   33 +++
 .../state_trackers/d3d1x/winedlls/d3d10/version.rc |3 +
 .../state_trackers/d3d1x/winedlls/d3d10_1/Makefile |6 +
 .../d3d1x/winedlls/d3d10_1/d3d10_1.spec|   29 +++
 .../d3d1x/winedlls/d3d10_1/version.rc  |3 +
 .../state_trackers/d3d1x/winedlls/d3d11/Makefile   |6 +
 .../state_trackers/d3d1x/winedlls/d3d11/d3d11.spec |6 +
 .../state_trackers/d3d1x/winedlls/d3d11/version.rc |3 +
 .../state_trackers/d3d1x/winedlls/dxgi/Makefile|6 +
 .../state_trackers/d3d1x/winedlls/dxgi/dxgi.spec   |4 +
 .../state_trackers/d3d1x/winedlls/dxgi/dxgi_dll.c  |  214 
 .../state_trackers/d3d1x/winedlls/dxgi/version.rc  |3 +
 .../state_trackers/d3d1x/winedlls/version.rc.h |   30 +++
 16 files changed, 386 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/winedlls/Makefile 
b/src/gallium/state_trackers/d3d1x/winedlls/Makefile
new file mode 100644
index 000..c7e51b2
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/winedlls/Makefile
@@ -0,0 +1,11 @@
+SUBDIRS=dxgi d3d10 d3d10_1 d3d11
+
+all:
+   @for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir || exit $?; done
+
+clean:
+   rm -f `find . -name \*.[oa]`
+   rm -f `find . -name depend`
+
+install:
+   sudo install */*.dll.so /usr/lib/wine
diff --git a/src/gallium/state_trackers/d3d1x/winedlls/Makefile.wine 
b/src/gallium/state_trackers/d3d1x/winedlls/Makefile.wine
new file mode 100644
index 000..c9a0687
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/winedlls/Makefile.wine
@@ -0,0 +1,23 @@
+TOP=../../../../../..
+D3D1X=../..
+include $(TOP)/configs/current
+CFLAGS=$(CXXFLAGS)
+
+all: lib$(LIBNAME).def lib$(LIBNAME).cross.a $(LIBNAME).dll.so
+
+%.dll.fake: %.spec $(OBJECTS) version.res
+   wineg++ -m32 -fasynchronous-unwind-tables -shared $^ -o $@ $(LDADD)
+
+%.dll.so: %.spec $(OBJECTS) version.res
+   wineg++ -m32 -fasynchronous-unwind-tables -shared $^ -o $@ $(LDADD)
+
+lib%.def: %.spec
+   winebuild -w --def -o $@ --export $
+
+lib%.cross.a: %.spec
+   winebuild -m32  -b i586-mingw32msvc -w --implib -o $@ --export $
+
+version.res: version.rc
+   wrc --nostdinc -I. -I. -I../../include -I../../include  -D__WINESRC__   
-fo$@ $^
+
+include ../../../../Makefile.template
diff --git a/src/gallium/state_trackers/d3d1x/winedlls/d3d10/Makefile 
b/src/gallium/state_trackers/d3d1x/winedlls/d3d10/Makefile
new file mode 100644
index 000..0ea5ffe
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/winedlls/d3d10/Makefile
@@ -0,0 +1,6 @@
+LIBNAME=d3d10
+LIBRARY_INCLUDES=-I$(D3D1X)/gd3dapi -I$(D3D1X)/d3dapi -I$(D3D1X)/w32api
+OBJECTS=../../dxgid3d10/libdxgid3d10.a ../../gd3d10/libgd3d10.a 
../../gd3d1x/libgd3d1x.a ../../d3d1xshader/libd3d1xshader.a 
../../d3d1xstutil/libd3d1xstutil.a ../../../../auxiliary/libgallium.a
+LDADD=-L../dxgi -ldxgi -ldl
+
+include ../Makefile.wine
diff --git a/src/gallium/state_trackers/d3d1x/winedlls/d3d10/d3d10.spec 
b/src/gallium/state_trackers/d3d1x/winedlls/d3d10/d3d10.spec
new file mode 100644
index 000..4a68ab5
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/winedlls/d3d10/d3d10.spec
@@ -0,0 +1,33 @@
+@ stub D3D10CompileEffectFromMemory
+@ stub D3D10CompileShader
+@ stdcall D3D10CreateBlob(long ptr)
+@ stdcall D3D10CreateDevice(ptr long ptr long long ptr)
+@ stdcall D3D10CreateDeviceAndSwapChain(ptr long ptr long long ptr ptr ptr)
+@ stub D3D10CreateEffectFromMemory
+@ stub D3D10CreateEffectPoolFromMemory
+@ stub D3D10CreateStateBlock
+@ stub D3D10DisassembleEffect
+@ stub D3D10DisassembleShader
+@ stdcall D3D10GetGeometryShaderProfile(ptr)
+@ stdcall D3D10GetInputAndOutputSignatureBlob(ptr long ptr)
+@ stdcall D3D10GetInputSignatureBlob(ptr long ptr)
+@ stdcall D3D10GetOutputSignatureBlob(ptr long ptr)
+@ stdcall D3D10GetPixelShaderProfile(ptr)
+@ stub D3D10GetShaderDebugInfo
+@ stub D3D10GetVersion
+@ stdcall D3D10GetVertexShaderProfile(ptr)
+@ stub D3D10PreprocessShader
+@ stub D3D10ReflectShader
+@ stub D3D10RegisterLayers
+@ stub D3D10StateBlockMaskDifference
+@ stub D3D10StateBlockMaskDisableAll
+@ stub D3D10StateBlockMaskDisableCapture
+@ stub D3D10StateBlockMaskEnableAll
+@ stub D3D10StateBlockMaskEnableCapture
+@ stub D3D10StateBlockMaskGetSetting
+@ stub D3D10StateBlockMaskIntersect
+@ stub D3D10StateBlockMaskUnion
+
+@ stdcall D3D10CreateDevice1(ptr long ptr long long long ptr)
+@ stdcall

Mesa (master): d3d1x: define GUIDs in the normal way

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep 22 19:31:54 2010 +0200

d3d1x: define GUIDs in the normal way

---

 .../d3d1x/d3d1xstutil/include/d3d1xstutil.h|   14 --
 .../d3d1x/progs/d3d10app/d3d10x11main.cpp  |1 -
 .../d3d1x/progs/d3d11app/d3d11x11main.cpp  |1 -
 3 files changed, 0 insertions(+), 16 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h 
b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
index 83cf0f2..7627720 100644
--- a/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
+++ b/src/gallium/state_trackers/d3d1x/d3d1xstutil/include/d3d1xstutil.h
@@ -42,20 +42,6 @@ namespace std
 #include utility
 
 #define WIN32_LEAN_AND_MEAN
-#define INITGUID
-#include guiddef.h
-
-// just replicate GUIDs in every object file to avoid the hassle of having to 
pull in a library for them
-#ifdef __GNUC__
-#define ATTRIBUTE_UNUSED __attribute__((unused))
-#else
-#define ATTRIBUTE_UNUSED
-#endif
-#undef DEFINE_GUID
-#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
-static const GUID name ATTRIBUTE_UNUSED = \
-   { l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }
-
 #include objbase.h
 #include specstrings.h
 
diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp 
b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp
index ddba685..0fcef0d 100755
--- a/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp
+++ b/src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp
@@ -24,7 +24,6 @@
  *
  **/
 
-#define INITGUID
 #include d3d10app.h
 #include X11/Xlib.h
 #include GL/glx.h
diff --git a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp 
b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp
index 7e1edeb..7055da9 100755
--- a/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp
+++ b/src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp
@@ -1,4 +1,3 @@
-#define INITGUID
 #include d3d11app.h
 #include X11/Xlib.h
 #include GL/glx.h

___
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): 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 
b/src

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): 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): 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): softpipe: make z/s test always pass if no zsbuf, instead of crashing

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Mon Sep 20 19:22:44 2010 +0200

softpipe: make z/s test always pass if no zsbuf, instead of crashing

D3D10 specifies this.

---

 src/gallium/drivers/softpipe/sp_quad_depth_test.c |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c 
b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
index 5590d40..425fecd 100644
--- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c
+++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
@@ -695,8 +695,9 @@ depth_test_quads_fallback(struct quad_stage *qs,
   nr = alpha_test_quads(qs, quads, nr);
}
 
-   if (qs-softpipe-depth_stencil-depth.enabled ||
-   qs-softpipe-depth_stencil-stencil[0].enabled) {
+   if (qs-softpipe-framebuffer.zsbuf 
+   (qs-softpipe-depth_stencil-depth.enabled ||
+   qs-softpipe-depth_stencil-stencil[0].enabled)) {
 
   data.ps = qs-softpipe-framebuffer.zsbuf;
   data.format = data.ps-format;
@@ -805,6 +806,9 @@ choose_depth_test(struct quad_stage *qs,
 
boolean occlusion = qs-softpipe-active_query_count;
 
+   if(!qs-softpipe-framebuffer.zsbuf)
+  depth = depthwrite = stencil = FALSE;
+
/* default */
qs-run = depth_test_quads_fallback;
 

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


Mesa (master): gallium: avoid the C++ keyword template in sw_winsys.h

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Mon Sep 20 20:13:30 2010 +0200

gallium: avoid the C++ keyword template in sw_winsys.h

---

 src/gallium/include/state_tracker/sw_winsys.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/include/state_tracker/sw_winsys.h 
b/src/gallium/include/state_tracker/sw_winsys.h
index d461ded..0b11fe3 100644
--- a/src/gallium/include/state_tracker/sw_winsys.h
+++ b/src/gallium/include/state_tracker/sw_winsys.h
@@ -97,7 +97,7 @@ struct sw_winsys
 */
struct sw_displaytarget *
(*displaytarget_from_handle)( struct sw_winsys *ws,
- const struct pipe_resource *template,
+ const struct pipe_resource *templat,
  struct winsys_handle *whandle,
  unsigned *stride );
 

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


Mesa (master): tgsi: add switch/case opcodes to tgsi_opcode_tmp.h

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Mon Sep 20 19:19:50 2010 +0200

tgsi: add switch/case opcodes to tgsi_opcode_tmp.h

---

 src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h 
b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
index e472947..b3123ed 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
@@ -163,6 +163,10 @@ OP12(USGE)
 OP12(USHR)
 OP12(USLT)
 OP12(USNE)
+OP01(SWITCH)
+OP01(CASE)
+OP00(DEFAULT)
+OP00(ENDSWITCH)
 
 
 #undef OP00

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


Mesa (master): softpipe: fix whitespace

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Mon Sep 20 20:49:03 2010 +0200

softpipe: fix whitespace

---

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

diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c 
b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
index 425fecd..e9b9262 100644
--- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c
+++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
@@ -696,8 +696,8 @@ depth_test_quads_fallback(struct quad_stage *qs,
}
 
if (qs-softpipe-framebuffer.zsbuf 
-   (qs-softpipe-depth_stencil-depth.enabled ||
-   qs-softpipe-depth_stencil-stencil[0].enabled)) {
+ (qs-softpipe-depth_stencil-depth.enabled ||
+  qs-softpipe-depth_stencil-stencil[0].enabled)) {
 
   data.ps = qs-softpipe-framebuffer.zsbuf;
   data.format = data.ps-format;

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


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

2010-09-20 Thread Luca Barbieri
Module: Mesa
Branch: d3d1x
Commit: e80d59faaa410bfc78af64204bc4055b837c7fad
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e80d59faaa410bfc78af64204bc4055b837c7fad

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 in 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 (7.9): auxiliary: fix depth-only and stencil-only clears

2010-09-19 Thread Luca Barbieri
Module: Mesa
Branch: 7.9
Commit: bd009df1cc545e8f461e252784abfd86d0d990b4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bd009df1cc545e8f461e252784abfd86d0d990b4

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Sun Sep 19 21:48:28 2010 +0200

auxiliary: fix depth-only and stencil-only clears

Depth-only and stencil-only clears should mask out depth/stencil from the
output, mask out stencil/input from input, and OR or ADD them together.

However, due to a typo they were being ANDed, resulting in zeroing the buffer.

---

 src/gallium/auxiliary/util/u_surface.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_surface.c 
b/src/gallium/auxiliary/util/u_surface.c
index af99163..f78b683 100644
--- a/src/gallium/auxiliary/util/u_surface.c
+++ b/src/gallium/auxiliary/util/u_surface.c
@@ -332,7 +332,7 @@ util_clear_depth_stencil(struct pipe_context *pipe,
uint32_t *row = (uint32_t *)dst_map;
for (j = 0; j  width; j++) {
   uint32_t tmp = *row  dst_mask;
-  *row++ = tmp  (zstencil  ~dst_mask);
+  *row++ = tmp | (zstencil  ~dst_mask);
}
dst_map += dst_stride;
 }

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


Mesa (master): auxiliary: fix depth-only and stencil-only clears

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

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Sun Sep 19 21:48:28 2010 +0200

auxiliary: fix depth-only and stencil-only clears

Depth-only and stencil-only clears should mask out depth/stencil from the
output, mask out stencil/input from input, and OR or ADD them together.

However, due to a typo they were being ANDed, resulting in zeroing the buffer.

---

 src/gallium/auxiliary/util/u_surface.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_surface.c 
b/src/gallium/auxiliary/util/u_surface.c
index af99163..f78b683 100644
--- a/src/gallium/auxiliary/util/u_surface.c
+++ b/src/gallium/auxiliary/util/u_surface.c
@@ -332,7 +332,7 @@ util_clear_depth_stencil(struct pipe_context *pipe,
uint32_t *row = (uint32_t *)dst_map;
for (j = 0; j  width; j++) {
   uint32_t tmp = *row  dst_mask;
-  *row++ = tmp  (zstencil  ~dst_mask);
+  *row++ = tmp | (zstencil  ~dst_mask);
}
dst_map += dst_stride;
 }

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


Mesa (shader-work): glext: update to version 64 (OpenGL 4.1)

2010-09-14 Thread Luca Barbieri
Module: Mesa
Branch: shader-work
Commit: dcfca78efd0c4deaa836c2e8b97591a3491fb885
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dcfca78efd0c4deaa836c2e8b97591a3491fb885

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Tue Sep 14 15:12:25 2010 +0200

glext: update to version 64 (OpenGL 4.1)

This version introduces GL_FIXED due to GL_ARB_es2_compatibility,
but does not define GLfixed, which Mesa assumed GL_FIXED would imply.

To fix this, typedef GLfixed and GLclampx unconditionally.
This doesn't seem to cause problems.

---

 include/GL/glext.h  | 1105 +++---
 src/mapi/glapi/glapi_priv.h |2 -
 src/mesa/main/glheader.h|2 +-
 3 files changed, 1027 insertions(+), 82 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=dcfca78efd0c4deaa836c2e8b97591a3491fb885
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (shader-work): mesa: add MESA_ROBUST_ACCESS env var to enable ARB_robustness

2010-09-14 Thread Luca Barbieri
Module: Mesa
Branch: shader-work
Commit: 6e677f16c4496e050f82ed4a43f53db87a72c3e4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6e677f16c4496e050f82ed4a43f53db87a72c3e4

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep  8 06:24:10 2010 +0200

mesa: add MESA_ROBUST_ACCESS env var to enable ARB_robustness

We use the robust access bit to choose whether to apply some loop
optimizations in the GLSL compiler, so it's a good idea to be able
to test this, and it's useful in general to be able to force robustness
from the command line.

In the future, GLX_ARB_create_context_robustness will also allow to turn
this on programmatically in the standard way.

---

 src/mesa/main/context.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 979bc40..f5fe94d 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -873,6 +873,11 @@ _mesa_initialize_context_for_api(GLcontext *ctx,
ctx-WinSysDrawBuffer = NULL;
ctx-WinSysReadBuffer = NULL;
 
+   /* eventually, GLX_ARB_create_context_robustness will be usable to enable 
this too */
+   if (_mesa_getenv(MESA_ROBUST_ACCESS)) {
+  ctx-Const.ContextFlags |= GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB;
+   }
+
/* misc one-time initializations */
one_time_init(ctx);
 

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


Mesa (shader-work): glsl/loop_unroll: unroll loops with cond breaks anywhere, not just the end

2010-09-14 Thread Luca Barbieri
Module: Mesa
Branch: shader-work
Commit: fa93dadda31decb7869fc856f58b5eaade284923
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fa93dadda31decb7869fc856f58b5eaade284923

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Tue Sep 14 04:56:34 2010 +0200

glsl/loop_unroll: unroll loops with cond breaks anywhere, not just the end

Currently we only unroll loops with conditional breaks at the end, which is
the form that ir_lower_jumps generates.

However, if breaks are not lowered, they tend to appear at the beginning, so
add support for a conditional break anywhere.

---

 src/glsl/loop_unroll.cpp |  130 +++---
 1 files changed, 76 insertions(+), 54 deletions(-)

diff --git a/src/glsl/loop_unroll.cpp b/src/glsl/loop_unroll.cpp
index 90797bd..6308907 100644
--- a/src/glsl/loop_unroll.cpp
+++ b/src/glsl/loop_unroll.cpp
@@ -73,44 +73,77 @@ loop_unroll_visitor::visit_leave(ir_loop *ir)
if (ls-num_loop_jumps  1)
   return visit_continue;
else if (ls-num_loop_jumps) {
-  /* recognize loops in the form produced by ir_lower_jumps */
-  ir_instruction *last_ir =
-((ir_instruction*)ir-body_instructions.get_tail());
-
-  assert(last_ir != NULL);
-
-  ir_if *last_if = last_ir-as_if();
-  if (last_if) {
-bool continue_from_then_branch;
-
-/* Determine which if-statement branch, if any, ends with a break.
- * The branch that did *not* have the break will get a temporary
- * continue inserted in each iteration of the loop unroll.
- *
- * Note that since ls-num_loop_jumps is = 1, it is impossible for
- * both branches to end with a break.
- */
-ir_instruction *last =
-   (ir_instruction *) last_if-then_instructions.get_tail();
-
-if (last  last-ir_type == ir_type_loop_jump
- ((ir_loop_jump*) last)-is_break()) {
-   continue_from_then_branch = false;
-} else {
-   last = (ir_instruction *) last_if-then_instructions.get_tail();
-
-   if (last  last-ir_type == ir_type_loop_jump
-((ir_loop_jump*) last)-is_break())
-  continue_from_then_branch = true;
-   else
-  /* Bail out if neither if-statement branch ends with a break.
-   */
-  return visit_continue;
-}
-
-/* Remove the break from the if-statement.
- */
-last-remove();
+  ir_instruction *last_ir = 
((ir_instruction*)ir-body_instructions.get_tail());
+
+  if (last_ir-ir_type == ir_type_loop_jump
+ ((ir_loop_jump*)last_ir)-is_break()) {
+ /* If the only loop-jump is a break at the end of the loop, the loop
+  * will execute exactly once.  Remove the break, set the iteration
+  * count, and fall through to the normal unroller.
+  */
+ last_ir-remove();
+ iterations = 1;
+
+ this-progress = true;
+  } else {
+ ir_if *ir_if = 0;
+ ir_instruction *break_ir = 0;
+ bool continue_from_then_branch = false;
+
+ foreach_list(node, ir-body_instructions) {
+/* recognize loops in the form produced by ir_lower_jumps */
+ir_instruction* cur_ir = (ir_instruction*)node;
+
+assert(last_ir != NULL);
+
+ir_if = cur_ir-as_if();
+if (ir_if) {
+   /* Determine which if-statement branch, if any, ends with a 
break.
+* The branch that did *not* have the break will get a temporary
+* continue inserted in each iteration of the loop unroll.
+*
+* Note that since ls-num_loop_jumps is = 1, it is impossible 
for
+* both branches to end with a break.
+*/
+   ir_instruction *ir_if_last =
+  (ir_instruction *) ir_if-then_instructions.get_tail();
+
+   if (ir_if_last  ir_if_last-ir_type == ir_type_loop_jump
+((ir_loop_jump*) ir_if_last)-is_break()) {
+  continue_from_then_branch = false;
+  break_ir = ir_if_last;
+  break;
+   } else {
+  ir_if_last = (ir_instruction *) 
ir_if-then_instructions.get_tail();
+
+  if (ir_if_last  ir_if_last-ir_type == ir_type_loop_jump
+   ((ir_loop_jump*) ir_if_last)-is_break())
+  {
+ break_ir = ir_if_last;
+ continue_from_then_branch = true;
+ break;
+  }
+   }
+}
+ }
+
+ if(!break_ir)
+return visit_continue;
+
+ /* move instructions after then if in the continue branch */
+ while (!ir_if-get_next()-is_tail_sentinel()) {
+ir_instruction *move_ir = (ir_instruction *)ir_if-get_next();
+
+move_ir-remove

Mesa (shader-work): glsl: teach loop analysis that array dereferences are bounds on the index (v3)

2010-09-14 Thread Luca Barbieri
Module: Mesa
Branch: shader-work
Commit: 1d568d38a1c755fed57d49a3921e40c31bccdabd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1d568d38a1c755fed57d49a3921e40c31bccdabd

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Tue Sep  7 19:29:00 2010 +0200

glsl: teach loop analysis that array dereferences are bounds on the index (v3)

Changes in v3:
- Only look for array dereferences in code that always executes, to avoid
  miscompilation

Changes in v2:
- Incorporate Ian Romanick's feedback
- Make GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB disable this

Since out-of-bounds dereferences cause undefined behavior, we are allowed
to assume that they terminate the loop, if my interpretation of the GLSL
spec is correct.

This allows to find the maximum number of iterations in cases like this:

uniform int texcoords;
float4 gl_TexCoord[8];

for(i = 0; i  texcoords; ++i)
do_something_with(gl_TexCoord[i]);

This is apparently an interesting case since NV_fragment_program2 has
a construct for this.

---

 src/glsl/glsl_parser_extras.cpp |4 +-
 src/glsl/ir_optimization.h  |2 +-
 src/glsl/linker.cpp |2 +-
 src/glsl/loop_analysis.cpp  |   69 ++-
 src/glsl/loop_analysis.h|2 +-
 src/glsl/loop_controls.cpp  |   22 
 src/glsl/main.cpp   |4 ++-
 src/mesa/program/ir_to_mesa.cpp |4 +-
 8 files changed, 92 insertions(+), 17 deletions(-)

diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 4ac062b..44e456b 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -685,7 +685,7 @@ ast_struct_specifier::ast_struct_specifier(char *identifier,
 }
 
 bool
-do_common_optimization(exec_list *ir, bool linked, unsigned 
max_unroll_iterations)
+do_common_optimization(exec_list *ir, bool linked, unsigned 
max_unroll_iterations, bool robust_access)
 {
GLboolean progress = GL_FALSE;
 
@@ -718,7 +718,7 @@ do_common_optimization(exec_list *ir, bool linked, unsigned 
max_unroll_iteration
 
progress = optimize_redundant_jumps(ir) || progress;
 
-   loop_state *ls = analyze_loop_variables(ir);
+   loop_state *ls = analyze_loop_variables(ir, !robust_access);
progress = set_loop_controls(ir, ls) || progress;
progress = unroll_loops(ir, ls, max_unroll_iterations) || progress;
delete ls;
diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h
index 8dbc6ed..02a7f37 100644
--- a/src/glsl/ir_optimization.h
+++ b/src/glsl/ir_optimization.h
@@ -28,7 +28,7 @@
  * Prototypes for optimization passes to be called by the compiler and drivers.
  */
 
-bool do_common_optimization(exec_list *ir, bool linked, unsigned 
max_unroll_iterations);
+bool do_common_optimization(exec_list *ir, bool linked, unsigned 
max_unroll_iterations, bool robust_access);
 
 bool do_algebraic(exec_list *instructions);
 bool do_array_index_to_cond_assign(exec_list *instructions);
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index c2c6621..8567efe 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1471,7 +1471,7 @@ link_shaders(GLcontext *ctx, struct gl_shader_program 
*prog)
 * some of that unused.
 */
for (unsigned i = 0; i  prog-_NumLinkedShaders; i++) {
-  while (do_common_optimization(prog-_LinkedShaders[i]-ir, true, 32))
+  while (do_common_optimization(prog-_LinkedShaders[i]-ir, true, 32, 
true))
 ;
}
 
diff --git a/src/glsl/loop_analysis.cpp b/src/glsl/loop_analysis.cpp
index 687825c..d39e1b4 100644
--- a/src/glsl/loop_analysis.cpp
+++ b/src/glsl/loop_analysis.cpp
@@ -64,6 +64,67 @@ bool contains_continue(ir_instruction* ir)
return visitor.contains_continue;
 }
 
+struct dereference_array_visitor : public ir_hierarchical_visitor
+{
+   loop_variable_state* ls;
+
+   dereference_array_visitor(loop_variable_state* ls)
+   {
+  this-ls = ls;
+   }
+
+   ir_visitor_status visit_leave(ir_dereference_array *ir)
+   {
+  int max_index;
+  if(ir-array-type-is_array())
+ max_index = ir-array-type-length - 1;
+  else if(ir-array-type-is_vector() || ir-array-type-is_matrix())
+ max_index = ir-array-type-components() - 1;
+  else
+ assert(0);
+
+  assert(ir-array_index-type-is_integer());
+  ir_constant *const max_index_c =
+ (ir-array_index-type-base_type == GLSL_TYPE_UINT)
+   ? new(ir) ir_constant((unsigned)max_index)
+   : new(ir) ir_constant((int)max_index);
+  ir_constant *const zero_c =
+ ir_constant::zero(ir, ir-array_index-type);
+
+  ir_if* bound_if;
+
+  bound_if = new (ir) ir_if(new(ir) ir_expression(ir_binop_greater, 
ir-array_index-type, ir-array_index, max_index_c));
+  bound_if-self_link();
+  ls-insert(bound_if);
+
+  bound_if = new (ir) ir_if(new(ir) ir_expression(ir_binop_less, 
ir-array_index-type, ir-array_index, zero_c));
+  bound_if-self_link();
+  ls-insert(bound_if

Mesa (shader-work): 26 new commits

2010-09-14 Thread Luca Barbieri
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b8481d8366604f949cf5c33c8ccc34d90d46f9a0
Author: Luca Barbieri l...@luca-barbieri.com
Date:   Tue Sep 14 04:56:34 2010 +0200

glsl/loop_unroll: unroll loops with cond breaks anywhere, not just the end

Currently we only unroll loops with conditional breaks at the end, which is
the form that ir_lower_jumps generates.

However, if breaks are not lowered, they tend to appear at the beginning, so
add support for a conditional break anywhere.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=20c87414bc919b6783b231bf8b7373c62a0a368e
Author: Luca Barbieri l...@luca-barbieri.com
Date:   Tue Sep 7 19:29:00 2010 +0200

glsl: teach loop analysis that array dereferences are bounds on the index 
(v3)

Changes in v3:
- Only look for array dereferences in code that always executes, to avoid
  miscompilation

Changes in v2:
- Incorporate Ian Romanick's feedback
- Make GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB disable this

Since out-of-bounds dereferences cause undefined behavior, we are allowed
to assume that they terminate the loop, if my interpretation of the GLSL
spec is correct.

This allows to find the maximum number of iterations in cases like this:

uniform int texcoords;
float4 gl_TexCoord[8];

for(i = 0; i  texcoords; ++i)
do_something_with(gl_TexCoord[i]);

This is apparently an interesting case since NV_fragment_program2 has
a construct for this.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a9c0986987b200d483defed8ca08d262d09c26ab
Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep 8 06:24:10 2010 +0200

mesa: add MESA_ROBUST_ACCESS env var to enable ARB_robustness

We use the robust access bit to choose whether to apply some loop
optimizations in the GLSL compiler, so it's a good idea to be able
to test this, and it's useful in general to be able to force robustness
from the command line.

In the future, GLX_ARB_create_context_robustness will also allow to turn
this on programmatically in the standard way.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=11f5a8dbe753dacfa371002d272ea842998a2b16
Author: Luca Barbieri l...@luca-barbieri.com
Date:   Tue Sep 14 04:15:25 2010 +0200

glsl/loop_analysis: fix miscompilation with continues before cond breaks

In the following case, we currently incorrectly determine that the loop
has at most 8 iterations, while it is in fact an infinite loop.

for(;; ++i)
{
foo();

if(i = 4) continue;

if(i  8) break;
}

To fix this, stop looking for induction variable terminators if we hit
a continue, or a continue nested inside ifs.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=759b5db9168f7c0ecc55d259b518f8c32be946fb
Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep 9 20:15:09 2010 +0200

glsl: TEMP: do array indexing lowering and structure split in main.cpp

The places that run optimization passes should be unified and refactored,
so that things need not be added everywhere.

Currently add this to main.cpp; OpenGL will need this too depending on
options.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=21d589669cd6fa70e5fcc257bd0ea9e07eb467aa
Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep 8 03:47:58 2010 +0200

glsl: teach structure splitting to split arrays, and never split in/outs

Currently structure splitting cannot split arrays, which makes
do_array_index_to_cond_assign useless.

This commit adds that capability.

Also, it prevents it from splitting in/out/inout variables, which were
incorrectly split.

It may be possible to split them if user-defined, but that will need
further changes and some way to make sure we link stages correctly.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0fbcf79cced4bc0c50477024520e5de477185bb1
Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep 8 01:35:44 2010 +0200

glsl: add pass to lower variable array indexing to conditional assignments

Currenly GLSL happily generates indirect addressing of any kind of
arrays.

Unfortunately DirectX 9 GPUs are not guaranteed to support any of them in
general.

This pass fixes that by lowering such constructs to a binary search on the
values, followed at the end by vectorized generation of equality masks, and
4 conditional assignments for each mask generation.

Note that this requires the ir_binop_equal change so that we can emit SEQ
to generate the boolean masks.

Unfortunately, ir_structure_splitting is too dumb to turn the resulting
constant array references to individual variables, so this will need to
be added too before this pass can actually be effective

Mesa (master): auxiliary: fix unintended fallthrough

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

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

auxiliary: fix unintended fallthrough

---

 src/gallium/auxiliary/util/u_caps.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_caps.c 
b/src/gallium/auxiliary/util/u_caps.c
index f6a8786..e209a98 100644
--- a/src/gallium/auxiliary/util/u_caps.c
+++ b/src/gallium/auxiliary/util/u_caps.c
@@ -82,6 +82,7 @@ util_check_caps_out(struct pipe_screen *screen, const 
unsigned *list, int *out)
 *out = i - 3;
 return FALSE;
  }
+ break;
   case UTIL_CAPS_CHECK_UNIMPLEMENTED:
  *out = i - 1;
  return FALSE;

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


Mesa (7.9): auxiliary: fix unintended fallthrough

2010-09-14 Thread Luca Barbieri
Module: Mesa
Branch: 7.9
Commit: 26e63a431d89e14f65453c6b4bbb3a343d85681e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=26e63a431d89e14f65453c6b4bbb3a343d85681e

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

auxiliary: fix unintended fallthrough

---

 src/gallium/auxiliary/util/u_caps.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_caps.c 
b/src/gallium/auxiliary/util/u_caps.c
index f6a8786..e209a98 100644
--- a/src/gallium/auxiliary/util/u_caps.c
+++ b/src/gallium/auxiliary/util/u_caps.c
@@ -82,6 +82,7 @@ util_check_caps_out(struct pipe_screen *screen, const 
unsigned *list, int *out)
 *out = i - 3;
 return FALSE;
  }
+ break;
   case UTIL_CAPS_CHECK_UNIMPLEMENTED:
  *out = i - 1;
  return FALSE;

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


Mesa (shader-work): glsl: add pass to lower variable array indexing to conditional assignments

2010-09-13 Thread Luca Barbieri
Module: Mesa
Branch: shader-work
Commit: eacb3a55fb910ab28897fbfed763147092e17c6d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=eacb3a55fb910ab28897fbfed763147092e17c6d

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep  8 01:35:44 2010 +0200

glsl: add pass to lower variable array indexing to conditional assignments

Currenly GLSL happily generates indirect addressing of any kind of
arrays.

Unfortunately DirectX 9 GPUs are not guaranteed to support any of them in
general.

This pass fixes that by lowering such constructs to a binary search on the
values, followed at the end by vectorized generation of equality masks, and
4 conditional assignments for each mask generation.

Note that this requires the ir_binop_equal change so that we can emit SEQ
to generate the boolean masks.

Unfortunately, ir_structure_splitting is too dumb to turn the resulting
constant array references to individual variables, so this will need to
be added too before this pass can actually be effective for temps.

---

 src/glsl/Makefile  |1 +
 src/glsl/SConscript|1 +
 src/glsl/ir_array_index_to_cond_assign.cpp |  278 
 src/glsl/ir_optimization.h |1 +
 4 files changed, 281 insertions(+), 0 deletions(-)

diff --git a/src/glsl/Makefile b/src/glsl/Makefile
index efa274b..b12878c 100644
--- a/src/glsl/Makefile
+++ b/src/glsl/Makefile
@@ -31,6 +31,7 @@ CXX_SOURCES = \
glsl_symbol_table.cpp \
hir_field_selection.cpp \
ir_algebraic.cpp \
+   ir_array_index_to_cond_assign.cpp \
ir_basic_block.cpp \
ir_clone.cpp \
ir_constant_expression.cpp \
diff --git a/src/glsl/SConscript b/src/glsl/SConscript
index ac6324a..ed12e84 100644
--- a/src/glsl/SConscript
+++ b/src/glsl/SConscript
@@ -28,6 +28,7 @@ sources = [
 'glsl_symbol_table.cpp',
 'hir_field_selection.cpp',
 'ir_algebraic.cpp',
+'ir_array_index_to_cond_assign.cpp',
 'ir_basic_block.cpp',
 'ir_clone.cpp',
 'ir_constant_expression.cpp',
diff --git a/src/glsl/ir_array_index_to_cond_assign.cpp 
b/src/glsl/ir_array_index_to_cond_assign.cpp
new file mode 100644
index 000..1ab19c0
--- /dev/null
+++ b/src/glsl/ir_array_index_to_cond_assign.cpp
@@ -0,0 +1,278 @@
+/*
+ * 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 AUTHORS OR COPYRIGHT HOLDERS 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.
+ */
+
+/**
+ * \file ir_array_index_to_cond_assign.cpp
+ *
+ * Turns non-constant indexing into array types to a series of
+ * conditional moves of each element into a temporary.
+ *
+ * Pre-DX10 GPUs often don't have a native way to do this operation,
+ * and this works around that.
+ */
+
+#include ir.h
+#include ir_rvalue_visitor.h
+#include ir_optimization.h
+#include glsl_types.h
+#include algorithm
+
+struct assignment_generator
+{
+   ir_instruction* base_ir;
+   ir_rvalue* array;
+   bool is_write;
+   ir_variable* var;
+
+   assignment_generator()
+   {
+   }
+
+   exec_list generate(unsigned i, ir_rvalue* condition) const
+   {
+  /* Just clone the rest of the deref chain when trying to get at the
+   * underlying variable.
+   * XXX: what if it has side effects?!? ir_vector_index_to_cond_assign 
does this too!
+   */
+  void *mem_ctx = talloc_parent(base_ir);
+  ir_rvalue* element = new(base_ir) 
ir_dereference_array(this-array-clone(mem_ctx, NULL), new(base_ir) 
ir_constant(i));
+  ir_rvalue* variable = new(base_ir) ir_dereference_variable(this-var);
+  exec_list list;
+  ir_assignment* assignment;
+  if(is_write)
+ assignment = new(base_ir) ir_assignment(element, variable, condition);
+  else
+ assignment = new(base_ir) ir_assignment(variable, element, condition);
+  list.push_tail(assignment);
+  return list;
+   }
+};
+
+struct switch_generator
+{
+   /* make TFunction a template parameter if you need to use

Mesa (shader-work): glsl: teach structure splitting to split arrays, and never split in/outs

2010-09-13 Thread Luca Barbieri
Module: Mesa
Branch: shader-work
Commit: e5d41d891f105c982aa26256107a761369ea23e1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e5d41d891f105c982aa26256107a761369ea23e1

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep  8 03:47:58 2010 +0200

glsl: teach structure splitting to split arrays, and never split in/outs

Currently structure splitting cannot split arrays, which makes
do_array_index_to_cond_assign useless.

This commit adds that capability.

Also, it prevents it from splitting in/out/inout variables, which were
incorrectly split.

It may be possible to split them if user-defined, but that will need
further changes and some way to make sure we link stages correctly.

---

 src/glsl/ir_structure_splitting.cpp |  143 +++---
 1 files changed, 113 insertions(+), 30 deletions(-)

diff --git a/src/glsl/ir_structure_splitting.cpp 
b/src/glsl/ir_structure_splitting.cpp
index ff3ec93..807d447 100644
--- a/src/glsl/ir_structure_splitting.cpp
+++ b/src/glsl/ir_structure_splitting.cpp
@@ -86,6 +86,7 @@ public:
virtual ir_visitor_status visit(ir_variable *);
virtual ir_visitor_status visit(ir_dereference_variable *);
virtual ir_visitor_status visit_enter(ir_dereference_record *);
+   virtual ir_visitor_status visit_enter(ir_dereference_array *);
virtual ir_visitor_status visit_enter(ir_assignment *);
virtual ir_visitor_status visit_enter(ir_function_signature *);
 
@@ -102,7 +103,8 @@ 
ir_structure_reference_visitor::get_variable_entry2(ir_variable *var)
 {
assert(var);
 
-   if (!var-type-is_record() || var-mode == ir_var_uniform)
+   if ((!var-type-is_record()  !var-type-is_array())
+ || (var-mode != ir_var_auto  var-mode != ir_var_temporary))
   return NULL;
 
foreach_iter(exec_list_iterator, iter, this-variable_list) {
@@ -149,6 +151,25 @@ 
ir_structure_reference_visitor::visit_enter(ir_dereference_record *ir)
 }
 
 ir_visitor_status
+ir_structure_reference_visitor::visit_enter(ir_dereference_array *ir)
+{
+   ir-array_index-accept(this);
+   if(!ir-array_index-as_constant())
+   {
+  /* FINISHME: could produce and make use of information
+   * about possible values of the index
+   */
+  ir_variable *const var = ir-array-variable_referenced();
+  variable_entry2 *entry = this-get_variable_entry2(var);
+
+  if (entry)
+ entry-whole_structure_access++;
+   }
+
+   /* Don't descend into the ir_dereference_variable below. */
+   return visit_continue_with_parent;
+}
+ir_visitor_status
 ir_structure_reference_visitor::visit_enter(ir_assignment *ir)
 {
if (ir-lhs-as_dereference_variable() 
@@ -198,7 +219,7 @@ 
ir_structure_splitting_visitor::get_splitting_entry(ir_variable *var)
 {
assert(var);
 
-   if (!var-type-is_record())
+   if (!var-type-is_record()  !var-type-is_array())
   return NULL;
 
foreach_iter(exec_list_iterator, iter, *this-variable_list) {
@@ -214,27 +235,61 @@ 
ir_structure_splitting_visitor::get_splitting_entry(ir_variable *var)
 void
 ir_structure_splitting_visitor::split_deref(ir_dereference **deref)
 {
-   if ((*deref)-ir_type != ir_type_dereference_record)
-  return;
-
-   ir_dereference_record *deref_record = (ir_dereference_record *)*deref;
-   ir_dereference_variable *deref_var = 
deref_record-record-as_dereference_variable();
-   if (!deref_var)
-  return;
-
-   variable_entry2 *entry = get_splitting_entry(deref_var-var);
-   if (!entry)
-  return;
+   if ((*deref)-ir_type == ir_type_dereference_record)
+   {
+  ir_dereference_record *deref_record = (ir_dereference_record *)*deref;
+  ir_dereference_variable *deref_var = 
deref_record-record-as_dereference_variable();
+  if (!deref_var)
+ return;
+
+  variable_entry2 *entry = get_splitting_entry(deref_var-var);
+  if (!entry)
+ return;
+
+  unsigned int i;
+  for (i = 0; i  entry-var-type-length; i++) {
+ if (strcmp(deref_record-field,
+entry-var-type-fields.structure[i].name) == 0)
+break;
+  }
+  assert(i != entry-var-type-length);
 
-   unsigned int i;
-   for (i = 0; i  entry-var-type-length; i++) {
-  if (strcmp(deref_record-field,
-entry-var-type-fields.structure[i].name) == 0)
-break;
+  *deref = new(entry-mem_ctx) 
ir_dereference_variable(entry-components[i]);
+   }
+   else if ((*deref)-ir_type == ir_type_dereference_array)
+   {
+  ir_dereference_array *deref_array = (ir_dereference_array*)*deref;
+  ir_dereference_variable *deref_var = 
deref_array-array-as_dereference_variable();
+  if (!deref_var)
+ return;
+
+  variable_entry2 *entry = get_splitting_entry(deref_var-var);
+  if (!entry)
+ return;
+
+  ir_constant* index = deref_array-array_index-as_constant();
+  assert(index);
+  assert(index-type-is_scalar());
+  assert(index-type-base_type == GLSL_TYPE_INT || index-type-base_type

Mesa (shader-work): glsl: TEMP: do array indexing lowering and structure split in main.cpp

2010-09-13 Thread Luca Barbieri
Module: Mesa
Branch: shader-work
Commit: a4090401ed0bdf20f98986114b3884e014f8b2ec
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a4090401ed0bdf20f98986114b3884e014f8b2ec

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep  9 20:15:09 2010 +0200

glsl: TEMP: do array indexing lowering and structure split in main.cpp

The places that run optimization passes should be unified and refactored,
so that things need not be added everywhere.

Currently add this to main.cpp; OpenGL will need this too depending on
options.

---

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

diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp
index bc82966..dddc181 100644
--- a/src/glsl/main.cpp
+++ b/src/glsl/main.cpp
@@ -219,6 +219,9 @@ compile_shader(GLcontext *ctx, struct gl_shader *shader)
 progress = set_loop_controls(shader-ir, ls) || progress;
 progress = unroll_loops(shader-ir, ls, 32) || progress;
 delete ls;
+
+progress = do_array_index_to_cond_assign(shader-ir) || progress;
+progress = do_structure_splitting(shader-ir) || progress;
   } while (progress);
 
   validate_ir_tree(shader-ir);

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


Mesa (shader-work): glsl: teach loop analysis that array dereferences are bounds on the index ( BROKEN)

2010-09-13 Thread Luca Barbieri
Module: Mesa
Branch: shader-work
Commit: 7c51116de276d14d832ff5acd75d42e14017cdd1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7c51116de276d14d832ff5acd75d42e14017cdd1

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Tue Sep  7 19:29:00 2010 +0200

glsl: teach loop analysis that array dereferences are bounds on the index 
(BROKEN)

Note that this is BROKEN: the following code will be miscompiled:

int array[8];

for(;; ++i)
{
foo();

if(i = 4) continue;

bar(array[i])
}

However, the existing code seems also BROKEN, as the following will be 
miscompiled:

for(;; ++i)
{
foo();

if(i = 4) continue;

if(i  8) break;
}

Changes in v2:
- Incorporate Ian Romanick's feedback
- Make GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB disable this

Since out-of-bounds dereferences cause undefined behavior, we are allowed
to assume that they terminate the loop, if my interpretation of the GLSL
spec is correct.

This allows to find the maximum number of iterations in cases like this:

uniform int texcoords;
float4 gl_TexCoord[8];

for(i = 0; i  texcoords; ++i)
do_something_with(gl_TexCoord[i]);

This is apparently an interesting case since NV_fragment_program2 has
a construct for this.

---

 src/glsl/glsl_parser_extras.cpp |4 +-
 src/glsl/ir_optimization.h  |2 +-
 src/glsl/linker.cpp |2 +-
 src/glsl/loop_analysis.cpp  |   51 ++-
 src/glsl/loop_analysis.h|2 +-
 src/glsl/loop_controls.cpp  |   22 ++--
 src/glsl/main.cpp   |4 ++-
 src/mesa/program/ir_to_mesa.cpp |4 +-
 8 files changed, 74 insertions(+), 17 deletions(-)

diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 4ac062b..44e456b 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -685,7 +685,7 @@ ast_struct_specifier::ast_struct_specifier(char *identifier,
 }
 
 bool
-do_common_optimization(exec_list *ir, bool linked, unsigned 
max_unroll_iterations)
+do_common_optimization(exec_list *ir, bool linked, unsigned 
max_unroll_iterations, bool robust_access)
 {
GLboolean progress = GL_FALSE;
 
@@ -718,7 +718,7 @@ do_common_optimization(exec_list *ir, bool linked, unsigned 
max_unroll_iteration
 
progress = optimize_redundant_jumps(ir) || progress;
 
-   loop_state *ls = analyze_loop_variables(ir);
+   loop_state *ls = analyze_loop_variables(ir, !robust_access);
progress = set_loop_controls(ir, ls) || progress;
progress = unroll_loops(ir, ls, max_unroll_iterations) || progress;
delete ls;
diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h
index b365ed2..f2c37bb 100644
--- a/src/glsl/ir_optimization.h
+++ b/src/glsl/ir_optimization.h
@@ -28,7 +28,7 @@
  * Prototypes for optimization passes to be called by the compiler and drivers.
  */
 
-bool do_common_optimization(exec_list *ir, bool linked, unsigned 
max_unroll_iterations);
+bool do_common_optimization(exec_list *ir, bool linked, unsigned 
max_unroll_iterations, bool robust_access);
 
 bool do_algebraic(exec_list *instructions);
 bool do_constant_folding(exec_list *instructions);
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index c2c6621..8567efe 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1471,7 +1471,7 @@ link_shaders(GLcontext *ctx, struct gl_shader_program 
*prog)
 * some of that unused.
 */
for (unsigned i = 0; i  prog-_NumLinkedShaders; i++) {
-  while (do_common_optimization(prog-_LinkedShaders[i]-ir, true, 32))
+  while (do_common_optimization(prog-_LinkedShaders[i]-ir, true, 32, 
true))
 ;
}
 
diff --git a/src/glsl/loop_analysis.cpp b/src/glsl/loop_analysis.cpp
index 91e34da..9d6dce6 100644
--- a/src/glsl/loop_analysis.cpp
+++ b/src/glsl/loop_analysis.cpp
@@ -105,6 +105,7 @@ public:
 
virtual ir_visitor_status visit(ir_loop_jump *);
virtual ir_visitor_status visit(ir_dereference_variable *);
+   virtual ir_visitor_status visit_leave(ir_dereference_array *);
 
virtual ir_visitor_status visit_enter(ir_loop *);
virtual ir_visitor_status visit_leave(ir_loop *);
@@ -113,6 +114,8 @@ public:
virtual ir_visitor_status visit_enter(ir_if *);
virtual ir_visitor_status visit_leave(ir_if *);
 
+   bool out_of_bounds_can_break;
+
loop_state *loops;
 
int if_statement_depth;
@@ -191,6 +194,51 @@ loop_analysis::visit(ir_dereference_variable *ir)
 }
 
 ir_visitor_status
+loop_analysis::visit_leave(ir_dereference_array *ir)
+{
+   /* If we're not somewhere inside a loop, there's nothing to do.
+*/
+   if (this-state.is_empty())
+  return visit_continue;
+
+   /* ARB_robustness forbids this */
+   if(!out_of_bounds_can_break)
+  return visit_continue;
+
+   loop_variable_state *const ls =
+(loop_variable_state *) this-state.get_head();
+
+   int max_index;
+   if(ir-array-type-is_array())
+  max_index = ir-array-type-length - 1

Mesa (shader-work): glsl: add pass to lower variable array indexing to conditional assignments

2010-09-13 Thread Luca Barbieri
Module: Mesa
Branch: shader-work
Commit: 65cd10054b84da27a2054e58626d8377e0e6d2d0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=65cd10054b84da27a2054e58626d8377e0e6d2d0

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep  8 01:35:44 2010 +0200

glsl: add pass to lower variable array indexing to conditional assignments

Currenly GLSL happily generates indirect addressing of any kind of
arrays.

Unfortunately DirectX 9 GPUs are not guaranteed to support any of them in
general.

This pass fixes that by lowering such constructs to a binary search on the
values, followed at the end by vectorized generation of equality masks, and
4 conditional assignments for each mask generation.

Note that this requires the ir_binop_equal change so that we can emit SEQ
to generate the boolean masks.

Unfortunately, ir_structure_splitting is too dumb to turn the resulting
constant array references to individual variables, so this will need to
be added too before this pass can actually be effective for temps.

---

 src/glsl/Makefile  |1 +
 src/glsl/SConscript|1 +
 src/glsl/ir_array_index_to_cond_assign.cpp |  278 
 src/glsl/ir_optimization.h |1 +
 4 files changed, 281 insertions(+), 0 deletions(-)

diff --git a/src/glsl/Makefile b/src/glsl/Makefile
index 1746e18..4f9b0f5 100644
--- a/src/glsl/Makefile
+++ b/src/glsl/Makefile
@@ -31,6 +31,7 @@ CXX_SOURCES = \
glsl_symbol_table.cpp \
hir_field_selection.cpp \
ir_algebraic.cpp \
+   ir_array_index_to_cond_assign.cpp \
ir_basic_block.cpp \
ir_clone.cpp \
ir_constant_expression.cpp \
diff --git a/src/glsl/SConscript b/src/glsl/SConscript
index 6e2ef2d..78d6a4d 100644
--- a/src/glsl/SConscript
+++ b/src/glsl/SConscript
@@ -28,6 +28,7 @@ sources = [
 'glsl_symbol_table.cpp',
 'hir_field_selection.cpp',
 'ir_algebraic.cpp',
+'ir_array_index_to_cond_assign.cpp',
 'ir_basic_block.cpp',
 'ir_clone.cpp',
 'ir_constant_expression.cpp',
diff --git a/src/glsl/ir_array_index_to_cond_assign.cpp 
b/src/glsl/ir_array_index_to_cond_assign.cpp
new file mode 100644
index 000..1ab19c0
--- /dev/null
+++ b/src/glsl/ir_array_index_to_cond_assign.cpp
@@ -0,0 +1,278 @@
+/*
+ * 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 AUTHORS OR COPYRIGHT HOLDERS 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.
+ */
+
+/**
+ * \file ir_array_index_to_cond_assign.cpp
+ *
+ * Turns non-constant indexing into array types to a series of
+ * conditional moves of each element into a temporary.
+ *
+ * Pre-DX10 GPUs often don't have a native way to do this operation,
+ * and this works around that.
+ */
+
+#include ir.h
+#include ir_rvalue_visitor.h
+#include ir_optimization.h
+#include glsl_types.h
+#include algorithm
+
+struct assignment_generator
+{
+   ir_instruction* base_ir;
+   ir_rvalue* array;
+   bool is_write;
+   ir_variable* var;
+
+   assignment_generator()
+   {
+   }
+
+   exec_list generate(unsigned i, ir_rvalue* condition) const
+   {
+  /* Just clone the rest of the deref chain when trying to get at the
+   * underlying variable.
+   * XXX: what if it has side effects?!? ir_vector_index_to_cond_assign 
does this too!
+   */
+  void *mem_ctx = talloc_parent(base_ir);
+  ir_rvalue* element = new(base_ir) 
ir_dereference_array(this-array-clone(mem_ctx, NULL), new(base_ir) 
ir_constant(i));
+  ir_rvalue* variable = new(base_ir) ir_dereference_variable(this-var);
+  exec_list list;
+  ir_assignment* assignment;
+  if(is_write)
+ assignment = new(base_ir) ir_assignment(element, variable, condition);
+  else
+ assignment = new(base_ir) ir_assignment(variable, element, condition);
+  list.push_tail(assignment);
+  return list;
+   }
+};
+
+struct switch_generator
+{
+   /* make TFunction a template parameter if you need to use

Mesa (shader-work): glsl: TEMP: do array indexing lowering and structure split in main.cpp

2010-09-13 Thread Luca Barbieri
Module: Mesa
Branch: shader-work
Commit: a04743b665b27472f8ec5fae7103daa3200dd9de
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a04743b665b27472f8ec5fae7103daa3200dd9de

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep  9 20:15:09 2010 +0200

glsl: TEMP: do array indexing lowering and structure split in main.cpp

The places that run optimization passes should be unified and refactored,
so that things need not be added everywhere.

Currently add this to main.cpp; OpenGL will need this too depending on
options.

---

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

diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp
index bc82966..dddc181 100644
--- a/src/glsl/main.cpp
+++ b/src/glsl/main.cpp
@@ -219,6 +219,9 @@ compile_shader(GLcontext *ctx, struct gl_shader *shader)
 progress = set_loop_controls(shader-ir, ls) || progress;
 progress = unroll_loops(shader-ir, ls, 32) || progress;
 delete ls;
+
+progress = do_array_index_to_cond_assign(shader-ir) || progress;
+progress = do_structure_splitting(shader-ir) || progress;
   } while (progress);
 
   validate_ir_tree(shader-ir);

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


Mesa (shader-work): glsl: teach structure splitting to split arrays, and never split in/outs

2010-09-13 Thread Luca Barbieri
Module: Mesa
Branch: shader-work
Commit: b43c59bd4e692f4a7372a04dacf2466ae4380136
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b43c59bd4e692f4a7372a04dacf2466ae4380136

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep  8 03:47:58 2010 +0200

glsl: teach structure splitting to split arrays, and never split in/outs

Currently structure splitting cannot split arrays, which makes
do_array_index_to_cond_assign useless.

This commit adds that capability.

Also, it prevents it from splitting in/out/inout variables, which were
incorrectly split.

It may be possible to split them if user-defined, but that will need
further changes and some way to make sure we link stages correctly.

---

 src/glsl/ir_structure_splitting.cpp |  143 +++---
 1 files changed, 113 insertions(+), 30 deletions(-)

diff --git a/src/glsl/ir_structure_splitting.cpp 
b/src/glsl/ir_structure_splitting.cpp
index ff3ec93..807d447 100644
--- a/src/glsl/ir_structure_splitting.cpp
+++ b/src/glsl/ir_structure_splitting.cpp
@@ -86,6 +86,7 @@ public:
virtual ir_visitor_status visit(ir_variable *);
virtual ir_visitor_status visit(ir_dereference_variable *);
virtual ir_visitor_status visit_enter(ir_dereference_record *);
+   virtual ir_visitor_status visit_enter(ir_dereference_array *);
virtual ir_visitor_status visit_enter(ir_assignment *);
virtual ir_visitor_status visit_enter(ir_function_signature *);
 
@@ -102,7 +103,8 @@ 
ir_structure_reference_visitor::get_variable_entry2(ir_variable *var)
 {
assert(var);
 
-   if (!var-type-is_record() || var-mode == ir_var_uniform)
+   if ((!var-type-is_record()  !var-type-is_array())
+ || (var-mode != ir_var_auto  var-mode != ir_var_temporary))
   return NULL;
 
foreach_iter(exec_list_iterator, iter, this-variable_list) {
@@ -149,6 +151,25 @@ 
ir_structure_reference_visitor::visit_enter(ir_dereference_record *ir)
 }
 
 ir_visitor_status
+ir_structure_reference_visitor::visit_enter(ir_dereference_array *ir)
+{
+   ir-array_index-accept(this);
+   if(!ir-array_index-as_constant())
+   {
+  /* FINISHME: could produce and make use of information
+   * about possible values of the index
+   */
+  ir_variable *const var = ir-array-variable_referenced();
+  variable_entry2 *entry = this-get_variable_entry2(var);
+
+  if (entry)
+ entry-whole_structure_access++;
+   }
+
+   /* Don't descend into the ir_dereference_variable below. */
+   return visit_continue_with_parent;
+}
+ir_visitor_status
 ir_structure_reference_visitor::visit_enter(ir_assignment *ir)
 {
if (ir-lhs-as_dereference_variable() 
@@ -198,7 +219,7 @@ 
ir_structure_splitting_visitor::get_splitting_entry(ir_variable *var)
 {
assert(var);
 
-   if (!var-type-is_record())
+   if (!var-type-is_record()  !var-type-is_array())
   return NULL;
 
foreach_iter(exec_list_iterator, iter, *this-variable_list) {
@@ -214,27 +235,61 @@ 
ir_structure_splitting_visitor::get_splitting_entry(ir_variable *var)
 void
 ir_structure_splitting_visitor::split_deref(ir_dereference **deref)
 {
-   if ((*deref)-ir_type != ir_type_dereference_record)
-  return;
-
-   ir_dereference_record *deref_record = (ir_dereference_record *)*deref;
-   ir_dereference_variable *deref_var = 
deref_record-record-as_dereference_variable();
-   if (!deref_var)
-  return;
-
-   variable_entry2 *entry = get_splitting_entry(deref_var-var);
-   if (!entry)
-  return;
+   if ((*deref)-ir_type == ir_type_dereference_record)
+   {
+  ir_dereference_record *deref_record = (ir_dereference_record *)*deref;
+  ir_dereference_variable *deref_var = 
deref_record-record-as_dereference_variable();
+  if (!deref_var)
+ return;
+
+  variable_entry2 *entry = get_splitting_entry(deref_var-var);
+  if (!entry)
+ return;
+
+  unsigned int i;
+  for (i = 0; i  entry-var-type-length; i++) {
+ if (strcmp(deref_record-field,
+entry-var-type-fields.structure[i].name) == 0)
+break;
+  }
+  assert(i != entry-var-type-length);
 
-   unsigned int i;
-   for (i = 0; i  entry-var-type-length; i++) {
-  if (strcmp(deref_record-field,
-entry-var-type-fields.structure[i].name) == 0)
-break;
+  *deref = new(entry-mem_ctx) 
ir_dereference_variable(entry-components[i]);
+   }
+   else if ((*deref)-ir_type == ir_type_dereference_array)
+   {
+  ir_dereference_array *deref_array = (ir_dereference_array*)*deref;
+  ir_dereference_variable *deref_var = 
deref_array-array-as_dereference_variable();
+  if (!deref_var)
+ return;
+
+  variable_entry2 *entry = get_splitting_entry(deref_var-var);
+  if (!entry)
+ return;
+
+  ir_constant* index = deref_array-array_index-as_constant();
+  assert(index);
+  assert(index-type-is_scalar());
+  assert(index-type-base_type == GLSL_TYPE_INT || index-type-base_type

Mesa (shader-work): glsl: add pass to lower variable array indexing to conditional assignments

2010-09-13 Thread Luca Barbieri
Module: Mesa
Branch: shader-work
Commit: 75b1f7ac52d0c9125f6f6110ac6349ffdd96a2a5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=75b1f7ac52d0c9125f6f6110ac6349ffdd96a2a5

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep  8 01:35:44 2010 +0200

glsl: add pass to lower variable array indexing to conditional assignments

Currenly GLSL happily generates indirect addressing of any kind of
arrays.

Unfortunately DirectX 9 GPUs are not guaranteed to support any of them in
general.

This pass fixes that by lowering such constructs to a binary search on the
values, followed at the end by vectorized generation of equality masks, and
4 conditional assignments for each mask generation.

Note that this requires the ir_binop_equal change so that we can emit SEQ
to generate the boolean masks.

Unfortunately, ir_structure_splitting is too dumb to turn the resulting
constant array references to individual variables, so this will need to
be added too before this pass can actually be effective for temps.

---

 src/glsl/Makefile  |1 +
 src/glsl/SConscript|1 +
 src/glsl/ir_array_index_to_cond_assign.cpp |  278 
 src/glsl/ir_optimization.h |1 +
 4 files changed, 281 insertions(+), 0 deletions(-)

diff --git a/src/glsl/Makefile b/src/glsl/Makefile
index 1746e18..4f9b0f5 100644
--- a/src/glsl/Makefile
+++ b/src/glsl/Makefile
@@ -31,6 +31,7 @@ CXX_SOURCES = \
glsl_symbol_table.cpp \
hir_field_selection.cpp \
ir_algebraic.cpp \
+   ir_array_index_to_cond_assign.cpp \
ir_basic_block.cpp \
ir_clone.cpp \
ir_constant_expression.cpp \
diff --git a/src/glsl/SConscript b/src/glsl/SConscript
index 6e2ef2d..78d6a4d 100644
--- a/src/glsl/SConscript
+++ b/src/glsl/SConscript
@@ -28,6 +28,7 @@ sources = [
 'glsl_symbol_table.cpp',
 'hir_field_selection.cpp',
 'ir_algebraic.cpp',
+'ir_array_index_to_cond_assign.cpp',
 'ir_basic_block.cpp',
 'ir_clone.cpp',
 'ir_constant_expression.cpp',
diff --git a/src/glsl/ir_array_index_to_cond_assign.cpp 
b/src/glsl/ir_array_index_to_cond_assign.cpp
new file mode 100644
index 000..1ab19c0
--- /dev/null
+++ b/src/glsl/ir_array_index_to_cond_assign.cpp
@@ -0,0 +1,278 @@
+/*
+ * 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 AUTHORS OR COPYRIGHT HOLDERS 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.
+ */
+
+/**
+ * \file ir_array_index_to_cond_assign.cpp
+ *
+ * Turns non-constant indexing into array types to a series of
+ * conditional moves of each element into a temporary.
+ *
+ * Pre-DX10 GPUs often don't have a native way to do this operation,
+ * and this works around that.
+ */
+
+#include ir.h
+#include ir_rvalue_visitor.h
+#include ir_optimization.h
+#include glsl_types.h
+#include algorithm
+
+struct assignment_generator
+{
+   ir_instruction* base_ir;
+   ir_rvalue* array;
+   bool is_write;
+   ir_variable* var;
+
+   assignment_generator()
+   {
+   }
+
+   exec_list generate(unsigned i, ir_rvalue* condition) const
+   {
+  /* Just clone the rest of the deref chain when trying to get at the
+   * underlying variable.
+   * XXX: what if it has side effects?!? ir_vector_index_to_cond_assign 
does this too!
+   */
+  void *mem_ctx = talloc_parent(base_ir);
+  ir_rvalue* element = new(base_ir) 
ir_dereference_array(this-array-clone(mem_ctx, NULL), new(base_ir) 
ir_constant(i));
+  ir_rvalue* variable = new(base_ir) ir_dereference_variable(this-var);
+  exec_list list;
+  ir_assignment* assignment;
+  if(is_write)
+ assignment = new(base_ir) ir_assignment(element, variable, condition);
+  else
+ assignment = new(base_ir) ir_assignment(variable, element, condition);
+  list.push_tail(assignment);
+  return list;
+   }
+};
+
+struct switch_generator
+{
+   /* make TFunction a template parameter if you need to use

Mesa (shader-work): glsl: teach structure splitting to split arrays, and never split in/outs

2010-09-13 Thread Luca Barbieri
Module: Mesa
Branch: shader-work
Commit: 058df122e3c039f4875e9480c7f23c1123a1f630
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=058df122e3c039f4875e9480c7f23c1123a1f630

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep  8 03:47:58 2010 +0200

glsl: teach structure splitting to split arrays, and never split in/outs

Currently structure splitting cannot split arrays, which makes
do_array_index_to_cond_assign useless.

This commit adds that capability.

Also, it prevents it from splitting in/out/inout variables, which were
incorrectly split.

It may be possible to split them if user-defined, but that will need
further changes and some way to make sure we link stages correctly.

---

 src/glsl/ir_structure_splitting.cpp |  143 +++---
 1 files changed, 113 insertions(+), 30 deletions(-)

diff --git a/src/glsl/ir_structure_splitting.cpp 
b/src/glsl/ir_structure_splitting.cpp
index ff3ec93..807d447 100644
--- a/src/glsl/ir_structure_splitting.cpp
+++ b/src/glsl/ir_structure_splitting.cpp
@@ -86,6 +86,7 @@ public:
virtual ir_visitor_status visit(ir_variable *);
virtual ir_visitor_status visit(ir_dereference_variable *);
virtual ir_visitor_status visit_enter(ir_dereference_record *);
+   virtual ir_visitor_status visit_enter(ir_dereference_array *);
virtual ir_visitor_status visit_enter(ir_assignment *);
virtual ir_visitor_status visit_enter(ir_function_signature *);
 
@@ -102,7 +103,8 @@ 
ir_structure_reference_visitor::get_variable_entry2(ir_variable *var)
 {
assert(var);
 
-   if (!var-type-is_record() || var-mode == ir_var_uniform)
+   if ((!var-type-is_record()  !var-type-is_array())
+ || (var-mode != ir_var_auto  var-mode != ir_var_temporary))
   return NULL;
 
foreach_iter(exec_list_iterator, iter, this-variable_list) {
@@ -149,6 +151,25 @@ 
ir_structure_reference_visitor::visit_enter(ir_dereference_record *ir)
 }
 
 ir_visitor_status
+ir_structure_reference_visitor::visit_enter(ir_dereference_array *ir)
+{
+   ir-array_index-accept(this);
+   if(!ir-array_index-as_constant())
+   {
+  /* FINISHME: could produce and make use of information
+   * about possible values of the index
+   */
+  ir_variable *const var = ir-array-variable_referenced();
+  variable_entry2 *entry = this-get_variable_entry2(var);
+
+  if (entry)
+ entry-whole_structure_access++;
+   }
+
+   /* Don't descend into the ir_dereference_variable below. */
+   return visit_continue_with_parent;
+}
+ir_visitor_status
 ir_structure_reference_visitor::visit_enter(ir_assignment *ir)
 {
if (ir-lhs-as_dereference_variable() 
@@ -198,7 +219,7 @@ 
ir_structure_splitting_visitor::get_splitting_entry(ir_variable *var)
 {
assert(var);
 
-   if (!var-type-is_record())
+   if (!var-type-is_record()  !var-type-is_array())
   return NULL;
 
foreach_iter(exec_list_iterator, iter, *this-variable_list) {
@@ -214,27 +235,61 @@ 
ir_structure_splitting_visitor::get_splitting_entry(ir_variable *var)
 void
 ir_structure_splitting_visitor::split_deref(ir_dereference **deref)
 {
-   if ((*deref)-ir_type != ir_type_dereference_record)
-  return;
-
-   ir_dereference_record *deref_record = (ir_dereference_record *)*deref;
-   ir_dereference_variable *deref_var = 
deref_record-record-as_dereference_variable();
-   if (!deref_var)
-  return;
-
-   variable_entry2 *entry = get_splitting_entry(deref_var-var);
-   if (!entry)
-  return;
+   if ((*deref)-ir_type == ir_type_dereference_record)
+   {
+  ir_dereference_record *deref_record = (ir_dereference_record *)*deref;
+  ir_dereference_variable *deref_var = 
deref_record-record-as_dereference_variable();
+  if (!deref_var)
+ return;
+
+  variable_entry2 *entry = get_splitting_entry(deref_var-var);
+  if (!entry)
+ return;
+
+  unsigned int i;
+  for (i = 0; i  entry-var-type-length; i++) {
+ if (strcmp(deref_record-field,
+entry-var-type-fields.structure[i].name) == 0)
+break;
+  }
+  assert(i != entry-var-type-length);
 
-   unsigned int i;
-   for (i = 0; i  entry-var-type-length; i++) {
-  if (strcmp(deref_record-field,
-entry-var-type-fields.structure[i].name) == 0)
-break;
+  *deref = new(entry-mem_ctx) 
ir_dereference_variable(entry-components[i]);
+   }
+   else if ((*deref)-ir_type == ir_type_dereference_array)
+   {
+  ir_dereference_array *deref_array = (ir_dereference_array*)*deref;
+  ir_dereference_variable *deref_var = 
deref_array-array-as_dereference_variable();
+  if (!deref_var)
+ return;
+
+  variable_entry2 *entry = get_splitting_entry(deref_var-var);
+  if (!entry)
+ return;
+
+  ir_constant* index = deref_array-array_index-as_constant();
+  assert(index);
+  assert(index-type-is_scalar());
+  assert(index-type-base_type == GLSL_TYPE_INT || index-type-base_type

Mesa (shader-work): glsl/loop_analysis: fix miscompilation with continues before cond breaks

2010-09-13 Thread Luca Barbieri
Module: Mesa
Branch: shader-work
Commit: 50d23201da0628f65a72278bc66e7c607064b983
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=50d23201da0628f65a72278bc66e7c607064b983

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Tue Sep 14 04:15:25 2010 +0200

glsl/loop_analysis: fix miscompilation with continues before cond breaks

In the following case, we currently incorrectly determine that the loop
has at most 8 iterations, while it is in fact an infinite loop.

for(;; ++i)
{
foo();

if(i = 4) continue;

if(i  8) break;
}

To fix this, stop looking for induction variable terminators if we hit
a continue, or a continue nested inside ifs.

---

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

diff --git a/src/glsl/loop_analysis.cpp b/src/glsl/loop_analysis.cpp
index 91e34da..687825c 100644
--- a/src/glsl/loop_analysis.cpp
+++ b/src/glsl/loop_analysis.cpp
@@ -32,6 +32,37 @@ static bool 
all_expression_operands_are_loop_constant(ir_rvalue *,
 
 static ir_rvalue *get_basic_induction_increment(ir_assignment *, hash_table *);
 
+struct contains_continue_visitor : public ir_hierarchical_visitor
+{
+   bool contains_continue;
+
+   contains_continue_visitor()
+   {
+  this-contains_continue = false;
+   }
+
+   virtual ir_visitor_status visit(ir_loop_jump *ir)
+   {
+  if(ir-is_continue()) {
+ contains_continue = true;
+ return visit_stop;
+  }
+  return visit_continue;
+   }
+
+   virtual ir_visitor_status visit_enter(class ir_loop *)
+   {
+  /* continues inside nested loops are harmless */
+  return visit_continue_with_parent;
+   }
+};
+
+bool contains_continue(ir_instruction* ir)
+{
+   contains_continue_visitor visitor;
+   ir-accept(visitor);
+   return visitor.contains_continue;
+}
 
 loop_state::loop_state()
 {
@@ -212,6 +243,12 @@ loop_analysis::visit_leave(ir_loop *ir)
   if (((ir_instruction *) node)-as_variable())
 continue;
 
+  /* If we find a continue, we cannot go ahead, because
+   * the following instructions may never get executed
+   */
+  if(contains_continue((ir_instruction*) node))
+ break;
+
   ir_if *if_stmt = ((ir_instruction *) node)-as_if();
 
   if ((if_stmt != NULL)  is_loop_terminator(if_stmt))
@@ -464,6 +501,9 @@ get_basic_induction_increment(ir_assignment *ir, hash_table 
*var_hash)
  * Detects if-statements of the form
  *
  *  (if (expression bool ...) (break))
+ *
+ *  NOTE: if we ever extend it to allow other instructions before the break, we
+ *  need to return false if contains_continue() apply to any of those 
instructions.
  */
 bool
 is_loop_terminator(ir_if *ir)

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


Mesa (shader-work): glsl: TEMP: do array indexing lowering and structure split in main.cpp

2010-09-13 Thread Luca Barbieri
Module: Mesa
Branch: shader-work
Commit: 59bc1f08a2fa044dcd9042c5bf08d7dbe6ef72e4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=59bc1f08a2fa044dcd9042c5bf08d7dbe6ef72e4

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Thu Sep  9 20:15:09 2010 +0200

glsl: TEMP: do array indexing lowering and structure split in main.cpp

The places that run optimization passes should be unified and refactored,
so that things need not be added everywhere.

Currently add this to main.cpp; OpenGL will need this too depending on
options.

---

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

diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp
index 94c14a5..bfa1b71 100644
--- a/src/glsl/main.cpp
+++ b/src/glsl/main.cpp
@@ -217,6 +217,9 @@ compile_shader(GLcontext *ctx, struct gl_shader *shader)
 progress = set_loop_controls(shader-ir, ls) || progress;
 progress = unroll_loops(shader-ir, ls, 32) || progress;
 delete ls;
+
+progress = do_array_index_to_cond_assign(shader-ir) || progress;
+progress = do_structure_splitting(shader-ir) || progress;
   } while (progress);
 
   validate_ir_tree(shader-ir);

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


Mesa (shader-work): glsl: teach loop analysis that array dereferences are bounds on the index (v3)

2010-09-13 Thread Luca Barbieri
Module: Mesa
Branch: shader-work
Commit: 86fd1ec83ec0893120609ef604475e38c249f677
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=86fd1ec83ec0893120609ef604475e38c249f677

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Tue Sep  7 19:29:00 2010 +0200

glsl: teach loop analysis that array dereferences are bounds on the index (v3)

Changes in v3:
- Only look for array dereferences in code that always executes, to avoid
  miscompilation

Changes in v2:
- Incorporate Ian Romanick's feedback
- Make GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB disable this

Since out-of-bounds dereferences cause undefined behavior, we are allowed
to assume that they terminate the loop, if my interpretation of the GLSL
spec is correct.

This allows to find the maximum number of iterations in cases like this:

uniform int texcoords;
float4 gl_TexCoord[8];

for(i = 0; i  texcoords; ++i)
do_something_with(gl_TexCoord[i]);

This is apparently an interesting case since NV_fragment_program2 has
a construct for this.

---

 src/glsl/glsl_parser_extras.cpp |4 +-
 src/glsl/ir_optimization.h  |2 +-
 src/glsl/linker.cpp |2 +-
 src/glsl/loop_analysis.cpp  |   69 ++-
 src/glsl/loop_analysis.h|2 +-
 src/glsl/loop_controls.cpp  |   22 
 src/glsl/main.cpp   |4 ++-
 src/mesa/program/ir_to_mesa.cpp |4 +-
 8 files changed, 92 insertions(+), 17 deletions(-)

diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 4ac062b..44e456b 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -685,7 +685,7 @@ ast_struct_specifier::ast_struct_specifier(char *identifier,
 }
 
 bool
-do_common_optimization(exec_list *ir, bool linked, unsigned 
max_unroll_iterations)
+do_common_optimization(exec_list *ir, bool linked, unsigned 
max_unroll_iterations, bool robust_access)
 {
GLboolean progress = GL_FALSE;
 
@@ -718,7 +718,7 @@ do_common_optimization(exec_list *ir, bool linked, unsigned 
max_unroll_iteration
 
progress = optimize_redundant_jumps(ir) || progress;
 
-   loop_state *ls = analyze_loop_variables(ir);
+   loop_state *ls = analyze_loop_variables(ir, !robust_access);
progress = set_loop_controls(ir, ls) || progress;
progress = unroll_loops(ir, ls, max_unroll_iterations) || progress;
delete ls;
diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h
index 8dbc6ed..02a7f37 100644
--- a/src/glsl/ir_optimization.h
+++ b/src/glsl/ir_optimization.h
@@ -28,7 +28,7 @@
  * Prototypes for optimization passes to be called by the compiler and drivers.
  */
 
-bool do_common_optimization(exec_list *ir, bool linked, unsigned 
max_unroll_iterations);
+bool do_common_optimization(exec_list *ir, bool linked, unsigned 
max_unroll_iterations, bool robust_access);
 
 bool do_algebraic(exec_list *instructions);
 bool do_array_index_to_cond_assign(exec_list *instructions);
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index c2c6621..8567efe 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1471,7 +1471,7 @@ link_shaders(GLcontext *ctx, struct gl_shader_program 
*prog)
 * some of that unused.
 */
for (unsigned i = 0; i  prog-_NumLinkedShaders; i++) {
-  while (do_common_optimization(prog-_LinkedShaders[i]-ir, true, 32))
+  while (do_common_optimization(prog-_LinkedShaders[i]-ir, true, 32, 
true))
 ;
}
 
diff --git a/src/glsl/loop_analysis.cpp b/src/glsl/loop_analysis.cpp
index 687825c..d39e1b4 100644
--- a/src/glsl/loop_analysis.cpp
+++ b/src/glsl/loop_analysis.cpp
@@ -64,6 +64,67 @@ bool contains_continue(ir_instruction* ir)
return visitor.contains_continue;
 }
 
+struct dereference_array_visitor : public ir_hierarchical_visitor
+{
+   loop_variable_state* ls;
+
+   dereference_array_visitor(loop_variable_state* ls)
+   {
+  this-ls = ls;
+   }
+
+   ir_visitor_status visit_leave(ir_dereference_array *ir)
+   {
+  int max_index;
+  if(ir-array-type-is_array())
+ max_index = ir-array-type-length - 1;
+  else if(ir-array-type-is_vector() || ir-array-type-is_matrix())
+ max_index = ir-array-type-components() - 1;
+  else
+ assert(0);
+
+  assert(ir-array_index-type-is_integer());
+  ir_constant *const max_index_c =
+ (ir-array_index-type-base_type == GLSL_TYPE_UINT)
+   ? new(ir) ir_constant((unsigned)max_index)
+   : new(ir) ir_constant((int)max_index);
+  ir_constant *const zero_c =
+ ir_constant::zero(ir, ir-array_index-type);
+
+  ir_if* bound_if;
+
+  bound_if = new (ir) ir_if(new(ir) ir_expression(ir_binop_greater, 
ir-array_index-type, ir-array_index, max_index_c));
+  bound_if-self_link();
+  ls-insert(bound_if);
+
+  bound_if = new (ir) ir_if(new(ir) ir_expression(ir_binop_less, 
ir-array_index-type, ir-array_index, zero_c));
+  bound_if-self_link();
+  ls-insert(bound_if

Mesa (shader-work): mesa: add GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB and env var to set it

2010-09-13 Thread Luca Barbieri
Module: Mesa
Branch: shader-work
Commit: 1c6de307bb73b492274aeba303fb69160df69514
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1c6de307bb73b492274aeba303fb69160df69514

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Sep  8 06:24:10 2010 +0200

mesa: add GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB and env var to set it

ARB_robustness specifies it, and we need the bit to choose whether
to apply some loop optimizations in the GLSL compiler.

Currenly, it is turned on by export MESA_ROBUST_ACCESS=1.

In the future, GLX_ARB_create_context_robustness will allow to turn
it on in the standard way.

---

 src/mesa/main/context.c |5 +
 src/mesa/main/mtypes.h  |4 
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 979bc40..f5fe94d 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -873,6 +873,11 @@ _mesa_initialize_context_for_api(GLcontext *ctx,
ctx-WinSysDrawBuffer = NULL;
ctx-WinSysReadBuffer = NULL;
 
+   /* eventually, GLX_ARB_create_context_robustness will be usable to enable 
this too */
+   if (_mesa_getenv(MESA_ROBUST_ACCESS)) {
+  ctx-Const.ContextFlags |= GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB;
+   }
+
/* misc one-time initializations */
one_time_init(ctx);
 
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index cabc42b..d66a60f 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3088,6 +3088,10 @@ typedef enum {
API_OPENGLES2
 } gl_api;
 
+#ifndef GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB
+#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x0004
+#endif
+
 /**
  * Mesa rendering context.
  *

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


Mesa (shader-work): glsl/loop_unroll: unroll loops with cond breaks anywhere, not just the end

2010-09-13 Thread Luca Barbieri
Module: Mesa
Branch: shader-work
Commit: 7152a253e081b71aeb55dd40515643748ab28d14
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7152a253e081b71aeb55dd40515643748ab28d14

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Tue Sep 14 04:56:34 2010 +0200

glsl/loop_unroll: unroll loops with cond breaks anywhere, not just the end

Currently we only unroll loops with conditional breaks at the end, which is
the form that ir_lower_jumps generates.

However, if breaks are not lowered, they tend to appear at the beginning, so
add support for a conditional break anywhere.

---

 src/glsl/loop_unroll.cpp |  130 +++---
 1 files changed, 76 insertions(+), 54 deletions(-)

diff --git a/src/glsl/loop_unroll.cpp b/src/glsl/loop_unroll.cpp
index 90797bd..6308907 100644
--- a/src/glsl/loop_unroll.cpp
+++ b/src/glsl/loop_unroll.cpp
@@ -73,44 +73,77 @@ loop_unroll_visitor::visit_leave(ir_loop *ir)
if (ls-num_loop_jumps  1)
   return visit_continue;
else if (ls-num_loop_jumps) {
-  /* recognize loops in the form produced by ir_lower_jumps */
-  ir_instruction *last_ir =
-((ir_instruction*)ir-body_instructions.get_tail());
-
-  assert(last_ir != NULL);
-
-  ir_if *last_if = last_ir-as_if();
-  if (last_if) {
-bool continue_from_then_branch;
-
-/* Determine which if-statement branch, if any, ends with a break.
- * The branch that did *not* have the break will get a temporary
- * continue inserted in each iteration of the loop unroll.
- *
- * Note that since ls-num_loop_jumps is = 1, it is impossible for
- * both branches to end with a break.
- */
-ir_instruction *last =
-   (ir_instruction *) last_if-then_instructions.get_tail();
-
-if (last  last-ir_type == ir_type_loop_jump
- ((ir_loop_jump*) last)-is_break()) {
-   continue_from_then_branch = false;
-} else {
-   last = (ir_instruction *) last_if-then_instructions.get_tail();
-
-   if (last  last-ir_type == ir_type_loop_jump
-((ir_loop_jump*) last)-is_break())
-  continue_from_then_branch = true;
-   else
-  /* Bail out if neither if-statement branch ends with a break.
-   */
-  return visit_continue;
-}
-
-/* Remove the break from the if-statement.
- */
-last-remove();
+  ir_instruction *last_ir = 
((ir_instruction*)ir-body_instructions.get_tail());
+
+  if (last_ir-ir_type == ir_type_loop_jump
+ ((ir_loop_jump*)last_ir)-is_break()) {
+ /* If the only loop-jump is a break at the end of the loop, the loop
+  * will execute exactly once.  Remove the break, set the iteration
+  * count, and fall through to the normal unroller.
+  */
+ last_ir-remove();
+ iterations = 1;
+
+ this-progress = true;
+  } else {
+ ir_if *ir_if = 0;
+ ir_instruction *break_ir = 0;
+ bool continue_from_then_branch = false;
+
+ foreach_list(node, ir-body_instructions) {
+/* recognize loops in the form produced by ir_lower_jumps */
+ir_instruction* cur_ir = (ir_instruction*)node;
+
+assert(last_ir != NULL);
+
+ir_if = cur_ir-as_if();
+if (ir_if) {
+   /* Determine which if-statement branch, if any, ends with a 
break.
+* The branch that did *not* have the break will get a temporary
+* continue inserted in each iteration of the loop unroll.
+*
+* Note that since ls-num_loop_jumps is = 1, it is impossible 
for
+* both branches to end with a break.
+*/
+   ir_instruction *ir_if_last =
+  (ir_instruction *) ir_if-then_instructions.get_tail();
+
+   if (ir_if_last  ir_if_last-ir_type == ir_type_loop_jump
+((ir_loop_jump*) ir_if_last)-is_break()) {
+  continue_from_then_branch = false;
+  break_ir = ir_if_last;
+  break;
+   } else {
+  ir_if_last = (ir_instruction *) 
ir_if-then_instructions.get_tail();
+
+  if (ir_if_last  ir_if_last-ir_type == ir_type_loop_jump
+   ((ir_loop_jump*) ir_if_last)-is_break())
+  {
+ break_ir = ir_if_last;
+ continue_from_then_branch = true;
+ break;
+  }
+   }
+}
+ }
+
+ if(!break_ir)
+return visit_continue;
+
+ /* move instructions after then if in the continue branch */
+ while (!ir_if-get_next()-is_tail_sentinel()) {
+ir_instruction *move_ir = (ir_instruction *)ir_if-get_next();
+
+move_ir-remove

  1   2   3   4   5   >