[PATCH 5/5] d3d9: Report d3d9 adapter group information in device caps.
Zhiyi Zhang
zzhang at codeweavers.com
Mon Mar 16 08:32:05 CDT 2020
On 3/16/20 8:02 PM, Henri Verbeet wrote:
> On Fri, 13 Mar 2020 at 13:07, Zhiyi Zhang <zzhang at codeweavers.com> wrote:
>> -HRESULT vdecl_convert_fvf(DWORD FVF, D3DVERTEXELEMENT9 **ppVertexElements) DECLSPEC_HIDDEN;
>> -D3DFORMAT d3dformat_from_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN;
>> -BOOL is_gdi_compat_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN;
>> -enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format) DECLSPEC_HIDDEN;
>> -unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags, unsigned int usage) DECLSPEC_HIDDEN;
>> -void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *present_parameters,
>> - const struct wined3d_swapchain_desc *swapchain_desc, DWORD presentation_interval) DECLSPEC_HIDDEN;
>> -void d3dcaps_from_wined3dcaps(D3DCAPS9 *caps, const struct wined3d_caps *wined3d_caps) DECLSPEC_HIDDEN;
>> -
>> struct d3d9
>> {
>> IDirect3D9Ex IDirect3D9Ex_iface;
>> @@ -71,6 +62,16 @@ struct d3d9
>> BOOL extended;
>> };
>>
>> +HRESULT vdecl_convert_fvf(DWORD FVF, D3DVERTEXELEMENT9 **ppVertexElements) DECLSPEC_HIDDEN;
>> +D3DFORMAT d3dformat_from_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN;
>> +BOOL is_gdi_compat_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN;
>> +enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format) DECLSPEC_HIDDEN;
>> +unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags, unsigned int usage) DECLSPEC_HIDDEN;
>> +void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *present_parameters,
>> + const struct wined3d_swapchain_desc *swapchain_desc, DWORD presentation_interval) DECLSPEC_HIDDEN;
>> +void d3dcaps_from_wined3dcaps(D3DCAPS9 *caps, const struct wined3d_caps *wined3d_caps,
>> + const struct d3d9 *d3d9, unsigned int adapter_ordinal) DECLSPEC_HIDDEN;
>> +
> If you're going to move these, you may as well fix the parameter
> names. On the other hand, you could also consider doing something like
> the following:
>
> void d3d9_caps_from_wined3dcaps(const struct d3d9 *d3d9, unsigned
> int adapter_ordinal,
> D3DCAPS9 *caps, const struct wined3d_caps *wined3d_caps)
> DECLSPEC_HIDDEN;
>
> and just leaving the other declarations where they are.
So, only moving this function up?
>
>> + /* Get adapter group information */
>> + output_idx = adapter_ordinal;
>> + wined3d_output = d3d9->wined3d_outputs[output_idx];
>> + wined3d_adapter = wined3d_output_get_adapter(wined3d_output);
>> +
>> + master_output = wined3d_adapter_get_output(wined3d_adapter, 0);
>> + for (output_idx = 0; output_idx < d3d9->wined3d_output_count; ++output_idx)
>> + {
>> + if (master_output == d3d9->wined3d_outputs[output_idx])
>> + {
>> + caps->MasterAdapterOrdinal = output_idx;
>> + break;
>> + }
>> + }
>> +
>> + output_count = wined3d_adapter_get_output_count(wined3d_adapter);
>> + for (output_idx = 0; output_idx < output_count; ++output_idx)
>> + {
>> + if (wined3d_output == wined3d_adapter_get_output(wined3d_adapter, output_idx))
>> + {
>> + caps->AdapterOrdinalInGroup = output_idx;
>> + break;
>> + }
>> + }
>> +
>> + caps->NumberOfAdaptersInGroup = caps->AdapterOrdinalInGroup ? 0 : output_count;
>> }
> If you store the output ordinal in the wined3d_output_desc structure,
> the above would become:
>
> caps->MasterAdapterOrdinal = output_idx - output_desc.orindal;
> caps->AdapterOrdinalInGroup = output_desc.ordinal;
Will do. Thanks.
More information about the wine-devel
mailing list