[3/3] d3dx9: Disallow sampler declarations where not supported.

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


-------------- next part --------------
From 3c70827d5ef9f409f1da1fab7b03116792700636 Mon Sep 17 00:00:00 2001
From: Matteo Bruni <matteo.mystral at gmail.com>
Date: Tue, 8 Jun 2010 16:13:59 +0200
Subject: d3dx9: Disallow sampler declarations where not supported.

---
 dlls/d3dx9_36/asmparser.c |   11 +++++++++--
 dlls/d3dx9_36/tests/asm.c |    3 +++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/dlls/d3dx9_36/asmparser.c b/dlls/d3dx9_36/asmparser.c
index 528e6b3..4e7f018 100644
--- a/dlls/d3dx9_36/asmparser.c
+++ b/dlls/d3dx9_36/asmparser.c
@@ -178,6 +178,13 @@ static void asmparser_dcl_sampler(struct asm_parser *This, DWORD samptype,
     }
 }
 
+static void asmparser_dcl_sampler_unsupported(struct asm_parser *This, DWORD samptype,
+					      DWORD mod, DWORD regnum,
+					      unsigned int line_no) {
+    asmparser_message(This, "Line %u: Sampler declaration unsupported in this shader version\n", This->line_no);
+    set_parse_status(This, PARSE_ERR);
+}
+
 static void asmparser_sincos(struct asm_parser *This, DWORD mod, DWORD shift,
                              const struct shader_reg *dst,
                              const struct src_regs *srcs) {
@@ -779,7 +786,7 @@ static const struct asmparser_backend parser_vs_1 = {
 
     asmparser_dcl_output,
     asmparser_dcl_input,
-    asmparser_dcl_sampler,
+    asmparser_dcl_sampler_unsupported,
 
     asmparser_end,
 
@@ -799,7 +806,7 @@ static const struct asmparser_backend parser_vs_2 = {
 
     asmparser_dcl_output,
     asmparser_dcl_input,
-    asmparser_dcl_sampler,
+    asmparser_dcl_sampler_unsupported,
 
     asmparser_end,
 
diff --git a/dlls/d3dx9_36/tests/asm.c b/dlls/d3dx9_36/tests/asm.c
index 6255d02..276a6e2 100644
--- a/dlls/d3dx9_36/tests/asm.c
+++ b/dlls/d3dx9_36/tests/asm.c
@@ -1374,6 +1374,9 @@ static void failure_test(void) {
         /* shader 46: no tx registers in ps_3_0 */
         "ps_3_0\n"
         "dcl t2\n",
+        /* shader 47: no samplers in vs_2_0 */
+        "vs_2_0\n"
+        "dcl_2d s2\n",
     };
     HRESULT hr;
     unsigned int i;
-- 
1.6.4.4


More information about the wine-patches mailing list