Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
vkd3d
Manage
Activity
Members
Labels
Plan
Wiki
Bugzilla
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wine
vkd3d
Commits
feef2577
Commit
feef2577
authored
10 months ago
by
Conor McCarthy
Committed by
Alexandre Julliard
10 months ago
Browse files
Options
Downloads
Patches
Plain Diff
vkd3d-shader/spirv: Implement the WAVE_ALL_BIT_COUNT instruction.
parent
cb5163f9
No related branches found
No related tags found
1 merge request
!856
vkd3d-shader/dxil: Wave ops part 3.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libs/vkd3d-shader/spirv.c
+40
-4
40 additions, 4 deletions
libs/vkd3d-shader/spirv.c
tests/hlsl/wave-ops-uint.shader_test
+1
-1
1 addition, 1 deletion
tests/hlsl/wave-ops-uint.shader_test
with
41 additions
and
5 deletions
libs/vkd3d-shader/spirv.c
+
40
−
4
View file @
feef2577
...
@@ -1760,6 +1760,14 @@ static uint32_t vkd3d_spirv_build_op_group_nonuniform_ballot(struct vkd3d_spirv_
...
@@ -1760,6 +1760,14 @@ static uint32_t vkd3d_spirv_build_op_group_nonuniform_ballot(struct vkd3d_spirv_
result_type
,
vkd3d_spirv_get_op_scope_subgroup
(
builder
),
val_id
);
result_type
,
vkd3d_spirv_get_op_scope_subgroup
(
builder
),
val_id
);
}
}
static
uint32_t
vkd3d_spirv_build_op_group_nonuniform_ballot_bit_count
(
struct
vkd3d_spirv_builder
*
builder
,
uint32_t
result_type
,
SpvGroupOperation
group_op
,
uint32_t
val_id
)
{
vkd3d_spirv_enable_capability
(
builder
,
SpvCapabilityGroupNonUniformBallot
);
return
vkd3d_spirv_build_op_tr3
(
builder
,
&
builder
->
function_stream
,
SpvOpGroupNonUniformBallotBitCount
,
result_type
,
vkd3d_spirv_get_op_scope_subgroup
(
builder
),
group_op
,
val_id
);
}
static
uint32_t
vkd3d_spirv_build_op_glsl_std450_tr1
(
struct
vkd3d_spirv_builder
*
builder
,
static
uint32_t
vkd3d_spirv_build_op_glsl_std450_tr1
(
struct
vkd3d_spirv_builder
*
builder
,
enum
GLSLstd450
op
,
uint32_t
result_type
,
uint32_t
operand
)
enum
GLSLstd450
op
,
uint32_t
result_type
,
uint32_t
operand
)
{
{
...
@@ -9801,18 +9809,26 @@ static void spirv_compiler_emit_wave_bool_op(struct spirv_compiler *compiler,
...
@@ -9801,18 +9809,26 @@ static void spirv_compiler_emit_wave_bool_op(struct spirv_compiler *compiler,
spirv_compiler_emit_store_dst
(
compiler
,
dst
,
val_id
);
spirv_compiler_emit_store_dst
(
compiler
,
dst
,
val_id
);
}
}
static
void
spirv_compiler_emit_
wave_active
_ballot
(
struct
spirv_compiler
*
compiler
,
static
uint32_t
spirv_compiler_emit_
group_nonuniform
_ballot
(
struct
spirv_compiler
*
compiler
,
const
struct
vkd3d_shader_
instruction
*
instruction
)
const
struct
vkd3d_shader_
src_param
*
src
)
{
{
struct
vkd3d_spirv_builder
*
builder
=
&
compiler
->
spirv_builder
;
struct
vkd3d_spirv_builder
*
builder
=
&
compiler
->
spirv_builder
;
const
struct
vkd3d_shader_dst_param
*
dst
=
instruction
->
dst
;
const
struct
vkd3d_shader_src_param
*
src
=
instruction
->
src
;
uint32_t
type_id
,
val_id
;
uint32_t
type_id
,
val_id
;
type_id
=
vkd3d_spirv_get_type_id
(
builder
,
VKD3D_SHADER_COMPONENT_UINT
,
VKD3D_VEC4_SIZE
);
type_id
=
vkd3d_spirv_get_type_id
(
builder
,
VKD3D_SHADER_COMPONENT_UINT
,
VKD3D_VEC4_SIZE
);
val_id
=
spirv_compiler_emit_load_src
(
compiler
,
src
,
VKD3DSP_WRITEMASK_0
);
val_id
=
spirv_compiler_emit_load_src
(
compiler
,
src
,
VKD3DSP_WRITEMASK_0
);
val_id
=
vkd3d_spirv_build_op_group_nonuniform_ballot
(
builder
,
type_id
,
val_id
);
val_id
=
vkd3d_spirv_build_op_group_nonuniform_ballot
(
builder
,
type_id
,
val_id
);
return
val_id
;
}
static
void
spirv_compiler_emit_wave_active_ballot
(
struct
spirv_compiler
*
compiler
,
const
struct
vkd3d_shader_instruction
*
instruction
)
{
const
struct
vkd3d_shader_dst_param
*
dst
=
instruction
->
dst
;
uint32_t
val_id
;
val_id
=
spirv_compiler_emit_group_nonuniform_ballot
(
compiler
,
instruction
->
src
);
spirv_compiler_emit_store_dst
(
compiler
,
dst
,
val_id
);
spirv_compiler_emit_store_dst
(
compiler
,
dst
,
val_id
);
}
}
...
@@ -9871,6 +9887,23 @@ static void spirv_compiler_emit_wave_alu_op(struct spirv_compiler *compiler,
...
@@ -9871,6 +9887,23 @@ static void spirv_compiler_emit_wave_alu_op(struct spirv_compiler *compiler,
spirv_compiler_emit_store_dst
(
compiler
,
dst
,
val_id
);
spirv_compiler_emit_store_dst
(
compiler
,
dst
,
val_id
);
}
}
static
void
spirv_compiler_emit_wave_bit_count
(
struct
spirv_compiler
*
compiler
,
const
struct
vkd3d_shader_instruction
*
instruction
)
{
struct
vkd3d_spirv_builder
*
builder
=
&
compiler
->
spirv_builder
;
const
struct
vkd3d_shader_dst_param
*
dst
=
instruction
->
dst
;
SpvGroupOperation
group_op
;
uint32_t
type_id
,
val_id
;
group_op
=
SpvGroupOperationReduce
;
val_id
=
spirv_compiler_emit_group_nonuniform_ballot
(
compiler
,
instruction
->
src
);
type_id
=
vkd3d_spirv_get_type_id
(
builder
,
VKD3D_SHADER_COMPONENT_UINT
,
1
);
val_id
=
vkd3d_spirv_build_op_group_nonuniform_ballot_bit_count
(
builder
,
type_id
,
group_op
,
val_id
);
spirv_compiler_emit_store_dst
(
compiler
,
dst
,
val_id
);
}
/* This function is called after declarations are processed. */
/* This function is called after declarations are processed. */
static
void
spirv_compiler_emit_main_prolog
(
struct
spirv_compiler
*
compiler
)
static
void
spirv_compiler_emit_main_prolog
(
struct
spirv_compiler
*
compiler
)
{
{
...
@@ -10236,6 +10269,9 @@ static int spirv_compiler_handle_instruction(struct spirv_compiler *compiler,
...
@@ -10236,6 +10269,9 @@ static int spirv_compiler_handle_instruction(struct spirv_compiler *compiler,
case
VKD3DSIH_WAVE_OP_UMIN
:
case
VKD3DSIH_WAVE_OP_UMIN
:
spirv_compiler_emit_wave_alu_op
(
compiler
,
instruction
);
spirv_compiler_emit_wave_alu_op
(
compiler
,
instruction
);
break
;
break
;
case
VKD3DSIH_WAVE_ALL_BIT_COUNT
:
spirv_compiler_emit_wave_bit_count
(
compiler
,
instruction
);
break
;
case
VKD3DSIH_DCL
:
case
VKD3DSIH_DCL
:
case
VKD3DSIH_DCL_HS_MAX_TESSFACTOR
:
case
VKD3DSIH_DCL_HS_MAX_TESSFACTOR
:
case
VKD3DSIH_DCL_INPUT_CONTROL_POINT_COUNT
:
case
VKD3DSIH_DCL_INPUT_CONTROL_POINT_COUNT
:
...
...
This diff is collapsed.
Click to expand it.
tests/hlsl/wave-ops-uint.shader_test
+
1
−
1
View file @
feef2577
...
@@ -177,7 +177,7 @@ void main(uint id : SV_GroupIndex)
...
@@ -177,7 +177,7 @@ void main(uint id : SV_GroupIndex)
}
}
[test]
[test]
todo
dispatch 4 1 1
dispatch 4 1 1
probe uav 1 (0) rui (2)
probe uav 1 (0) rui (2)
probe uav 1 (1) rui (2)
probe uav 1 (1) rui (2)
probe uav 1 (2) rui (2)
probe uav 1 (2) rui (2)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment