Commit 6cbd5114 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

d3dx9: Add input dcl instruction support to the shader assembler.

parent efec8bb3
......@@ -51,6 +51,15 @@ 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,
const struct shader_reg *reg) {
if(!This->shader) return;
if(!record_declaration(This->shader, usage, num, FALSE, reg->regnum, reg->writemask)) {
ERR("Out of memory\n");
set_parse_status(This, PARSE_ERR);
}
}
static void asmparser_instr(struct asm_parser *This, DWORD opcode,
DWORD mod, DWORD shift,
BWRITER_COMPARISON_TYPE comp,
......@@ -149,6 +158,7 @@ static const struct asmparser_backend parser_vs_3 = {
asmparser_coissue_unsupported,
asmparser_dcl_output,
asmparser_dcl_input,
asmparser_end,
......
......@@ -522,6 +522,30 @@ instruction: INSTR_ADD omods dreg ',' sregs
reg.writemask = $4;
asm_ctx.funcs->dcl_output(&asm_ctx, $2.dclusage, $2.regnum, &reg);
}
| INSTR_DCL dclusage REG_INPUT
{
struct shader_reg reg;
TRACE("Input reg declaration\n");
ZeroMemory(&reg, sizeof(reg));
reg.type = BWRITERSPR_INPUT;
reg.regnum = $3;
reg.rel_reg = NULL;
reg.srcmod = 0;
reg.writemask = BWRITERSP_WRITEMASK_ALL;
asm_ctx.funcs->dcl_input(&asm_ctx, $2.dclusage, $2.regnum, &reg);
}
| INSTR_DCL dclusage REG_INPUT writemask
{
struct shader_reg reg;
TRACE("Input reg declaration\n");
ZeroMemory(&reg, sizeof(reg));
reg.type = BWRITERSPR_INPUT;
reg.regnum = $3;
reg.rel_reg = NULL;
reg.srcmod = 0;
reg.writemask = $4;
asm_ctx.funcs->dcl_input(&asm_ctx, $2.dclusage, $2.regnum, &reg);
}
| INSTR_REP sregs
{
TRACE("REP\n");
......
......@@ -284,6 +284,7 @@ static void sm_3_header(struct bc_writer *This, const struct bwriter_shader *sha
/* Declare the shader type and version */
put_dword(buffer, This->version);
write_declarations(buffer, TRUE, shader->inputs, shader->num_inputs, D3DSPR_INPUT);
write_declarations(buffer, TRUE, shader->outputs, shader->num_outputs, D3DSPR_OUTPUT);
return;
}
......
......@@ -255,6 +255,8 @@ struct asmparser_backend {
void (*dcl_output)(struct asm_parser *This, DWORD usage, DWORD num,
const struct shader_reg *reg);
void (*dcl_input)(struct asm_parser *This, DWORD usage, DWORD num,
const struct shader_reg *reg);
void (*end)(struct asm_parser *This);
......
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