[PATCH 4/6] d3d10/effect: Add a semi-stub for GetShaderDesc().

Matteo Bruni matteo.mystral at gmail.com
Fri Aug 27 04:56:10 CDT 2021


On Thu, Aug 26, 2021 at 7:32 AM Nikolay Sivov <nsivov at codeweavers.com> wrote:
>
> Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
> ---
>  dlls/d3d10/effect.c       | 25 +++++++++++++--
>  dlls/d3d10/tests/effect.c | 66 ++++++++++++++++++++++++++++++++++-----
>  2 files changed, 82 insertions(+), 9 deletions(-)
>
> diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
> index acc7199138b..aa0eef8852d 100644
> --- a/dlls/d3d10/effect.c
> +++ b/dlls/d3d10/effect.c
> @@ -6783,9 +6783,30 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetRawValue(
>  static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetShaderDesc(
>          ID3D10EffectShaderVariable *iface, UINT index, D3D10_EFFECT_SHADER_DESC *desc)
>  {
> -    FIXME("iface %p, index %u, desc %p stub!\n", iface, index, desc);
> +    struct d3d10_effect_variable *v = impl_from_ID3D10EffectShaderVariable(iface);
> +    D3D10_SHADER_DESC shader_desc;
> +    HRESULT hr = S_OK;
>
> -    return E_NOTIMPL;
> +    FIXME("iface %p, index %u, desc %p semi-stub.\n", iface, index, desc);
> +
> +    if (v->type->element_count)
> +        v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));

I wonder if this isn't supposed to do the same thing with
used_shaders[] like in GetOutputSignatureElementDesc().

> diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c
> index 5fcece4695b..17ebafcec37 100644
> --- a/dlls/d3d10/tests/effect.c
> +++ b/dlls/d3d10/tests/effect.c

> @@ -5865,6 +5861,61 @@ static void test_effect_resource_variable(void)
>      ok(!refcount, "Device has %u references left.\n", refcount);
>  }
>
> +static void test_effect_optimize(void)
> +{
> +    D3D10_EFFECT_SHADER_DESC shaderdesc;
> +    ID3D10EffectShaderVariable *gs;
> +    ID3D10EffectVariable *v;
> +    ID3D10Effect* effect;
> +    ID3D10Device *device;
> +    ULONG refcount;
> +    HRESULT hr;
> +
> +    if (!(device = create_device()))
> +    {
> +        skip("Failed to create device, skipping tests.\n");
> +        return;
> +    }
> +
> +    hr = create_effect(fx_local_shader, 0, device, NULL, &effect);
> +    ok(SUCCEEDED(hr), "Failed to create an effect!\n");
> +
> +    v = effect->lpVtbl->GetVariableByName(effect, "g_so");
> +
> +    gs = v->lpVtbl->AsShader(v);
> +    hr = gs->lpVtbl->GetShaderDesc(gs, 0, &shaderdesc);
> +    ok(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr);
> +    ok(!!shaderdesc.pInputSignature, "Expected input signature.\n");
> +    ok(!shaderdesc.IsInline, "Unexpected inline flag.\n");
> +todo_wine {
> +    ok(!!shaderdesc.pBytecode, "Expected bytecode.\n");
> +    ok(shaderdesc.BytecodeLength != 0, "Unexpected bytecode length.\n");
> +}
> +    ok(!strcmp(shaderdesc.SODecl, "SV_POSITION.x"), "Unexpected stream output declaration %s.\n", shaderdesc.SODecl);
> +    ok(shaderdesc.NumInputSignatureEntries != 0, "Unexpected input signature count.\n");
> +    ok(shaderdesc.NumOutputSignatureEntries != 0, "Unexpected input signature count.\n");

Since I'm here anyway... Typo in the ok() message right above.
Small style nit, we usually do !! (or nothing, except that's not
allowed here as the ok() condition) even for numeric expressions when
we want to check for non-zero.



More information about the wine-devel mailing list