[01/49] wined3d: Add a comment about D3D write masks and GLSL destination swizzles

H. Verbeet hverbeet at gmail.com
Mon Jan 15 12:30:12 CST 2007


This comment also explains the larger part of the next few patches.
The way we currently handle this difference between D3D and GLSL is by
first casting the source expression to a vec4, and then applying the
write mask as a swizzle. This sort of works, but generates GLSL
compiler warnings about using potentially uninitialised variables.
It's also doesn't produce the most readable GLSL, which makes things
harder to debug.

Changelog:
  - Add a comment about D3D write masks and GLSL destination swizzles
-------------- next part --------------
---

 dlls/wined3d/glsl_shader.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index fd44111..185d530 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -19,6 +19,14 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+/*
+ * D3D shader asm has swizzles on source parameters, and write masks for
+ * destination parameters. GLSL uses swizzles for both. The result of this is
+ * that for example "mov dst.xw, src.zyxw" becomes "dst.xw = src.zw" in GLSL.
+ * Ie, to generate a proper GLSL source swizzle, we need to take the D3D write
+ * mask for the destination parameter into account.
+ */
+
 #include "config.h"
 #include <stdio.h>
 #include "wined3d_private.h"


More information about the wine-patches mailing list