wined3d: Introduce wined3d_shader_create_cs().

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2016-06-21 13:09:57 +02:00 committed by Alexandre Julliard
parent b30f59c567
commit 061aa115b0
5 changed files with 47 additions and 0 deletions

View File

@ -353,6 +353,7 @@ static const struct wined3d_shader_frontend *shader_select_frontend(DWORD versio
case WINED3D_SM4_GS:
case WINED3D_SM5_HS:
case WINED3D_SM5_DS:
case WINED3D_SM5_CS:
return &sm4_shader_frontend;
default:
@ -3263,6 +3264,44 @@ void pixelshader_update_resource_types(struct wined3d_shader *shader, WORD tex_t
}
}
static HRESULT compute_shader_init(struct wined3d_shader *shader, struct wined3d_device *device,
const struct wined3d_shader_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops)
{
HRESULT hr;
if (FAILED(hr = shader_init(shader, device, desc, 0, WINED3D_SHADER_TYPE_COMPUTE, parent, parent_ops)))
return hr;
shader->load_local_constsF = shader->lconst_inf_or_nan;
return WINED3D_OK;
}
HRESULT CDECL wined3d_shader_create_cs(struct wined3d_device *device, const struct wined3d_shader_desc *desc,
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader)
{
struct wined3d_shader *object;
HRESULT hr;
TRACE("device %p, desc %p, parent %p, parent_ops %p, shader %p.\n",
device, desc, parent, parent_ops, shader);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = compute_shader_init(object, device, desc, parent, parent_ops)))
{
WARN("Failed to initialize compute shader, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
return hr;
}
TRACE("Created compute shader %p.\n", object);
*shader = object;
return WINED3D_OK;
}
HRESULT CDECL wined3d_shader_create_ds(struct wined3d_device *device, const struct wined3d_shader_desc *desc,
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader)
{

View File

@ -980,6 +980,10 @@ static void shader_sm4_read_header(void *data, const DWORD **ptr, struct wined3d
priv->shader_version.type = WINED3D_SHADER_TYPE_DOMAIN;
break;
case WINED3D_SM5_CS:
priv->shader_version.type = WINED3D_SHADER_TYPE_COMPUTE;
break;
default:
FIXME("Unrecognized shader type %#x.\n", version_token >> 16);
}

View File

@ -200,6 +200,7 @@
@ cdecl wined3d_sampler_get_parent(ptr)
@ cdecl wined3d_sampler_incref(ptr)
@ cdecl wined3d_shader_create_cs(ptr ptr ptr ptr ptr)
@ cdecl wined3d_shader_create_ds(ptr ptr ptr ptr ptr)
@ cdecl wined3d_shader_create_gs(ptr ptr ptr ptr ptr)
@ cdecl wined3d_shader_create_hs(ptr ptr ptr ptr ptr)

View File

@ -513,6 +513,7 @@ enum wined3d_shader_conditional_op
#define WINED3D_SM4_GS 0x0002u
#define WINED3D_SM5_HS 0x0003u
#define WINED3D_SM5_DS 0x0004u
#define WINED3D_SM5_CS 0x0005u
/* Shader version tokens, and shader end tokens */
#define WINED3DPS_VERSION(major, minor) ((WINED3D_SM1_PS << 16) | ((major) << 8) | (minor))

View File

@ -2426,6 +2426,8 @@ ULONG __cdecl wined3d_sampler_decref(struct wined3d_sampler *sampler);
void * __cdecl wined3d_sampler_get_parent(const struct wined3d_sampler *sampler);
ULONG __cdecl wined3d_sampler_incref(struct wined3d_sampler *sampler);
HRESULT __cdecl wined3d_shader_create_cs(struct wined3d_device *device, const struct wined3d_shader_desc *desc,
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader);
HRESULT __cdecl wined3d_shader_create_ds(struct wined3d_device *device, const struct wined3d_shader_desc *desc,
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader);
HRESULT __cdecl wined3d_shader_create_gs(struct wined3d_device *device, const struct wined3d_shader_desc *desc,