Commit 772370d3 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Implement dcl_thread_group instruction.

GLSL 1.30 is not enough for layout qualifiers. Signed-off-by: 's avatarJózef Kucia <jkucia@codeweavers.com> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 67b59998
......@@ -353,7 +353,8 @@ static const char *shader_glsl_get_prefix(enum wined3d_shader_type type)
static unsigned int shader_glsl_get_version(const struct wined3d_gl_info *gl_info,
const struct wined3d_shader_version *version)
{
if (!gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
if (!gl_info->supported[WINED3D_GL_LEGACY_CONTEXT]
|| (version && version->type == WINED3D_SHADER_TYPE_COMPUTE))
return 150;
else if (gl_info->glsl_version >= MAKEDWORD_VERSION(1, 30) && version && version->major >= 4)
return 130;
......@@ -6584,6 +6585,7 @@ static GLuint shader_glsl_generate_compute_shader(const struct wined3d_context *
struct wined3d_string_buffer *buffer, struct wined3d_string_buffer_list *string_buffers,
const struct wined3d_shader *shader)
{
const struct wined3d_shader_thread_group_size *thread_group_size = &shader->u.cs.thread_group_size;
const struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps;
const struct wined3d_gl_info *gl_info = context->gl_info;
const DWORD *function = shader->function;
......@@ -6601,6 +6603,10 @@ static GLuint shader_glsl_generate_compute_shader(const struct wined3d_context *
memset(&priv_ctx, 0, sizeof(priv_ctx));
priv_ctx.string_buffers = string_buffers;
shader_generate_glsl_declarations(context, buffer, shader, reg_maps, &priv_ctx);
shader_addline(buffer, "layout(local_size_x = %u, local_size_y = %u, local_size_z = %u) in;\n",
thread_group_size->x, thread_group_size->y, thread_group_size->z);
shader_addline(buffer, "void main()\n{\n");
shader_generate_main(shader, buffer, reg_maps, function, &priv_ctx);
shader_addline(buffer, "}\n");
......@@ -9203,7 +9209,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
/* WINED3DSIH_DCL_TESSELLATOR_PARTITIONING */ NULL,
/* WINED3DSIH_DCL_TGSM_RAW */ NULL,
/* WINED3DSIH_DCL_TGSM_STRUCTURED */ NULL,
/* WINED3DSIH_DCL_THREAD_GROUP */ NULL,
/* WINED3DSIH_DCL_THREAD_GROUP */ shader_glsl_nop,
/* WINED3DSIH_DCL_UAV_RAW */ NULL,
/* WINED3DSIH_DCL_UAV_STRUCTURED */ NULL,
/* WINED3DSIH_DCL_UAV_TYPED */ shader_glsl_nop,
......
......@@ -1033,6 +1033,18 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
{
reg_maps->temporary_count = ins.declaration.count;
}
else if (ins.handler_idx == WINED3DSIH_DCL_THREAD_GROUP)
{
if (shader_version.type == WINED3D_SHADER_TYPE_COMPUTE)
{
shader->u.cs.thread_group_size = ins.declaration.thread_group_size;
}
else
{
FIXME("Invalid instruction %#x for shader type %#x.\n",
ins.handler_idx, shader_version.type);
}
}
else if (ins.handler_idx == WINED3DSIH_DCL_VERTICES_OUT)
{
if (shader_version.type == WINED3D_SHADER_TYPE_GEOMETRY)
......
......@@ -3560,6 +3560,11 @@ struct wined3d_pixel_shader
DWORD color0_reg;
};
struct wined3d_compute_shader
{
struct wined3d_shader_thread_group_size thread_group_size;
};
struct wined3d_shader
{
LONG ref;
......@@ -3597,6 +3602,7 @@ struct wined3d_shader
struct wined3d_vertex_shader vs;
struct wined3d_geometry_shader gs;
struct wined3d_pixel_shader ps;
struct wined3d_compute_shader cs;
} u;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment