[1/3] d3dx9: Allow sampler declaration without sampler type.

Matteo Bruni matteo.mystral at gmail.com
Thu Jun 10 09:06:46 CDT 2010


-------------- next part --------------
From d1d47cba8aff9ab235bd3c1152250a315310bcf8 Mon Sep 17 00:00:00 2001
From: Matteo Bruni <matteo.mystral at gmail.com>
Date: Tue, 8 Jun 2010 03:20:20 +0200
Subject: d3dx9: Allow sampler declaration without sampler type.

---
 dlls/d3dx9_36/asmshader.y |   15 +++++++++++++++
 dlls/d3dx9_36/tests/asm.c |    5 +++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/dlls/d3dx9_36/asmshader.y b/dlls/d3dx9_36/asmshader.y
index 0c335b4..689a8fd 100644
--- a/dlls/d3dx9_36/asmshader.y
+++ b/dlls/d3dx9_36/asmshader.y
@@ -618,6 +618,21 @@ instruction:          INSTR_ADD omods dreg ',' sregs
                                 }
                                 asm_ctx.funcs->dcl_sampler(&asm_ctx, $2, $3.mod, $4, asm_ctx.line_no);
                             }
+                    | INSTR_DCL omods REG_SAMPLER
+                            {
+                                TRACE("Sampler declared\n");
+                                if($2.shift != 0) {
+                                    asmparser_message(&asm_ctx, "Line %u: Shift modifier not allowed here\n",
+                                                      asm_ctx.line_no);
+                                    set_parse_status(&asm_ctx, PARSE_ERR);
+                                }
+                                if(asm_ctx.shader->type != ST_PIXEL) {
+                                    asmparser_message(&asm_ctx, "Line %u: Declaration needs a sampler type\n",
+                                                      asm_ctx.line_no);
+                                    set_parse_status(&asm_ctx, PARSE_ERR);
+                                }
+                                asm_ctx.funcs->dcl_sampler(&asm_ctx, BWRITERSTT_UNKNOWN, $2.mod, $3, asm_ctx.line_no);
+                            }
                     | INSTR_DCL sampdcl omods dcl_inputreg
                             {
                                 TRACE("Error rule: sampler decl of input reg\n");
diff --git a/dlls/d3dx9_36/tests/asm.c b/dlls/d3dx9_36/tests/asm.c
index dda0e2b..5f2e49a 100644
--- a/dlls/d3dx9_36/tests/asm.c
+++ b/dlls/d3dx9_36/tests/asm.c
@@ -1216,6 +1216,11 @@ static void ps_3_0_test(void) {
             "dcl v0\n",
             {0xffff0300, 0x0200001f, 0x80000000, 0x900f0000, 0x0000ffff}
         },
+        {   /* shader 16 */
+            "ps_3_0\n"
+            "dcl s2\n",
+            {0xffff0300, 0x0200001f, 0x80000000, 0xa00f0802, 0x0000ffff}
+        },
     };
 
     exec_tests("ps_3_0", tests, sizeof(tests) / sizeof(tests[0]));
-- 
1.6.4.4


More information about the wine-patches mailing list