Commit e9845d4f authored by Ziqing Hui's avatar Ziqing Hui Committed by Alexandre Julliard

d2d1: Implement LoadVertexShader().

parent ed4cc8ed
...@@ -568,12 +568,22 @@ struct d2d_device ...@@ -568,12 +568,22 @@ struct d2d_device
void d2d_device_init(struct d2d_device *device, ID2D1Factory1 *factory, IDXGIDevice *dxgi_device) DECLSPEC_HIDDEN; void d2d_device_init(struct d2d_device *device, ID2D1Factory1 *factory, IDXGIDevice *dxgi_device) DECLSPEC_HIDDEN;
struct d2d_shader
{
const GUID *id;
IUnknown *shader;
};
struct d2d_effect_context struct d2d_effect_context
{ {
ID2D1EffectContext ID2D1EffectContext_iface; ID2D1EffectContext ID2D1EffectContext_iface;
LONG refcount; LONG refcount;
struct d2d_device_context *device_context; struct d2d_device_context *device_context;
struct d2d_shader *shaders;
size_t shaders_size;
size_t shader_count;
}; };
void d2d_effect_context_init(struct d2d_effect_context *effect_context, void d2d_effect_context_init(struct d2d_effect_context *effect_context,
......
...@@ -37,6 +37,15 @@ static inline struct d2d_effect_context *impl_from_ID2D1EffectContext(ID2D1Effec ...@@ -37,6 +37,15 @@ static inline struct d2d_effect_context *impl_from_ID2D1EffectContext(ID2D1Effec
static void d2d_effect_context_cleanup(struct d2d_effect_context *effect_context) static void d2d_effect_context_cleanup(struct d2d_effect_context *effect_context)
{ {
unsigned int i;
for (i = 0; i < effect_context->shader_count; ++i)
{
if (effect_context->shaders[i].shader)
IUnknown_Release(effect_context->shaders[i].shader);
}
heap_free(effect_context->shaders);
ID2D1DeviceContext_Release(&effect_context->device_context->ID2D1DeviceContext_iface); ID2D1DeviceContext_Release(&effect_context->device_context->ID2D1DeviceContext_iface);
} }
...@@ -178,10 +187,37 @@ static HRESULT STDMETHODCALLTYPE d2d_effect_context_LoadPixelShader(ID2D1EffectC ...@@ -178,10 +187,37 @@ static HRESULT STDMETHODCALLTYPE d2d_effect_context_LoadPixelShader(ID2D1EffectC
static HRESULT STDMETHODCALLTYPE d2d_effect_context_LoadVertexShader(ID2D1EffectContext *iface, static HRESULT STDMETHODCALLTYPE d2d_effect_context_LoadVertexShader(ID2D1EffectContext *iface,
REFGUID shader_id, const BYTE *buffer, UINT32 buffer_size) REFGUID shader_id, const BYTE *buffer, UINT32 buffer_size)
{ {
FIXME("iface %p, shader_id %s, buffer %p, buffer_size %u stub!\n", struct d2d_effect_context *effect_context = impl_from_ID2D1EffectContext(iface);
ID3D11VertexShader *vertex_shader;
struct d2d_shader *shader;
HRESULT hr;
TRACE("iface %p, shader_id %s, buffer %p, buffer_size %u.\n",
iface, debugstr_guid(shader_id), buffer, buffer_size); iface, debugstr_guid(shader_id), buffer, buffer_size);
return E_NOTIMPL; if (FAILED(hr = ID3D11Device1_CreateVertexShader(effect_context->device_context->d3d_device,
buffer, buffer_size, NULL, &vertex_shader)))
{
WARN("Failed to create vertex shader, hr %#lx.\n", hr);
return hr;
}
if (!d2d_array_reserve((void **)&effect_context->shaders, &effect_context->shaders_size,
effect_context->shader_count + 1, sizeof(*effect_context->shaders)))
{
ERR("Failed to resize shaders array.\n");
ID3D11VertexShader_Release(vertex_shader);
return E_OUTOFMEMORY;
}
memset(effect_context->shaders + effect_context->shader_count, 0,
sizeof(*effect_context->shaders) * (effect_context->shaders_size - effect_context->shader_count));
effect_context->shader_count++;
shader = &effect_context->shaders[effect_context->shader_count - 1];
shader->id = shader_id;
shader->shader = (IUnknown *)vertex_shader;
return S_OK;
} }
static HRESULT STDMETHODCALLTYPE d2d_effect_context_LoadComputeShader(ID2D1EffectContext *iface, static HRESULT STDMETHODCALLTYPE d2d_effect_context_LoadComputeShader(ID2D1EffectContext *iface,
......
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