mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-12-15 08:03:30 -08:00
vkd3d-shader/dxil: Allocate instructions directly in sm6_parser_emit_dx_stream().
This commit is contained in:
committed by
Henri Verbeet
parent
900c8f10a2
commit
ad4c497b79
Notes:
Henri Verbeet
2025-12-09 17:22:15 +01:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1862
@@ -5656,35 +5656,36 @@ static void sm6_parser_emit_dx_create_handle(struct sm6_parser *sm6, enum dx_int
|
|||||||
state->pushed_instruction = true;
|
state->pushed_instruction = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sm6_parser_emit_dx_stream(struct sm6_parser *sm6, enum dx_intrinsic_opcode op,
|
static void sm6_parser_emit_dx_stream(struct sm6_parser *dxil, enum dx_intrinsic_opcode op,
|
||||||
const struct sm6_value **operands, struct function_emission_state *state)
|
const struct sm6_value **operands, struct function_emission_state *state)
|
||||||
{
|
{
|
||||||
struct vkd3d_shader_instruction *ins = state->ins;
|
struct vkd3d_shader_instruction *ins;
|
||||||
struct vsir_src_operand *src_param;
|
struct vsir_src_operand *src_param;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
vsir_instruction_init(ins, &sm6->p.location, (op == DX_CUT_STREAM) ? VSIR_OP_CUT_STREAM : VSIR_OP_EMIT_STREAM);
|
if (!(ins = sm6_parser_add_function_instruction(dxil, state)))
|
||||||
|
|
||||||
if (!(src_param = instruction_src_params_alloc(ins, 1, sm6)))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
i = sm6_value_get_constant_uint(operands[0], sm6);
|
state->pushed_instruction = true;
|
||||||
if (i >= MAX_GS_OUTPUT_STREAMS)
|
|
||||||
|
vsir_instruction_init(ins, &dxil->p.location, (op == DX_CUT_STREAM) ? VSIR_OP_CUT_STREAM : VSIR_OP_EMIT_STREAM);
|
||||||
|
|
||||||
|
if (!(src_param = instruction_src_params_alloc(ins, 1, dxil)))
|
||||||
{
|
{
|
||||||
WARN("Invalid stream index %u.\n", i);
|
vkd3d_shader_instruction_make_nop(ins);
|
||||||
vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_INVALID_OPERAND,
|
return;
|
||||||
"Output stream index %u is invalid.", i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i = sm6_value_get_constant_uint(operands[0], dxil);
|
||||||
|
if (i >= MAX_GS_OUTPUT_STREAMS)
|
||||||
|
vkd3d_shader_parser_error(&dxil->p, VKD3D_SHADER_ERROR_DXIL_INVALID_OPERAND,
|
||||||
|
"Output stream index %u is invalid.", i);
|
||||||
|
|
||||||
register_init_with_id(&src_param->reg, VKD3DSPR_STREAM, VSIR_DATA_UNUSED, i);
|
register_init_with_id(&src_param->reg, VKD3DSPR_STREAM, VSIR_DATA_UNUSED, i);
|
||||||
src_param_init(src_param);
|
src_param_init(src_param);
|
||||||
|
|
||||||
if (op == DX_EMIT_THEN_CUT_STREAM)
|
if (op == DX_EMIT_THEN_CUT_STREAM)
|
||||||
{
|
sm6_parser_emit_dx_stream(dxil, DX_CUT_STREAM, operands, state);
|
||||||
++state->ins;
|
|
||||||
++state->function->instructions.count;
|
|
||||||
sm6_parser_emit_dx_stream(sm6, DX_CUT_STREAM, operands, state);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sm6_parser_emit_dx_discard(struct sm6_parser *sm6, enum dx_intrinsic_opcode op,
|
static void sm6_parser_emit_dx_discard(struct sm6_parser *sm6, enum dx_intrinsic_opcode op,
|
||||||
|
|||||||
Reference in New Issue
Block a user