Ivan Gyurdiev : wined3d: Use COLOROUT/DEPTHOUT for pixel shaders 2.0+.

Alexandre Julliard julliard at wine.codeweavers.com
Wed May 17 04:47:01 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: c65a86828c82ce305b6891ea01688c664724df42
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=c65a86828c82ce305b6891ea01688c664724df42

Author: Ivan Gyurdiev <ivg2 at cornell.edu>
Date:   Wed May 17 02:09:25 2006 -0400

wined3d: Use COLOROUT/DEPTHOUT for pixel shaders 2.0+.

As previously mentioned, RASTOUT is invalid on pixel shaders.
On shaders 1.x, r0 is treated as the color output register:
http://www.gamedev.net/columns/hardcore/dxshader3/page2.asp
That's what we currently do in all cases, change it not to do so
for shaders >= 2.0. Support COLOROUT/DEPTHOUT instead.

---

 dlls/wined3d/pixelshader.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/dlls/wined3d/pixelshader.c b/dlls/wined3d/pixelshader.c
index b9e06e5..d391a8c 100644
--- a/dlls/wined3d/pixelshader.c
+++ b/dlls/wined3d/pixelshader.c
@@ -745,7 +745,6 @@ CONST SHADER_OPCODE IWineD3DPixelShaderI
 };
 
 inline static void get_register_name(const DWORD param, char* regstr, char constants[WINED3D_PSHADER_MAX_CONSTANTS]) {
-    static const char* rastout_reg_names[] = { "oC0", "oC1", "oC2", "oC3", "oDepth" };
 
     DWORD reg = param & D3DSP_REGNUM_MASK;
     DWORD regtype = shader_get_regtype(param);
@@ -770,8 +769,17 @@ inline static void get_register_name(con
     case D3DSPR_TEXTURE: /* case D3DSPR_ADDR: */
         sprintf(regstr,"T%lu", reg);
     break;
-    case D3DSPR_RASTOUT:
-        sprintf(regstr, "%s", rastout_reg_names[reg]);
+    case D3DSPR_COLOROUT:
+        if (reg == 0)
+            sprintf(regstr, "result.color");
+        else {
+            /* TODO: See GL_ARB_draw_buffers */
+            FIXME("Unsupported write to render target %lu\n", reg);
+            sprintf(regstr, "unsupported_register");
+        }
+    break;
+    case D3DSPR_DEPTHOUT:
+        sprintf(regstr, "result.depth");
     break;
     case D3DSPR_ATTROUT:
         sprintf(regstr, "oD[%lu]", reg);
@@ -1341,8 +1349,8 @@ #endif
             of the pixel shader string for us */
         generate_base_shader( (IWineD3DBaseShader*) This, &buffer, pFunction);
 
-        /*FIXME: This next line isn't valid for certain pixel shader versions */
-        shader_addline(&buffer, "MOV result.color, R0;\n");
+        if (This->baseShader.hex_version < D3DPS_VERSION(2,0))
+            shader_addline(&buffer, "MOV result.color, R0;\n");
         shader_addline(&buffer, "END\n\0"); 
 
         /* TODO: change to resource.glObjectHandle or something like that */




More information about the wine-cvs mailing list