[PATCH 4/6] wined3d: Implement SM5 sync instruction.
Józef Kucia
jkucia at codeweavers.com
Wed Mar 1 17:55:29 CST 2017
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
The barrier() function seems to "imply" memoryBarrierShared(). The GLSL
spec says:
"The function barrier() provides a partially defined order of
execution between shader invocations. This ensures that values written
by one invocation prior to a given static instance of barrier() can be
safely read by other invocations after their call to the same static
instance barrier()."
---
dlls/wined3d/glsl_shader.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 61865c1..e5dd567 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -5338,6 +5338,27 @@ static void shader_glsl_store_raw_structured(const struct wined3d_shader_instruc
string_buffer_release(priv->string_buffers, address);
}
+static void shader_glsl_sync(const struct wined3d_shader_instruction *ins)
+{
+ struct wined3d_string_buffer *buffer = ins->ctx->buffer;
+ unsigned int sync_flags = ins->flags;
+
+ if (sync_flags & WINED3DSSF_THREAD_GROUP)
+ {
+ shader_addline(buffer, "barrier();\n");
+ sync_flags &= ~(WINED3DSSF_THREAD_GROUP | WINED3DSSF_GROUP_SHARED_MEMORY);
+ }
+
+ if (sync_flags & WINED3DSSF_GROUP_SHARED_MEMORY)
+ {
+ shader_addline(buffer, "memoryBarrierShared();\n");
+ sync_flags &= ~WINED3DSSF_GROUP_SHARED_MEMORY;
+ }
+
+ if (sync_flags)
+ FIXME("Unhandled sync flags %#x.\n", sync_flags);
+}
+
static void shader_glsl_resinfo(const struct wined3d_shader_instruction *ins)
{
const struct wined3d_shader_version *version = &ins->ctx->reg_maps->shader_version;
@@ -9677,7 +9698,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
/* WINED3DSIH_SUB */ shader_glsl_binop,
/* WINED3DSIH_SWAPC */ NULL,
/* WINED3DSIH_SWITCH */ shader_glsl_switch,
- /* WINED3DSIH_SYNC */ NULL,
+ /* WINED3DSIH_SYNC */ shader_glsl_sync,
/* WINED3DSIH_TEX */ shader_glsl_tex,
/* WINED3DSIH_TEXBEM */ shader_glsl_texbem,
/* WINED3DSIH_TEXBEML */ shader_glsl_texbem,
--
2.10.2
More information about the wine-patches
mailing list