From 5a5844d45864201d3be01055035f5fe4f7ae1310 Mon Sep 17 00:00:00 2001 From: Matteo Bruni Date: Tue, 8 Jun 2010 16:13:59 +0200 Subject: [PATCH] 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 528e6b39edf..4e7f0183f27 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 6255d022006..276a6e2a41a 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;