From: Connor McAdams conmanx360@gmail.com
Signed-off-by: Connor McAdams conmanx360@gmail.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dcompiler_43/reflection.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index f480c72986f..7a278114821 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -1930,17 +1930,37 @@ static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetResourceBindingDesc( static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetInputParameterDesc(ID3D10ShaderReflection *iface, UINT index, D3D10_SIGNATURE_PARAMETER_DESC *desc) { - FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D10ShaderReflection(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 d3d10_shader_reflection_GetOutputParameterDesc(ID3D10ShaderReflection *iface, UINT index, D3D10_SIGNATURE_PARAMETER_DESC *desc) { - FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D10ShaderReflection(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 const struct ID3D10ShaderReflectionVtbl d3d10_shader_reflection_vtbl =
From: Connor McAdams conmanx360@gmail.com
Signed-off-by: Connor McAdams conmanx360@gmail.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dcompiler_43/reflection.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 7a278114821..02210df7d5e 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -1922,9 +1922,19 @@ static struct ID3D10ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d10_sha static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetResourceBindingDesc(ID3D10ShaderReflection *iface, UINT index, D3D10_SHADER_INPUT_BIND_DESC *desc) { - FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D10ShaderReflection(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 d3d10_shader_reflection_GetInputParameterDesc(ID3D10ShaderReflection *iface,
From: Connor McAdams conmanx360@gmail.com
Signed-off-by: Connor McAdams conmanx360@gmail.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dcompiler_43/reflection.c | 87 ++++++++++++++++++++++++++++++-- 1 file changed, 83 insertions(+), 4 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 02210df7d5e..6bad13e3a04 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -44,6 +44,7 @@ struct d3dcompiler_shader_signature struct d3dcompiler_shader_reflection_type { ID3D11ShaderReflectionType ID3D11ShaderReflectionType_iface; + ID3D10ShaderReflectionType ID3D10ShaderReflectionType_iface;
DWORD id; struct wine_rb_entry entry; @@ -65,6 +66,7 @@ struct d3dcompiler_shader_reflection_type_member struct d3dcompiler_shader_reflection_variable { ID3D11ShaderReflectionVariable ID3D11ShaderReflectionVariable_iface; + ID3D10ShaderReflectionVariable ID3D10ShaderReflectionVariable_iface;
struct d3dcompiler_shader_reflection_constant_buffer *constant_buffer; struct d3dcompiler_shader_reflection_type *type; @@ -79,6 +81,7 @@ struct d3dcompiler_shader_reflection_variable struct d3dcompiler_shader_reflection_constant_buffer { ID3D11ShaderReflectionConstantBuffer ID3D11ShaderReflectionConstantBuffer_iface; + ID3D10ShaderReflectionConstantBuffer ID3D10ShaderReflectionConstantBuffer_iface;
struct d3dcompiler_shader_reflection *reflection;
@@ -147,11 +150,28 @@ static const struct ID3D11ShaderReflectionConstantBufferVtbl d3dcompiler_shader_ static const struct ID3D11ShaderReflectionVariableVtbl d3dcompiler_shader_reflection_variable_vtbl; static const struct ID3D11ShaderReflectionTypeVtbl d3dcompiler_shader_reflection_type_vtbl;
+static const struct ID3D10ShaderReflectionConstantBufferVtbl d3d10_shader_reflection_constant_buffer_vtbl; +static const struct ID3D10ShaderReflectionVariableVtbl d3d10_shader_reflection_variable_vtbl; +static const struct ID3D10ShaderReflectionTypeVtbl d3d10_shader_reflection_type_vtbl; + /* null objects - needed for invalid calls */ -static struct d3dcompiler_shader_reflection_constant_buffer null_constant_buffer = {{&d3dcompiler_shader_reflection_constant_buffer_vtbl}}; -static struct d3dcompiler_shader_reflection_type null_type = {{&d3dcompiler_shader_reflection_type_vtbl}}; -static struct d3dcompiler_shader_reflection_variable null_variable = {{&d3dcompiler_shader_reflection_variable_vtbl}, - &null_constant_buffer, &null_type}; +static struct d3dcompiler_shader_reflection_constant_buffer null_constant_buffer = +{ + {&d3dcompiler_shader_reflection_constant_buffer_vtbl}, + {&d3d10_shader_reflection_constant_buffer_vtbl} +}; +static struct d3dcompiler_shader_reflection_type null_type = +{ + {&d3dcompiler_shader_reflection_type_vtbl}, + {&d3d10_shader_reflection_type_vtbl} +}; +static struct d3dcompiler_shader_reflection_variable null_variable = +{ + {&d3dcompiler_shader_reflection_variable_vtbl}, + {&d3d10_shader_reflection_variable_vtbl}, + &null_constant_buffer, + &null_type +};
static BOOL copy_name(const char *ptr, char **name) { @@ -1507,6 +1527,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->ID3D10ShaderReflectionConstantBuffer_iface.lpVtbl = &d3d10_shader_reflection_constant_buffer_vtbl; cb->reflection = r;
read_dword(&ptr, &offset); @@ -1986,6 +2007,64 @@ static const struct ID3D10ShaderReflectionVtbl d3d10_shader_reflection_vtbl = d3d10_shader_reflection_GetOutputParameterDesc, };
+static inline struct d3dcompiler_shader_reflection_constant_buffer *impl_from_ID3D10ShaderReflectionConstantBuffer( + ID3D10ShaderReflectionConstantBuffer *iface) +{ + return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection_constant_buffer, + ID3D10ShaderReflectionConstantBuffer_iface); +} + +static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_constant_buffer_GetDesc( + ID3D10ShaderReflectionConstantBuffer *iface, D3D10_SHADER_BUFFER_DESC *desc) +{ + struct d3dcompiler_shader_reflection_constant_buffer *cb = impl_from_ID3D10ShaderReflectionConstantBuffer(iface); + + TRACE("iface %p, desc %p.\n", iface, desc); + + if (cb == &null_constant_buffer) + { + WARN("Null constant buffer specified.\n"); + return E_FAIL; + } + + if (!desc) + { + WARN("Invalid argument specified.\n"); + return E_FAIL; + } + + 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 ID3D10ShaderReflectionVariable * STDMETHODCALLTYPE d3d10_shader_reflection_constant_buffer_GetVariableByIndex( + ID3D10ShaderReflectionConstantBuffer *iface, UINT index) +{ + FIXME("iface %p, index %d stub!\n", iface, index); + + return &null_variable.ID3D10ShaderReflectionVariable_iface; +} + +static ID3D10ShaderReflectionVariable * STDMETHODCALLTYPE d3d10_shader_reflection_constant_buffer_GetVariableByName( + ID3D10ShaderReflectionConstantBuffer *iface, const char *name) +{ + FIXME("iface %p, name %s stub!\n", iface, name); + + return &null_variable.ID3D10ShaderReflectionVariable_iface; +} + +static const struct ID3D10ShaderReflectionConstantBufferVtbl d3d10_shader_reflection_constant_buffer_vtbl = +{ + d3d10_shader_reflection_constant_buffer_GetDesc, + d3d10_shader_reflection_constant_buffer_GetVariableByIndex, + d3d10_shader_reflection_constant_buffer_GetVariableByName, +}; + HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10ShaderReflection **reflector) { struct d3dcompiler_shader_reflection *object;
From: Connor McAdams conmanx360@gmail.com
Signed-off-by: Connor McAdams conmanx360@gmail.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dcompiler_43/reflection.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 6bad13e3a04..a88c444eaae 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -1927,9 +1927,17 @@ static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetDesc(ID3D10ShaderRef static struct ID3D10ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d10_shader_reflection_GetConstantBufferByIndex( ID3D10ShaderReflection *iface, UINT index) { - FIXME("iface %p, index %u stub!\n", iface, index); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D10ShaderReflection(iface);
- return NULL; + TRACE("iface %p, index %u.\n", iface, index); + + if (index >= reflection->constant_buffer_count) + { + WARN("Invalid argument specified.\n"); + return &null_constant_buffer.ID3D10ShaderReflectionConstantBuffer_iface; + } + + return &reflection->constant_buffers[index].ID3D10ShaderReflectionConstantBuffer_iface; }
static struct ID3D10ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d10_shader_reflection_GetConstantBufferByName(
From: Connor McAdams conmanx360@gmail.com
Signed-off-by: Connor McAdams conmanx360@gmail.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dcompiler_43/reflection.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index a88c444eaae..7cfea141c48 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -1943,9 +1943,31 @@ static struct ID3D10ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d10_sha static struct ID3D10ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3d10_shader_reflection_GetConstantBufferByName( ID3D10ShaderReflection *iface, const char *name) { - FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name)); + struct d3dcompiler_shader_reflection *reflection = impl_from_ID3D10ShaderReflection(iface); + unsigned int i;
- return NULL; + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + if (!name) + { + WARN("Invalid argument specified.\n"); + return &null_constant_buffer.ID3D10ShaderReflectionConstantBuffer_iface; + } + + for (i = 0; i < reflection->constant_buffer_count; ++i) + { + struct d3dcompiler_shader_reflection_constant_buffer *d = &reflection->constant_buffers[i]; + + if (!strcmp(d->name, name)) + { + TRACE("Returning ID3D10ShaderReflectionConstantBuffer %p.\n", d); + return &d->ID3D10ShaderReflectionConstantBuffer_iface; + } + } + + WARN("Invalid name specified.\n"); + + return &null_constant_buffer.ID3D10ShaderReflectionConstantBuffer_iface; }
static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_GetResourceBindingDesc(ID3D10ShaderReflection *iface,
From: Connor McAdams conmanx360@gmail.com
Signed-off-by: Connor McAdams conmanx360@gmail.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dcompiler_43/reflection.c | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 7cfea141c48..a79439a3fe5 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -1353,6 +1353,7 @@ static HRESULT d3dcompiler_parse_variables(struct d3dcompiler_shader_reflection_ DWORD offset;
v->ID3D11ShaderReflectionVariable_iface.lpVtbl = &d3dcompiler_shader_reflection_variable_vtbl; + v->ID3D10ShaderReflectionVariable_iface.lpVtbl = &d3d10_shader_reflection_variable_vtbl; v->constant_buffer = cb;
read_dword(&ptr, &offset); @@ -2095,6 +2096,53 @@ static const struct ID3D10ShaderReflectionConstantBufferVtbl d3d10_shader_reflec d3d10_shader_reflection_constant_buffer_GetVariableByName, };
+static inline struct d3dcompiler_shader_reflection_variable *impl_from_ID3D10ShaderReflectionVariable(ID3D10ShaderReflectionVariable *iface) +{ + return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection_variable, ID3D10ShaderReflectionVariable_iface); +} + +static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_variable_GetDesc(ID3D10ShaderReflectionVariable *iface, + D3D10_SHADER_VARIABLE_DESC *desc) +{ + struct d3dcompiler_shader_reflection_variable *var = impl_from_ID3D10ShaderReflectionVariable(iface); + + TRACE("iface %p, desc %p.\n", iface, desc); + + if (var == &null_variable) + { + WARN("Null variable specified.\n"); + return E_FAIL; + } + + if (!desc) + { + WARN("Invalid argument specified.\n"); + return E_FAIL; + } + + desc->Name = var->name; + desc->StartOffset = var->start_offset; + desc->Size = var->size; + desc->uFlags = var->flags; + desc->DefaultValue = var->default_value; + + return S_OK; +} + +static ID3D10ShaderReflectionType * STDMETHODCALLTYPE d3d10_shader_reflection_variable_GetType( + ID3D10ShaderReflectionVariable *iface) +{ + FIXME("iface %p stub!\n", iface); + + return &null_type.ID3D10ShaderReflectionType_iface; +} + +static const struct ID3D10ShaderReflectionVariableVtbl d3d10_shader_reflection_variable_vtbl = +{ + d3d10_shader_reflection_variable_GetDesc, + d3d10_shader_reflection_variable_GetType, +}; + HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10ShaderReflection **reflector) { struct d3dcompiler_shader_reflection *object;