Commit 35de12fc authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Implement SM5 imm_atomic_consume instruction.

parent 87ef57af
......@@ -5152,10 +5152,15 @@ static void shader_glsl_atomic(const struct wined3d_shader_instruction *ins)
static void shader_glsl_uav_counter(const struct wined3d_shader_instruction *ins)
{
const char *prefix = shader_glsl_get_prefix(ins->ctx->reg_maps->shader_version.type);
const char *op;
if (ins->handler_idx == WINED3DSIH_IMM_ATOMIC_ALLOC)
op = "atomicCounterIncrement";
else
op = "atomicCounterDecrement";
shader_glsl_append_dst(ins->ctx->buffer, ins);
shader_addline(ins->ctx->buffer, "atomicCounterIncrement(%s_counter%u));\n",
prefix, ins->src[0].reg.idx[0].offset);
shader_addline(ins->ctx->buffer, "%s(%s_counter%u));\n", op, prefix, ins->src[0].reg.idx[0].offset);
}
static void shader_glsl_ld_uav(const struct wined3d_shader_instruction *ins)
......@@ -9653,7 +9658,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
/* WINED3DSIH_IMM_ATOMIC_ALLOC */ shader_glsl_uav_counter,
/* WINED3DSIH_IMM_ATOMIC_AND */ shader_glsl_atomic,
/* WINED3DSIH_IMM_ATOMIC_CMP_EXCH */ shader_glsl_atomic,
/* WINED3DSIH_IMM_ATOMIC_CONSUME */ NULL,
/* WINED3DSIH_IMM_ATOMIC_CONSUME */ shader_glsl_uav_counter,
/* WINED3DSIH_IMM_ATOMIC_EXCH */ shader_glsl_atomic,
/* WINED3DSIH_IMM_ATOMIC_IADD */ shader_glsl_atomic,
/* WINED3DSIH_IMM_ATOMIC_IMAX */ shader_glsl_atomic,
......
......@@ -1370,7 +1370,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
}
}
if (ins.handler_idx == WINED3DSIH_IMM_ATOMIC_ALLOC)
if (ins.handler_idx == WINED3DSIH_IMM_ATOMIC_ALLOC || ins.handler_idx == WINED3DSIH_IMM_ATOMIC_CONSUME)
{
unsigned int reg_idx = ins.src[0].reg.idx[0].offset;
if (reg_idx >= MAX_UNORDERED_ACCESS_VIEWS)
......@@ -1381,9 +1381,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
reg_maps->uav_counter_mask |= (1u << reg_idx);
}
else if ((WINED3DSIH_ATOMIC_AND <= ins.handler_idx && ins.handler_idx <= WINED3DSIH_ATOMIC_XOR)
|| (WINED3DSIH_IMM_ATOMIC_AND <= ins.handler_idx
&& ins.handler_idx <= WINED3DSIH_IMM_ATOMIC_XOR
&& ins.handler_idx != WINED3DSIH_IMM_ATOMIC_CONSUME)
|| (WINED3DSIH_IMM_ATOMIC_AND <= ins.handler_idx && ins.handler_idx <= WINED3DSIH_IMM_ATOMIC_XOR)
|| ins.handler_idx == WINED3DSIH_LD_UAV_TYPED
|| (ins.handler_idx == WINED3DSIH_LD_RAW && ins.src[1].reg.type == WINED3DSPR_UAV)
|| (ins.handler_idx == WINED3DSIH_LD_STRUCTURED && ins.src[2].reg.type == WINED3DSPR_UAV))
......
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