Implement GetInputParameterDesc and GetOutputParameterDesc methods for d3d10 shader reflection interface.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- Extra info, the structs being memcpy'd:
typedef struct _D3D10_SIGNATURE_PARAMETER_DESC { LPCSTR SemanticName; UINT SemanticIndex; UINT Register; D3D10_NAME SystemValueType; D3D10_REGISTER_COMPONENT_TYPE ComponentType; BYTE Mask; BYTE ReadWriteMask; } D3D10_SIGNATURE_PARAMETER_DESC;
typedef struct _D3D11_SIGNATURE_PARAMETER_DESC { LPCSTR SemanticName; UINT SemanticIndex; UINT Register; D3D_NAME SystemValueType; D3D_REGISTER_COMPONENT_TYPE ComponentType; BYTE Mask; BYTE ReadWriteMask; UINT Stream; D3D_MIN_PRECISION MinPrecision; } D3D11_SIGNATURE_PARAMETER_DESC; --- 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 d3d083e8d8..9d8ca2e48f 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -1926,17 +1926,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 =
Implement the GetResourceBindingDesc method for d3d10 shader reflection interface.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- Extra info, structs being memcpy'd: typedef struct _D3D10_SHADER_INPUT_BIND_DESC { LPCSTR Name; D3D10_SHADER_INPUT_TYPE Type; UINT BindPoint; UINT BindCount; UINT uFlags; D3D10_RESOURCE_RETURN_TYPE ReturnType; D3D10_SRV_DIMENSION Dimension; UINT NumSamples; } D3D10_SHADER_INPUT_BIND_DESC;
typedef struct _D3D11_SHADER_INPUT_BIND_DESC { LPCSTR Name; D3D_SHADER_INPUT_TYPE Type; UINT BindPoint; UINT BindCount; UINT uFlags; D3D_RESOURCE_RETURN_TYPE ReturnType; D3D_SRV_DIMENSION Dimension; UINT NumSamples; } D3D11_SHADER_INPUT_BIND_DESC;
Might be able to get away with a typecast instead, up to you. --- 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 9d8ca2e48f..f9a65464e7 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -1918,9 +1918,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,
Partially implement ID3D10ShaderReflectionConstantBuffer interface methods.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- dlls/d3dcompiler_43/reflection.c | 76 ++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 4 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index f9a65464e7..e7893a0914 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,16 @@ 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) { @@ -704,6 +712,65 @@ static const struct ID3D11ShaderReflectionVtbl d3dcompiler_shader_reflection_vtb d3dcompiler_shader_reflection_GetRequiresFlags, };
+/* ID3D10ShaderReflectionConstantBuffer methods */ +#ifndef D3D_COMPILER_VERSION +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 *reflection = impl_from_ID3D10ShaderReflectionConstantBuffer(iface); + + TRACE("iface %p, desc %p.\n", iface, desc); + + if (reflection == &null_constant_buffer) + { + WARN("Null constant buffer specified.\n"); + return E_FAIL; + } + + if (!desc) + { + WARN("Invalid argument specified.\n"); + return E_FAIL; + } + + desc->Name = reflection->name; + desc->Type = reflection->type; + desc->Variables = reflection->variable_count; + desc->Size = reflection->size; + desc->uFlags = reflection->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, +}; +#endif + /* ID3D11ShaderReflectionConstantBuffer methods */
static inline struct d3dcompiler_shader_reflection_constant_buffer *impl_from_ID3D11ShaderReflectionConstantBuffer(ID3D11ShaderReflectionConstantBuffer *iface) @@ -1507,6 +1574,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);
Implement GetConstantBufferByIndex and GetConstantBufferByName methods for d3d10 shader reflection interface.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- dlls/d3dcompiler_43/reflection.c | 38 ++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index e7893a0914..4c40c40e58 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -1970,17 +1970,47 @@ 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( 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,
Partially implement ID3D10ShaderReflectionVariable methods.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- dlls/d3dcompiler_43/reflection.c | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 4c40c40e58..e7e0bb69c9 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -860,6 +860,56 @@ static const struct ID3D11ShaderReflectionConstantBufferVtbl d3dcompiler_shader_ d3dcompiler_shader_reflection_constant_buffer_GetVariableByName, };
+/* ID3D10ShaderReflectionVariable methods */ +#ifndef D3D_COMPILER_VERSION +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 *reflection = impl_from_ID3D10ShaderReflectionVariable(iface); + + TRACE("iface %p, desc %p.\n", iface, desc); + + if (reflection == &null_variable) + { + WARN("Null variable specified.\n"); + return E_FAIL; + } + + if (!desc) + { + WARN("Invalid argument specified.\n"); + return E_FAIL; + } + + desc->Name = reflection->name; + desc->StartOffset = reflection->start_offset; + desc->Size = reflection->size; + desc->uFlags = reflection->flags; + desc->DefaultValue = reflection->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, +}; +#endif + /* ID3D11ShaderReflectionVariable methods */
static inline struct d3dcompiler_shader_reflection_variable *impl_from_ID3D11ShaderReflectionVariable(ID3D11ShaderReflectionVariable *iface) @@ -1400,6 +1450,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);
Implement methods for ID3D10ShaderReflectionType interface.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- Extra info, structs being memcpy'd: typedef struct _D3D10_SHADER_TYPE_DESC { D3D10_SHADER_VARIABLE_CLASS Class; D3D10_SHADER_VARIABLE_TYPE Type; UINT Rows; UINT Columns; UINT Elements; UINT Members; UINT Offset; } D3D10_SHADER_TYPE_DESC;
typedef struct _D3D11_SHADER_TYPE_DESC { D3D_SHADER_VARIABLE_CLASS Class; D3D_SHADER_VARIABLE_TYPE Type; UINT Rows; UINT Columns; UINT Elements; UINT Members; UINT Offset; LPCSTR Name; } D3D11_SHADER_TYPE_DESC; --- dlls/d3dcompiler_43/reflection.c | 109 +++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index e7e0bb69c9..5856c1e008 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -982,6 +982,114 @@ static const struct ID3D11ShaderReflectionVariableVtbl d3dcompiler_shader_reflec d3dcompiler_shader_reflection_variable_GetInterfaceSlot, };
+/* ID3D10ShaderReflectionType methods */ +#ifndef D3D_COMPILER_VERSION +static inline struct d3dcompiler_shader_reflection_type *impl_from_ID3D10ShaderReflectionType(ID3D10ShaderReflectionType *iface) +{ + return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection_type, ID3D10ShaderReflectionType_iface); +} + +static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_type_GetDesc( + ID3D10ShaderReflectionType *iface, D3D10_SHADER_TYPE_DESC *desc) +{ + struct d3dcompiler_shader_reflection_type *reflection = impl_from_ID3D10ShaderReflectionType(iface); + + TRACE("iface %p, desc %p.\n", iface, desc); + + if (reflection == &null_type) + { + WARN("Null type specified.\n"); + return E_FAIL; + } + + if (!desc) + { + WARN("Invalid argument specified.\n"); + return E_FAIL; + } + + memcpy(desc, &reflection->desc, sizeof(*desc)); + + return S_OK; +} + +static ID3D10ShaderReflectionType * STDMETHODCALLTYPE d3d10_shader_reflection_type_GetMemberTypeByIndex( + ID3D10ShaderReflectionType *iface, UINT index) +{ + struct d3dcompiler_shader_reflection_type *reflection = impl_from_ID3D10ShaderReflectionType(iface); + + TRACE("iface %p, index %u.\n", iface, index); + + if (index >= reflection->desc.Members) + { + WARN("Invalid index specified.\n"); + return &null_type.ID3D10ShaderReflectionType_iface; + } + + return &reflection->members[index].type->ID3D10ShaderReflectionType_iface; +} + +static ID3D10ShaderReflectionType * STDMETHODCALLTYPE d3d10_shader_reflection_type_GetMemberTypeByName( + ID3D10ShaderReflectionType *iface, const char *name) +{ + struct d3dcompiler_shader_reflection_type *reflection = impl_from_ID3D10ShaderReflectionType(iface); + unsigned int i; + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + if (!name) + { + WARN("Invalid argument specified.\n"); + return &null_type.ID3D10ShaderReflectionType_iface; + } + + for (i = 0; i < reflection->desc.Members; ++i) + { + struct d3dcompiler_shader_reflection_type_member *member = &reflection->members[i]; + + if (!strcmp(member->name, name)) + { + TRACE("Returning ID3D10ShaderReflectionType %p.\n", member->type); + return &member->type->ID3D10ShaderReflectionType_iface; + } + } + + WARN("Invalid name specified.\n"); + + return &null_type.ID3D10ShaderReflectionType_iface; +} + +static const char * STDMETHODCALLTYPE d3d10_shader_reflection_type_GetMemberTypeName( + ID3D10ShaderReflectionType *iface, UINT index) +{ + struct d3dcompiler_shader_reflection_type *reflection = impl_from_ID3D10ShaderReflectionType(iface); + + TRACE("iface %p, index %u.\n", iface, index); + + if (reflection == &null_type) + { + WARN("Null type specified.\n"); + return "$Invalid"; + } + + if (index >= reflection->desc.Members) + { + WARN("Invalid index specified.\n"); + return NULL; + } + + return reflection->members[index].name; +} + +static const struct ID3D10ShaderReflectionTypeVtbl d3d10_shader_reflection_type_vtbl = +{ + d3d10_shader_reflection_type_GetDesc, + d3d10_shader_reflection_type_GetMemberTypeByIndex, + d3d10_shader_reflection_type_GetMemberTypeByName, + d3d10_shader_reflection_type_GetMemberTypeName, +}; +#endif + /* ID3D11ShaderReflectionType methods */
static inline struct d3dcompiler_shader_reflection_type *impl_from_ID3D11ShaderReflectionType(ID3D11ShaderReflectionType *iface) @@ -1409,6 +1517,7 @@ static struct d3dcompiler_shader_reflection_type *get_reflection_type(struct d3d return NULL;
type->ID3D11ShaderReflectionType_iface.lpVtbl = &d3dcompiler_shader_reflection_type_vtbl; + type->ID3D10ShaderReflectionType_iface.lpVtbl = &d3d10_shader_reflection_type_vtbl; type->id = offset; type->reflection = reflection;
Completes the ID3D10ShaderReflectionVariable method that was previously a stub.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- dlls/d3dcompiler_43/reflection.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 5856c1e008..9d98163fa5 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -898,9 +898,11 @@ static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_variable_GetDesc( static ID3D10ShaderReflectionType * STDMETHODCALLTYPE d3d10_shader_reflection_variable_GetType( ID3D10ShaderReflectionVariable *iface) { - FIXME("iface %p stub!\n", iface); + struct d3dcompiler_shader_reflection_variable *reflection = impl_from_ID3D10ShaderReflectionVariable(iface);
- return &null_type.ID3D10ShaderReflectionType_iface; + TRACE("iface %p\n", iface); + + return &reflection->type->ID3D10ShaderReflectionType_iface; }
static const struct ID3D10ShaderReflectionVariableVtbl d3d10_shader_reflection_variable_vtbl =
Completes ID3D10ShaderReflectionConstantBuffer methods that were previously stubs.
Signed-off-by: Connor McAdams conmanx360@gmail.com --- dlls/d3dcompiler_43/reflection.c | 36 +++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index 9d98163fa5..c0dc99f832 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -750,15 +750,45 @@ static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_constant_buffer_GetDesc static ID3D10ShaderReflectionVariable * STDMETHODCALLTYPE d3d10_shader_reflection_constant_buffer_GetVariableByIndex( ID3D10ShaderReflectionConstantBuffer *iface, UINT index) { - FIXME("iface %p, index %d stub!\n", iface, index); + struct d3dcompiler_shader_reflection_constant_buffer *reflection = impl_from_ID3D10ShaderReflectionConstantBuffer(iface);
- return &null_variable.ID3D10ShaderReflectionVariable_iface; + TRACE("iface %p, index %u.\n", iface, index); + + if (index >= reflection->variable_count) + { + WARN("Invalid index specified.\n"); + return &null_variable.ID3D10ShaderReflectionVariable_iface; + } + + return &reflection->variables[index].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); + struct d3dcompiler_shader_reflection_constant_buffer *reflection = impl_from_ID3D10ShaderReflectionConstantBuffer(iface); + unsigned int i; + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + if (!name) + { + WARN("Invalid argument specified.\n"); + return &null_variable.ID3D10ShaderReflectionVariable_iface; + } + + for (i = 0; i < reflection->variable_count; ++i) + { + struct d3dcompiler_shader_reflection_variable *v = &reflection->variables[i]; + + if (!strcmp(v->name, name)) + { + TRACE("Returning ID3D10ShaderReflectionVariable %p.\n", v); + return &v->ID3D10ShaderReflectionVariable_iface; + } + } + + WARN("Invalid name specified.\n");
return &null_variable.ID3D10ShaderReflectionVariable_iface; }
On Thu, Nov 7, 2019 at 12:43 AM Connor McAdams conmanx360@gmail.com wrote:
Just as an heads up, I'm going to send an updated version of this series over the next few days, on top of the patches I just sent out (most of which seem to be stuck in a limbo for the time being...).