mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Generate vsir instructions for indexed output streams in geometry shaders.
This commit is contained in:
Notes:
Henri Verbeet
2025-06-02 21:00:38 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1518
@@ -8485,6 +8485,14 @@ static bool sm4_generate_vsir_reg_from_deref(struct hlsl_ctx *ctx, struct vsir_p
|
|||||||
VKD3D_ASSERT(regset == HLSL_REGSET_SAMPLERS);
|
VKD3D_ASSERT(regset == HLSL_REGSET_SAMPLERS);
|
||||||
*writemask = VKD3DSP_WRITEMASK_ALL;
|
*writemask = VKD3DSP_WRITEMASK_ALL;
|
||||||
}
|
}
|
||||||
|
else if (regset == HLSL_REGSET_STREAM_OUTPUTS)
|
||||||
|
{
|
||||||
|
reg->type = VKD3DSPR_STREAM;
|
||||||
|
reg->dimension = VSIR_DIMENSION_NONE;
|
||||||
|
reg->idx[0].offset = var->regs[HLSL_REGSET_STREAM_OUTPUTS].index;
|
||||||
|
reg->idx_count = 1;
|
||||||
|
*writemask = VKD3DSP_WRITEMASK_ALL;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned int offset = deref->const_offset + var->buffer_offset;
|
unsigned int offset = deref->const_offset + var->buffer_offset;
|
||||||
@@ -10835,20 +10843,27 @@ static bool sm4_generate_vsir_instr_resource_store(struct hlsl_ctx *ctx,
|
|||||||
|
|
||||||
if (store->store_type != HLSL_RESOURCE_STORE)
|
if (store->store_type != HLSL_RESOURCE_STORE)
|
||||||
{
|
{
|
||||||
enum vkd3d_shader_opcode opcode = store->store_type == HLSL_RESOURCE_STREAM_APPEND
|
enum vkd3d_shader_opcode opcode;
|
||||||
? VKD3DSIH_EMIT : VKD3DSIH_CUT;
|
|
||||||
|
|
||||||
VKD3D_ASSERT(!store->value.node && !store->coords.node);
|
VKD3D_ASSERT(!store->value.node && !store->coords.node);
|
||||||
VKD3D_ASSERT(store->resource.var->regs[HLSL_REGSET_STREAM_OUTPUTS].allocated);
|
VKD3D_ASSERT(store->resource.var->regs[HLSL_REGSET_STREAM_OUTPUTS].allocated);
|
||||||
|
|
||||||
if (store->resource.var->regs[HLSL_REGSET_STREAM_OUTPUTS].index)
|
if (hlsl_version_lt(ctx, 5, 0))
|
||||||
{
|
{
|
||||||
hlsl_fixme(ctx, &instr->loc, "Stream output operation with a nonzero stream index.");
|
opcode = store->store_type == HLSL_RESOURCE_STREAM_APPEND ? VKD3DSIH_EMIT : VKD3DSIH_CUT;
|
||||||
return false;
|
ins = generate_vsir_add_program_instruction(ctx, program, &store->node.loc, opcode, 0, 0);
|
||||||
|
return !!ins;
|
||||||
}
|
}
|
||||||
|
|
||||||
ins = generate_vsir_add_program_instruction(ctx, program, &store->node.loc, opcode, 0, 0);
|
opcode = store->store_type == HLSL_RESOURCE_STREAM_APPEND ? VKD3DSIH_EMIT_STREAM : VKD3DSIH_CUT_STREAM;
|
||||||
return !!ins;
|
if (!(ins = generate_vsir_add_program_instruction(ctx, program, &store->node.loc, opcode, 0, 1)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!sm4_generate_vsir_init_src_param_from_deref(ctx, program, &ins->src[0],
|
||||||
|
&store->resource, VKD3DSP_WRITEMASK_ALL, &instr->loc))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!store->resource.var->is_uniform)
|
if (!store->resource.var->is_uniform)
|
||||||
|
@@ -4176,6 +4176,7 @@ static void tpf_handle_instruction(struct tpf_compiler *tpf, const struct vkd3d_
|
|||||||
case VKD3DSIH_CASE:
|
case VKD3DSIH_CASE:
|
||||||
case VKD3DSIH_CONTINUE:
|
case VKD3DSIH_CONTINUE:
|
||||||
case VKD3DSIH_CUT:
|
case VKD3DSIH_CUT:
|
||||||
|
case VKD3DSIH_CUT_STREAM:
|
||||||
case VKD3DSIH_DCL_STREAM:
|
case VKD3DSIH_DCL_STREAM:
|
||||||
case VKD3DSIH_DEFAULT:
|
case VKD3DSIH_DEFAULT:
|
||||||
case VKD3DSIH_DISCARD:
|
case VKD3DSIH_DISCARD:
|
||||||
@@ -4191,6 +4192,7 @@ static void tpf_handle_instruction(struct tpf_compiler *tpf, const struct vkd3d_
|
|||||||
case VKD3DSIH_DSY_FINE:
|
case VKD3DSIH_DSY_FINE:
|
||||||
case VKD3DSIH_ELSE:
|
case VKD3DSIH_ELSE:
|
||||||
case VKD3DSIH_EMIT:
|
case VKD3DSIH_EMIT:
|
||||||
|
case VKD3DSIH_EMIT_STREAM:
|
||||||
case VKD3DSIH_ENDIF:
|
case VKD3DSIH_ENDIF:
|
||||||
case VKD3DSIH_ENDLOOP:
|
case VKD3DSIH_ENDLOOP:
|
||||||
case VKD3DSIH_ENDSWITCH:
|
case VKD3DSIH_ENDSWITCH:
|
||||||
|
@@ -541,7 +541,7 @@ gs_data main(point gs_data vin[1], inout TriangleStream<gs_data> vout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
% Output streams with nonzero stream indices are only allowed with point streams, and with SM >= 5.
|
% Output streams with nonzero stream indices are only allowed with point streams, and with SM >= 5.
|
||||||
[geometry shader fail(sm<5) todo(sm>=5)]
|
[geometry shader fail(sm<5)]
|
||||||
struct gs_data
|
struct gs_data
|
||||||
{
|
{
|
||||||
float4 pos : SV_POSITION;
|
float4 pos : SV_POSITION;
|
||||||
@@ -610,7 +610,7 @@ void main(point gs_data vin[1], inout PointStream<gs_data> vout1, inout Triangle
|
|||||||
vout1.RestartStrip();
|
vout1.RestartStrip();
|
||||||
}
|
}
|
||||||
|
|
||||||
[geometry shader fail(sm<5) todo(sm>=5)]
|
[geometry shader fail(sm<5)]
|
||||||
struct gs_data
|
struct gs_data
|
||||||
{
|
{
|
||||||
float4 pos : SV_POSITION;
|
float4 pos : SV_POSITION;
|
||||||
@@ -623,7 +623,7 @@ void main(point gs_data vin[1], inout PointStream<gs_data> vout1, inout Triangle
|
|||||||
}
|
}
|
||||||
|
|
||||||
% A maximum of 4 streams are allowed.
|
% A maximum of 4 streams are allowed.
|
||||||
[geometry shader fail(sm<5) todo(sm>=5)]
|
[geometry shader fail(sm<5)]
|
||||||
struct gs_data
|
struct gs_data
|
||||||
{
|
{
|
||||||
float4 pos : SV_POSITION;
|
float4 pos : SV_POSITION;
|
||||||
|
Reference in New Issue
Block a user