[PATCH] d3d11: Support D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS in ID3D11Device CheckFeatureSupport

Józef Kucia joseph.kucia at gmail.com
Wed Aug 17 07:09:57 CDT 2016


This patch is probably fine because I don't expect that we will expose
compute shaders in SM4 (at least initially).

On Wed, Aug 17, 2016 at 8:52 AM, Alistair Leslie-Hughes
<leslie_alistair at hotmail.com> wrote:
> Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
> ---
>  dlls/d3d11/device.c      | 12 ++++++++++++
>  dlls/d3d11/tests/d3d11.c | 18 ++++++++++++++++++
>  include/d3d11.idl        |  5 +++++
>  3 files changed, 35 insertions(+)
>
> diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
> index df5a4ac..6142ac0 100644
> --- a/dlls/d3d11/device.c
> +++ b/dlls/d3d11/device.c
> @@ -3463,6 +3463,18 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFeatureSupport(ID3D11Device *
>              threading_data->DriverCommandLists = FALSE;
>              return S_OK;
>          }
> +        case D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS:
> +        {
> +            D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS *options = feature_support_data;
> +            if (feature_support_data_size != sizeof(*options))
> +            {
> +                WARN("Invalid data size.\n");
> +                return E_INVALIDARG;
> +            }
> +
> +            options->ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x = FALSE;
> +            return S_OK;
> +        }
>
>          default:
>              FIXME("Unhandled feature %#x.\n", feature);
> diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
> index 330a960..962682d 100644
> --- a/dlls/d3d11/tests/d3d11.c
> +++ b/dlls/d3d11/tests/d3d11.c
> @@ -9188,6 +9188,7 @@ static void test_null_sampler(void)
>  static void test_check_feature_support(void)
>  {
>      D3D11_FEATURE_DATA_THREADING threading[2];
> +    D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS hwopts;

This is not important but I would name it d3d10_hw_opts or d3d10_opts.

>      ID3D11Device *device;
>      ULONG refcount;
>      HRESULT hr;
> @@ -9229,6 +9230,23 @@ static void test_check_feature_support(void)
>      ok(threading->DriverCommandLists == TRUE || threading->DriverCommandLists == FALSE,
>              "Got unexpected command lists %#x.\n", threading->DriverCommandLists);
>
> +    hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, NULL, 0);
> +    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
> +    hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &hwopts, 0);
> +    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
> +    hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &hwopts, sizeof(hwopts) - 1);
> +    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
> +    hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &hwopts, sizeof(hwopts) / 2);
> +    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
> +    hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &hwopts, sizeof(hwopts) + 1);
> +    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
> +    hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &hwopts, sizeof(hwopts) * 2);
> +    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
> +
> +    hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &hwopts, sizeof(hwopts));
> +    ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
> +    trace("Shader support %#x.\n", hwopts.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4);

It should be "ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x".
Besides, the trace() message could more clear, e.g. "Compute shader
support via SM4".

> +
>      refcount = ID3D11Device_Release(device);
>      ok(!refcount, "Device has %u references left.\n", refcount);
>  }
> diff --git a/include/d3d11.idl b/include/d3d11.idl
> index cd177c2..767321b 100644
> --- a/include/d3d11.idl
> +++ b/include/d3d11.idl
> @@ -445,6 +445,11 @@ typedef struct D3D11_FEATURE_DATA_THREADING
>      BOOL DriverCommandLists;
>  } D3D11_FEATURE_DATA_THREADING;
>
> +typedef struct D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS
> +{
> +    BOOL ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x;
> +} D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS;
> +
>  typedef struct D3D11_FEATURE_DATA_D3D11_OPTIONS
>  {
>      BOOL OutputMergerLogicOp;
> --
> 2.8.1
>
>
>



More information about the wine-devel mailing list