[PATCH 2/7] wined3d: Introduce wined3d_shader_create_cs().
Józef Kucia
jkucia at codeweavers.com
Tue Jun 21 06:09:57 CDT 2016
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
dlls/wined3d/shader.c | 39 +++++++++++++++++++++++++++++++++++++++
dlls/wined3d/shader_sm4.c | 4 ++++
dlls/wined3d/wined3d.spec | 1 +
dlls/wined3d/wined3d_private.h | 1 +
include/wine/wined3d.h | 2 ++
5 files changed, 47 insertions(+)
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index d0f6eeb..f7ecda3 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -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)
{
diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c
index 18d345b..893c331 100644
--- a/dlls/wined3d/shader_sm4.c
+++ b/dlls/wined3d/shader_sm4.c
@@ -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);
}
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 0a00290..8d1d8dc 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -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)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 7560a23..3f9f959 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -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))
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 5ca03d7..9becd6f 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -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,
--
2.7.3
More information about the wine-patches
mailing list