d3d10core: Add a separate function for d3d10_pixel_shader initialization.
This commit is contained in:
parent
8aea1b1302
commit
dde50a4748
|
@ -153,7 +153,6 @@ struct d3d10_geometry_shader
|
|||
};
|
||||
|
||||
/* ID3D10PixelShader */
|
||||
extern const struct ID3D10PixelShaderVtbl d3d10_pixel_shader_vtbl DECLSPEC_HIDDEN;
|
||||
struct d3d10_pixel_shader
|
||||
{
|
||||
const struct ID3D10PixelShaderVtbl *vtbl;
|
||||
|
@ -163,8 +162,9 @@ struct d3d10_pixel_shader
|
|||
struct wined3d_shader_signature output_signature;
|
||||
};
|
||||
|
||||
HRESULT shader_extract_from_dxbc(const void *dxbc, SIZE_T dxbc_length,
|
||||
struct d3d10_shader_info *shader_info) DECLSPEC_HIDDEN;
|
||||
HRESULT d3d10_pixel_shader_init(struct d3d10_pixel_shader *shader, struct d3d10_device *device,
|
||||
const void *byte_code, SIZE_T byte_code_length) DECLSPEC_HIDDEN;
|
||||
|
||||
HRESULT shader_parse_signature(const char *data, DWORD data_size, struct wined3d_shader_signature *s) DECLSPEC_HIDDEN;
|
||||
void shader_free_signature(struct wined3d_shader_signature *s) DECLSPEC_HIDDEN;
|
||||
|
||||
|
|
|
@ -1001,7 +1001,6 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *if
|
|||
{
|
||||
struct d3d10_device *This = (struct d3d10_device *)iface;
|
||||
struct d3d10_pixel_shader *object;
|
||||
struct d3d10_shader_info shader_info;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
|
||||
|
@ -1014,29 +1013,15 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *if
|
|||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
object->vtbl = &d3d10_pixel_shader_vtbl;
|
||||
object->refcount = 1;
|
||||
|
||||
shader_info.output_signature = &object->output_signature;
|
||||
hr = shader_extract_from_dxbc(byte_code, byte_code_length, &shader_info);
|
||||
hr = d3d10_pixel_shader_init(object, This, byte_code, byte_code_length);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("Failed to extract shader, hr %#x\n", hr);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = IWineD3DDevice_CreatePixelShader(This->wined3d_device,
|
||||
shader_info.shader_code, &object->output_signature,
|
||||
&object->wined3d_shader, (IUnknown *)object);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("CreatePixelShader failed, hr %#x\n", hr);
|
||||
shader_free_signature(&object->output_signature);
|
||||
WARN("Failed to initialize pixel shader, hr %#x.\n", hr);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
return hr;
|
||||
}
|
||||
|
||||
TRACE("Created pixel shader %p.\n", object);
|
||||
*shader = (ID3D10PixelShader *)object;
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -48,7 +48,7 @@ static HRESULT shdr_handler(const char *data, DWORD data_size, DWORD tag, void *
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT shader_extract_from_dxbc(const void *dxbc, SIZE_T dxbc_length, struct d3d10_shader_info *shader_info)
|
||||
static HRESULT shader_extract_from_dxbc(const void *dxbc, SIZE_T dxbc_length, struct d3d10_shader_info *shader_info)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -447,7 +447,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_pixel_shader_SetPrivateDataInterface(ID3D
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
const struct ID3D10PixelShaderVtbl d3d10_pixel_shader_vtbl =
|
||||
static const struct ID3D10PixelShaderVtbl d3d10_pixel_shader_vtbl =
|
||||
{
|
||||
/* IUnknown methods */
|
||||
d3d10_pixel_shader_QueryInterface,
|
||||
|
@ -459,3 +459,33 @@ const struct ID3D10PixelShaderVtbl d3d10_pixel_shader_vtbl =
|
|||
d3d10_pixel_shader_SetPrivateData,
|
||||
d3d10_pixel_shader_SetPrivateDataInterface,
|
||||
};
|
||||
|
||||
HRESULT d3d10_pixel_shader_init(struct d3d10_pixel_shader *shader, struct d3d10_device *device,
|
||||
const void *byte_code, SIZE_T byte_code_length)
|
||||
{
|
||||
struct d3d10_shader_info shader_info;
|
||||
HRESULT hr;
|
||||
|
||||
shader->vtbl = &d3d10_pixel_shader_vtbl;
|
||||
shader->refcount = 1;
|
||||
|
||||
shader_info.output_signature = &shader->output_signature;
|
||||
hr = shader_extract_from_dxbc(byte_code, byte_code_length, &shader_info);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("Failed to extract shader, hr %#x.\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = IWineD3DDevice_CreatePixelShader(device->wined3d_device,
|
||||
shader_info.shader_code, &shader->output_signature,
|
||||
&shader->wined3d_shader, (IUnknown *)shader);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to create wined3d pixel shader, hr %#x.\n", hr);
|
||||
shader_free_signature(&shader->output_signature);
|
||||
return hr;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue