Commit c2b0f200 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

d3dx9: Check dcl input instruction syntax against shader version.

parent 0ea6f795
......@@ -152,11 +152,6 @@ static void asmparser_dcl_input_ps_2(struct asm_parser *This, DWORD usage, DWORD
struct instruction instr;
if(!This->shader) return;
if(usage != 0) {
asmparser_message(This, "Line %u: Unsupported usage in dcl instruction\n", This->line_no);
set_parse_status(This, PARSE_ERR);
return;
}
instr.dstmod = mod;
instr.shift = 0;
This->funcs->dstreg(This, &instr, reg);
......
......@@ -549,6 +549,12 @@ instruction: INSTR_ADD omods dreg ',' sregs
asm_ctx.line_no);
set_parse_status(&asm_ctx, PARSE_ERR);
}
if(asm_ctx.shader->version == BWRITERPS_VERSION(2, 0) ||
asm_ctx.shader->version == BWRITERPS_VERSION(2, 1)) {
asmparser_message(&asm_ctx, "Line %u: Declaration not supported in PS 2\n",
asm_ctx.line_no);
set_parse_status(&asm_ctx, PARSE_ERR);
}
ZeroMemory(&reg, sizeof(reg));
reg.type = $4.type;
reg.regnum = $4.regnum;
......@@ -566,6 +572,12 @@ instruction: INSTR_ADD omods dreg ',' sregs
asm_ctx.line_no);
set_parse_status(&asm_ctx, PARSE_ERR);
}
if(asm_ctx.shader->version == BWRITERPS_VERSION(2, 0) ||
asm_ctx.shader->version == BWRITERPS_VERSION(2, 1)) {
asmparser_message(&asm_ctx, "Line %u: Declaration not supported in PS 2\n",
asm_ctx.line_no);
set_parse_status(&asm_ctx, PARSE_ERR);
}
ZeroMemory(&reg, sizeof(reg));
reg.type = $4.type;
reg.regnum = $4.regnum;
......@@ -583,6 +595,11 @@ instruction: INSTR_ADD omods dreg ',' sregs
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 semantic\n",
asm_ctx.line_no);
set_parse_status(&asm_ctx, PARSE_ERR);
}
ZeroMemory(&reg, sizeof(reg));
reg.type = $3.type;
reg.regnum = $3.regnum;
......@@ -600,6 +617,11 @@ instruction: INSTR_ADD omods dreg ',' sregs
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 semantic\n",
asm_ctx.line_no);
set_parse_status(&asm_ctx, PARSE_ERR);
}
ZeroMemory(&reg, sizeof(reg));
reg.type = $3.type;
reg.regnum = $3.regnum;
......
......@@ -1377,6 +1377,18 @@ static void failure_test(void) {
/* shader 47: no samplers in vs_2_0 */
"vs_2_0\n"
"dcl_2d s2\n",
/* shader 48: semantic required in vs dcl input instruction */
"vs_2_0\n"
"dcl v0\n",
/* shader 49: semantic not allowed in ps dcl input instruction*/
"ps_2_0\n"
"dcl_position0 v0\n",
/* shader 50: dcl instruction not in ps_1_x */
"ps_1_4\n"
"dcl_position0 v0\n",
/* shader 51: no dcl output instruction in < vs 3.0 */
"vs_2_0\n"
"dcl_positiont0 o0\n",
};
HRESULT hr;
unsigned int i;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment