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
19c1b81a
Commit
19c1b81a
authored
7 years ago
by
Józef Kucia
Browse files
Options
Downloads
Patches
Plain Diff
libs/vkd3d-shader: Translate sync instructions.
parent
3a966cf3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libs/vkd3d-shader/spirv.c
+74
-0
74 additions, 0 deletions
libs/vkd3d-shader/spirv.c
with
74 additions
and
0 deletions
libs/vkd3d-shader/spirv.c
+
74
−
0
View file @
19c1b81a
...
...
@@ -1326,6 +1326,20 @@ static uint32_t vkd3d_spirv_build_op_image_query_levels(struct vkd3d_spirv_build
SpvOpImageQueryLevels
,
result_type
,
image_id
);
}
static
void
vkd3d_spirv_build_op_control_barrier
(
struct
vkd3d_spirv_builder
*
builder
,
uint32_t
execution_id
,
uint32_t
memory_id
,
uint32_t
memory_semantics_id
)
{
vkd3d_spirv_build_op3
(
&
builder
->
function_stream
,
SpvOpControlBarrier
,
execution_id
,
memory_id
,
memory_semantics_id
);
}
static
void
vkd3d_spirv_build_op_memory_barrier
(
struct
vkd3d_spirv_builder
*
builder
,
uint32_t
memory_id
,
uint32_t
memory_semantics_id
)
{
vkd3d_spirv_build_op2
(
&
builder
->
function_stream
,
SpvOpMemoryBarrier
,
memory_id
,
memory_semantics_id
);
}
static
uint32_t
vkd3d_spirv_build_op_glsl_std450_fabs
(
struct
vkd3d_spirv_builder
*
builder
,
uint32_t
result_type
,
uint32_t
operand
)
{
...
...
@@ -4592,6 +4606,63 @@ static void vkd3d_dxbc_compiler_emit_resinfo(struct vkd3d_dxbc_compiler *compile
vkd3d_dxbc_compiler_emit_store_dst
(
compiler
,
dst
,
val_id
);
}
/* From the Vulkan spec:
*
* "Scope for execution must be limited to: * Workgroup * Subgroup"
*
* "Scope for memory must be limited to: * Device * Workgroup * Invocation"
*/
static
void
vkd3d_dxbc_compiler_emit_sync
(
struct
vkd3d_dxbc_compiler
*
compiler
,
const
struct
vkd3d_shader_instruction
*
instruction
)
{
struct
vkd3d_spirv_builder
*
builder
=
&
compiler
->
spirv_builder
;
uint32_t
execution_id
,
memory_id
,
semantics_id
;
unsigned
int
flags
=
instruction
->
flags
;
SpvScope
execution_scope
=
SpvScopeMax
;
SpvScope
memory_scope
=
SpvScopeDevice
;
unsigned
int
memory_semantics
=
0
;
if
(
flags
&
VKD3DSSF_GROUP_SHARED_MEMORY
)
{
memory_scope
=
SpvScopeWorkgroup
;
memory_semantics
|=
SpvMemorySemanticsWorkgroupMemoryMask
;
flags
&=
~
VKD3DSSF_GROUP_SHARED_MEMORY
;
}
if
(
flags
&
VKD3DSSF_THREAD_GROUP
)
{
execution_scope
=
SpvScopeWorkgroup
;
flags
&=
~
VKD3DSSF_THREAD_GROUP
;
}
if
(
flags
)
{
FIXME
(
"Unhandled sync flags %#x.
\n
"
,
flags
);
memory_scope
=
SpvScopeDevice
;
execution_scope
=
SpvScopeWorkgroup
;
memory_semantics
|=
SpvMemorySemanticsSequentiallyConsistentMask
|
SpvMemorySemanticsUniformMemoryMask
|
SpvMemorySemanticsSubgroupMemoryMask
|
SpvMemorySemanticsWorkgroupMemoryMask
|
SpvMemorySemanticsCrossWorkgroupMemoryMask
|
SpvMemorySemanticsAtomicCounterMemoryMask
|
SpvMemorySemanticsImageMemoryMask
;
}
memory_id
=
vkd3d_dxbc_compiler_get_constant_uint
(
compiler
,
memory_scope
);
semantics_id
=
vkd3d_dxbc_compiler_get_constant_uint
(
compiler
,
memory_semantics
);
if
(
execution_scope
!=
SpvScopeMax
)
{
execution_id
=
vkd3d_dxbc_compiler_get_constant_uint
(
compiler
,
execution_scope
);
vkd3d_spirv_build_op_control_barrier
(
builder
,
execution_id
,
memory_id
,
semantics_id
);
}
else
{
vkd3d_spirv_build_op_memory_barrier
(
builder
,
memory_id
,
semantics_id
);
}
}
/* This function is called after declarations are processed. */
static
void
vkd3d_dxbc_compiler_emit_main_prolog
(
struct
vkd3d_dxbc_compiler
*
compiler
)
{
...
...
@@ -4795,6 +4866,9 @@ void vkd3d_dxbc_compiler_handle_instruction(struct vkd3d_dxbc_compiler *compiler
case
VKD3DSIH_RESINFO
:
vkd3d_dxbc_compiler_emit_resinfo
(
compiler
,
instruction
);
break
;
case
VKD3DSIH_SYNC
:
vkd3d_dxbc_compiler_emit_sync
(
compiler
,
instruction
);
break
;
default:
FIXME
(
"Unhandled instruction %#x.
\n
"
,
instruction
->
handler_idx
);
}
...
...
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