d3d11: Implement d3d11_device_CreatePixelShader().

This commit is contained in:
Józef Kucia 2015-09-16 01:30:14 +02:00 committed by Alexandre Julliard
parent 13a80eaab1
commit 8d253f8401
3 changed files with 42 additions and 18 deletions

View File

@ -266,8 +266,8 @@ struct d3d_pixel_shader
ID3D11Device *device;
};
HRESULT d3d_pixel_shader_init(struct d3d_pixel_shader *shader, struct d3d_device *device,
const void *byte_code, SIZE_T byte_code_length) DECLSPEC_HIDDEN;
HRESULT d3d_pixel_shader_create(struct d3d_device *device, const void *byte_code, SIZE_T byte_code_length,
struct d3d_pixel_shader **shader) DECLSPEC_HIDDEN;
struct d3d_pixel_shader *unsafe_impl_from_ID3D10PixelShader(ID3D10PixelShader *iface) DECLSPEC_HIDDEN;
HRESULT shader_parse_signature(const char *data, DWORD data_size, struct wined3d_shader_signature *s) DECLSPEC_HIDDEN;

View File

@ -242,10 +242,22 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateGeometryShaderWithStreamOutp
static HRESULT STDMETHODCALLTYPE d3d11_device_CreatePixelShader(ID3D11Device *iface, const void *byte_code,
SIZE_T byte_code_length, ID3D11ClassLinkage *class_linkage, ID3D11PixelShader **shader)
{
FIXME("iface %p, byte_code %p, byte_code_length %lu, class_linkage %p, shader %p stub!\n",
struct d3d_device *device = impl_from_ID3D11Device(iface);
struct d3d_pixel_shader *object;
HRESULT hr;
TRACE("iface %p, byte_code %p, byte_code_length %lu, class_linkage %p, shader %p.\n",
iface, byte_code, byte_code_length, class_linkage, shader);
return E_NOTIMPL;
if (class_linkage)
FIXME("Class linkage is not implemented yet.\n");
if (FAILED(hr = d3d_pixel_shader_create(device, byte_code, byte_code_length, &object)))
return hr;
*shader = &object->ID3D11PixelShader_iface;
return S_OK;
}
static HRESULT STDMETHODCALLTYPE d3d11_device_CreateHullShader(ID3D11Device *iface, const void *byte_code,
@ -2307,26 +2319,16 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutp
static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device1 *iface,
const void *byte_code, SIZE_T byte_code_length, ID3D10PixelShader **shader)
{
struct d3d_device *This = impl_from_ID3D10Device(iface);
struct d3d_device *device = impl_from_ID3D10Device(iface);
struct d3d_pixel_shader *object;
HRESULT hr;
TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p.\n",
iface, byte_code, byte_code_length, shader);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
return E_OUTOFMEMORY;
hr = d3d_pixel_shader_init(object, This, byte_code, byte_code_length);
if (FAILED(hr))
{
WARN("Failed to initialize pixel shader, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
if (FAILED(hr = d3d_pixel_shader_create(device, byte_code, byte_code_length, &object)))
return hr;
}
TRACE("Created pixel shader %p.\n", object);
*shader = &object->ID3D10PixelShader_iface;
return S_OK;

View File

@ -849,7 +849,7 @@ static const struct wined3d_parent_ops d3d_pixel_shader_wined3d_parent_ops =
d3d_pixel_shader_wined3d_object_destroyed,
};
HRESULT d3d_pixel_shader_init(struct d3d_pixel_shader *shader, struct d3d_device *device,
static HRESULT d3d_pixel_shader_init(struct d3d_pixel_shader *shader, struct d3d_device *device,
const void *byte_code, SIZE_T byte_code_length)
{
struct wined3d_shader_signature output_signature;
@ -898,6 +898,28 @@ HRESULT d3d_pixel_shader_init(struct d3d_pixel_shader *shader, struct d3d_device
return S_OK;
}
HRESULT d3d_pixel_shader_create(struct d3d_device *device, const void *byte_code, SIZE_T byte_code_length,
struct d3d_pixel_shader **shader)
{
struct d3d_pixel_shader *object;
HRESULT hr;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d3d_pixel_shader_init(object, device, byte_code, byte_code_length)))
{
WARN("Failed to initialize pixel shader, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
return hr;
}
TRACE("Created pixel shader %p.\n", object);
*shader = object;
return S_OK;
}
struct d3d_pixel_shader *unsafe_impl_from_ID3D10PixelShader(ID3D10PixelShader *iface)
{
if (!iface)