Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/d3dcompiler_43/reflection.c | 578 +++++++++++++++---------------- 1 file changed, 287 insertions(+), 291 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 729501dbddc..9a1e869f0a5 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -145,9 +145,9 @@ struct d3dcompiler_shader_reflection
static struct d3dcompiler_shader_reflection_type *get_reflection_type(struct d3dcompiler_shader_reflection *reflection, const char *data, DWORD offset);
-static const struct ID3D11ShaderReflectionConstantBufferVtbl d3dcompiler_shader_reflection_constant_buffer_vtbl; -static const struct ID3D11ShaderReflectionVariableVtbl d3dcompiler_shader_reflection_variable_vtbl; -static const struct ID3D11ShaderReflectionTypeVtbl d3dcompiler_shader_reflection_type_vtbl; +static const struct ID3D11ShaderReflectionConstantBufferVtbl d3d11_shader_reflection_constant_buffer_vtbl; +static const struct ID3D11ShaderReflectionVariableVtbl d3d11_shader_reflection_variable_vtbl; +static const struct ID3D11ShaderReflectionTypeVtbl d3d11_shader_reflection_type_vtbl;
static const struct ID3D10ShaderReflectionConstantBufferVtbl d3d10_shader_reflection_constant_buffer_vtbl; static const struct ID3D10ShaderReflectionVariableVtbl d3d10_shader_reflection_variable_vtbl; @@ -156,17 +156,17 @@ static const struct ID3D10ShaderReflectionTypeVtbl d3d10_shader_reflection_type_ /* null objects - needed for invalid calls */ static struct d3dcompiler_shader_reflection_constant_buffer null_constant_buffer = { - {&d3dcompiler_shader_reflection_constant_buffer_vtbl}, + {&d3d11_shader_reflection_constant_buffer_vtbl}, {&d3d10_shader_reflection_constant_buffer_vtbl} }; static struct d3dcompiler_shader_reflection_type null_type = { - {&d3dcompiler_shader_reflection_type_vtbl}, + {&d3d11_shader_reflection_type_vtbl}, {&d3d10_shader_reflection_type_vtbl} }; static struct d3dcompiler_shader_reflection_variable null_variable = { - {&d3dcompiler_shader_reflection_variable_vtbl}, + {&d3d11_shader_reflection_variable_vtbl}, {&d3d10_shader_reflection_variable_vtbl}, &null_constant_buffer, &null_type @@ -327,9 +327,9 @@ static inline struct d3dcompiler_shader_reflection *impl_from_ID3D11ShaderReflec return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection, ID3D11ShaderReflection_iface); }
-static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_QueryInterface(ID3D11ShaderReflection *iface, REFIID riid, void **object) +static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_QueryInterface(ID3D11ShaderReflection *iface, REFIID riid, void **object) { - TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object); + TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
if (IsEqualGUID(riid, &IID_ID3D11ShaderReflection) || IsEqualGUID(riid, &IID_IUnknown)) @@ -339,33 +339,33 @@ static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_QueryInterface(ID return S_OK; }
- WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid)); + 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) +static ULONG STDMETHODCALLTYPE d3d11_shader_reflection_AddRef(ID3D11ShaderReflection *iface) { - struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface); - ULONG refcount = InterlockedIncrement(&This->refcount); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface); + ULONG refcount = InterlockedIncrement(&reflection->refcount);
- TRACE("%p increasing refcount to %u\n", This, refcount); + TRACE("%p increasing refcount to %u.\n", reflection, refcount);
return refcount; }
-static ULONG STDMETHODCALLTYPE d3dcompiler_shader_reflection_Release(ID3D11ShaderReflection *iface) +static ULONG STDMETHODCALLTYPE d3d11_shader_reflection_Release(ID3D11ShaderReflection *iface) { - struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface); - ULONG refcount = InterlockedDecrement(&This->refcount); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface); + ULONG refcount = InterlockedDecrement(&reflection->refcount);
- TRACE("%p decreasing refcount to %u\n", This, refcount); + TRACE("%p decreasing refcount to %u.\n", reflection, refcount);
if (!refcount) { - reflection_cleanup(This); - HeapFree(GetProcessHeap(), 0, This); + reflection_cleanup(reflection); + HeapFree(GetProcessHeap(), 0, reflection); }
return refcount; @@ -373,53 +373,53 @@ static ULONG STDMETHODCALLTYPE d3dcompiler_shader_reflection_Release(ID3D11Shade
/* ID3D11ShaderReflection methods */
-static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetDesc(ID3D11ShaderReflection *iface, D3D11_SHADER_DESC *desc) +static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_GetDesc(ID3D11ShaderReflection *iface, D3D11_SHADER_DESC *desc) { - struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface);
- FIXME("iface %p, desc %p partial stub!\n", iface, desc); + FIXME("iface %p, desc %p partial stub.\n", iface, desc);
if (!desc) { - WARN("Invalid argument specified\n"); + WARN("Invalid argument specified.\n"); return E_FAIL; }
- desc->Version = This->version; - desc->Creator = This->creator; - desc->Flags = This->flags; - desc->ConstantBuffers = This->constant_buffer_count; - desc->BoundResources = This->bound_resource_count; - desc->InputParameters = This->isgn ? This->isgn->element_count : 0; - desc->OutputParameters = This->osgn ? This->osgn->element_count : 0; - desc->InstructionCount = This->instruction_count; - desc->TempRegisterCount = This->temp_register_count; - desc->TempArrayCount = This->temp_array_count; + desc->Version = reflection->version; + desc->Creator = reflection->creator; + desc->Flags = reflection->flags; + desc->ConstantBuffers = reflection->constant_buffer_count; + desc->BoundResources = reflection->bound_resource_count; + desc->InputParameters = reflection->isgn ? reflection->isgn->element_count : 0; + desc->OutputParameters = reflection->osgn ? reflection->osgn->element_count : 0; + desc->InstructionCount = reflection->instruction_count; + desc->TempRegisterCount = reflection->temp_register_count; + desc->TempArrayCount = reflection->temp_array_count; desc->DefCount = 0; - desc->DclCount = This->dcl_count; - desc->TextureNormalInstructions = This->texture_normal_instructions; - desc->TextureLoadInstructions = This->texture_load_instructions; - desc->TextureCompInstructions = This->texture_comp_instructions; - desc->TextureBiasInstructions = This->texture_bias_instructions; - desc->TextureGradientInstructions = This->texture_gradient_instructions; - desc->FloatInstructionCount = This->float_instruction_count; - desc->IntInstructionCount = This->int_instruction_count; - desc->UintInstructionCount = This->uint_instruction_count; - desc->StaticFlowControlCount = This->static_flow_control_count; - desc->DynamicFlowControlCount = This->dynamic_flow_control_count; + desc->DclCount = reflection->dcl_count; + desc->TextureNormalInstructions = reflection->texture_normal_instructions; + desc->TextureLoadInstructions = reflection->texture_load_instructions; + desc->TextureCompInstructions = reflection->texture_comp_instructions; + desc->TextureBiasInstructions = reflection->texture_bias_instructions; + desc->TextureGradientInstructions = reflection->texture_gradient_instructions; + desc->FloatInstructionCount = reflection->float_instruction_count; + desc->IntInstructionCount = reflection->int_instruction_count; + desc->UintInstructionCount = reflection->uint_instruction_count; + desc->StaticFlowControlCount = reflection->static_flow_control_count; + desc->DynamicFlowControlCount = reflection->dynamic_flow_control_count; desc->MacroInstructionCount = 0; - desc->ArrayInstructionCount = This->array_instruction_count; - desc->CutInstructionCount = This->cut_instruction_count; - desc->EmitInstructionCount = This->emit_instruction_count; - desc->GSOutputTopology = This->gs_output_topology; - desc->GSMaxOutputVertexCount = This->gs_max_output_vertex_count; - desc->InputPrimitive = This->input_primitive; - desc->PatchConstantParameters = This->pcsg ? This->pcsg->element_count : 0; + desc->ArrayInstructionCount = reflection->array_instruction_count; + desc->CutInstructionCount = reflection->cut_instruction_count; + desc->EmitInstructionCount = reflection->emit_instruction_count; + desc->GSOutputTopology = reflection->gs_output_topology; + desc->GSMaxOutputVertexCount = reflection->gs_max_output_vertex_count; + desc->InputPrimitive = reflection->input_primitive; + desc->PatchConstantParameters = reflection->pcsg ? reflection->pcsg->element_count : 0; desc->cGSInstanceCount = 0; - desc->cControlPoints = This->c_control_points; - desc->HSOutputPrimitive = This->hs_output_primitive; - desc->HSPartitioning = This->hs_prtitioning; - desc->TessellatorDomain = This->tessellator_domain; + desc->cControlPoints = reflection->c_control_points; + desc->HSOutputPrimitive = reflection->hs_output_primitive; + desc->HSPartitioning = reflection->hs_prtitioning; + desc->TessellatorDomain = reflection->tessellator_domain; desc->cBarrierInstructions = 0; desc->cInterlockedInstructions = 0; desc->cTextureStoreInstructions = 0; @@ -427,39 +427,39 @@ static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetDesc(ID3D11Sha return S_OK; }
-static struct ID3D11ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetConstantBufferByIndex( - ID3D11ShaderReflection *iface, UINT index) +static struct ID3D11ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d11_shader_reflection_GetConstantBufferByIndex + (ID3D11ShaderReflection *iface, UINT index) { - struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface);
- TRACE("iface %p, index %u\n", iface, index); + TRACE("iface %p, index %u.\n", iface, index);
- if (index >= This->constant_buffer_count) + if (index >= reflection->constant_buffer_count) { - WARN("Invalid argument specified\n"); + WARN("Invalid argument specified.\n"); return &null_constant_buffer.ID3D11ShaderReflectionConstantBuffer_iface; }
- return &This->constant_buffers[index].ID3D11ShaderReflectionConstantBuffer_iface; + return &reflection->constant_buffers[index].ID3D11ShaderReflectionConstantBuffer_iface; }
-static struct ID3D11ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetConstantBufferByName( - ID3D11ShaderReflection *iface, const char *name) +static struct ID3D11ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d11_shader_reflection_GetConstantBufferByName + (ID3D11ShaderReflection *iface, const char *name) { - struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface); unsigned int i;
- TRACE("iface %p, name %s\n", iface, debugstr_a(name)); + TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
if (!name) { - WARN("Invalid argument specified\n"); + WARN("Invalid argument specified.\n"); return &null_constant_buffer.ID3D11ShaderReflectionConstantBuffer_iface; }
- for (i = 0; i < This->constant_buffer_count; ++i) + for (i = 0; i < reflection->constant_buffer_count; ++i) { - struct d3dcompiler_shader_reflection_constant_buffer *d = &This->constant_buffers[i]; + struct d3dcompiler_shader_reflection_constant_buffer *d = &reflection->constant_buffers[i];
if (!strcmp(d->name, name)) { @@ -468,21 +468,21 @@ static struct ID3D11ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3dcompil } }
- WARN("Invalid name specified\n"); + WARN("Invalid name specified.\n");
return &null_constant_buffer.ID3D11ShaderReflectionConstantBuffer_iface; }
-static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetResourceBindingDesc( - ID3D11ShaderReflection *iface, UINT index, D3D11_SHADER_INPUT_BIND_DESC *desc) +static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_GetResourceBindingDesc(ID3D11ShaderReflection *iface, + UINT index, D3D11_SHADER_INPUT_BIND_DESC *desc) { struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface);
- TRACE("iface %p, index %u, desc %p\n", iface, index, desc); + TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
if (!desc || index >= reflection->bound_resource_count) { - WARN("Invalid argument specified\n"); + WARN("Invalid argument specified.\n"); return E_INVALIDARG; }
@@ -491,16 +491,16 @@ static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetResourceBindin return S_OK; }
-static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetInputParameterDesc( - ID3D11ShaderReflection *iface, UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) +static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_GetInputParameterDesc(ID3D11ShaderReflection *iface, + UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) { struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface);
- TRACE("iface %p, index %u, desc %p\n", iface, index, desc); + TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
if (!desc || !reflection->isgn || index >= reflection->isgn->element_count) { - WARN("Invalid argument specified\n"); + WARN("Invalid argument specified.\n"); return E_INVALIDARG; }
@@ -509,16 +509,16 @@ static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetInputParameter return S_OK; }
-static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetOutputParameterDesc( - ID3D11ShaderReflection *iface, UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) +static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_GetOutputParameterDesc(ID3D11ShaderReflection *iface, + UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) { struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface);
- TRACE("iface %p, index %u, desc %p\n", iface, index, desc); + TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
if (!desc || !reflection->osgn || index >= reflection->osgn->element_count) { - WARN("Invalid argument specified\n"); + WARN("Invalid argument specified.\n"); return E_INVALIDARG; }
@@ -527,16 +527,16 @@ static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetOutputParamete return S_OK; }
-static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetPatchConstantParameterDesc( - ID3D11ShaderReflection *iface, UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) +static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_GetPatchConstantParameterDesc(ID3D11ShaderReflection *iface, + UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) { struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface);
- TRACE("iface %p, index %u, desc %p\n", iface, index, desc); + TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
if (!desc || !reflection->pcsg || index >= reflection->pcsg->element_count) { - WARN("Invalid argument specified\n"); + WARN("Invalid argument specified.\n"); return E_INVALIDARG; }
@@ -545,23 +545,23 @@ static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetPatchConstantP return S_OK; }
-static struct ID3D11ShaderReflectionVariable * STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetVariableByName( - ID3D11ShaderReflection *iface, const char *name) +static struct ID3D11ShaderReflectionVariable * STDMETHODCALLTYPE d3d11_shader_reflection_GetVariableByName + (ID3D11ShaderReflection *iface, const char *name) { - struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface); unsigned int i, k;
- TRACE("iface %p, name %s\n", iface, debugstr_a(name)); + TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
if (!name) { - WARN("Invalid name specified\n"); + WARN("Invalid name specified.\n"); return &null_variable.ID3D11ShaderReflectionVariable_iface; }
- for (i = 0; i < This->constant_buffer_count; ++i) + for (i = 0; i < reflection->constant_buffer_count; ++i) { - struct d3dcompiler_shader_reflection_constant_buffer *cb = &This->constant_buffers[i]; + struct d3dcompiler_shader_reflection_constant_buffer *cb = &reflection->constant_buffers[i];
for (k = 0; k < cb->variable_count; ++k) { @@ -575,28 +575,28 @@ static struct ID3D11ShaderReflectionVariable * STDMETHODCALLTYPE d3dcompiler_sha } }
- WARN("Invalid name specified\n"); + WARN("Invalid name specified.\n");
return &null_variable.ID3D11ShaderReflectionVariable_iface; }
-static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetResourceBindingDescByName( - ID3D11ShaderReflection *iface, const char *name, D3D11_SHADER_INPUT_BIND_DESC *desc) +static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_GetResourceBindingDescByName(ID3D11ShaderReflection *iface, + const char *name, D3D11_SHADER_INPUT_BIND_DESC *desc) { - struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface); unsigned int i;
- TRACE("iface %p, name %s, desc %p\n", iface, debugstr_a(name), desc); + TRACE("iface %p, name %s, desc %p.\n", iface, debugstr_a(name), desc);
if (!desc || !name) { - WARN("Invalid argument specified\n"); + WARN("Invalid argument specified.\n"); return E_INVALIDARG; }
- for (i = 0; i < This->bound_resource_count; ++i) + for (i = 0; i < reflection->bound_resource_count; ++i) { - D3D12_SHADER_INPUT_BIND_DESC *d = &This->bound_resources[i]; + D3D12_SHADER_INPUT_BIND_DESC *d = &reflection->bound_resources[i];
if (!strcmp(d->Name, name)) { @@ -606,191 +606,185 @@ static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetResourceBindin } }
- WARN("Invalid name specified\n"); + WARN("Invalid name specified.\n");
return E_INVALIDARG; }
-static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetMovInstructionCount( - ID3D11ShaderReflection *iface) +static UINT STDMETHODCALLTYPE d3d11_shader_reflection_GetMovInstructionCount(ID3D11ShaderReflection *iface) { - struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface);
- TRACE("iface %p\n", iface); + TRACE("iface %p.\n", iface);
- return This->mov_instruction_count; + return reflection->mov_instruction_count; }
-static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetMovcInstructionCount( - ID3D11ShaderReflection *iface) +static UINT STDMETHODCALLTYPE d3d11_shader_reflection_GetMovcInstructionCount(ID3D11ShaderReflection *iface) { - FIXME("iface %p stub!\n", iface); + FIXME("iface %p stub.\n", iface);
return 0; }
-static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetConversionInstructionCount( - ID3D11ShaderReflection *iface) +static UINT STDMETHODCALLTYPE d3d11_shader_reflection_GetConversionInstructionCount(ID3D11ShaderReflection *iface) { - struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface);
- TRACE("iface %p\n", iface); + TRACE("iface %p.\n", iface);
- return This->conversion_instruction_count; + return reflection->conversion_instruction_count; }
-static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetBitwiseInstructionCount( - ID3D11ShaderReflection *iface) +static UINT STDMETHODCALLTYPE d3d11_shader_reflection_GetBitwiseInstructionCount(ID3D11ShaderReflection *iface) { - FIXME("iface %p stub!\n", iface); + FIXME("iface %p stub.\n", iface);
return 0; }
-static D3D_PRIMITIVE STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetGSInputPrimitive( - ID3D11ShaderReflection *iface) +static D3D_PRIMITIVE STDMETHODCALLTYPE d3d11_shader_reflection_GetGSInputPrimitive(ID3D11ShaderReflection *iface) { - FIXME("iface %p stub!\n", iface); + FIXME("iface %p stub.\n", iface);
return 0; }
-static BOOL STDMETHODCALLTYPE d3dcompiler_shader_reflection_IsSampleFrequencyShader( - ID3D11ShaderReflection *iface) +static BOOL STDMETHODCALLTYPE d3d11_shader_reflection_IsSampleFrequencyShader(ID3D11ShaderReflection *iface) { - FIXME("iface %p stub!\n", iface); + FIXME("iface %p stub.\n", iface);
return FALSE; }
-static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetNumInterfaceSlots( - ID3D11ShaderReflection *iface) +static UINT STDMETHODCALLTYPE d3d11_shader_reflection_GetNumInterfaceSlots(ID3D11ShaderReflection *iface) { - FIXME("iface %p stub!\n", iface); + FIXME("iface %p stub.\n", iface);
return 0; }
-static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetMinFeatureLevel( - ID3D11ShaderReflection *iface, D3D_FEATURE_LEVEL *level) +static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_GetMinFeatureLevel(ID3D11ShaderReflection *iface, + D3D_FEATURE_LEVEL *level) { - FIXME("iface %p, level %p stub!\n", iface, 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) +static UINT STDMETHODCALLTYPE d3d11_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); + FIXME("iface %p, sizex %p, sizey %p, sizez %p stub.\n", iface, sizex, sizey, sizez);
return 0; }
-static UINT64 STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetRequiresFlags( - ID3D11ShaderReflection *iface) +static UINT64 STDMETHODCALLTYPE d3d11_shader_reflection_GetRequiresFlags(ID3D11ShaderReflection *iface) { - FIXME("iface %p stub!\n", iface); + FIXME("iface %p stub.\n", iface);
return 0; }
-static const struct ID3D11ShaderReflectionVtbl d3dcompiler_shader_reflection_vtbl = +static const struct ID3D11ShaderReflectionVtbl d3d11_shader_reflection_vtbl = { /* IUnknown methods */ - d3dcompiler_shader_reflection_QueryInterface, - d3dcompiler_shader_reflection_AddRef, - d3dcompiler_shader_reflection_Release, + d3d11_shader_reflection_QueryInterface, + d3d11_shader_reflection_AddRef, + d3d11_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, - d3dcompiler_shader_reflection_GetRequiresFlags, + d3d11_shader_reflection_GetDesc, + d3d11_shader_reflection_GetConstantBufferByIndex, + d3d11_shader_reflection_GetConstantBufferByName, + d3d11_shader_reflection_GetResourceBindingDesc, + d3d11_shader_reflection_GetInputParameterDesc, + d3d11_shader_reflection_GetOutputParameterDesc, + d3d11_shader_reflection_GetPatchConstantParameterDesc, + d3d11_shader_reflection_GetVariableByName, + d3d11_shader_reflection_GetResourceBindingDescByName, + d3d11_shader_reflection_GetMovInstructionCount, + d3d11_shader_reflection_GetMovcInstructionCount, + d3d11_shader_reflection_GetConversionInstructionCount, + d3d11_shader_reflection_GetBitwiseInstructionCount, + d3d11_shader_reflection_GetGSInputPrimitive, + d3d11_shader_reflection_IsSampleFrequencyShader, + d3d11_shader_reflection_GetNumInterfaceSlots, + d3d11_shader_reflection_GetMinFeatureLevel, + d3d11_shader_reflection_GetThreadGroupSize, + d3d11_shader_reflection_GetRequiresFlags, };
/* ID3D11ShaderReflectionConstantBuffer methods */
-static inline struct d3dcompiler_shader_reflection_constant_buffer *impl_from_ID3D11ShaderReflectionConstantBuffer(ID3D11ShaderReflectionConstantBuffer *iface) +static inline struct d3dcompiler_shader_reflection_constant_buffer *impl_from_ID3D11ShaderReflectionConstantBuffer + (ID3D11ShaderReflectionConstantBuffer *iface) { - return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection_constant_buffer, ID3D11ShaderReflectionConstantBuffer_iface); + return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection_constant_buffer, + ID3D11ShaderReflectionConstantBuffer_iface); }
-static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_constant_buffer_GetDesc( - ID3D11ShaderReflectionConstantBuffer *iface, D3D11_SHADER_BUFFER_DESC *desc) +static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_constant_buffer_GetDesc + (ID3D11ShaderReflectionConstantBuffer *iface, D3D11_SHADER_BUFFER_DESC *desc) { - struct d3dcompiler_shader_reflection_constant_buffer *This = impl_from_ID3D11ShaderReflectionConstantBuffer(iface); + struct d3dcompiler_shader_reflection_constant_buffer *cb = impl_from_ID3D11ShaderReflectionConstantBuffer(iface);
- TRACE("iface %p, desc %p\n", iface, desc); + TRACE("iface %p, desc %p.\n", iface, desc);
- if (This == &null_constant_buffer) + if (cb == &null_constant_buffer) { - WARN("Null constant buffer specified\n"); + WARN("Null constant buffer specified.\n"); return E_FAIL; }
if (!desc) { - WARN("Invalid argument specified\n"); + WARN("Invalid argument specified.\n"); return E_FAIL; }
- desc->Name = This->name; - desc->Type = This->type; - desc->Variables = This->variable_count; - desc->Size = This->size; - desc->uFlags = This->flags; + desc->Name = cb->name; + desc->Type = cb->type; + desc->Variables = cb->variable_count; + desc->Size = cb->size; + desc->uFlags = cb->flags;
return S_OK; }
-static ID3D11ShaderReflectionVariable * STDMETHODCALLTYPE d3dcompiler_shader_reflection_constant_buffer_GetVariableByIndex( - ID3D11ShaderReflectionConstantBuffer *iface, UINT index) +static ID3D11ShaderReflectionVariable * STDMETHODCALLTYPE d3d11_shader_reflection_constant_buffer_GetVariableByIndex + (ID3D11ShaderReflectionConstantBuffer *iface, UINT index) { - struct d3dcompiler_shader_reflection_constant_buffer *This = impl_from_ID3D11ShaderReflectionConstantBuffer(iface); + struct d3dcompiler_shader_reflection_constant_buffer *cb = impl_from_ID3D11ShaderReflectionConstantBuffer(iface);
- TRACE("iface %p, index %u\n", iface, index); + TRACE("iface %p, index %u.\n", iface, index);
- if (index >= This->variable_count) + if (index >= cb->variable_count) { - WARN("Invalid index specified\n"); + WARN("Invalid index specified.\n"); return &null_variable.ID3D11ShaderReflectionVariable_iface; }
- return &This->variables[index].ID3D11ShaderReflectionVariable_iface; + return &cb->variables[index].ID3D11ShaderReflectionVariable_iface; }
-static ID3D11ShaderReflectionVariable * STDMETHODCALLTYPE d3dcompiler_shader_reflection_constant_buffer_GetVariableByName( - ID3D11ShaderReflectionConstantBuffer *iface, const char *name) +static ID3D11ShaderReflectionVariable * STDMETHODCALLTYPE d3d11_shader_reflection_constant_buffer_GetVariableByName + (ID3D11ShaderReflectionConstantBuffer *iface, const char *name) { - struct d3dcompiler_shader_reflection_constant_buffer *This = impl_from_ID3D11ShaderReflectionConstantBuffer(iface); + struct d3dcompiler_shader_reflection_constant_buffer *cb = impl_from_ID3D11ShaderReflectionConstantBuffer(iface); unsigned int i;
- TRACE("iface %p, name %s\n", iface, debugstr_a(name)); + TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
if (!name) { - WARN("Invalid argument specified\n"); + WARN("Invalid argument specified.\n"); return &null_variable.ID3D11ShaderReflectionVariable_iface; }
- for (i = 0; i < This->variable_count; ++i) + for (i = 0; i < cb->variable_count; ++i) { - struct d3dcompiler_shader_reflection_variable *v = &This->variables[i]; + struct d3dcompiler_shader_reflection_variable *v = &cb->variables[i];
if (!strcmp(v->name, name)) { @@ -799,155 +793,158 @@ static ID3D11ShaderReflectionVariable * STDMETHODCALLTYPE d3dcompiler_shader_ref } }
- WARN("Invalid name specified\n"); + WARN("Invalid name specified.\n");
return &null_variable.ID3D11ShaderReflectionVariable_iface; }
-static const struct ID3D11ShaderReflectionConstantBufferVtbl d3dcompiler_shader_reflection_constant_buffer_vtbl = +static const struct ID3D11ShaderReflectionConstantBufferVtbl d3d11_shader_reflection_constant_buffer_vtbl = { /* ID3D11ShaderReflectionConstantBuffer methods */ - d3dcompiler_shader_reflection_constant_buffer_GetDesc, - d3dcompiler_shader_reflection_constant_buffer_GetVariableByIndex, - d3dcompiler_shader_reflection_constant_buffer_GetVariableByName, + d3d11_shader_reflection_constant_buffer_GetDesc, + d3d11_shader_reflection_constant_buffer_GetVariableByIndex, + d3d11_shader_reflection_constant_buffer_GetVariableByName, };
/* ID3D11ShaderReflectionVariable methods */
-static inline struct d3dcompiler_shader_reflection_variable *impl_from_ID3D11ShaderReflectionVariable(ID3D11ShaderReflectionVariable *iface) +static inline struct d3dcompiler_shader_reflection_variable *impl_from_ID3D11ShaderReflectionVariable + (ID3D11ShaderReflectionVariable *iface) { - return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection_variable, ID3D11ShaderReflectionVariable_iface); + return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection_variable, + ID3D11ShaderReflectionVariable_iface); }
-static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_variable_GetDesc( - ID3D11ShaderReflectionVariable *iface, D3D11_SHADER_VARIABLE_DESC *desc) +static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_variable_GetDesc + (ID3D11ShaderReflectionVariable *iface, D3D11_SHADER_VARIABLE_DESC *desc) { - struct d3dcompiler_shader_reflection_variable *This = impl_from_ID3D11ShaderReflectionVariable(iface); + struct d3dcompiler_shader_reflection_variable *cb = impl_from_ID3D11ShaderReflectionVariable(iface);
- TRACE("iface %p, desc %p\n", iface, desc); + TRACE("iface %p, desc %p.\n", iface, desc);
- if (This == &null_variable) + if (cb == &null_variable) { - WARN("Null variable specified\n"); + WARN("Null variable specified.\n"); return E_FAIL; }
if (!desc) { - WARN("Invalid argument specified\n"); + WARN("Invalid argument specified.\n"); return E_FAIL; }
- desc->Name = This->name; - desc->StartOffset = This->start_offset; - desc->Size = This->size; - desc->uFlags = This->flags; - desc->DefaultValue = This->default_value; + desc->Name = cb->name; + desc->StartOffset = cb->start_offset; + desc->Size = cb->size; + desc->uFlags = cb->flags; + desc->DefaultValue = cb->default_value;
return S_OK; }
-static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3dcompiler_shader_reflection_variable_GetType( - ID3D11ShaderReflectionVariable *iface) +static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3d11_shader_reflection_variable_GetType + (ID3D11ShaderReflectionVariable *iface) { - struct d3dcompiler_shader_reflection_variable *This = impl_from_ID3D11ShaderReflectionVariable(iface); + struct d3dcompiler_shader_reflection_variable *cb = impl_from_ID3D11ShaderReflectionVariable(iface);
- TRACE("iface %p\n", iface); + TRACE("iface %p.\n", iface);
- return &This->type->ID3D11ShaderReflectionType_iface; + return &cb->type->ID3D11ShaderReflectionType_iface; }
-static ID3D11ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3dcompiler_shader_reflection_variable_GetBuffer( - ID3D11ShaderReflectionVariable *iface) +static ID3D11ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d11_shader_reflection_variable_GetBuffer + (ID3D11ShaderReflectionVariable *iface) { - struct d3dcompiler_shader_reflection_variable *This = impl_from_ID3D11ShaderReflectionVariable(iface); + struct d3dcompiler_shader_reflection_variable *cb = impl_from_ID3D11ShaderReflectionVariable(iface);
- TRACE("iface %p\n", iface); + TRACE("iface %p.\n", iface);
- return &This->constant_buffer->ID3D11ShaderReflectionConstantBuffer_iface; + return &cb->constant_buffer->ID3D11ShaderReflectionConstantBuffer_iface; }
-static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_variable_GetInterfaceSlot( - ID3D11ShaderReflectionVariable *iface, UINT index) +static UINT STDMETHODCALLTYPE d3d11_shader_reflection_variable_GetInterfaceSlot + (ID3D11ShaderReflectionVariable *iface, UINT index) { - FIXME("iface %p, index %u stub!\n", iface, index); + FIXME("iface %p, index %u stub.\n", iface, index);
return 0; }
-static const struct ID3D11ShaderReflectionVariableVtbl d3dcompiler_shader_reflection_variable_vtbl = +static const struct ID3D11ShaderReflectionVariableVtbl d3d11_shader_reflection_variable_vtbl = { /* ID3D11ShaderReflectionVariable methods */ - d3dcompiler_shader_reflection_variable_GetDesc, - d3dcompiler_shader_reflection_variable_GetType, - d3dcompiler_shader_reflection_variable_GetBuffer, - d3dcompiler_shader_reflection_variable_GetInterfaceSlot, + d3d11_shader_reflection_variable_GetDesc, + d3d11_shader_reflection_variable_GetType, + d3d11_shader_reflection_variable_GetBuffer, + d3d11_shader_reflection_variable_GetInterfaceSlot, };
/* ID3D11ShaderReflectionType methods */
-static inline struct d3dcompiler_shader_reflection_type *impl_from_ID3D11ShaderReflectionType(ID3D11ShaderReflectionType *iface) +static inline struct d3dcompiler_shader_reflection_type *impl_from_ID3D11ShaderReflectionType + (ID3D11ShaderReflectionType *iface) { return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection_type, ID3D11ShaderReflectionType_iface); }
-static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetDesc( - ID3D11ShaderReflectionType *iface, D3D11_SHADER_TYPE_DESC *desc) +static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_type_GetDesc + (ID3D11ShaderReflectionType *iface, D3D11_SHADER_TYPE_DESC *desc) { - struct d3dcompiler_shader_reflection_type *This = impl_from_ID3D11ShaderReflectionType(iface); + struct d3dcompiler_shader_reflection_type *type = impl_from_ID3D11ShaderReflectionType(iface);
- TRACE("iface %p, desc %p\n", iface, desc); + TRACE("iface %p, desc %p.\n", iface, desc);
- if (This == &null_type) + if (type == &null_type) { - WARN("Null type specified\n"); + WARN("Null type specified.\n"); return E_FAIL; }
if (!desc) { - WARN("Invalid argument specified\n"); + WARN("Invalid argument specified.\n"); return E_FAIL; }
- *desc = This->desc; + *desc = type->desc;
return S_OK; }
-static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetMemberTypeByIndex( - ID3D11ShaderReflectionType *iface, UINT index) +static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3d11_shader_reflection_type_GetMemberTypeByIndex + (ID3D11ShaderReflectionType *iface, UINT index) { - struct d3dcompiler_shader_reflection_type *This = impl_from_ID3D11ShaderReflectionType(iface); + struct d3dcompiler_shader_reflection_type *type = impl_from_ID3D11ShaderReflectionType(iface);
- TRACE("iface %p, index %u\n", iface, index); + TRACE("iface %p, index %u.\n", iface, index);
- if (index >= This->desc.Members) + if (index >= type->desc.Members) { - WARN("Invalid index specified\n"); + WARN("Invalid index specified.\n"); return &null_type.ID3D11ShaderReflectionType_iface; }
- return &This->members[index].type->ID3D11ShaderReflectionType_iface; + return &type->members[index].type->ID3D11ShaderReflectionType_iface; }
-static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetMemberTypeByName( - ID3D11ShaderReflectionType *iface, const char *name) +static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3d11_shader_reflection_type_GetMemberTypeByName + (ID3D11ShaderReflectionType *iface, const char *name) { - struct d3dcompiler_shader_reflection_type *This = impl_from_ID3D11ShaderReflectionType(iface); + struct d3dcompiler_shader_reflection_type *type = impl_from_ID3D11ShaderReflectionType(iface); unsigned int i;
- TRACE("iface %p, name %s\n", iface, debugstr_a(name)); + TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
if (!name) { - WARN("Invalid argument specified\n"); + WARN("Invalid argument specified.\n"); return &null_type.ID3D11ShaderReflectionType_iface; }
- for (i = 0; i < This->desc.Members; ++i) + for (i = 0; i < type->desc.Members; ++i) { - struct d3dcompiler_shader_reflection_type_member *member = &This->members[i]; + struct d3dcompiler_shader_reflection_type_member *member = &type->members[i];
if (!strcmp(member->name, name)) { @@ -956,43 +953,43 @@ static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3dcompiler_shader_reflect } }
- WARN("Invalid name specified\n"); + WARN("Invalid name specified.\n");
return &null_type.ID3D11ShaderReflectionType_iface; }
-static const char * STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetMemberTypeName( - ID3D11ShaderReflectionType *iface, UINT index) +static const char * STDMETHODCALLTYPE d3d11_shader_reflection_type_GetMemberTypeName + (ID3D11ShaderReflectionType *iface, UINT index) { - struct d3dcompiler_shader_reflection_type *This = impl_from_ID3D11ShaderReflectionType(iface); + struct d3dcompiler_shader_reflection_type *type = impl_from_ID3D11ShaderReflectionType(iface);
- TRACE("iface %p, index %u\n", iface, index); + TRACE("iface %p, index %u.\n", iface, index);
- if (This == &null_type) + if (type == &null_type) { - WARN("Null type specified\n"); + WARN("Null type specified.\n"); return "$Invalid"; }
- if (index >= This->desc.Members) + if (index >= type->desc.Members) { - WARN("Invalid index specified\n"); + WARN("Invalid index specified.\n"); return NULL; }
- return This->members[index].name; + return type->members[index].name; }
-static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_IsEqual( - ID3D11ShaderReflectionType *iface, ID3D11ShaderReflectionType *type) +static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_type_IsEqual + (ID3D11ShaderReflectionType *iface, ID3D11ShaderReflectionType *type) { - struct d3dcompiler_shader_reflection_type *This = impl_from_ID3D11ShaderReflectionType(iface); + struct d3dcompiler_shader_reflection_type *reflection_type = impl_from_ID3D11ShaderReflectionType(iface);
- TRACE("iface %p, type %p\n", iface, type); + TRACE("iface %p, type %p.\n", iface, type);
- if (This == &null_type) + if (reflection_type == &null_type) { - WARN("Null type specified\n"); + WARN("Null type specified.\n"); return E_FAIL; }
@@ -1002,68 +999,67 @@ static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_IsEqual( return S_FALSE; }
-static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetSubType( - ID3D11ShaderReflectionType *iface) +static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3d11_shader_reflection_type_GetSubType + (ID3D11ShaderReflectionType *iface) { FIXME("iface %p stub!\n", iface);
return NULL; }
-static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetBaseClass( - ID3D11ShaderReflectionType *iface) +static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3d11_shader_reflection_type_GetBaseClass + (ID3D11ShaderReflectionType *iface) { FIXME("iface %p stub!\n", iface);
return NULL; }
-static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetNumInterfaces( - ID3D11ShaderReflectionType *iface) +static UINT STDMETHODCALLTYPE d3d11_shader_reflection_type_GetNumInterfaces(ID3D11ShaderReflectionType *iface) { FIXME("iface %p stub!\n", iface);
return 0; }
-static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetInterfaceByIndex( - ID3D11ShaderReflectionType *iface, UINT index) +static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3d11_shader_reflection_type_GetInterfaceByIndex + (ID3D11ShaderReflectionType *iface, UINT index) { FIXME("iface %p, index %u stub!\n", iface, index);
return NULL; }
-static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_IsOfType( - ID3D11ShaderReflectionType *iface, ID3D11ShaderReflectionType *type) +static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_type_IsOfType + (ID3D11ShaderReflectionType *iface, ID3D11ShaderReflectionType *type) { FIXME("iface %p, type %p stub!\n", iface, type);
return E_NOTIMPL; }
-static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_ImplementsInterface( - ID3D11ShaderReflectionType *iface, ID3D11ShaderReflectionType *base) +static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_type_ImplementsInterface + (ID3D11ShaderReflectionType *iface, ID3D11ShaderReflectionType *base) { FIXME("iface %p, base %p stub!\n", iface, base);
return E_NOTIMPL; }
-static const struct ID3D11ShaderReflectionTypeVtbl d3dcompiler_shader_reflection_type_vtbl = +static const struct ID3D11ShaderReflectionTypeVtbl d3d11_shader_reflection_type_vtbl = { /* ID3D11ShaderReflectionType methods */ - d3dcompiler_shader_reflection_type_GetDesc, - d3dcompiler_shader_reflection_type_GetMemberTypeByIndex, - d3dcompiler_shader_reflection_type_GetMemberTypeByName, - d3dcompiler_shader_reflection_type_GetMemberTypeName, - d3dcompiler_shader_reflection_type_IsEqual, - d3dcompiler_shader_reflection_type_GetSubType, - d3dcompiler_shader_reflection_type_GetBaseClass, - d3dcompiler_shader_reflection_type_GetNumInterfaces, - d3dcompiler_shader_reflection_type_GetInterfaceByIndex, - d3dcompiler_shader_reflection_type_IsOfType, - d3dcompiler_shader_reflection_type_ImplementsInterface, + d3d11_shader_reflection_type_GetDesc, + d3d11_shader_reflection_type_GetMemberTypeByIndex, + d3d11_shader_reflection_type_GetMemberTypeByName, + d3d11_shader_reflection_type_GetMemberTypeName, + d3d11_shader_reflection_type_IsEqual, + d3d11_shader_reflection_type_GetSubType, + d3d11_shader_reflection_type_GetBaseClass, + d3d11_shader_reflection_type_GetNumInterfaces, + d3d11_shader_reflection_type_GetInterfaceByIndex, + d3d11_shader_reflection_type_IsOfType, + d3d11_shader_reflection_type_ImplementsInterface, };
static HRESULT d3dcompiler_parse_stat(struct d3dcompiler_shader_reflection *r, const char *data, DWORD data_size) @@ -1310,7 +1306,7 @@ static struct d3dcompiler_shader_reflection_type *get_reflection_type(struct d3d if (!type) return NULL;
- type->ID3D11ShaderReflectionType_iface.lpVtbl = &d3dcompiler_shader_reflection_type_vtbl; + type->ID3D11ShaderReflectionType_iface.lpVtbl = &d3d11_shader_reflection_type_vtbl; type->ID3D10ShaderReflectionType_iface.lpVtbl = &d3d10_shader_reflection_type_vtbl; type->id = offset; type->reflection = reflection; @@ -1352,7 +1348,7 @@ static HRESULT d3dcompiler_parse_variables(struct d3dcompiler_shader_reflection_ struct d3dcompiler_shader_reflection_variable *v = &variables[i]; DWORD offset;
- v->ID3D11ShaderReflectionVariable_iface.lpVtbl = &d3dcompiler_shader_reflection_variable_vtbl; + v->ID3D11ShaderReflectionVariable_iface.lpVtbl = &d3d11_shader_reflection_variable_vtbl; v->ID3D10ShaderReflectionVariable_iface.lpVtbl = &d3d10_shader_reflection_variable_vtbl; v->constant_buffer = cb;
@@ -1551,7 +1547,7 @@ static HRESULT d3dcompiler_parse_rdef(struct d3dcompiler_shader_reflection *r, c { struct d3dcompiler_shader_reflection_constant_buffer *cb = &constant_buffers[i];
- cb->ID3D11ShaderReflectionConstantBuffer_iface.lpVtbl = &d3dcompiler_shader_reflection_constant_buffer_vtbl; + cb->ID3D11ShaderReflectionConstantBuffer_iface.lpVtbl = &d3d11_shader_reflection_constant_buffer_vtbl; cb->ID3D10ShaderReflectionConstantBuffer_iface.lpVtbl = &d3d10_shader_reflection_constant_buffer_vtbl; cb->reflection = r;
@@ -2375,7 +2371,7 @@ HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void if (!object) return E_OUTOFMEMORY;
- object->ID3D11ShaderReflection_iface.lpVtbl = &d3dcompiler_shader_reflection_vtbl; + object->ID3D11ShaderReflection_iface.lpVtbl = &d3d11_shader_reflection_vtbl; object->refcount = 1;
hr = d3dcompiler_shader_reflection_init(object, data, data_size);
Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/d3dcompiler_43/reflection.c | 280 +++++++++++++++++++++++-- dlls/d3dcompiler_43/tests/reflection.c | 59 +++++- 2 files changed, 315 insertions(+), 24 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 9a1e869f0a5..420af0aff9a 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -96,6 +96,7 @@ struct d3dcompiler_shader_reflection_constant_buffer /* ID3D11ShaderReflection */ struct d3dcompiler_shader_reflection { + ID3D12ShaderReflection ID3D12ShaderReflection_iface; ID3D11ShaderReflection ID3D11ShaderReflection_iface; ID3D10ShaderReflection ID3D10ShaderReflection_iface; LONG refcount; @@ -320,34 +321,18 @@ static void reflection_cleanup(struct d3dcompiler_shader_reflection *ref) HeapFree(GetProcessHeap(), 0, ref->creator); }
-/* IUnknown methods */ - static inline struct d3dcompiler_shader_reflection *impl_from_ID3D11ShaderReflection(ID3D11ShaderReflection *iface) { return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection, ID3D11ShaderReflection_iface); }
-static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_QueryInterface(ID3D11ShaderReflection *iface, REFIID riid, void **object) +static inline struct d3dcompiler_shader_reflection *impl_from_ID3D12ShaderReflection(ID3D12ShaderReflection *iface) { - 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; + return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection, ID3D12ShaderReflection_iface); }
-static ULONG STDMETHODCALLTYPE d3d11_shader_reflection_AddRef(ID3D11ShaderReflection *iface) +static ULONG d3dcompiler_shader_reflection_AddRef(struct d3dcompiler_shader_reflection *reflection) { - struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface); ULONG refcount = InterlockedIncrement(&reflection->refcount);
TRACE("%p increasing refcount to %u.\n", reflection, refcount); @@ -355,9 +340,8 @@ static ULONG STDMETHODCALLTYPE d3d11_shader_reflection_AddRef(ID3D11ShaderReflec return refcount; }
-static ULONG STDMETHODCALLTYPE d3d11_shader_reflection_Release(ID3D11ShaderReflection *iface) +static ULONG d3dcompiler_shader_reflection_Release(struct d3dcompiler_shader_reflection *reflection) { - struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface); ULONG refcount = InterlockedDecrement(&reflection->refcount);
TRACE("%p decreasing refcount to %u.\n", reflection, refcount); @@ -371,6 +355,59 @@ static ULONG STDMETHODCALLTYPE d3d11_shader_reflection_Release(ID3D11ShaderRefle return refcount; }
+static HRESULT d3dcompiler_shader_reflection_QueryInterface(struct d3dcompiler_shader_reflection *reflection, + REFIID riid, void **object, IUnknown *iface) +{ + if (IsEqualGUID(riid, &IID_ID3D11ShaderReflection)) + { + d3dcompiler_shader_reflection_AddRef(reflection); + *object = &reflection->ID3D11ShaderReflection_iface; + return S_OK; + } + +#if D3D_COMPILER_VERSION >= 47 + if (IsEqualGUID(riid, &IID_ID3D12ShaderReflection)) + { + d3dcompiler_shader_reflection_AddRef(reflection); + *object = &reflection->ID3D12ShaderReflection_iface; + return S_OK; + } +#endif + + if (IsEqualGUID(riid, &IID_IUnknown)) + { + d3dcompiler_shader_reflection_AddRef(reflection); + *object = iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); + + *object = NULL; + return E_NOINTERFACE; +} + +/* IUnknown methods */ + +static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_QueryInterface(ID3D11ShaderReflection *iface, + REFIID riid, void **object) +{ + TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); + + return d3dcompiler_shader_reflection_QueryInterface(impl_from_ID3D11ShaderReflection(iface), + riid, object, (IUnknown *)iface); +} + +static ULONG STDMETHODCALLTYPE d3d11_shader_reflection_AddRef(ID3D11ShaderReflection *iface) +{ + return d3dcompiler_shader_reflection_AddRef(impl_from_ID3D11ShaderReflection(iface)); +} + +static ULONG STDMETHODCALLTYPE d3d11_shader_reflection_Release(ID3D11ShaderReflection *iface) +{ + return d3dcompiler_shader_reflection_Release(impl_from_ID3D11ShaderReflection(iface)); +} + /* ID3D11ShaderReflection methods */
static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_GetDesc(ID3D11ShaderReflection *iface, D3D11_SHADER_DESC *desc) @@ -2333,6 +2370,200 @@ HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10Shad } #endif
+static HRESULT STDMETHODCALLTYPE d3d12_shader_reflection_QueryInterface(ID3D12ShaderReflection *iface, + REFIID riid, void **object) +{ + TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); + + return d3dcompiler_shader_reflection_QueryInterface(impl_from_ID3D12ShaderReflection(iface), + riid, object, (IUnknown *)iface); +} + +static ULONG STDMETHODCALLTYPE d3d12_shader_reflection_AddRef(ID3D12ShaderReflection *iface) +{ + return d3dcompiler_shader_reflection_AddRef(impl_from_ID3D12ShaderReflection(iface)); +} + +static ULONG STDMETHODCALLTYPE d3d12_shader_reflection_Release(ID3D12ShaderReflection *iface) +{ + return d3dcompiler_shader_reflection_Release(impl_from_ID3D12ShaderReflection(iface)); +} + +static HRESULT STDMETHODCALLTYPE d3d12_shader_reflection_GetDesc(ID3D12ShaderReflection *iface, D3D12_SHADER_DESC *desc) +{ + FIXME("iface %p, desc %p stub.\n", iface, desc); + + return E_NOTIMPL; +} + +static struct ID3D12ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d12_shader_reflection_GetConstantBufferByIndex + (ID3D12ShaderReflection *iface, UINT index) +{ + FIXME("iface %p, index %u stub.\n", iface, index); + + return NULL; +} + +static struct ID3D12ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d12_shader_reflection_GetConstantBufferByName + (ID3D12ShaderReflection *iface, const char *name) +{ + FIXME("iface %p, name %s stub.\n", iface, debugstr_a(name)); + + return NULL; +} + +static HRESULT STDMETHODCALLTYPE d3d12_shader_reflection_GetResourceBindingDesc(ID3D12ShaderReflection *iface, + UINT index, D3D12_SHADER_INPUT_BIND_DESC *desc) +{ + FIXME("iface %p, index %u, desc %p stub.\n", iface, index, desc); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE d3d12_shader_reflection_GetInputParameterDesc(ID3D12ShaderReflection *iface, + UINT index, D3D12_SIGNATURE_PARAMETER_DESC *desc) +{ + FIXME("iface %p, index %u, desc %p stub.\n", iface, index, desc); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE d3d12_shader_reflection_GetOutputParameterDesc(ID3D12ShaderReflection *iface, + UINT index, D3D12_SIGNATURE_PARAMETER_DESC *desc) +{ + FIXME("iface %p, index %u, desc %p stub.\n", iface, index, desc); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE d3d12_shader_reflection_GetPatchConstantParameterDesc(ID3D12ShaderReflection *iface, + UINT index, D3D12_SIGNATURE_PARAMETER_DESC *desc) +{ + FIXME("iface %p, index %u, desc %p stub.\n", iface, index, desc); + + return E_NOTIMPL; +} + +static struct ID3D12ShaderReflectionVariable * STDMETHODCALLTYPE d3d12_shader_reflection_GetVariableByName + (ID3D12ShaderReflection *iface, const char *name) +{ + FIXME("iface %p, name %s stub.\n", iface, debugstr_a(name)); + + return NULL; +} + +static HRESULT STDMETHODCALLTYPE d3d12_shader_reflection_GetResourceBindingDescByName(ID3D12ShaderReflection *iface, + const char *name, D3D12_SHADER_INPUT_BIND_DESC *desc) +{ + FIXME("iface %p, name %s, desc %p stub.\n", iface, debugstr_a(name), desc); + + return E_NOTIMPL; +} + +static UINT STDMETHODCALLTYPE d3d12_shader_reflection_GetMovInstructionCount(ID3D12ShaderReflection *iface) +{ + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D12ShaderReflection(iface); + + TRACE("iface %p.\n", iface); + + return reflection->mov_instruction_count; +} + +static UINT STDMETHODCALLTYPE d3d12_shader_reflection_GetMovcInstructionCount(ID3D12ShaderReflection *iface) +{ + FIXME("iface %p stub.\n", iface); + + return 0; +} + +static UINT STDMETHODCALLTYPE d3d12_shader_reflection_GetConversionInstructionCount(ID3D12ShaderReflection *iface) +{ + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D12ShaderReflection(iface); + + TRACE("iface %p.\n", iface); + + return reflection->conversion_instruction_count; +} + +static UINT STDMETHODCALLTYPE d3d12_shader_reflection_GetBitwiseInstructionCount(ID3D12ShaderReflection *iface) +{ + FIXME("iface %p stub.\n", iface); + + return 0; +} + +static D3D_PRIMITIVE STDMETHODCALLTYPE d3d12_shader_reflection_GetGSInputPrimitive(ID3D12ShaderReflection *iface) +{ + FIXME("iface %p stub.\n", iface); + + return 0; +} + +static BOOL STDMETHODCALLTYPE d3d12_shader_reflection_IsSampleFrequencyShader(ID3D12ShaderReflection *iface) +{ + FIXME("iface %p stub.\n", iface); + + return FALSE; +} + +static UINT STDMETHODCALLTYPE d3d12_shader_reflection_GetNumInterfaceSlots(ID3D12ShaderReflection *iface) +{ + FIXME("iface %p stub.\n", iface); + + return 0; +} + +static HRESULT STDMETHODCALLTYPE d3d12_shader_reflection_GetMinFeatureLevel(ID3D12ShaderReflection *iface, + D3D_FEATURE_LEVEL *level) +{ + FIXME("iface %p, level %p stub.\n", iface, level); + + return E_NOTIMPL; +} + +static UINT STDMETHODCALLTYPE d3d12_shader_reflection_GetThreadGroupSize(ID3D12ShaderReflection *iface, + UINT *sizex, UINT *sizey, UINT *sizez) +{ + FIXME("iface %p, sizex %p, sizey %p, sizez %p stub.\n", iface, sizex, sizey, sizez); + + return 0; +} + +static UINT64 STDMETHODCALLTYPE d3d12_shader_reflection_GetRequiresFlags(ID3D12ShaderReflection *iface) +{ + FIXME("iface %p stub.\n", iface); + + return 0; +} + +static const struct ID3D12ShaderReflectionVtbl d3d12_shader_reflection_vtbl = +{ + /* IUnknown methods */ + d3d12_shader_reflection_QueryInterface, + d3d12_shader_reflection_AddRef, + d3d12_shader_reflection_Release, + /* ID3D12ShaderReflection methods */ + d3d12_shader_reflection_GetDesc, + d3d12_shader_reflection_GetConstantBufferByIndex, + d3d12_shader_reflection_GetConstantBufferByName, + d3d12_shader_reflection_GetResourceBindingDesc, + d3d12_shader_reflection_GetInputParameterDesc, + d3d12_shader_reflection_GetOutputParameterDesc, + d3d12_shader_reflection_GetPatchConstantParameterDesc, + d3d12_shader_reflection_GetVariableByName, + d3d12_shader_reflection_GetResourceBindingDescByName, + d3d12_shader_reflection_GetMovInstructionCount, + d3d12_shader_reflection_GetMovcInstructionCount, + d3d12_shader_reflection_GetConversionInstructionCount, + d3d12_shader_reflection_GetBitwiseInstructionCount, + d3d12_shader_reflection_GetGSInputPrimitive, + d3d12_shader_reflection_IsSampleFrequencyShader, + d3d12_shader_reflection_GetNumInterfaceSlots, + d3d12_shader_reflection_GetMinFeatureLevel, + d3d12_shader_reflection_GetThreadGroupSize, + d3d12_shader_reflection_GetRequiresFlags, +}; + HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void **reflector) { struct d3dcompiler_shader_reflection *object; @@ -2357,7 +2588,8 @@ HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void #endif }
- if (!IsEqualGUID(riid, &IID_ID3D11ShaderReflection)) + if (!IsEqualGUID(riid, &IID_ID3D11ShaderReflection) + && (D3D_COMPILER_VERSION < 47 || !IsEqualGUID(riid, &IID_ID3D12ShaderReflection))) { WARN("Wrong riid %s, accept only %s!\n", debugstr_guid(riid), debugstr_guid(&IID_ID3D11ShaderReflection)); #if D3D_COMPILER_VERSION >= 46 @@ -2372,6 +2604,7 @@ HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void return E_OUTOFMEMORY;
object->ID3D11ShaderReflection_iface.lpVtbl = &d3d11_shader_reflection_vtbl; + object->ID3D12ShaderReflection_iface.lpVtbl = &d3d12_shader_reflection_vtbl; object->refcount = 1;
hr = d3dcompiler_shader_reflection_init(object, data, data_size); @@ -2382,7 +2615,8 @@ HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void return hr; }
- *reflector = object; + *reflector = IsEqualGUID(riid, &IID_ID3D12ShaderReflection) ? (void **)&object->ID3D12ShaderReflection_iface + : (void **)&object->ID3D11ShaderReflection_iface;
TRACE("Created ID3D11ShaderReflection %p\n", object);
diff --git a/dlls/d3dcompiler_43/tests/reflection.c b/dlls/d3dcompiler_43/tests/reflection.c index 617003a97b7..443b06e74f0 100644 --- a/dlls/d3dcompiler_43/tests/reflection.c +++ b/dlls/d3dcompiler_43/tests/reflection.c @@ -57,7 +57,6 @@ static DWORD shader_creator[] = { 0x39207265, 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, };
-#if D3D_COMPILER_VERSION /* * fxc.exe /E VS /Tvs_4_0 /Fx */ @@ -85,6 +84,7 @@ static DWORD test_reflection_blob[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, };
+#if D3D_COMPILER_VERSION static void test_reflection_references(void) { ID3D11ShaderReflection *ref11, *ref11_test; @@ -157,6 +157,62 @@ static void test_reflection_references(void) } #endif
+static void test_reflection_interfaces(void) +{ + ID3D12ShaderReflection *ref12 = NULL; + ID3D11ShaderReflection *ref11; + HRESULT hr, expected_hr; + IUnknown *iface, *iunk; + ULONG count; + + expected_hr = D3D_COMPILER_VERSION < 46 ? E_NOINTERFACE : D3D_COMPILER_VERSION == 46 ? E_INVALIDARG : S_OK; + hr = call_reflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D12ShaderReflection, (void **)&ref12); + /* Broken with older d3dcompiler_47. */ + ok(hr == expected_hr || broken(expected_hr == S_OK && hr == E_NOINTERFACE), "Got unexpected hr %#x.\n", hr); + + if (hr != S_OK) + return; + + hr = call_reflect(test_reflection_blob, test_reflection_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + hr = ref12->lpVtbl->QueryInterface(ref12, &IID_ID3D11ShaderReflection, (void **)&iface); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + hr = iface->lpVtbl->QueryInterface(iface, &IID_IUnknown, (void **)&iunk); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(iface == iunk, "Got unexpected iface %p.\n", iface); + iface->lpVtbl->Release(iunk); + iface->lpVtbl->Release(iface); + + hr = ref12->lpVtbl->QueryInterface(ref12, &IID_IUnknown, (void **)&iface); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(iface == (IUnknown *)ref12, "Got unexpected iface %p.\n", iface); + iface->lpVtbl->Release(iface); + + hr = ref11->lpVtbl->QueryInterface(ref11, &IID_ID3D12ShaderReflection, (void **)&iface); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + hr = iface->lpVtbl->QueryInterface(iface, &IID_IUnknown, (void **)&iunk); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(iface == iunk, "Got unexpected iface %p.\n", iface); + iface->lpVtbl->Release(iunk); + iface->lpVtbl->Release(iface); + + hr = ref11->lpVtbl->QueryInterface(ref11, &IID_IUnknown, (void **)&iface); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(iface == (IUnknown *)ref11, "Got unexpected iface %p.\n", iface); + iface->lpVtbl->Release(iface); + + hr = ref11->lpVtbl->QueryInterface(ref11, &IID_ID3D10ShaderReflection, (void **)&iface); + ok(hr == E_NOINTERFACE, "Got unexpected hr %#x.\n", hr); + hr = ref12->lpVtbl->QueryInterface(ref12, &IID_ID3D10ShaderReflection, (void **)&iface); + ok(hr == E_NOINTERFACE, "Got unexpected hr %#x.\n", hr); + + count = ref12->lpVtbl->Release(ref12); + ok(!count, "Got unexpected ref count %u.\n", count); + count = ref11->lpVtbl->Release(ref11); + ok(!count, "Got unexpected ref count %u.\n", count); +} + /* * fxc.exe /E VS /Tvs_4_1 /Fx */ @@ -1862,6 +1918,7 @@ START_TEST(reflection) #if D3D_COMPILER_VERSION test_reflection_references(); #endif + test_reflection_interfaces(); test_reflection_desc_vs(); test_reflection_desc_ps(); test_reflection_desc_ps_output();
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=76807
Your paranoid android.
=== debiant (32 bit report) ===
d3d10: reflection.c:171: Test failed: Got unexpected hr 0. reflection.c:180: Test failed: Got unexpected hr 0x80004002. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00421137).
Report validation errors: d3d10:reflection crashed (c0000005)
=== debiant (32 bit Chinese:China report) ===
d3d10: reflection.c:171: Test failed: Got unexpected hr 0. reflection.c:180: Test failed: Got unexpected hr 0x80004002. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00421137).
Report validation errors: d3d10:reflection crashed (c0000005)
=== debiant (32 bit WoW report) ===
d3d10: reflection.c:171: Test failed: Got unexpected hr 0. reflection.c:180: Test failed: Got unexpected hr 0x80004002. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00421137).
Report validation errors: d3d10:reflection crashed (c0000005)
=== debiant (64 bit WoW report) ===
d3d10: reflection.c:171: Test failed: Got unexpected hr 0. reflection.c:180: Test failed: Got unexpected hr 0x80004002. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00421137).
Report validation errors: d3d10:reflection crashed (c0000005)
Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/d3dcompiler_43/reflection.c | 63 ++++++++++++++------------ dlls/d3dcompiler_43/tests/reflection.c | 17 +++++++ 2 files changed, 50 insertions(+), 30 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 420af0aff9a..088f734a0a4 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -387,35 +387,8 @@ static HRESULT d3dcompiler_shader_reflection_QueryInterface(struct d3dcompiler_s return E_NOINTERFACE; }
-/* IUnknown methods */ - -static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_QueryInterface(ID3D11ShaderReflection *iface, - REFIID riid, void **object) -{ - TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); - - return d3dcompiler_shader_reflection_QueryInterface(impl_from_ID3D11ShaderReflection(iface), - riid, object, (IUnknown *)iface); -} - -static ULONG STDMETHODCALLTYPE d3d11_shader_reflection_AddRef(ID3D11ShaderReflection *iface) -{ - return d3dcompiler_shader_reflection_AddRef(impl_from_ID3D11ShaderReflection(iface)); -} - -static ULONG STDMETHODCALLTYPE d3d11_shader_reflection_Release(ID3D11ShaderReflection *iface) +static HRESULT d3dcompiler_shader_reflection_GetDesc(struct d3dcompiler_shader_reflection *reflection, D3D12_SHADER_DESC *desc) { - return d3dcompiler_shader_reflection_Release(impl_from_ID3D11ShaderReflection(iface)); -} - -/* ID3D11ShaderReflection methods */ - -static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_GetDesc(ID3D11ShaderReflection *iface, D3D11_SHADER_DESC *desc) -{ - struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface); - - FIXME("iface %p, desc %p partial stub.\n", iface, desc); - if (!desc) { WARN("Invalid argument specified.\n"); @@ -464,6 +437,36 @@ static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_GetDesc(ID3D11ShaderRef return S_OK; }
+/* IUnknown methods */ + +static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_QueryInterface(ID3D11ShaderReflection *iface, + REFIID riid, void **object) +{ + TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); + + return d3dcompiler_shader_reflection_QueryInterface(impl_from_ID3D11ShaderReflection(iface), + riid, object, (IUnknown *)iface); +} + +static ULONG STDMETHODCALLTYPE d3d11_shader_reflection_AddRef(ID3D11ShaderReflection *iface) +{ + return d3dcompiler_shader_reflection_AddRef(impl_from_ID3D11ShaderReflection(iface)); +} + +static ULONG STDMETHODCALLTYPE d3d11_shader_reflection_Release(ID3D11ShaderReflection *iface) +{ + return d3dcompiler_shader_reflection_Release(impl_from_ID3D11ShaderReflection(iface)); +} + +/* ID3D11ShaderReflection methods */ + +static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_GetDesc(ID3D11ShaderReflection *iface, D3D11_SHADER_DESC *desc) +{ + FIXME("iface %p, desc %p partial stub.\n", iface, desc); + + return d3dcompiler_shader_reflection_GetDesc(impl_from_ID3D11ShaderReflection(iface), (D3D12_SHADER_DESC *)desc); +} + static struct ID3D11ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d11_shader_reflection_GetConstantBufferByIndex (ID3D11ShaderReflection *iface, UINT index) { @@ -2391,9 +2394,9 @@ static ULONG STDMETHODCALLTYPE d3d12_shader_reflection_Release(ID3D12ShaderRefle
static HRESULT STDMETHODCALLTYPE d3d12_shader_reflection_GetDesc(ID3D12ShaderReflection *iface, D3D12_SHADER_DESC *desc) { - FIXME("iface %p, desc %p stub.\n", iface, desc); + FIXME("iface %p, desc %p partial stub.\n", iface, desc);
- return E_NOTIMPL; + return d3dcompiler_shader_reflection_GetDesc(impl_from_ID3D12ShaderReflection(iface), desc); }
static struct ID3D12ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d12_shader_reflection_GetConstantBufferByIndex diff --git a/dlls/d3dcompiler_43/tests/reflection.c b/dlls/d3dcompiler_43/tests/reflection.c index 443b06e74f0..af8a980948c 100644 --- a/dlls/d3dcompiler_43/tests/reflection.c +++ b/dlls/d3dcompiler_43/tests/reflection.c @@ -387,7 +387,9 @@ static void test_reflection_desc_vs(void) D3D11_SIGNATURE_PARAMETER_DESC desc = {0}; D3D_MIN_PRECISION expected_min_prec; D3D11_SHADER_DESC sdesc11 = {0}; + D3D12_SHADER_DESC sdesc12 = {0}; ID3D11ShaderReflection *ref11; + ID3D12ShaderReflection *ref12; unsigned int i; ULONG count; HRESULT hr; @@ -398,6 +400,8 @@ static void test_reflection_desc_vs(void) hr = call_reflect(test_reflection_desc_vs_blob, test_reflection_desc_vs_blob[6], &IID_ID3D11ShaderReflection, (void **)&ref11); ok(hr == S_OK, "D3DReflect failed %x\n", hr);
+ ref11->lpVtbl->QueryInterface(ref11, &IID_ID3D12ShaderReflection, (void **)&ref12); + hr = ref11->lpVtbl->GetDesc(ref11, NULL); ok(hr == E_FAIL, "GetDesc failed %x\n", hr);
@@ -443,6 +447,13 @@ static void test_reflection_desc_vs(void) ok(sdesc11.cInterlockedInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cInterlockedInstructions, 0); ok(sdesc11.cTextureStoreInstructions == 0, "GetDesc failed, got %u, expected %u\n", sdesc11.cTextureStoreInstructions, 0);
+ if (ref12) + { + hr = ref12->lpVtbl->GetDesc(ref12, &sdesc12); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(!memcmp(&sdesc11, &sdesc12, sizeof(sdesc12)), "D3D11 and D3D12 descs do not match.\n"); + } + #if D3D_COMPILER_VERSION ret = ref11->lpVtbl->GetBitwiseInstructionCount(ref11); ok(ret == 0, "GetBitwiseInstructionCount failed, got %u, expected %u\n", ret, 0); @@ -527,6 +538,12 @@ static void test_reflection_desc_vs(void) ok(!desc.Stream, "(%u): got unexpected Stream %u.\n", i, desc.Stream); }
+ if (ref12) + { + count = ref12->lpVtbl->Release(ref12); + ok(count == 1, "Got unexpected ref count %u.\n", count); + } + count = ref11->lpVtbl->Release(ref11); ok(count == 0, "Release failed %u\n", count); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=76808
Your paranoid android.
=== debiant (32 bit report) ===
d3d10: reflection.c:171: Test failed: Got unexpected hr 0. reflection.c:180: Test failed: Got unexpected hr 0x80004002. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00421137).
Report validation errors: d3d10:reflection crashed (c0000005)
=== debiant (32 bit Chinese:China report) ===
d3d10: reflection.c:171: Test failed: Got unexpected hr 0. reflection.c:180: Test failed: Got unexpected hr 0x80004002. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00421137).
Report validation errors: d3d10:reflection crashed (c0000005)
=== debiant (32 bit WoW report) ===
d3d10: reflection.c:171: Test failed: Got unexpected hr 0. reflection.c:180: Test failed: Got unexpected hr 0x80004002. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00421137).
Report validation errors: d3d10:reflection crashed (c0000005)
=== debiant (64 bit WoW report) ===
d3d10: reflection.c:171: Test failed: Got unexpected hr 0. reflection.c:180: Test failed: Got unexpected hr 0x80004002. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00421137).
Report validation errors: d3d10:reflection crashed (c0000005)
Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/d3dcompiler_43/reflection.c | 75 +++++--- dlls/d3dcompiler_43/tests/reflection.c | 253 ++++++++++++++++--------- 2 files changed, 207 insertions(+), 121 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 088f734a0a4..d88d6216dd8 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -437,6 +437,34 @@ static HRESULT d3dcompiler_shader_reflection_GetDesc(struct d3dcompiler_shader_r return S_OK; }
+static HRESULT d3dcompiler_shader_reflection_GetResourceBindingDescByName + (struct d3dcompiler_shader_reflection *reflection, const char *name, void *desc, DWORD desc_size) +{ + unsigned int i; + + if (!desc || !name) + { + WARN("Invalid argument specified.\n"); + return E_INVALIDARG; + } + + for (i = 0; i < reflection->bound_resource_count; ++i) + { + D3D12_SHADER_INPUT_BIND_DESC *d = &reflection->bound_resources[i]; + + if (!strcmp(d->Name, name)) + { + TRACE("Returning D3D12_SHADER_INPUT_BIND_DESC %p.\n", d); + memcpy(desc, d, desc_size); + return S_OK; + } + } + + WARN("Invalid name specified.\n"); + + return E_INVALIDARG; +} + /* IUnknown methods */
static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_QueryInterface(ID3D11ShaderReflection *iface, @@ -623,32 +651,10 @@ static struct ID3D11ShaderReflectionVariable * STDMETHODCALLTYPE d3d11_shader_re static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_GetResourceBindingDescByName(ID3D11ShaderReflection *iface, const char *name, D3D11_SHADER_INPUT_BIND_DESC *desc) { - struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D11ShaderReflection(iface); - unsigned int i; - TRACE("iface %p, name %s, desc %p.\n", iface, debugstr_a(name), desc);
- if (!desc || !name) - { - WARN("Invalid argument specified.\n"); - return E_INVALIDARG; - } - - for (i = 0; i < reflection->bound_resource_count; ++i) - { - D3D12_SHADER_INPUT_BIND_DESC *d = &reflection->bound_resources[i]; - - if (!strcmp(d->Name, name)) - { - TRACE("Returning D3D11_SHADER_INPUT_BIND_DESC %p.\n", d); - memcpy(desc, d, sizeof(*desc)); - return S_OK; - } - } - - WARN("Invalid name specified.\n"); - - return E_INVALIDARG; + return d3dcompiler_shader_reflection_GetResourceBindingDescByName(impl_from_ID3D11ShaderReflection(iface), + name, desc, sizeof(*desc)); }
static UINT STDMETHODCALLTYPE d3d11_shader_reflection_GetMovInstructionCount(ID3D11ShaderReflection *iface) @@ -1567,7 +1573,7 @@ static HRESULT d3dcompiler_parse_rdef(struct d3dcompiler_shader_reflection *r, c else { desc->Space = 0; - desc->uID = 0; + desc->uID = desc->BindPoint; } } } @@ -2418,9 +2424,19 @@ static struct ID3D12ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d12_sha static HRESULT STDMETHODCALLTYPE d3d12_shader_reflection_GetResourceBindingDesc(ID3D12ShaderReflection *iface, UINT index, D3D12_SHADER_INPUT_BIND_DESC *desc) { - FIXME("iface %p, index %u, desc %p stub.\n", iface, index, desc); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D12ShaderReflection(iface);
- return E_NOTIMPL; + TRACE("iface %p, index %u, desc %p\n", iface, index, desc); + + if (!desc || index >= reflection->bound_resource_count) + { + WARN("Invalid argument specified\n"); + return E_INVALIDARG; + } + + memcpy(desc, &reflection->bound_resources[index], sizeof(*desc)); + + return S_OK; }
static HRESULT STDMETHODCALLTYPE d3d12_shader_reflection_GetInputParameterDesc(ID3D12ShaderReflection *iface, @@ -2458,9 +2474,10 @@ static struct ID3D12ShaderReflectionVariable * STDMETHODCALLTYPE d3d12_shader_re static HRESULT STDMETHODCALLTYPE d3d12_shader_reflection_GetResourceBindingDescByName(ID3D12ShaderReflection *iface, const char *name, D3D12_SHADER_INPUT_BIND_DESC *desc) { - FIXME("iface %p, name %s, desc %p stub.\n", iface, debugstr_a(name), desc); + TRACE("iface %p, name %s, desc %p.\n", iface, debugstr_a(name), desc);
- return E_NOTIMPL; + return d3dcompiler_shader_reflection_GetResourceBindingDescByName(impl_from_ID3D12ShaderReflection(iface), + name, desc, sizeof(*desc)); }
static UINT STDMETHODCALLTYPE d3d12_shader_reflection_GetMovInstructionCount(ID3D12ShaderReflection *iface) diff --git a/dlls/d3dcompiler_43/tests/reflection.c b/dlls/d3dcompiler_43/tests/reflection.c index af8a980948c..e76b855b127 100644 --- a/dlls/d3dcompiler_43/tests/reflection.c +++ b/dlls/d3dcompiler_43/tests/reflection.c @@ -1108,10 +1108,11 @@ static void test_reflection_desc_ps_output(void) }
/* - * fxc.exe /E PS /Tps_4_0 /Fx + * fxc.exe /E PS /Tps_4_0 /Fo */ #if 0 -Texture2D tex1; +Texture2D tex1[2]; +Texture2D tex2; SamplerState sam { Filter = MIN_MAG_MIP_LINEAR; @@ -1131,7 +1132,7 @@ cbuffer c2
float4 PS(float2 uv : TEXCOORD0) : sv_target { - float4 q = tex1.Sample(sam, uv); + float4 q = tex1[0].Sample(sam, uv) + tex1[1].Sample(sam, uv) + tex2.Sample(sam, uv); q.x = q.x + x; q.w = q.w + y[0] + y[1] + t; return q; @@ -1139,53 +1140,62 @@ float4 PS(float2 uv : TEXCOORD0) : sv_target #endif static const DWORD test_reflection_bound_resources_blob[] = { -0x43425844, 0xe4af0279, 0x690268fc, 0x76bf6a72, 0xe5aff43b, 0x00000001, 0x000003f4, 0x00000005, -0x00000034, 0x000001e8, 0x0000021c, 0x00000250, 0x00000378, 0x46454452, 0x000001ac, 0x00000002, -0x000000ac, 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x0000017a, 0x0000009c, 0x00000003, -0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x000000a0, 0x00000002, -0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000c, 0x000000a5, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x000000a8, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x006d6173, 0x31786574, -0x00316300, 0xab003263, 0x000000a5, 0x00000003, 0x000000dc, 0x00000030, 0x00000000, 0x00000000, -0x000000a8, 0x00000001, 0x00000160, 0x00000010, 0x00000000, 0x00000000, 0x00000124, 0x00000000, -0x00000004, 0x00000002, 0x00000128, 0x00000000, 0x00000138, 0x00000010, 0x00000014, 0x00000002, -0x0000013c, 0x00000000, 0x0000014c, 0x00000024, 0x00000004, 0x00000000, 0x00000150, 0x00000000, -0xabab0078, 0x00030000, 0x00010001, 0x00000000, 0x00000000, 0xabab0079, 0x00030000, 0x00010001, -0x00000002, 0x00000000, 0xabab007a, 0x00020000, 0x00010001, 0x00000000, 0x00000000, 0x00000178, -0x00000000, 0x00000004, 0x00000002, 0x00000128, 0x00000000, 0x694d0074, 0x736f7263, 0x2074666f, -0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, -0x31332e32, 0xab003131, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, -0x00000000, 0x00000003, 0x00000000, 0x00000303, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, -0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, -0x0000000f, 0x745f7673, 0x65677261, 0xabab0074, 0x52444853, 0x00000120, 0x00000040, 0x00000048, -0x04000059, 0x00208e46, 0x00000000, 0x00000003, 0x04000059, 0x00208e46, 0x00000001, 0x00000001, -0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, -0x00101032, 0x00000000, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, -0x001000f2, 0x00000000, 0x00101046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, -0x08000000, 0x00100082, 0x00000000, 0x0010003a, 0x00000000, 0x0020800a, 0x00000000, 0x00000001, -0x08000000, 0x00100082, 0x00000000, 0x0010003a, 0x00000000, 0x0020800a, 0x00000000, 0x00000002, -0x08000000, 0x00102082, 0x00000000, 0x0010003a, 0x00000000, 0x0020800a, 0x00000001, 0x00000000, -0x08000000, 0x00102012, 0x00000000, 0x0010000a, 0x00000000, 0x0020800a, 0x00000000, 0x00000000, -0x05000036, 0x00102062, 0x00000000, 0x00100656, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, -0x00000007, 0x00000001, 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000000, 0x00000001, -0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x43425844, 0x003472ed, 0xe3436185, 0xcc1faad3, 0xfdac0a07, 0x00000001, 0x000004b0, 0x00000005, + 0x00000034, 0x00000204, 0x00000238, 0x0000026c, 0x00000434, 0x46454452, 0x000001c8, 0x00000002, + 0x000000d0, 0x00000005, 0x0000001c, 0xffff0400, 0x00000100, 0x0000019e, 0x000000bc, 0x00000003, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x000000c0, 0x00000002, + 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000002, 0x0000000c, 0x000000c5, 0x00000002, + 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000c, 0x000000ca, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x000000cd, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x006d6173, 0x31786574, + 0x78657400, 0x31630032, 0x00326300, 0x000000ca, 0x00000003, 0x00000100, 0x00000030, 0x00000000, + 0x00000000, 0x000000cd, 0x00000001, 0x00000184, 0x00000010, 0x00000000, 0x00000000, 0x00000148, + 0x00000000, 0x00000004, 0x00000002, 0x0000014c, 0x00000000, 0x0000015c, 0x00000010, 0x00000014, + 0x00000002, 0x00000160, 0x00000000, 0x00000170, 0x00000024, 0x00000004, 0x00000000, 0x00000174, + 0x00000000, 0xabab0078, 0x00030000, 0x00010001, 0x00000000, 0x00000000, 0xabab0079, 0x00030000, + 0x00010001, 0x00000002, 0x00000000, 0xabab007a, 0x00020000, 0x00010001, 0x00000000, 0x00000000, + 0x0000019c, 0x00000000, 0x00000004, 0x00000002, 0x0000014c, 0x00000000, 0x694d0074, 0x736f7263, + 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, 0x72656c69, 0x2e303120, + 0xabab0031, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x00000303, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, + 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, + 0x745f7673, 0x65677261, 0xabab0074, 0x52444853, 0x000001c0, 0x00000040, 0x00000070, 0x04000059, + 0x00208e46, 0x00000000, 0x00000003, 0x04000059, 0x00208e46, 0x00000001, 0x00000001, 0x0300005a, + 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, + 0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032, + 0x00000000, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, + 0x001000f2, 0x00000001, 0x00101046, 0x00000000, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, + 0x07000000, 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x09000045, + 0x001000f2, 0x00000001, 0x00101046, 0x00000000, 0x00107e46, 0x00000002, 0x00106000, 0x00000000, + 0x07000000, 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x08000000, + 0x00100082, 0x00000000, 0x0010003a, 0x00000000, 0x0020800a, 0x00000000, 0x00000001, 0x08000000, + 0x00100082, 0x00000000, 0x0010003a, 0x00000000, 0x0020800a, 0x00000000, 0x00000002, 0x08000000, + 0x00102082, 0x00000000, 0x0010003a, 0x00000000, 0x0020800a, 0x00000001, 0x00000000, 0x08000000, + 0x00102012, 0x00000000, 0x0010000a, 0x00000000, 0x0020800a, 0x00000000, 0x00000000, 0x05000036, + 0x00102062, 0x00000000, 0x00100656, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, + 0x00000002, 0x00000000, 0x00000002, 0x00000006, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, };
-static const D3D11_SHADER_INPUT_BIND_DESC test_reflection_bound_resources_result[] = +static const D3D12_SHADER_INPUT_BIND_DESC test_reflection_bound_resources_result[] = { {"sam", D3D_SIT_SAMPLER, 0, 1, 0, 0, D3D_SRV_DIMENSION_UNKNOWN, 0}, - {"tex1", D3D_SIT_TEXTURE, 0, 1, 12, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, 0xffffffff}, + {"tex1", D3D_SIT_TEXTURE, 0, 2, 12, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, 0xffffffff}, + {"tex2", D3D_SIT_TEXTURE, 2, 1, 12, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, 0xffffffff, 0, 2}, {"c1", D3D_SIT_CBUFFER, 0, 1, 0, 0, D3D_SRV_DIMENSION_UNKNOWN, 0}, - {"c2", D3D_SIT_CBUFFER, 1, 1, 0, 0, D3D_SRV_DIMENSION_UNKNOWN, 0}, + {"c2", D3D_SIT_CBUFFER, 1, 1, 0, 0, D3D_SRV_DIMENSION_UNKNOWN, 0, 0, 1}, };
-static void test_reflection_bound_resources(const DWORD *blob, const D3D11_SHADER_INPUT_BIND_DESC *result, +static void test_reflection_bound_resources(const DWORD *blob, const D3D12_SHADER_INPUT_BIND_DESC *result, unsigned int result_count, unsigned int target_version) { - const D3D11_SHADER_INPUT_BIND_DESC *pdesc; - D3D11_SHADER_INPUT_BIND_DESC desc; + ID3D12ShaderReflection *ref12 = NULL, *ref12_from_d3d11 = NULL; + const D3D12_SHADER_INPUT_BIND_DESC *pdesc; + D3D12_SHADER_INPUT_BIND_DESC desc12; + D3D11_SHADER_INPUT_BIND_DESC desc11; ID3D11ShaderReflection *ref11; HRESULT hr, expected_hr; unsigned int i; @@ -1202,25 +1212,30 @@ static void test_reflection_bound_resources(const DWORD *blob, const D3D11_SHADE if (hr == E_INVALIDARG) return;
+ call_reflect(blob, blob[6], &IID_ID3D12ShaderReflection, (void **)&ref12); + ref11->lpVtbl->QueryInterface(ref11, &IID_ID3D12ShaderReflection, (void **)&ref12_from_d3d11); + ok ((!ref12 && !ref12_from_d3d11) || (ref12 && ref12_from_d3d11), "Got unexpected interfaces %p, %p.\n", + ref12, ref12_from_d3d11); + /* check invalid cases */ hr = ref11->lpVtbl->GetResourceBindingDesc(ref11, 0, NULL); - ok(hr == E_INVALIDARG, "GetResourceBindingDesc failed, got %x, expected %x\n", hr, E_INVALIDARG); + ok(hr == E_INVALIDARG, "Got unexpected hr %x.\n", hr);
- hr = ref11->lpVtbl->GetResourceBindingDesc(ref11, 0xffffffff, &desc); - ok(hr == E_INVALIDARG, "GetResourceBindingDesc failed, got %x, expected %x\n", hr, E_INVALIDARG); + hr = ref11->lpVtbl->GetResourceBindingDesc(ref11, 0xffffffff, &desc11); + ok(hr == E_INVALIDARG, "Got unexpected hr %x.\n", hr);
#if D3D_COMPILER_VERSION - hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, NULL, &desc); - ok(hr == E_INVALIDARG, "GetResourceBindingDescByName failed, got %x, expected %x\n", hr, E_INVALIDARG); + hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, NULL, &desc11); + ok(hr == E_INVALIDARG, "Got unexpected hr %x.\n", hr);
hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, "sam", NULL); - ok(hr == E_INVALIDARG, "GetResourceBindingDescByName failed, got %x, expected %x\n", hr, E_INVALIDARG); + ok(hr == E_INVALIDARG, "Got unexpected hr %x.\n", hr);
hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, "invalid", NULL); - ok(hr == E_INVALIDARG, "GetResourceBindingDescByName failed, got %x, expected %x\n", hr, E_INVALIDARG); + ok(hr == E_INVALIDARG, "Got unexpected hr %x.\n", hr);
- hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, "invalid", &desc); - ok(hr == E_INVALIDARG, "GetResourceBindingDescByName failed, got %x, expected %x\n", hr, E_INVALIDARG); + hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, "invalid", &desc11); + ok(hr == E_INVALIDARG, "Got unexpected hr %x.\n", hr); #endif
/* GetResourceBindingDesc */ @@ -1228,31 +1243,54 @@ static void test_reflection_bound_resources(const DWORD *blob, const D3D11_SHADE { pdesc = &result[i];
- hr = ref11->lpVtbl->GetResourceBindingDesc(ref11, i, &desc); - ok(hr == S_OK, "GetResourceBindingDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK); - - ok(!strcmp(desc.Name, pdesc->Name), "GetResourceBindingDesc(%u) Name failed, got "%s", expected "%s"\n", - i, desc.Name, pdesc->Name); - ok(desc.Type == pdesc->Type, "GetResourceBindingDesc(%u) Type failed, got %x, expected %x\n", - i, desc.Type, pdesc->Type); - ok(desc.BindPoint == pdesc->BindPoint, "GetResourceBindingDesc(%u) BindPoint failed, got %u, expected %u\n", - i, desc.BindPoint, pdesc->BindPoint); - ok(desc.BindCount == pdesc->BindCount, "GetResourceBindingDesc(%u) BindCount failed, got %u, expected %u\n", - i, desc.BindCount, pdesc->BindCount); + hr = ref11->lpVtbl->GetResourceBindingDesc(ref11, i, &desc11); + ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i); + + ok(!strcmp(desc11.Name, pdesc->Name), "Got unexpected Name "%s", i %u.\n", desc11.Name, i); + ok(desc11.Type == pdesc->Type, "Got unexpected Type %#x, i %u.\n", desc11.Type, i); + ok(desc11.BindPoint == pdesc->BindPoint, "Got unexpected BindPoint %u, i %u.\n", desc11.BindPoint, i); + ok(desc11.BindCount == pdesc->BindCount, "Got unexpected BindCount %u, i %u.\n", desc11.BindCount, i); #if D3D_COMPILER_VERSION expected = pdesc->uFlags; #else expected = 0; todo_wine_if(pdesc->uFlags) #endif - ok(desc.uFlags == expected, "(%u): Got unexpected uFlags %#x, expected %#x.\n", - i, desc.uFlags, expected); - ok(desc.ReturnType == pdesc->ReturnType, "GetResourceBindingDesc(%u) ReturnType failed, got %x, expected %x\n", - i, desc.ReturnType, pdesc->ReturnType); - ok(desc.Dimension == pdesc->Dimension, "GetResourceBindingDesc(%u) Dimension failed, got %x, expected %x\n", - i, desc.Dimension, pdesc->Dimension); - ok(desc.NumSamples == pdesc->NumSamples, "GetResourceBindingDesc(%u) NumSamples failed, got %u, expected %u\n", - i, desc.NumSamples, pdesc->NumSamples); + ok(desc11.uFlags == expected, "Got unexpected uFlags %#x, i %u.\n", desc11.uFlags, i); + ok(desc11.ReturnType == pdesc->ReturnType, "Got unexpected ReturnType %#x, i %u.\n", desc11.ReturnType, i); + ok(desc11.Dimension == pdesc->Dimension, "Got unexpected Dimenstion %#x, i %u.\n", desc11.Dimension, i); + ok(desc11.NumSamples == pdesc->NumSamples, "Got unexpected NumSamples %u, i %u.\n", desc11.NumSamples, i); + + if (ref12) + { + memset(&desc12, 0, sizeof(desc12)); + desc12.Space = 0xdeadbeef; + desc12.uID = 0xdeadbeef; + + hr = ref12->lpVtbl->GetResourceBindingDescByName(ref12, pdesc->Name, &desc12); + ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i); + + ok(!strcmp(desc12.Name, pdesc->Name), "Got unexpected Name "%s", i %u.\n", desc12.Name, i); + ok(!memcmp(&desc12.Type, &desc11.Type, sizeof(desc11) - offsetof(D3D11_SHADER_INPUT_BIND_DESC, Type)), + "D3D11 and D3D12 descs do not match.\n"); + ok(desc12.Space == pdesc->Space, "Got unexpected Space %u, i %u.\n", desc12.Space, i); + ok(desc12.uID == pdesc->uID, "Got unexpected uID %#x, i %u.\n", desc12.uID, i); + + memset(&desc12, 0, sizeof(desc12)); + desc12.Space = 0xdeadbeef; + desc12.uID = 0xdeadbeef; + hr = ref12_from_d3d11->lpVtbl->GetResourceBindingDescByName(ref12_from_d3d11, pdesc->Name, &desc12); + ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i); + + ok(!strcmp(desc12.Name, pdesc->Name), "Got unexpected Name "%s", i %u.\n", desc12.Name, i); + ok(!memcmp(&desc12.Type, &desc11.Type, sizeof(desc11) - offsetof(D3D11_SHADER_INPUT_BIND_DESC, Type)), + "D3D11 and D3D12 descs do not match.\n"); + /* Some versions of d3dcompiler_47 do not fill the extra d3d12 fields if ID3D12ShaderReflection + * was queried from ID3D11ShaderReflection. */ + ok(desc12.Space == pdesc->Space || broken(desc12.Space == 0xdeadbeef), "Got unexpected Space %u, i %u.\n", + desc12.Space, i); + ok(desc12.uID == pdesc->uID || broken(desc12.uID == 0xdeadbeef), "Got unexpected uID %#x, i %u.\n", desc12.uID, i); + } }
#if D3D_COMPILER_VERSION @@ -1261,30 +1299,61 @@ static void test_reflection_bound_resources(const DWORD *blob, const D3D11_SHADE { pdesc = &result[i];
- hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, pdesc->Name, &desc); - ok(hr == S_OK, "GetResourceBindingDescByName(%u) failed, got %x, expected %x\n", i, hr, S_OK); - - ok(!strcmp(desc.Name, pdesc->Name), "GetResourceBindingDescByName(%u) Name failed, got "%s", expected "%s"\n", - i, desc.Name, pdesc->Name); - ok(desc.Type == pdesc->Type, "GetResourceBindingDescByName(%u) Type failed, got %x, expected %x\n", - i, desc.Type, pdesc->Type); - ok(desc.BindPoint == pdesc->BindPoint, "GetResourceBindingDescByName(%u) BindPoint failed, got %u, expected %u\n", - i, desc.BindPoint, pdesc->BindPoint); - ok(desc.BindCount == pdesc->BindCount, "GetResourceBindingDescByName(%u) BindCount failed, got %u, expected %u\n", - i, desc.BindCount, pdesc->BindCount); - ok(desc.uFlags == pdesc->uFlags, "GetResourceBindingDescByName(%u) uFlags failed, got %u, expected %u\n", - i, desc.uFlags, pdesc->uFlags); - ok(desc.ReturnType == pdesc->ReturnType, "GetResourceBindingDescByName(%u) ReturnType failed, got %x, expected %x\n", - i, desc.ReturnType, pdesc->ReturnType); - ok(desc.Dimension == pdesc->Dimension, "GetResourceBindingDescByName(%u) Dimension failed, got %x, expected %x\n", - i, desc.Dimension, pdesc->Dimension); - ok(desc.NumSamples == pdesc->NumSamples, "GetResourceBindingDescByName(%u) NumSamples failed, got %u, expected %u\n", - i, desc.NumSamples, pdesc->NumSamples); + hr = ref11->lpVtbl->GetResourceBindingDescByName(ref11, pdesc->Name, &desc11); + ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i); + + ok(!strcmp(desc11.Name, pdesc->Name), "Got unexpected Name "%s", i %u.\n", desc11.Name, i); + ok(desc11.Type == pdesc->Type, "Got unexpected Type %#x, i %u.\n", desc11.Type, i); + ok(desc11.BindPoint == pdesc->BindPoint, "Got unexpected BindPoint %u, i %u.\n", desc11.BindPoint, i); + ok(desc11.BindCount == pdesc->BindCount, "Got unexpected BindCount failed %u, i %u.\n", desc11.BindCount, i); + ok(desc11.uFlags == pdesc->uFlags, "Got unexpected uFlags %#x, i %u.\n", desc11.uFlags, i); + ok(desc11.ReturnType == pdesc->ReturnType, "Got unexpected ReturnType %#x, i %u.\n", desc11.ReturnType, i); + ok(desc11.Dimension == pdesc->Dimension, "Got unexpected Dimenstion %#x, i %u.\n", desc11.Dimension, i); + ok(desc11.NumSamples == pdesc->NumSamples, "Got unexpected NumSamples %u, i %u.\n", desc11.NumSamples, i); + + if (ref12) + { + memset(&desc12, 0, sizeof(desc12)); + desc12.Space = 0xdeadbeef; + desc12.uID = 0xdeadbeef; + + hr = ref12->lpVtbl->GetResourceBindingDescByName(ref12, pdesc->Name, &desc12); + ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i); + + ok(!strcmp(desc12.Name, pdesc->Name), "Got unexpected Name "%s", i %u.\n", desc12.Name, i); + ok(!memcmp(&desc12.Type, &desc11.Type, sizeof(desc11) - offsetof(D3D11_SHADER_INPUT_BIND_DESC, Type)), + "D3D11 and D3D12 descs do not match.\n"); + ok(desc12.Space == pdesc->Space, "Got unexpected Space %u, i %u.\n", desc12.Space, i); + ok(desc12.uID == pdesc->uID, "Got unexpected uID %#x, i %u.\n", desc12.uID, i); + + memset(&desc12, 0, sizeof(desc12)); + desc12.Space = 0xdeadbeef; + desc12.uID = 0xdeadbeef; + hr = ref12_from_d3d11->lpVtbl->GetResourceBindingDescByName(ref12_from_d3d11, pdesc->Name, &desc12); + ok(hr == S_OK, "Got unexpected hr %x, i %u.\n", hr, i); + + ok(!strcmp(desc12.Name, pdesc->Name), "Got unexpected Name "%s", i %u.\n", desc12.Name, i); + ok(!memcmp(&desc12.Type, &desc11.Type, sizeof(desc11) - offsetof(D3D11_SHADER_INPUT_BIND_DESC, Type)), + "D3D11 and D3D12 descs do not match.\n"); + ok(desc12.Space == pdesc->Space || broken(desc12.Space == 0xdeadbeef), "Got unexpected Space %u, i %u.\n", + desc12.Space, i); + ok(desc12.uID == pdesc->uID || broken(desc12.uID == 0xdeadbeef), "Got unexpected uID %#x, i %u.\n", desc12.uID, i); + } } #endif
+ if (ref12) + { + count = ref12->lpVtbl->Release(ref12); + ok(!count, "Got unexpected ref count %u.\n", count); + + count = ref12_from_d3d11->lpVtbl->Release(ref12_from_d3d11); + ok(count == 1, "Got unexpected ref count %u.\n", count); + + } + count = ref11->lpVtbl->Release(ref11); - ok(count == 0, "Release failed %u\n", count); + ok(!count, "Got unexpected ref count %u.\n", count); }
#if D3D_COMPILER_VERSION @@ -1898,12 +1967,12 @@ static const DWORD test_reflection_bound_resources_sm51_blob[] = 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, };
-static const D3D11_SHADER_INPUT_BIND_DESC test_reflection_bound_resources_sm51_result[] = +static const D3D12_SHADER_INPUT_BIND_DESC test_reflection_bound_resources_sm51_result[] = { {"sam", D3D_SIT_SAMPLER, 0, 1, 0, 0, D3D_SRV_DIMENSION_UNKNOWN, 0}, - {"tex1", D3D_SIT_TEXTURE, 1, 1, 12, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, 0xffffffff}, + {"tex1", D3D_SIT_TEXTURE, 1, 1, 12, D3D_RETURN_TYPE_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, 0xffffffff, 1, 0}, {"c1", D3D_SIT_CBUFFER, 0, 1, D3D_SIF_USERPACKED, 0, D3D_SRV_DIMENSION_UNKNOWN, 0}, - {"c2", D3D_SIT_CBUFFER, 0, 1, D3D_SIF_USERPACKED, 0, D3D_SRV_DIMENSION_UNKNOWN, 0}, + {"c2", D3D_SIT_CBUFFER, 0, 1, D3D_SIF_USERPACKED, 0, D3D_SRV_DIMENSION_UNKNOWN, 0, 1, 1}, };
static BOOL load_d3dreflect(void)
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=76809
Your paranoid android.
=== debiant (32 bit report) ===
d3d10: reflection.c:171: Test failed: Got unexpected hr 0. reflection.c:180: Test failed: Got unexpected hr 0x80004002. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00421137).
Report validation errors: d3d10:reflection crashed (c0000005)
=== debiant (32 bit Chinese:China report) ===
d3d10: reflection.c:171: Test failed: Got unexpected hr 0. reflection.c:180: Test failed: Got unexpected hr 0x80004002. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00421137).
Report validation errors: d3d10:reflection crashed (c0000005)
=== debiant (32 bit WoW report) ===
d3d10: reflection.c:171: Test failed: Got unexpected hr 0. reflection.c:180: Test failed: Got unexpected hr 0x80004002. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00421137).
Report validation errors: d3d10:reflection crashed (c0000005)
=== debiant (64 bit WoW report) ===
d3d10: reflection.c:171: Test failed: Got unexpected hr 0. reflection.c:180: Test failed: Got unexpected hr 0x80004002. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00421137).
Report validation errors: d3d10:reflection crashed (c0000005)
Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/d3dcompiler_43/reflection.c | 52 ++++++++--- dlls/d3dcompiler_43/tests/reflection.c | 123 ++++++++++++++++--------- 2 files changed, 118 insertions(+), 57 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index d88d6216dd8..9610fd140b9 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -35,7 +35,7 @@ enum D3DCOMPILER_SIGNATURE_ELEMENT_SIZE
struct d3dcompiler_shader_signature { - D3D11_SIGNATURE_PARAMETER_DESC *elements; + D3D12_SIGNATURE_PARAMETER_DESC *elements; UINT element_count; char *string_data; }; @@ -572,7 +572,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_GetInputParameterDesc(I return E_INVALIDARG; }
- *desc = reflection->isgn->elements[index]; + memcpy(desc, &reflection->isgn->elements[index], sizeof(*desc));
return S_OK; } @@ -590,7 +590,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_GetOutputParameterDesc( return E_INVALIDARG; }
- *desc = reflection->osgn->elements[index]; + memcpy(desc, &reflection->osgn->elements[index], sizeof(*desc));
return S_OK; } @@ -608,7 +608,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_shader_reflection_GetPatchConstantParamet return E_INVALIDARG; }
- *desc = reflection->pcsg->elements[index]; + memcpy(desc, &reflection->pcsg->elements[index], sizeof(*desc));
return S_OK; } @@ -1652,7 +1652,7 @@ err_out:
static HRESULT d3dcompiler_parse_signature(struct d3dcompiler_shader_signature *s, struct dxbc_section *section, DWORD target) { - D3D11_SIGNATURE_PARAMETER_DESC *d; + D3D12_SIGNATURE_PARAMETER_DESC *d; unsigned int string_data_offset; unsigned int string_data_size; const char *ptr = section->data; @@ -2442,25 +2442,55 @@ static HRESULT STDMETHODCALLTYPE d3d12_shader_reflection_GetResourceBindingDesc( static HRESULT STDMETHODCALLTYPE d3d12_shader_reflection_GetInputParameterDesc(ID3D12ShaderReflection *iface, UINT index, D3D12_SIGNATURE_PARAMETER_DESC *desc) { - FIXME("iface %p, index %u, desc %p stub.\n", iface, index, desc); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D12ShaderReflection(iface);
- return E_NOTIMPL; + TRACE("iface %p, index %u, desc %p\n", iface, index, desc); + + if (!desc || !reflection->isgn || index >= reflection->isgn->element_count) + { + WARN("Invalid argument specified\n"); + return E_INVALIDARG; + } + + memcpy(desc, &reflection->isgn->elements[index], sizeof(*desc)); + + return S_OK; }
static HRESULT STDMETHODCALLTYPE d3d12_shader_reflection_GetOutputParameterDesc(ID3D12ShaderReflection *iface, UINT index, D3D12_SIGNATURE_PARAMETER_DESC *desc) { - FIXME("iface %p, index %u, desc %p stub.\n", iface, index, desc); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D12ShaderReflection(iface);
- return E_NOTIMPL; + TRACE("iface %p, index %u, desc %p\n", iface, index, desc); + + if (!desc || !reflection->osgn || index >= reflection->osgn->element_count) + { + WARN("Invalid argument specified\n"); + return E_INVALIDARG; + } + + memcpy(desc, &reflection->osgn->elements[index], sizeof(*desc)); + + return S_OK; }
static HRESULT STDMETHODCALLTYPE d3d12_shader_reflection_GetPatchConstantParameterDesc(ID3D12ShaderReflection *iface, UINT index, D3D12_SIGNATURE_PARAMETER_DESC *desc) { - FIXME("iface %p, index %u, desc %p stub.\n", iface, index, desc); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D12ShaderReflection(iface);
- return E_NOTIMPL; + TRACE("iface %p, index %u, desc %p.\n", iface, index, desc); + + if (!desc || !reflection->pcsg || index >= reflection->pcsg->element_count) + { + WARN("Invalid argument specified.\n"); + return E_INVALIDARG; + } + + memcpy(desc, &reflection->pcsg->elements[index], sizeof(*desc)); + + return S_OK; }
static struct ID3D12ShaderReflectionVariable * STDMETHODCALLTYPE d3d12_shader_reflection_GetVariableByName diff --git a/dlls/d3dcompiler_43/tests/reflection.c b/dlls/d3dcompiler_43/tests/reflection.c index e76b855b127..5bdc54ef6a4 100644 --- a/dlls/d3dcompiler_43/tests/reflection.c +++ b/dlls/d3dcompiler_43/tests/reflection.c @@ -384,7 +384,8 @@ static void test_reflection_desc_vs(void) { struct D3D11_SIGNATURE_PARAMETER_DESC_46 desc_46 = {0}; const D3D11_SIGNATURE_PARAMETER_DESC *pdesc; - D3D11_SIGNATURE_PARAMETER_DESC desc = {0}; + D3D11_SIGNATURE_PARAMETER_DESC desc11 = {0}; + D3D12_SIGNATURE_PARAMETER_DESC desc12 = {0}; D3D_MIN_PRECISION expected_min_prec; D3D11_SHADER_DESC sdesc11 = {0}; D3D12_SHADER_DESC sdesc12 = {0}; @@ -456,16 +457,31 @@ static void test_reflection_desc_vs(void)
#if D3D_COMPILER_VERSION ret = ref11->lpVtbl->GetBitwiseInstructionCount(ref11); - ok(ret == 0, "GetBitwiseInstructionCount failed, got %u, expected %u\n", ret, 0); + ok(ret == 0, "Got unexpected ret %u.\n", ret);
ret = ref11->lpVtbl->GetConversionInstructionCount(ref11); - ok(ret == 2, "GetConversionInstructionCount failed, got %u, expected %u\n", ret, 2); + ok(ret == 2, "Got unexpected ret %u.\n", ret);
ret = ref11->lpVtbl->GetMovInstructionCount(ref11); - ok(ret == 10, "GetMovInstructionCount failed, got %u, expected %u\n", ret, 10); + ok(ret == 10, "Got unexpected ret %u.\n", ret);
ret = ref11->lpVtbl->GetMovcInstructionCount(ref11); - ok(ret == 0, "GetMovcInstructionCount failed, got %u, expected %u\n", ret, 0); + ok(ret == 0, "Got unexpected ret %u.\n", ret); + + if (ref12) + { + ret = ref12->lpVtbl->GetBitwiseInstructionCount(ref12); + ok(ret == 0, "Got unexpected ret %u.\n", ret); + + ret = ref12->lpVtbl->GetConversionInstructionCount(ref12); + ok(ret == 2, "Got unexpected ret %u.\n", ret); + + ret = ref12->lpVtbl->GetMovInstructionCount(ref12); + ok(ret == 10, "Got unexpected ret %u.\n", ret); + + ret = ref12->lpVtbl->GetMovcInstructionCount(ref12); + ok(ret == 0, "Got unexpected ret %u.\n", ret); + } #endif
/* GetIn/OutputParameterDesc */ @@ -483,59 +499,74 @@ static void test_reflection_desc_vs(void) { pdesc = &test_reflection_desc_vs_resultin[i];
- hr = ref11->lpVtbl->GetInputParameterDesc(ref11, i, &desc); - ok(hr == S_OK, "GetInputParameterDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK); - - ok(!strcmp(desc.SemanticName, pdesc->SemanticName), "GetInputParameterDesc(%u) SemanticName failed, got "%s", expected "%s"\n", - i, desc.SemanticName, pdesc->SemanticName); - ok(desc.SemanticIndex == pdesc->SemanticIndex, "GetInputParameterDesc(%u) SemanticIndex failed, got %u, expected %u\n", - i, desc.SemanticIndex, pdesc->SemanticIndex); - ok(desc.Register == pdesc->Register, "GetInputParameterDesc(%u) Register failed, got %u, expected %u\n", - i, desc.Register, pdesc->Register); - ok(desc.SystemValueType == pdesc->SystemValueType, "GetInputParameterDesc(%u) SystemValueType failed, got %x, expected %x\n", - i, desc.SystemValueType, pdesc->SystemValueType); - ok(desc.ComponentType == pdesc->ComponentType, "GetInputParameterDesc(%u) ComponentType failed, got %x, expected %x\n", - i, desc.ComponentType, pdesc->ComponentType); - ok(desc.Mask == pdesc->Mask, "GetInputParameterDesc(%u) Mask failed, got %x, expected %x\n", - i, desc.Mask, pdesc->Mask); - ok(desc.ReadWriteMask == pdesc->ReadWriteMask, "GetInputParameterDesc(%u) ReadWriteMask failed, got %x, expected %x\n", - i, desc.ReadWriteMask, pdesc->ReadWriteMask); + hr = ref11->lpVtbl->GetInputParameterDesc(ref11, i, &desc11); + ok(hr == S_OK, "Got unexpected hr %#x, i %u.\n", hr, i); + + ok(!strcmp(desc11.SemanticName, pdesc->SemanticName), "Got unexpected SemanticName "%s", i %u.\n", + desc11.SemanticName, i); + ok(desc11.SemanticIndex == pdesc->SemanticIndex, "Got unexpected SemanticIndex %u, i %u.\n", + desc11.SemanticIndex, i); + ok(desc11.Register == pdesc->Register, "Got unexpected Register %u, i %u.\n", desc11.Register, i); + ok(desc11.SystemValueType == pdesc->SystemValueType, "Got unexpected SystemValueType %u, i %u.\n", + desc11.SystemValueType, i); + ok(desc11.ComponentType == pdesc->ComponentType, "Got unexpected ComponentType %u, i %u.\n", + desc11.ComponentType, i); + ok(desc11.Mask == pdesc->Mask, "Got unexpected SystemValueType %#x, i %u.\n", desc11.Mask, i); + ok(desc11.ReadWriteMask == pdesc->ReadWriteMask, "Got unexpected ReadWriteMask %#x, i %u.\n", + desc11.ReadWriteMask, i); /* The Stream field of D3D11_SIGNATURE_PARAMETER_DESC is in the * trailing padding of the D3D10_SIGNATURE_PARAMETER_DESC struct on * 64-bits and thus undefined. Don't test it. */ if (D3D_COMPILER_VERSION) - ok(desc.Stream == pdesc->Stream, "(%u): got unexpected Stream %u, expected %u.\n", - i, desc.Stream, pdesc->Stream); + ok(desc11.Stream == pdesc->Stream, "Got unexpected Stream %u, i %u.\n", + desc11.Stream, i); else if (sizeof(void *) == 4) - ok(!desc.Stream, "(%u): got unexpected Stream %u.\n", i, desc.Stream); + ok(!desc11.Stream, "Got unexpected Stream %u, i %u.\n", desc11.Stream, i); + + if (ref12) + { + hr = ref12->lpVtbl->GetInputParameterDesc(ref12, i, &desc12); + ok(hr == S_OK, "Got unexpected hr %#x, i %u.\n", hr, i); + + ok(!memcmp(&desc12, &desc11, sizeof(desc11)), "D3D11 and D3D12 descs do not match.\n"); + } }
for (i = 0; i < ARRAY_SIZE(test_reflection_desc_vs_resultout); ++i) { pdesc = &test_reflection_desc_vs_resultout[i];
- hr = ref11->lpVtbl->GetOutputParameterDesc(ref11, i, &desc); - ok(hr == S_OK, "GetOutputParameterDesc(%u) failed, got %x, expected %x\n", i, hr, S_OK); - - ok(!strcmp(desc.SemanticName, pdesc->SemanticName), "GetOutputParameterDesc(%u) SemanticName failed, got "%s", expected "%s"\n", - i, desc.SemanticName, pdesc->SemanticName); - ok(desc.SemanticIndex == pdesc->SemanticIndex, "GetOutputParameterDesc(%u) SemanticIndex failed, got %u, expected %u\n", - i, desc.SemanticIndex, pdesc->SemanticIndex); - ok(desc.Register == pdesc->Register, "GetOutputParameterDesc(%u) Register failed, got %u, expected %u\n", - i, desc.Register, pdesc->Register); - ok(desc.SystemValueType == pdesc->SystemValueType, "GetOutputParameterDesc(%u) SystemValueType failed, got %x, expected %x\n", - i, desc.SystemValueType, pdesc->SystemValueType); - ok(desc.ComponentType == pdesc->ComponentType, "GetOutputParameterDesc(%u) ComponentType failed, got %x, expected %x\n", - i, desc.ComponentType, pdesc->ComponentType); - ok(desc.Mask == pdesc->Mask, "GetOutputParameterDesc(%u) Mask failed, got %x, expected %x\n", - i, desc.Mask, pdesc->Mask); - ok(desc.ReadWriteMask == pdesc->ReadWriteMask, "GetOutputParameterDesc(%u) ReadWriteMask failed, got %x, expected %x\n", - i, desc.ReadWriteMask, pdesc->ReadWriteMask); + hr = ref11->lpVtbl->GetOutputParameterDesc(ref11, i, &desc11); + ok(hr == S_OK, "Got unexpected hr %#x, i %u.\n", hr, i); + + ok(!strcmp(desc11.SemanticName, pdesc->SemanticName), "Got unexpected SemanticName "%s", i %u.\n", + desc11.SemanticName, i); + ok(desc11.SemanticIndex == pdesc->SemanticIndex, "Got unexpected SemanticIndex %u, i %u.\n", + desc11.SemanticIndex, i); + ok(desc11.Register == pdesc->Register, "Got unexpected Register %u, i %u.\n", desc11.Register, i); + ok(desc11.SystemValueType == pdesc->SystemValueType, "Got unexpected SystemValueType %u, i %u.\n", + desc11.SystemValueType, i); + ok(desc11.ComponentType == pdesc->ComponentType, "Got unexpected ComponentType %u, i %u.\n", + desc11.ComponentType, i); + ok(desc11.Mask == pdesc->Mask, "Got unexpected SystemValueType %#x, i %u.\n", desc11.Mask, i); + ok(desc11.ReadWriteMask == pdesc->ReadWriteMask, "Got unexpected ReadWriteMask %#x, i %u.\n", + desc11.ReadWriteMask, i); + /* The Stream field of D3D11_SIGNATURE_PARAMETER_DESC is in the + * trailing padding of the D3D10_SIGNATURE_PARAMETER_DESC struct on + * 64-bits and thus undefined. Don't test it. */ if (D3D_COMPILER_VERSION) - ok(desc.Stream == pdesc->Stream, "(%u): got unexpected Stream %u, expected %u.\n", - i, desc.Stream, pdesc->Stream); + ok(desc11.Stream == pdesc->Stream, "Got unexpected Stream %u, i %u.\n", + desc11.Stream, i); else if (sizeof(void *) == 4) - ok(!desc.Stream, "(%u): got unexpected Stream %u.\n", i, desc.Stream); + ok(!desc11.Stream, "Got unexpected Stream %u, i %u.\n", desc11.Stream, i); + + if (ref12) + { + hr = ref12->lpVtbl->GetOutputParameterDesc(ref12, i, &desc12); + ok(hr == S_OK, "Got unexpected hr %#x, i %u.\n", hr, i); + + ok(!memcmp(&desc12, &desc11, sizeof(desc11)), "D3D11 and D3D12 descs do not match.\n"); + } }
if (ref12) @@ -545,7 +576,7 @@ static void test_reflection_desc_vs(void) }
count = ref11->lpVtbl->Release(ref11); - ok(count == 0, "Release failed %u\n", count); + ok(count == 0, "Got unexpected ref count %u.\n", count); }
/*
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=76810
Your paranoid android.
=== debiant (32 bit report) ===
d3d10: reflection.c:171: Test failed: Got unexpected hr 0. reflection.c:180: Test failed: Got unexpected hr 0x80004002. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00421137).
Report validation errors: d3d10:reflection crashed (c0000005)
=== debiant (32 bit Chinese:China report) ===
d3d10: reflection.c:171: Test failed: Got unexpected hr 0. reflection.c:180: Test failed: Got unexpected hr 0x80004002. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00421137).
Report validation errors: d3d10:reflection crashed (c0000005)
=== debiant (32 bit WoW report) ===
d3d10: reflection.c:171: Test failed: Got unexpected hr 0. reflection.c:180: Test failed: Got unexpected hr 0x80004002. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00421137).
Report validation errors: d3d10:reflection crashed (c0000005)
=== debiant (64 bit WoW report) ===
d3d10: reflection.c:171: Test failed: Got unexpected hr 0. reflection.c:180: Test failed: Got unexpected hr 0x80004002. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00421137).
Report validation errors: d3d10:reflection crashed (c0000005)