d3dx9: Check register type in dcl input instruction.

This commit is contained in:
Matteo Bruni 2010-06-08 03:21:43 +02:00 committed by Alexandre Julliard
parent 5bb403ceb2
commit a74978dfef
2 changed files with 17 additions and 0 deletions

View File

@ -118,6 +118,8 @@ static void asmparser_dcl_output(struct asm_parser *This, DWORD usage, DWORD num
static void asmparser_dcl_input(struct asm_parser *This, DWORD usage, DWORD num, static void asmparser_dcl_input(struct asm_parser *This, DWORD usage, DWORD num,
DWORD mod, const struct shader_reg *reg) { DWORD mod, const struct shader_reg *reg) {
struct instruction instr;
if(!This->shader) return; if(!This->shader) return;
if(mod != 0 && if(mod != 0 &&
(This->shader->version != BWRITERPS_VERSION(3, 0) || (This->shader->version != BWRITERPS_VERSION(3, 0) ||
@ -127,6 +129,12 @@ static void asmparser_dcl_input(struct asm_parser *This, DWORD usage, DWORD num,
set_parse_status(This, PARSE_ERR); set_parse_status(This, PARSE_ERR);
return; return;
} }
/* Check register type and modifiers */
instr.dstmod = mod;
instr.shift = 0;
This->funcs->dstreg(This, &instr, reg);
if(!record_declaration(This->shader, usage, num, mod, FALSE, reg->regnum, reg->writemask, FALSE)) { if(!record_declaration(This->shader, usage, num, mod, FALSE, reg->regnum, reg->writemask, FALSE)) {
ERR("Out of memory\n"); ERR("Out of memory\n");
set_parse_status(This, PARSE_ERR); set_parse_status(This, PARSE_ERR);

View File

@ -1365,6 +1365,15 @@ static void failure_test(void) {
/* shader 43: can't explicitely declare input registers in ps_2_0 */ /* shader 43: can't explicitely declare input registers in ps_2_0 */
"ps_2_0\n" "ps_2_0\n"
"dcl_texcoord0 t0\n", "dcl_texcoord0 t0\n",
/* shader 44: can't implicitely declare registers in vs */
"vs_2_0\n"
"dcl o0\n",
/* shader 45: can't implicitely declare samplers in vs */
"vs_3_0\n"
"dcl s2\n",
/* shader 46: no tx registers in ps_3_0 */
"ps_3_0\n"
"dcl t2\n",
}; };
HRESULT hr; HRESULT hr;
unsigned int i; unsigned int i;