| /* |
| * Copyright 2009 Henri Verbeet for CodeWeavers |
| * Copyright 2010 Rico Schüller |
| * |
| * This library is free software; you can redistribute it and/or |
| * modify it under the terms of the GNU Lesser General Public |
| * License as published by the Free Software Foundation; either |
| * version 2.1 of the License, or (at your option) any later version. |
| * |
| * This library is distributed in the hope that it will be useful, |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| * Lesser General Public License for more details. |
| * |
| * You should have received a copy of the GNU Lesser General Public |
| * License along with this library; if not, write to the Free Software |
| * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
| * |
| */ |
| |
| #include "config.h" |
| #include "wine/port.h" |
| |
| #include "d3dcompiler_private.h" |
| |
| WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler); |
| |
| /* IUnknown methods */ |
| |
| static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_QueryInterface(ID3D11ShaderReflection *iface, REFIID riid, void **object) |
| { |
| TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object); |
| |
| if (IsEqualGUID(riid, &IID_ID3D11ShaderReflection) |
| || IsEqualGUID(riid, &IID_IUnknown)) |
| { |
| IUnknown_AddRef(iface); |
| *object = iface; |
| return S_OK; |
| } |
| |
| WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid)); |
| |
| *object = NULL; |
| return E_NOINTERFACE; |
| } |
| |
| static ULONG STDMETHODCALLTYPE d3dcompiler_shader_reflection_AddRef(ID3D11ShaderReflection *iface) |
| { |
| struct d3dcompiler_shader_reflection *This = (struct d3dcompiler_shader_reflection *)iface; |
| ULONG refcount = InterlockedIncrement(&This->refcount); |
| |
| TRACE("%p increasing refcount to %u\n", This, refcount); |
| |
| return refcount; |
| } |
| |
| static ULONG STDMETHODCALLTYPE d3dcompiler_shader_reflection_Release(ID3D11ShaderReflection *iface) |
| { |
| struct d3dcompiler_shader_reflection *This = (struct d3dcompiler_shader_reflection *)iface; |
| ULONG refcount = InterlockedDecrement(&This->refcount); |
| |
| TRACE("%p decreasing refcount to %u\n", This, refcount); |
| |
| if (!refcount) |
| { |
| HeapFree(GetProcessHeap(), 0, This); |
| } |
| |
| return refcount; |
| } |
| |
| /* ID3D11ShaderReflection methods */ |
| |
| static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetDesc(ID3D11ShaderReflection *iface, D3D11_SHADER_DESC *desc) |
| { |
| FIXME("iface %p, desc %p stub!\n", iface, desc); |
| |
| return E_NOTIMPL; |
| } |
| |
| static struct ID3D11ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetConstantBufferByIndex( |
| ID3D11ShaderReflection *iface, UINT index) |
| { |
| FIXME("iface %p, index %u stub!\n", iface, index); |
| |
| return NULL; |
| } |
| |
| static struct ID3D11ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetConstantBufferByName( |
| ID3D11ShaderReflection *iface, LPCSTR name) |
| { |
| FIXME("iface %p, name \"%s\" stub!\n", iface, name); |
| |
| return NULL; |
| } |
| |
| static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetResourceBindingDesc( |
| ID3D11ShaderReflection *iface, UINT index, D3D11_SHADER_INPUT_BIND_DESC *desc) |
| { |
| FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc); |
| |
| return E_NOTIMPL; |
| } |
| |
| static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetInputParameterDesc( |
| ID3D11ShaderReflection *iface, UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) |
| { |
| FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc); |
| |
| return E_NOTIMPL; |
| } |
| |
| static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetOutputParameterDesc( |
| ID3D11ShaderReflection *iface, UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) |
| { |
| FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc); |
| |
| return E_NOTIMPL; |
| } |
| |
| static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetPatchConstantParameterDesc( |
| ID3D11ShaderReflection *iface, UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) |
| { |
| FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc); |
| |
| return E_NOTIMPL; |
| } |
| |
| static struct ID3D11ShaderReflectionVariable * STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetVariableByName( |
| ID3D11ShaderReflection *iface, LPCSTR name) |
| { |
| FIXME("iface %p, name %s stub!\n", iface, name); |
| |
| return NULL; |
| } |
| |
| static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetResourceBindingDescByName( |
| ID3D11ShaderReflection *iface, LPCSTR name, D3D11_SHADER_INPUT_BIND_DESC *desc) |
| { |
| FIXME("iface %p, name %s, desc %p stub!\n", iface, name, desc); |
| |
| return E_NOTIMPL; |
| } |
| |
| static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetMovInstructionCount( |
| ID3D11ShaderReflection *iface) |
| { |
| FIXME("iface %p stub!\n", iface); |
| |
| return 0; |
| } |
| |
| static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetMovcInstructionCount( |
| ID3D11ShaderReflection *iface) |
| { |
| FIXME("iface %p stub!\n", iface); |
| |
| return 0; |
| } |
| |
| static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetConversionInstructionCount( |
| ID3D11ShaderReflection *iface) |
| { |
| FIXME("iface %p stub!\n", iface); |
| |
| return 0; |
| } |
| |
| static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetBitwiseInstructionCount( |
| ID3D11ShaderReflection *iface) |
| { |
| FIXME("iface %p stub!\n", iface); |
| |
| return 0; |
| } |
| |
| static D3D_PRIMITIVE STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetGSInputPrimitive( |
| ID3D11ShaderReflection *iface) |
| { |
| FIXME("iface %p stub!\n", iface); |
| |
| return 0; |
| } |
| |
| static BOOL STDMETHODCALLTYPE d3dcompiler_shader_reflection_IsSampleFrequencyShader( |
| ID3D11ShaderReflection *iface) |
| { |
| FIXME("iface %p stub!\n", iface); |
| |
| return 0; |
| } |
| |
| static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetNumInterfaceSlots( |
| ID3D11ShaderReflection *iface) |
| { |
| FIXME("iface %p stub!\n", iface); |
| |
| return 0; |
| } |
| |
| static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetMinFeatureLevel( |
| ID3D11ShaderReflection *iface, D3D_FEATURE_LEVEL *level) |
| { |
| FIXME("iface %p, level %p stub!\n", iface, level); |
| |
| return E_NOTIMPL; |
| } |
| |
| static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetThreadGroupSize( |
| ID3D11ShaderReflection *iface, UINT *sizex, UINT *sizey, UINT *sizez) |
| { |
| FIXME("iface %p, sizex %p, sizey %p, sizez %p stub!\n", iface, sizex, sizey, sizez); |
| |
| return 0; |
| } |
| |
| const struct ID3D11ShaderReflectionVtbl d3dcompiler_shader_reflection_vtbl = |
| { |
| /* IUnknown methods */ |
| d3dcompiler_shader_reflection_QueryInterface, |
| d3dcompiler_shader_reflection_AddRef, |
| d3dcompiler_shader_reflection_Release, |
| /* ID3D11ShaderReflection methods */ |
| d3dcompiler_shader_reflection_GetDesc, |
| d3dcompiler_shader_reflection_GetConstantBufferByIndex, |
| d3dcompiler_shader_reflection_GetConstantBufferByName, |
| d3dcompiler_shader_reflection_GetResourceBindingDesc, |
| d3dcompiler_shader_reflection_GetInputParameterDesc, |
| d3dcompiler_shader_reflection_GetOutputParameterDesc, |
| d3dcompiler_shader_reflection_GetPatchConstantParameterDesc, |
| d3dcompiler_shader_reflection_GetVariableByName, |
| d3dcompiler_shader_reflection_GetResourceBindingDescByName, |
| d3dcompiler_shader_reflection_GetMovInstructionCount, |
| d3dcompiler_shader_reflection_GetMovcInstructionCount, |
| d3dcompiler_shader_reflection_GetConversionInstructionCount, |
| d3dcompiler_shader_reflection_GetBitwiseInstructionCount, |
| d3dcompiler_shader_reflection_GetGSInputPrimitive, |
| d3dcompiler_shader_reflection_IsSampleFrequencyShader, |
| d3dcompiler_shader_reflection_GetNumInterfaceSlots, |
| d3dcompiler_shader_reflection_GetMinFeatureLevel, |
| d3dcompiler_shader_reflection_GetThreadGroupSize, |
| }; |
| |
| HRESULT d3dcompiler_shader_reflection_init(struct d3dcompiler_shader_reflection *reflection, |
| const void *data, SIZE_T data_size) |
| { |
| struct dxbc src_dxbc; |
| HRESULT hr; |
| unsigned int i; |
| |
| reflection->vtbl = &d3dcompiler_shader_reflection_vtbl; |
| reflection->refcount = 1; |
| |
| hr = dxbc_parse(data, data_size, &src_dxbc); |
| if (FAILED(hr)) |
| { |
| WARN("Failed to parse reflection\n"); |
| return hr; |
| } |
| |
| for (i = 0; i < src_dxbc.count; ++i) |
| { |
| struct dxbc_section *section = &src_dxbc.sections[i]; |
| |
| switch (section->tag) |
| { |
| default: |
| FIXME("Unhandled section %s!\n", debugstr_an((const char *)§ion->tag, 4)); |
| break; |
| } |
| } |
| |
| dxbc_destroy(&src_dxbc); |
| |
| return hr; |
| } |