This adds all of the information used by the spirv backend to declare descriptor
variables. Most of these are added to the internal
vkd3d_shader_scan_descriptor_info1 structure, but patch 5/5 adds a flag to
enum vkd3d_shader_descriptor_info_flag, which is public API.
The ultimate goal here is to declare SPIR-V descriptor variables from the
scanned descriptor information, thereby avoiding the need to synthesize DCL
instructions for frontends that don't have them (specifically sm1, but it may be
that sm6 would benefit from this as well).
That work is visible here:
https://gitlab.winehq.org/zfigura/vkd3d/-/tree/himavant5
--
This is a follow-up to the already-approved 295, which I am submitting now so
that we're not blocked on Alexandre's vacation.
--
v3: vkd3d-shader: Add a flag marking raw buffers to struct vkd3d_shader_descriptor_info.
vkd3d-shader: Add structure stride to struct vkd3d_shader_descriptor_info1.
vkd3d-shader: Add constant buffer size to struct vkd3d_shader_descriptor_info1.
vkd3d-shader: Add sample count to struct vkd3d_shader_descriptor_info1.
vkd3d-shader: Set descriptor flags in the caller to vkd3d_shader_scan_add_descriptor().
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/304
Nikolay Sivov (@nsivov) commented about dlls/mf/scheme_handler.c:
> + if (FAILED(IMFByteStream_QueryInterface(*out, &IID_IMFAttributes, (void **)&attributes)))
> + WARN("Failed to get IMFAttributes interface\n");
> + else
> + {
> + if (FAILED(IMFAttributes_DeleteItem(attributes, &MF_BYTESTREAM_ORIGIN_NAME)))
> + WARN("Failed to delete MF_BYTESTREAM_ORIGIN_NAME attribute\n");
> + if (FAILED(IMFAttributes_SetString(attributes, &MF_BYTESTREAM_EFFECTIVE_URL, url)))
> + WARN("Failed to set MF_BYTESTREAM_EFFECTIVE_URL attribute\n");
> + if (FAILED(IMFAttributes_SetString(attributes, &MF_BYTESTREAM_CONTENT_TYPE, L"application/octet-stream")))
> + WARN("Failed to set MF_BYTESTREAM_CONTENT_TYPE attribute\n");
> + IMFAttributes_Release(attributes);
> + }
> + }
> +
> + IStream_Release(stream);
> + return hr;
Just release ulrmon stream right away, and return if mf stream creation failed. IMFAttributes are probably always available if you're going to use MFCreateMFByteStreamOnStream(). I don't see any value in these warnings.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/3439#note_43002
Nikolay Sivov (@nsivov) commented about dlls/mf/scheme_handler.c:
> IMFSourceResolver *resolver;
> struct list results;
> CRITICAL_SECTION cs;
> + resolve_cb resolve;
> };
I'd rather we call it closer to what it does, for example create_stream().
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/3439#note_43001
Even though the uninitialized values shouldn't be used in the output
binary program, they still show up in it, and affect the checksum, so
we better make them zeroes.
This error was reported by valgrind:
```
libtool --mode=execute valgrind --track-origins=yes vkd3d-build/tests/shader_runner vkd3d/tests/hlsl/static-initializer.shader_test
```
```
==46180== Conditional jump or move depends on uninitialised value(s)
==46180== at 0x48D98C7: parse_dxbc.isra.0 (dxbc.c:182)
==46180== by 0x48DA044: vkd3d_shader_parse_dxbc (dxbc.c:308)
==46180== by 0x488D1B6: vkd3d_shader_parse_dxbc_source_type (vkd3d_shader_utils.h:37)
==46180== by 0x488D1B6: create_shader_stage.isra.0 (state.c:1988)
==46180== by 0x48926B6: d3d12_pipeline_state_init_graphics (state.c:3084)
==46180== by 0x4893A96: d3d12_pipeline_state_create_graphics (state.c:3280)
==46180== by 0x4878498: d3d12_device_CreateGraphicsPipelineState (device.c:2619)
==46180== by 0x1FFEFFECC7: ???
==46180== by 0xE8: ???
==46180== by 0x47: ???
==46180== by 0x61: ???
==46180== by 0x660066000000023: ???
==46180== by 0x661066100000044: ???
==46180== Uninitialised value was created by a stack allocation
==46180== at 0x48F3FF0: hlsl_fold_constant_swizzles (hlsl_constant_ops.c:1010)
```
Thank you valgrind! :smile:
--
v2: vkd3d-shader/hlsl: Initialize unused constant components to zero.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/308