[PATCH 09/10] d3d10: Get resources used by effect shaders.

Matteo Bruni matteo.mystral at gmail.com
Wed Jan 22 09:46:10 CST 2020


On Sat, Dec 7, 2019 at 7:24 PM Connor McAdams <conmanx360 at gmail.com> wrote:
>
> Get the resources that the shader will need to be bound for use by
> searching the effect framework buffers + local variables.
>
> Signed-off-by: Connor McAdams <conmanx360 at gmail.com>
> ---
>  dlls/d3d10/d3d10_private.h | 12 ++++++
>  dlls/d3d10/effect.c        | 82 ++++++++++++++++++++++++++++++++++++++
>  2 files changed, 94 insertions(+)
>
> diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h
> index f3b4e65e1c..87e506d668 100644
> --- a/dlls/d3d10/d3d10_private.h
> +++ b/dlls/d3d10/d3d10_private.h
> @@ -76,6 +76,15 @@ struct d3d10_effect_object
>      } object;
>  };
>
> +struct d3d10_effect_shader_resource
> +{
> +    D3D10_SHADER_INPUT_TYPE in_type;
> +    UINT bind_point;
> +    UINT bind_count;
> +
> +    struct d3d10_effect_variable *resource_variable;
> +};
> +
>  struct d3d10_effect_shader_signature
>  {
>      char *signature;
> @@ -94,6 +103,9 @@ struct d3d10_effect_shader_variable
>          ID3D10PixelShader *ps;
>          ID3D10GeometryShader *gs;
>      } shader;
> +
> +    UINT resources;

We would usually call that "resource_count".

> +    struct d3d10_effect_shader_resource *shader_resource;
>  };
>
>  struct d3d10_effect_state_object_variable
> diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
> index 9898b7f79f..df95724f95 100644
> --- a/dlls/d3d10/effect.c
> +++ b/dlls/d3d10/effect.c
> @@ -657,6 +657,82 @@ static HRESULT shader_chunk_handler(const char *data, DWORD data_size, DWORD tag
>      return S_OK;
>  }
>
> +static HRESULT get_fx10_shader_resources(struct d3d10_effect_variable *v, const void *data, size_t data_size)
> +{
> +    struct d3d10_effect_variable *tmp;

You can probably just call it "var".

> +    struct d3d10_effect_shader_variable *shader_var = &v->u.shader;
> +    ID3D10ShaderReflection *reflector;
> +    D3D10_SHADER_DESC desc;
> +    D3D10_SHADER_INPUT_BIND_DESC rsrc_desc;
> +    unsigned int i, y;
> +    HRESULT hr;
> +
> +    hr = D3D10ReflectShader(data, data_size, &reflector);
> +    if (FAILED(hr)) return hr;
> +
> +    reflector->lpVtbl->GetDesc(reflector, &desc);
> +    shader_var->resources = desc.BoundResources;
> +
> +    if (!(shader_var->shader_resource = heap_calloc(shader_var->resources, sizeof(struct d3d10_effect_shader_resource))))

sizeof(*shader_var->resources)



More information about the wine-devel mailing list