First part of the continuation of the implementation of non-constant offset dereferences (a.k.a. relative addressing) for SM4, now that we use vsir registers in tpf.c.
As a quick recap: while parsing HLSL we are expressing derefs as paths, and then we are lowering these paths into a single offset node (which is closer to the bytecode) using the replace_deref_path_with_offset() pass, right before register allocation.
This first part of the series splits this offset node into 2 parts:
- A constant uint, which will be called hlsl_deref.offset_const.
- A non-hlsl_ir_constant offset node that will only be present when we need relative addressing, that we will end up calling hlsl_deref.offset_rel.
Both these fields will be analog to the ones used in vsir register indexes, vkd3d_shader_register_index.rel_addr and vkd3d_shader_register_index.offset respectively, which is something we need for the second part of this series.
The following patches are in my [nonconst-offsets-8](https://gitlab.winehq.org/fcasas/vkd3d/-/commits/noncon… branch, if something is not clear in this series, it may be worth skimming through them.
Supersedes !229.
--
v5: vkd3d-shader/tpf: Declare indexable temps.
vkd3d-shader/hlsl: Mark vars that require non-constant dereferences.
vkd3d-shader/hlsl: Rename hlsl_deref.offset to hlsl_deref.rel_offset.
vkd3d-shader/hlsl: Absorb hlsl_ir_constant deref offsets into const_offset.
vkd3d-shader/hlsl: Express deref->offset in whole registers.
vkd3d-shader/hlsl: Split deref-offset into a node and a constant uint.
vkd3d-shader/hlsl: Introduce hlsl_deref_is_lowered() helper.
vkd3d-shader/hlsl: Clean-up instruction block for offset node creation.
tests: Test array indexing with multiple swizzles.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/396
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
--
v25: vkd3d-shader/tpf: Write out 'switch' statements.
vkd3d-shader/hlsl: Add a pass to normalize switch cases blocks.
vkd3d-shader/hlsl: Add a pass to remove unreachable code.
vkd3d-shader/hlsl: Add copy propagation logic for switches.
vkd3d-shader/hlsl: Validate break/continue context.
vkd3d-shader/hlsl: Check for duplicate case statements.
vkd3d-shader/hlsl: Add initial support for parsing 'switch' statements.
tests: Add some tests for the 'switch' statements.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/361
Goes atop MR 408. The last five commits belong to this MR.
--
v3: vkd3d-shader/dxil: Implement the DXIL BINOP instruction.
vkd3d-shader/spirv: Support VKD3D_DATA_UINT in spirv_compiler_emit_neg().
vkd3d-shader/spirv: Handle the UMUL instruction.
vkd3d-shader/spirv: Introduce an IDIV instruction.
vkd3d-shader/spirv: Introduce an FREM instruction.
vkd3d-shader/dxil: Implement the DXIL EXTRACTVAL instruction.
vkd3d-shader/spirv: Support scalar swizzle of vector SSA registers.
vkd3d-shader/dxil: Implement DX instruction CBufferLoadLegacy.
vkd3d-shader/dxil: Implement DX instruction CreateHandle.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/409
The MR is divided to three commits:
1. Extend AddPathCurve3 test with offset and nseg variables
2. Moving main curve implementation from GdipAddPathCurve2 to GdipAddPathCurve3, allow for use offset and nseg variables in GdipAddPathCurve3. The offset and nseg variables, will be used for fixing curve calculation in next commit.
3. Fix GdipAddPathCurve3 curve calculation with offset and nseg variables
--
v3: gdiplus: Fix GdipAddPathCurve3 curve calculation with offset and nseg variables
gdiplus: Move main Curve implementation from GdipAddPathCurve2 to GdipAddPathCurve3
gdiplus/test: Extend AddPathCurve3 test with offset and nseg
https://gitlab.winehq.org/wine/wine/-/merge_requests/4207
In general, ucrtbase allocation are used here (and later ucrtbase.free for freeing memory). RtlCreateUnicodeStringFromAsciiz() is using RtlAllocateHeap(GetProcessHeap(),...) for allocation. Using ucrtbase.free() may results in freeing from a different heap which leaks the string as best or aborts the program when heap validation is enabled.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/4233
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55842
The bug blames commit 059094c1c18ddc33b04eac53a72fd0eb7510be94 ("ntdll: Define heap block's BLOCK_FLAG_LFH as 0x80.") but actually before the blamed commit that worked essentially by chance.
The problem the patch is solving is that RtlValidateHeap() currently always fails for LFH blocks allocated from large block memory (vs subheap blocks). That can happen for large enough LFH block sizes. In case of the regressed game the user of RtlValidateHeap() is msvcr80.msvcrt_heap_free() which uses HeapValidate() to guess the heap used to allocate the pointer to free. I am attaching a standalone test program which can be used to reproduce the problem without the patch.
[test_lfh_validate.c](/uploads/006b04a9a00ffb7949956b66a275d5cf/test_lfh_validate.c)
--
v2: ntdll: Fix pending free block validation in heap_validate() for LFH blocks.
https://gitlab.winehq.org/wine/wine/-/merge_requests/4232
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55842
The bug blames commit 059094c1c18ddc33b04eac53a72fd0eb7510be94 ("ntdll: Define heap block's BLOCK_FLAG_LFH as 0x80.") but actually before the blamed commit that worked essentially by chance.
The problem the patch is solving is that RtlValidateHeap() currently always fails for LFH blocks allocated from large block memory (vs subheap blocks). That can happen for large enough LFH block sizes. In case of the regressed game the user of RtlValidateHeap() is msvcr80.msvcrt_heap_free() which uses HeapValidate() to guess the heap used to allocate the pointer to free. I am attaching a standalone test program which can be used to reproduce the problem without the patch.
[test_lfh_validate.c](/uploads/006b04a9a00ffb7949956b66a275d5cf/test_lfh_validate.c)
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/4232