Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
November 2021
- 83 participants
- 2620 messages
Re: [PATCH] d2d1: Explicitly set default blend state.
by Henri Verbeet
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
Nov. 3, 2021
[PATCH] evr/presenter: Add presented frames counter.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/evr/presenter.c | 29 +++++++++++++++++++++++++++--
dlls/evr/tests/evr.c | 25 +++++++++++++++++++++++++
2 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/dlls/evr/presenter.c b/dlls/evr/presenter.c
index 9aef960dbb8..0381cb3e593 100644
--- a/dlls/evr/presenter.c
+++ b/dlls/evr/presenter.c
@@ -116,6 +116,12 @@ struct video_presenter
unsigned int ar_mode;
unsigned int state;
unsigned int flags;
+
+ struct
+ {
+ int presented;
+ } frame_stats;
+
CRITICAL_SECTION cs;
};
@@ -532,6 +538,7 @@ static void video_presenter_sample_present(struct video_presenter *presenter, IM
}
IDirect3DSwapChain9_Present(presenter->swapchain, &src, &dst, NULL, NULL, 0);
+ presenter->frame_stats.presented++;
IDirect3DDevice9_Release(device);
IDirect3DSurface9_Release(backbuffer);
@@ -934,6 +941,7 @@ static HRESULT WINAPI video_presenter_OnClockStop(IMFVideoPresenter *iface, MFTI
EnterCriticalSection(&presenter->cs);
presenter->state = PRESENTER_STATE_STOPPED;
+ presenter->frame_stats.presented = 0;
LeaveCriticalSection(&presenter->cs);
return S_OK;
@@ -1766,9 +1774,26 @@ static HRESULT WINAPI video_presenter_qualprop_get_FramesDroppedInRenderer(IQual
static HRESULT WINAPI video_presenter_qualprop_get_FramesDrawn(IQualProp *iface, int *frames)
{
- FIXME("%p, %p stub.\n", iface, frames);
+ struct video_presenter *presenter = impl_from_IQualProp(iface);
+ HRESULT hr = S_OK;
- return E_NOTIMPL;
+ TRACE("%p, %p.\n", iface, frames);
+
+ EnterCriticalSection(&presenter->cs);
+
+ switch (presenter->state)
+ {
+ case PRESENTER_STATE_STARTED:
+ case PRESENTER_STATE_PAUSED:
+ if (frames) *frames = presenter->frame_stats.presented;
+ else hr = E_POINTER;
+ default:
+ hr = E_NOTIMPL;
+ }
+
+ LeaveCriticalSection(&presenter->cs);
+
+ return hr;
}
static HRESULT WINAPI video_presenter_qualprop_get_AvgFrameRate(IQualProp *iface, int *avg_frame_rate)
diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c
index 48115388993..57b64937b79 100644
--- a/dlls/evr/tests/evr.c
+++ b/dlls/evr/tests/evr.c
@@ -2240,6 +2240,8 @@ static void test_presenter_quality_control(void)
MF_QUALITY_DROP_MODE mode;
IMFQualityAdvise *advise;
MF_QUALITY_LEVEL level;
+ IQualProp *qual_prop;
+ int frame_count;
HRESULT hr;
hr = MFCreateVideoPresenter(NULL, &IID_IDirect3DDevice9, &IID_IMFVideoPresenter, (void **)&presenter);
@@ -2293,6 +2295,17 @@ todo_wine {
IMFQualityAdvise_Release(advise);
+ hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IQualProp, (void **)&qual_prop);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ hr = IQualProp_get_FramesDrawn(qual_prop, NULL);
+ ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+
+ hr = IQualProp_get_FramesDrawn(qual_prop, &frame_count);
+ ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+
+ IQualProp_Release(qual_prop);
+
IMFVideoPresenter_Release(presenter);
}
@@ -2432,6 +2445,8 @@ static void test_presenter_shutdown(void)
IMFVideoPresenter *presenter;
IMFVideoDeviceID *deviceid;
HWND window, window2;
+ IQualProp *qual_prop;
+ int frame_count;
HRESULT hr;
DWORD mode;
RECT rect;
@@ -2453,6 +2468,9 @@ static void test_presenter_shutdown(void)
hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFVideoDisplayControl, (void **)&display_control);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IQualProp, (void **)&qual_prop);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
hr = IMFTopologyServiceLookupClient_ReleaseServicePointers(lookup_client);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
@@ -2505,9 +2523,16 @@ static void test_presenter_shutdown(void)
hr = IMFVideoDisplayControl_RepaintVideo(display_control);
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
+ hr = IQualProp_get_FramesDrawn(qual_prop, NULL);
+ ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+
+ hr = IQualProp_get_FramesDrawn(qual_prop, &frame_count);
+ ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+
hr = IMFTopologyServiceLookupClient_ReleaseServicePointers(lookup_client);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ IQualProp_Release(qual_prop);
IMFVideoDeviceID_Release(deviceid);
IMFVideoDisplayControl_Release(display_control);
IMFTopologyServiceLookupClient_Release(lookup_client);
--
2.33.0
Nov. 3, 2021
Re: [PATCH v5 4/4] ntdll: Don't return the last NULL address when capturing frames.
by Giovanni Mascellani
Signed-off-by: Giovanni Mascellani <gmascellani(a)codeweavers.com>
On 03/11/21 11:41, Paul Gofman wrote:
> Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com>
> ---
> dlls/ntdll/signal_i386.c | 2 +-
> dlls/ntdll/signal_x86_64.c | 2 +-
> dlls/ntdll/tests/exception.c | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
> index b28684839b7..5613af4bce0 100644
> --- a/dlls/ntdll/signal_i386.c
> +++ b/dlls/ntdll/signal_i386.c
> @@ -496,7 +496,7 @@ ULONG WINAPI capture_stack_back_trace( ULONG skip, ULONG count, PVOID *buffer, U
>
> for (i = 0; i < count; i++)
> {
> - if (!is_valid_frame( frame )) break;
> + if (!is_valid_frame( frame ) || !frame[1]) break;
> if (i >= skip)
> {
> buffer[num_entries++] = (void *)frame[1];
> diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
> index 4a9c7d4b9ff..0b6bbc09ed0 100644
> --- a/dlls/ntdll/signal_x86_64.c
> +++ b/dlls/ntdll/signal_x86_64.c
> @@ -1516,7 +1516,7 @@ ULONG WINAPI capture_stack_back_trace( ULONG skip, ULONG count, PVOID *buffer, U
> status = virtual_unwind( UNW_FLAG_NHANDLER, &dispatch, &context );
> if (status != STATUS_SUCCESS) break;
>
> - if (!dispatch.EstablisherFrame) break;
> + if (!dispatch.EstablisherFrame || !context.Rip) break;
>
> if ((dispatch.EstablisherFrame & 7) ||
> dispatch.EstablisherFrame < (ULONG64)NtCurrentTeb()->Tib.StackLimit ||
> diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
> index 6e57c94703c..60f5472793f 100644
> --- a/dlls/ntdll/tests/exception.c
> +++ b/dlls/ntdll/tests/exception.c
> @@ -9143,7 +9143,7 @@ static void test_walk_stack(void)
> {
> ok(addrs[i] == addrs2[i], "i %u, addresses do not match, %p vs %p.\n", i, addrs[i], addrs2[i]);
> }
> - todo_wine ok(!!addrs[frame_count - 1], "Expected non-NULL last address.\n");
> + ok(!!addrs[frame_count - 1], "Expected non-NULL last address.\n");
>
> for (requested_count = frame_count - 1; requested_count <= frame_count + 1; ++requested_count)
> {
>
Nov. 3, 2021
Re: [PATCH v5 3/4] ntdll: Also capture first frame in back trace on x86.
by Giovanni Mascellani
Signed-off-by: Giovanni Mascellani <gmascellani(a)codeweavers.com>
On 03/11/21 11:41, Paul Gofman wrote:
> Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com>
> ---
> dlls/ntdll/signal_i386.c | 5 +----
> dlls/ntdll/tests/exception.c | 2 --
> 2 files changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
> index ff3e837c784..b28684839b7 100644
> --- a/dlls/ntdll/signal_i386.c
> +++ b/dlls/ntdll/signal_i386.c
> @@ -490,9 +490,6 @@ ULONG WINAPI capture_stack_back_trace( ULONG skip, ULONG count, PVOID *buffer, U
> ULONG *frame;
> ULONG num_entries = 0;
>
> - ++skip;
> - ++count;
> -
> RtlCaptureContext( &context );
> if (hash) *hash = 0;
> frame = (ULONG *)context.Ebp;
> @@ -507,7 +504,7 @@ ULONG WINAPI capture_stack_back_trace( ULONG skip, ULONG count, PVOID *buffer, U
> }
> frame = (ULONG *)*frame;
> }
> - return i ? i - 1 : 0;
> + return i;
> }
>
>
> diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
> index 6f3b08b5ea6..6e57c94703c 100644
> --- a/dlls/ntdll/tests/exception.c
> +++ b/dlls/ntdll/tests/exception.c
> @@ -9134,10 +9134,8 @@ static void test_walk_stack(void)
>
> start = test_walk_stack;
> end = (BYTE *)start + 0x1000;
> - todo_wine_if(sizeof(void *) == 4)
> ok(addrs[0] >= start && addrs[0] < end, "Address is not inside test function, start %p, end %p, addr %p.\n",
> start, end, addrs[0]);
> - todo_wine_if(sizeof(void *) == 4)
> ok(addrs2[0] >= start && addrs2[0] < end, "Address is not inside test function, start %p, end %p, addr %p.\n",
> start, end, addrs2[0]);
>
>
Nov. 3, 2021
Re: [PATCH v5 2/4] ntdll: Implement RtlWalkFrameChain() for x86 and x86_64.
by Giovanni Mascellani
Signed-off-by: Giovanni Mascellani <gmascellani(a)codeweavers.com>
On 03/11/21 11:41, Paul Gofman wrote:
> Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com>
> ---
> v5:
> - also test for requested_count == frame_count + 1.
>
> dlls/ntdll/exception.c | 24 ++++++++-
> dlls/ntdll/ntdll.spec | 2 +-
> dlls/ntdll/signal_i386.c | 17 +++---
> dlls/ntdll/signal_x86_64.c | 7 +--
> dlls/ntdll/tests/exception.c | 83 +++++++++++++++++++++++++++++
> dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +-
> include/ddk/ntddk.h | 3 ++
> include/winnt.h | 2 +
> 8 files changed, 124 insertions(+), 16 deletions(-)
>
> diff --git a/dlls/ntdll/exception.c b/dlls/ntdll/exception.c
> index e956d8a722f..b020b829ae7 100644
> --- a/dlls/ntdll/exception.c
> +++ b/dlls/ntdll/exception.c
> @@ -30,6 +30,7 @@
> #define WIN32_NO_STATUS
> #include "windef.h"
> #include "winternl.h"
> +#include "ddk/ntddk.h"
> #include "ddk/wdm.h"
> #include "wine/exception.h"
> #include "wine/list.h"
> @@ -1074,6 +1075,25 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer,
> {
> ULONG ret;
>
> - ret = capture_stack_back_trace( skip, count, buffer, hash );
> - return min( ret, (USHORT)~0 );
> + ret = capture_stack_back_trace( skip, skip + count, buffer, hash );
> + if (ret < skip) return 0;
> + return min( ret - skip, (USHORT)~0 );
> +}
> +
> +
> +/**********************************************************************
> + * RtlWalkFrameChain (NTDLL.@)
> + */
> +ULONG WINAPI RtlWalkFrameChain( void **callers, ULONG count, ULONG skip )
> +{
> + TRACE( "callers %p, count %u, skip %#x.\n", callers, count, skip );
> +
> + if (skip & ~(0xff << RTL_STACK_WALKING_MODE_FRAMES_TO_SKIP_SHIFT))
> + {
> + WARN( "Invalid flags %#x.\n", skip );
> + return 0;
> + }
> + skip >>= RTL_STACK_WALKING_MODE_FRAMES_TO_SKIP_SHIFT;
> +
> + return capture_stack_back_trace( skip, count, callers, NULL );
> }
> diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
> index 13e65f65139..c54b2e205aa 100644
> --- a/dlls/ntdll/ntdll.spec
> +++ b/dlls/ntdll/ntdll.spec
> @@ -1073,7 +1073,7 @@
> @ stdcall RtlWakeAddressSingle(ptr)
> @ stdcall RtlWakeAllConditionVariable(ptr)
> @ stdcall RtlWakeConditionVariable(ptr)
> -@ stub RtlWalkFrameChain
> +@ stdcall RtlWalkFrameChain(ptr long long)
> @ stdcall RtlWalkHeap(long ptr)
> @ stdcall RtlWow64EnableFsRedirection(long)
> @ stdcall RtlWow64EnableFsRedirectionEx(long ptr)
> diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
> index 26150ce877b..ff3e837c784 100644
> --- a/dlls/ntdll/signal_i386.c
> +++ b/dlls/ntdll/signal_i386.c
> @@ -488,27 +488,26 @@ ULONG WINAPI capture_stack_back_trace( ULONG skip, ULONG count, PVOID *buffer, U
> CONTEXT context;
> ULONG i;
> ULONG *frame;
> + ULONG num_entries = 0;
>
> ++skip;
> + ++count;
>
> RtlCaptureContext( &context );
> if (hash) *hash = 0;
> frame = (ULONG *)context.Ebp;
>
> - while (skip--)
> - {
> - if (!is_valid_frame( frame )) return 0;
> - frame = (ULONG *)*frame;
> - }
> -
> for (i = 0; i < count; i++)
> {
> if (!is_valid_frame( frame )) break;
> - buffer[i] = (void *)frame[1];
> - if (hash) *hash += frame[1];
> + if (i >= skip)
> + {
> + buffer[num_entries++] = (void *)frame[1];
> + if (hash) *hash += frame[1];
> + }
> frame = (ULONG *)*frame;
> }
> - return i;
> + return i ? i - 1 : 0;
> }
>
>
> diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
> index 5f3c8f70208..4a9c7d4b9ff 100644
> --- a/dlls/ntdll/signal_x86_64.c
> +++ b/dlls/ntdll/signal_x86_64.c
> @@ -1504,16 +1504,17 @@ ULONG WINAPI capture_stack_back_trace( ULONG skip, ULONG count, PVOID *buffer, U
> TRACE( "(%u, %u, %p, %p)\n", skip, count, buffer, hash );
>
> ++skip;
> + ++count;
>
> RtlCaptureContext( &context );
> dispatch.TargetIp = 0;
> dispatch.ContextRecord = &context;
> dispatch.HistoryTable = &table;
> if (hash) *hash = 0;
> - for (i = 0; i < skip + count; i++)
> + for (i = 0; i < count; i++)
> {
> status = virtual_unwind( UNW_FLAG_NHANDLER, &dispatch, &context );
> - if (status != STATUS_SUCCESS) return i;
> + if (status != STATUS_SUCCESS) break;
>
> if (!dispatch.EstablisherFrame) break;
>
> @@ -1532,7 +1533,7 @@ ULONG WINAPI capture_stack_back_trace( ULONG skip, ULONG count, PVOID *buffer, U
> }
> if (hash && num_entries > 0) *hash = hash_pointers( buffer, num_entries );
> TRACE( "captured %u frames\n", num_entries );
> - return num_entries;
> + return i ? i - 1 : 0;
> }
>
>
> diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
> index 6af68317732..6f3b08b5ea6 100644
> --- a/dlls/ntdll/tests/exception.c
> +++ b/dlls/ntdll/tests/exception.c
> @@ -28,6 +28,7 @@
> #include "winnt.h"
> #include "winreg.h"
> #include "winternl.h"
> +#include "ddk/ntddk.h"
> #include "ddk/wdm.h"
> #include "excpt.h"
> #include "wine/test.h"
> @@ -9113,6 +9114,87 @@ static void test_copy_context(void)
> }
> #endif
>
> +static void test_walk_stack(void)
> +{
> + ULONG count, expected, frame_count, requested_count, skip_count;
> + void *addrs[256], *addrs2[256];
> + void *start, *end;
> + unsigned int i, j;
> +
> + memset(addrs, 0xcc, sizeof(addrs));
> + memset(addrs2, 0xcc, sizeof(addrs2));
> +
> + frame_count = RtlCaptureStackBackTrace(0, ARRAY_SIZE(addrs), addrs, NULL);
> + count = RtlWalkFrameChain(addrs2, ARRAY_SIZE(addrs2), 0);
> +
> + trace("frame_count %u.\n", frame_count);
> +
> + ok(frame_count > 1, "Got zero frame_count.\n");
> + ok(count == frame_count, "Got unexpected frame_count %u, count %u.\n", frame_count, count);
> +
> + start = test_walk_stack;
> + end = (BYTE *)start + 0x1000;
> + todo_wine_if(sizeof(void *) == 4)
> + ok(addrs[0] >= start && addrs[0] < end, "Address is not inside test function, start %p, end %p, addr %p.\n",
> + start, end, addrs[0]);
> + todo_wine_if(sizeof(void *) == 4)
> + ok(addrs2[0] >= start && addrs2[0] < end, "Address is not inside test function, start %p, end %p, addr %p.\n",
> + start, end, addrs2[0]);
> +
> + for (i = 1; i < frame_count; ++i)
> + {
> + ok(addrs[i] == addrs2[i], "i %u, addresses do not match, %p vs %p.\n", i, addrs[i], addrs2[i]);
> + }
> + todo_wine ok(!!addrs[frame_count - 1], "Expected non-NULL last address.\n");
> +
> + for (requested_count = frame_count - 1; requested_count <= frame_count + 1; ++requested_count)
> + {
> + for (i = 0; i < 32; ++i)
> + {
> + winetest_push_context("requested_count %u, i %u", requested_count, i);
> + skip_count = (1 << i) >> 8;
> +
> + if (i < RTL_STACK_WALKING_MODE_FRAMES_TO_SKIP_SHIFT
> + || i >= RTL_STACK_WALKING_MODE_FRAMES_TO_SKIP_SHIFT + 8)
> + expected = 0;
> + else
> + expected = min(frame_count, requested_count);
> +
> + memset(addrs2, 0xcc, sizeof(addrs2));
> + count = RtlWalkFrameChain(addrs2, requested_count, 1 << i);
> + ok(count == expected, "Got unexpected frame_count %u, expected %u.\n", count, expected);
> +
> + if (skip_count < count)
> + count -= skip_count;
> + else
> + count = 0;
> +
> + for (j = 0; j < count; ++j)
> + ok( addrs2[j] != (void *)(ULONG_PTR)0xcccccccccccccccc, "Address is not set, j %u.\n", j );
> + for (; j < ARRAY_SIZE(addrs2); ++j)
> + ok( addrs2[j] == (void *)(ULONG_PTR)0xcccccccccccccccc, "Address is set, j %u.\n", j );
> +
> + if (!count)
> + {
> + winetest_pop_context();
> + continue;
> + }
> +
> + memset(addrs, 0xcc, sizeof(addrs));
> + expected = skip_count > frame_count ? 0 : min(frame_count - skip_count, requested_count);
> + count = RtlCaptureStackBackTrace(skip_count, requested_count, addrs, NULL);
> + ok(count == expected, "Got unexpected frame_count %u, expected %u. i %u.\n", count, expected, i);
> +
> + count = min(frame_count, requested_count) - skip_count;
> + for (j = 0; j < count; ++j)
> + {
> + ok(addrs[j] == addrs2[j], "Addresses do not match, j %u, %p, %p.\n", j, addrs[j], addrs2[j]);
> + }
> + winetest_pop_context();
> + }
> + }
> +}
> +
> START_TEST(exception)
> {
> HMODULE hntdll = GetModuleHandleA("ntdll.dll");
> @@ -9339,5 +9421,6 @@ START_TEST(exception)
> test_suspend_thread();
> test_suspend_process();
> test_unload_trace();
> + test_walk_stack();
> VirtualFree(code_mem, 0, MEM_RELEASE);
> }
> diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
> index 0208e2f633f..b94e58ccb26 100644
> --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
> +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
> @@ -1300,7 +1300,7 @@
> @ stdcall RtlVerifyVersionInfo(ptr long int64)
> @ stdcall -arch=arm64,x86_64 RtlVirtualUnwind(long long long ptr ptr ptr ptr ptr)
> @ stub RtlVolumeDeviceToDosName
> -@ stub RtlWalkFrameChain
> +@ stdcall RtlWalkFrameChain(ptr long long)
> @ stdcall RtlWriteRegistryValue(long ptr ptr long ptr long)
> @ stub RtlZeroHeap
> @ stdcall RtlZeroMemory(ptr long)
> diff --git a/include/ddk/ntddk.h b/include/ddk/ntddk.h
> index 41ad3d721bd..ce558139aa6 100644
> --- a/include/ddk/ntddk.h
> +++ b/include/ddk/ntddk.h
> @@ -245,6 +245,8 @@ typedef EXPAND_STACK_CALLOUT *PEXPAND_STACK_CALLOUT;
> typedef GUID UUID;
> #endif
>
> +#define RTL_STACK_WALKING_MODE_FRAMES_TO_SKIP_SHIFT 8
> +
> NTSTATUS WINAPI ExUuidCreate(UUID*);
> NTSTATUS WINAPI IoQueryDeviceDescription(PINTERFACE_TYPE,PULONG,PCONFIGURATION_TYPE,PULONG,
> PCONFIGURATION_TYPE,PULONG,PIO_QUERY_DEVICE_ROUTINE,PVOID);
> @@ -267,5 +269,6 @@ NTSTATUS WINAPI PsSetCreateThreadNotifyRoutine(PCREATE_THREAD_NOTIFY_ROUTINE);
> NTSTATUS WINAPI PsSetLoadImageNotifyRoutine(PLOAD_IMAGE_NOTIFY_ROUTINE);
> void WINAPI RtlInitializeGenericTableAvl(PRTL_AVL_TABLE,PRTL_AVL_COMPARE_ROUTINE,PRTL_AVL_ALLOCATE_ROUTINE, PRTL_AVL_FREE_ROUTINE,void *);
> void WINAPI RtlInsertElementGenericTableAvl(PRTL_AVL_TABLE,void *,ULONG,BOOL*);
> +ULONG WINAPI RtlWalkFrameChain(void **,ULONG,ULONG);
>
> #endif
> diff --git a/include/winnt.h b/include/winnt.h
> index ef731e29c52..eb1bd165720 100644
> --- a/include/winnt.h
> +++ b/include/winnt.h
> @@ -1840,6 +1840,8 @@ NTSYSAPI PVOID WINAPI RtlVirtualUnwind(DWORD,ULONG_PTR,ULONG_PTR,RUNTIME_FUNCT
>
> #endif
>
> +NTSYSAPI USHORT WINAPI RtlCaptureStackBackTrace(ULONG,ULONG,void **,ULONG *);
> +
> /*
> * Product types
> */
>
Nov. 3, 2021
Re: [PATCH v5 1/4] ntdll: Factor out capture_stack_back_trace() helper.
by Giovanni Mascellani
Signed-off-by: Giovanni Mascellani <gmascellani(a)codeweavers.com>
On 03/11/21 11:41, Paul Gofman wrote:
> Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com>
> ---
> v5:
> - fix max USHORT value.
>
> dlls/ntdll/exception.c | 12 ++++++++++++
> dlls/ntdll/ntdll_misc.h | 2 ++
> dlls/ntdll/signal_arm.c | 4 ++--
> dlls/ntdll/signal_arm64.c | 4 ++--
> dlls/ntdll/signal_i386.c | 6 ++++--
> dlls/ntdll/signal_x86_64.c | 10 ++++++----
> 6 files changed, 28 insertions(+), 10 deletions(-)
>
> diff --git a/dlls/ntdll/exception.c b/dlls/ntdll/exception.c
> index c3714e8369b..e956d8a722f 100644
> --- a/dlls/ntdll/exception.c
> +++ b/dlls/ntdll/exception.c
> @@ -1065,3 +1065,15 @@ NTSTATUS WINAPI RtlCopyExtendedContext( CONTEXT_EX *dst, ULONG context_flags, CO
> memcpy( &dst_xs->YmmContext, &src_xs->YmmContext, sizeof(dst_xs->YmmContext) );
> return STATUS_SUCCESS;
> }
> +
> +
> +/*************************************************************************
> + * RtlCaptureStackBackTrace (NTDLL.@)
> + */
> +USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer, ULONG *hash )
> +{
> + ULONG ret;
> +
> + ret = capture_stack_back_trace( skip, count, buffer, hash );
> + return min( ret, (USHORT)~0 );
> +}
> diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
> index 34af6b780cf..31a33b04dbf 100644
> --- a/dlls/ntdll/ntdll_misc.h
> +++ b/dlls/ntdll/ntdll_misc.h
> @@ -57,6 +57,8 @@ extern void WINAPI KiUserCallbackDispatcher(ULONG,void*,ULONG) DECLSPEC_HIDDEN;
> extern RUNTIME_FUNCTION *lookup_function_info( ULONG_PTR pc, ULONG_PTR *base, LDR_DATA_TABLE_ENTRY **module ) DECLSPEC_HIDDEN;
> #endif
>
> +extern ULONG WINAPI capture_stack_back_trace( ULONG skip, ULONG count, PVOID *buffer, ULONG *hash ) DECLSPEC_HIDDEN;
> +
> /* debug helpers */
> extern LPCSTR debugstr_us( const UNICODE_STRING *str ) DECLSPEC_HIDDEN;
> extern const char *debugstr_exception_code( DWORD code ) DECLSPEC_HIDDEN;
> diff --git a/dlls/ntdll/signal_arm.c b/dlls/ntdll/signal_arm.c
> index 0ef210a0331..241ddc3ce70 100644
> --- a/dlls/ntdll/signal_arm.c
> +++ b/dlls/ntdll/signal_arm.c
> @@ -300,9 +300,9 @@ __ASM_STDCALL_FUNC( RtlRaiseException, 4,
> "bl " __ASM_NAME("RtlRaiseStatus") )
>
> /*************************************************************************
> - * RtlCaptureStackBackTrace (NTDLL.@)
> + * capture_stack_back_trace
> */
> -USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer, ULONG *hash )
> +ULONG WINAPI capture_stack_back_trace( ULONG skip, ULONG count, PVOID *buffer, ULONG *hash )
> {
> FIXME( "(%d, %d, %p, %p) stub!\n", skip, count, buffer, hash );
> return 0;
> diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c
> index 290639b676b..1bffbe7efe9 100644
> --- a/dlls/ntdll/signal_arm64.c
> +++ b/dlls/ntdll/signal_arm64.c
> @@ -1473,9 +1473,9 @@ __ASM_STDCALL_FUNC( RtlRaiseException, 4,
> "bl " __ASM_NAME("RtlRaiseStatus") /* does not return */ );
>
> /*************************************************************************
> - * RtlCaptureStackBackTrace (NTDLL.@)
> + * capture_stack_back_trace
> */
> -USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer, ULONG *hash )
> +ULONG WINAPI capture_stack_back_trace( ULONG skip, ULONG count, PVOID *buffer, ULONG *hash )
> {
> FIXME( "(%d, %d, %p, %p) stub!\n", skip, count, buffer, hash );
> return 0;
> diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
> index 14971032ce6..26150ce877b 100644
> --- a/dlls/ntdll/signal_i386.c
> +++ b/dlls/ntdll/signal_i386.c
> @@ -481,14 +481,16 @@ __ASM_STDCALL_FUNC( RtlRaiseException, 4,
>
>
> /*************************************************************************
> - * RtlCaptureStackBackTrace (NTDLL.@)
> + * capture_stack_back_trace
> */
> -USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer, ULONG *hash )
> +ULONG WINAPI capture_stack_back_trace( ULONG skip, ULONG count, PVOID *buffer, ULONG *hash )
> {
> CONTEXT context;
> ULONG i;
> ULONG *frame;
>
> + ++skip;
> +
> RtlCaptureContext( &context );
> if (hash) *hash = 0;
> frame = (ULONG *)context.Ebp;
> diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
> index ef32eba68b7..5f3c8f70208 100644
> --- a/dlls/ntdll/signal_x86_64.c
> +++ b/dlls/ntdll/signal_x86_64.c
> @@ -1490,19 +1490,21 @@ static inline ULONG hash_pointers( void **ptrs, ULONG count )
>
>
> /*************************************************************************
> - * RtlCaptureStackBackTrace (NTDLL.@)
> + * capture_stack_back_trace
> */
> -USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer, ULONG *hash )
> +ULONG WINAPI capture_stack_back_trace( ULONG skip, ULONG count, PVOID *buffer, ULONG *hash )
> {
> UNWIND_HISTORY_TABLE table;
> DISPATCHER_CONTEXT dispatch;
> CONTEXT context;
> NTSTATUS status;
> ULONG i;
> - USHORT num_entries = 0;
> + ULONG num_entries = 0;
>
> TRACE( "(%u, %u, %p, %p)\n", skip, count, buffer, hash );
>
> + ++skip;
> +
> RtlCaptureContext( &context );
> dispatch.TargetIp = 0;
> dispatch.ContextRecord = &context;
> @@ -1529,7 +1531,7 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer,
> if (i >= skip) buffer[num_entries++] = (void *)context.Rip;
> }
> if (hash && num_entries > 0) *hash = hash_pointers( buffer, num_entries );
> - TRACE( "captured %hu frames\n", num_entries );
> + TRACE( "captured %u frames\n", num_entries );
> return num_entries;
> }
>
>
Nov. 3, 2021
Re: [PATCH v5 3/4] ntdll: Also capture first frame in back trace on x86.
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=101234
Your paranoid android.
=== debiant2 (32 bit Chinese:China report) ===
ntdll:
virtual: Timeout
Nov. 3, 2021
[PATCH] winebuild: Fix relay entry points in Thumb mode with binutils/ELF and LLVM/PE
by Martin Storsjö
b1fe783adee51b5c3d3c0dc58e5dc1e81fd46299 fixed relay entry points
in Thumb mode when assembled with Clang/LLVM in ELF mode, but broke
them when assembled with binutils as (and PE mode with LLVM didn't
work either before or after).
When/where the thumb bit is applied on symbols varies a lot between
assemblers; this is a notoriously vague and undocumented area.
After a .thumb_func directive, binutils as considers the next
non-local symbol as a thumb symbol, to have the thumb bit set.
LLVM's built-in assembler considers the next symbol, local or not,
to be a thumb symbol. (Just noting for reference for possible
solutions, this particular difference didn't play a role so far.)
Secondly, in a symbol difference expression like this:
.long symbol1 - symbol2
Binutils as ignores the potential thumb state for both symbols and
just calculates the raw distance. LLVM does include the thumb bit
in symbol1 but ignores it in symbol2.
Finally, for PE targets, the linker sets the thumb bit on all
absolute addresses pointing to the text section, regardless of any
.thumb_func directives at assembly time. (I.e., the
__wine_spec_relay_entry_points entry in .L__wine_spec_relay_descr
gets the bit set even if it wasn't marked as .thumb_func.)
Therefore, mark __wine_spec_relay_entry_points as .thumb_func, as
the absolute address to it will end up with the thumb bit set in
PE builds in any case.
Don't mark the individual relay entry pointers as thumb functions
(the code still is generated as thumb as there hasn't been any
mode switch back to arm mode); this makes the differences calculated
correctly (both LLVM and binutils ignore the thumb state of the
subtracted label).
If desired, one could change __wine_spec_relay_entry_point_%d into
local labels with a .L prefix, just as before
b1fe783adee51b5c3d3c0dc58e5dc1e81fd46299 again, it doesn't make
any difference in this form.
Signed-off-by: Martin Storsjö <martin(a)martin.st>
---
tools/winebuild/spec32.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index 513778ad10c..36df296b9c1 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -248,6 +248,7 @@ static void output_relay_debug( DLLSPEC *spec )
/* then the relay thunks */
output( "\t.text\n" );
+ if (thumb_mode) output( "\t.thumb_func\n" );
output( "__wine_spec_relay_entry_points:\n" );
output( "\tnop\n" ); /* to avoid 0 offset */
@@ -303,7 +304,6 @@ static void output_relay_debug( DLLSPEC *spec )
has_float = is_float_arg( odp, j );
output( "\t.align %d\n", get_alignment(4) );
- if (thumb_mode) output( "\t.thumb_func\n" );
output( "__wine_spec_relay_entry_point_%d:\n", i );
output_cfi( ".cfi_startproc" );
output( "\tpush {r0-r3}\n" );
--
2.25.1
Nov. 3, 2021
Re: [PATCH vkd3d v2 7/7] vkd3d-shader/hlsl: Parse the Sample() method.
by Giovanni Mascellani
Signed-off-by: Giovanni Mascellani <gmascellani(a)codeweavers.com>
On 02/11/21 22:31, Zebediah Figura wrote:
> Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
> ---
> libs/vkd3d-shader/hlsl.c | 30 +++++++++++++++------
> libs/vkd3d-shader/hlsl.h | 8 +++---
> libs/vkd3d-shader/hlsl.y | 46 +++++++++++++++++++++++++++++++-
> libs/vkd3d-shader/hlsl_codegen.c | 8 ++++++
> libs/vkd3d-shader/hlsl_sm4.c | 4 +++
> 5 files changed, 84 insertions(+), 12 deletions(-)
>
> diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
> index a72e0a18f..da4f10a9f 100644
> --- a/libs/vkd3d-shader/hlsl.c
> +++ b/libs/vkd3d-shader/hlsl.c
> @@ -627,8 +627,9 @@ struct hlsl_ir_load *hlsl_new_var_load(struct hlsl_ctx *ctx, struct hlsl_ir_var
> }
>
> struct hlsl_ir_resource_load *hlsl_new_resource_load(struct hlsl_ctx *ctx, struct hlsl_type *data_type,
> - enum hlsl_resource_load_type type, struct hlsl_ir_var *resource, struct hlsl_ir_node *offset,
> - struct hlsl_ir_node *coords, const struct vkd3d_shader_location *loc)
> + enum hlsl_resource_load_type type, struct hlsl_ir_var *resource, struct hlsl_ir_node *resource_offset,
> + struct hlsl_ir_var *sampler, struct hlsl_ir_node *sampler_offset, struct hlsl_ir_node *coords,
> + const struct vkd3d_shader_location *loc)
> {
> struct hlsl_ir_resource_load *load;
>
> @@ -637,7 +638,9 @@ struct hlsl_ir_resource_load *hlsl_new_resource_load(struct hlsl_ctx *ctx, struc
> init_node(&load->node, HLSL_IR_RESOURCE_LOAD, data_type, *loc);
> load->load_type = type;
> load->resource.var = resource;
> - hlsl_src_from_node(&load->resource.offset, offset);
> + hlsl_src_from_node(&load->resource.offset, resource_offset);
> + load->sampler.var = sampler;
> + hlsl_src_from_node(&load->sampler.offset, sampler_offset);
> hlsl_src_from_node(&load->coords, coords);
> return load;
> }
> @@ -1059,12 +1062,19 @@ static void dump_ir_var(struct hlsl_ctx *ctx, struct vkd3d_string_buffer *buffer
>
> static void dump_deref(struct vkd3d_string_buffer *buffer, const struct hlsl_deref *deref)
> {
> - vkd3d_string_buffer_printf(buffer, "%s", deref->var->name);
> - if (deref->offset.node)
> + if (deref->var)
> + {
> + vkd3d_string_buffer_printf(buffer, "%s", deref->var->name);
> + if (deref->offset.node)
> + {
> + vkd3d_string_buffer_printf(buffer, "[");
> + dump_src(buffer, &deref->offset);
> + vkd3d_string_buffer_printf(buffer, "]");
> + }
> + }
> + else
> {
> - vkd3d_string_buffer_printf(buffer, "[");
> - dump_src(buffer, &deref->offset);
> - vkd3d_string_buffer_printf(buffer, "]");
> + vkd3d_string_buffer_printf(buffer, "(nil)");
> }
> }
>
> @@ -1239,10 +1249,13 @@ static void dump_ir_resource_load(struct vkd3d_string_buffer *buffer, const stru
> static const char *const type_names[] =
> {
> [HLSL_RESOURCE_LOAD] = "load_resource",
> + [HLSL_RESOURCE_SAMPLE] = "sample",
> };
>
> vkd3d_string_buffer_printf(buffer, "%s(resource = ", type_names[load->load_type]);
> dump_deref(buffer, &load->resource);
> + vkd3d_string_buffer_printf(buffer, ", sampler = ");
> + dump_deref(buffer, &load->sampler);
> vkd3d_string_buffer_printf(buffer, ", coords = ");
> dump_src(buffer, &load->coords);
> vkd3d_string_buffer_printf(buffer, ")");
> @@ -1419,6 +1432,7 @@ static void free_ir_loop(struct hlsl_ir_loop *loop)
> static void free_ir_resource_load(struct hlsl_ir_resource_load *load)
> {
> hlsl_src_remove(&load->coords);
> + hlsl_src_remove(&load->sampler.offset);
> hlsl_src_remove(&load->resource.offset);
> vkd3d_free(load);
> }
> diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h
> index a7503d5c8..eae962321 100644
> --- a/libs/vkd3d-shader/hlsl.h
> +++ b/libs/vkd3d-shader/hlsl.h
> @@ -376,13 +376,14 @@ struct hlsl_ir_load
> enum hlsl_resource_load_type
> {
> HLSL_RESOURCE_LOAD,
> + HLSL_RESOURCE_SAMPLE,
> };
>
> struct hlsl_ir_resource_load
> {
> struct hlsl_ir_node node;
> enum hlsl_resource_load_type load_type;
> - struct hlsl_deref resource;
> + struct hlsl_deref resource, sampler;
> struct hlsl_src coords;
> };
>
> @@ -703,8 +704,9 @@ struct hlsl_ir_load *hlsl_new_load(struct hlsl_ctx *ctx, struct hlsl_ir_var *var
> struct hlsl_type *type, struct vkd3d_shader_location loc);
> struct hlsl_ir_loop *hlsl_new_loop(struct hlsl_ctx *ctx, struct vkd3d_shader_location loc);
> struct hlsl_ir_resource_load *hlsl_new_resource_load(struct hlsl_ctx *ctx, struct hlsl_type *data_type,
> - enum hlsl_resource_load_type type, struct hlsl_ir_var *resource, struct hlsl_ir_node *offset,
> - struct hlsl_ir_node *coords, const struct vkd3d_shader_location *loc);
> + enum hlsl_resource_load_type type, struct hlsl_ir_var *resource, struct hlsl_ir_node *resource_offset,
> + struct hlsl_ir_var *sampler, struct hlsl_ir_node *sampler_offset, struct hlsl_ir_node *coords,
> + const struct vkd3d_shader_location *loc);
> struct hlsl_ir_store *hlsl_new_simple_store(struct hlsl_ctx *ctx, struct hlsl_ir_var *lhs, struct hlsl_ir_node *rhs);
> struct hlsl_ir_store *hlsl_new_store(struct hlsl_ctx *ctx, struct hlsl_ir_var *var, struct hlsl_ir_node *offset,
> struct hlsl_ir_node *rhs, unsigned int writemask, struct vkd3d_shader_location loc);
> diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
> index aae0ebcea..3d0a9ceda 100644
> --- a/libs/vkd3d-shader/hlsl.y
> +++ b/libs/vkd3d-shader/hlsl.y
> @@ -1803,7 +1803,51 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
> return false;
>
> if (!(load = hlsl_new_resource_load(ctx, object_type->e.resource_format, HLSL_RESOURCE_LOAD,
> - object_load->src.var, object_load->src.offset.node, coords, loc)))
> + object_load->src.var, object_load->src.offset.node, NULL, NULL, coords, loc)))
> + return false;
> + list_add_tail(instrs, &load->node.entry);
> + return true;
> + }
> + else if (!strcmp(name, "Sample"))
> + {
> + const unsigned int sampler_dim = sampler_dim_count(object_type->sampler_dim);
> + const struct hlsl_type *sampler_type;
> + struct hlsl_ir_resource_load *load;
> + struct hlsl_ir_load *sampler_load;
> + struct hlsl_ir_node *coords;
> +
> + if (params->args_count != 2 && params->args_count != 3)
> + {
> + hlsl_error(ctx, *loc, VKD3D_SHADER_ERROR_HLSL_WRONG_PARAMETER_COUNT,
> + "Wrong number of arguments to method 'Sample': expected 2 or 3, but got %u.", params->args_count);
> + return false;
> + }
> + if (params->args_count == 3)
> + FIXME("Ignoring offset parameter.\n");
> +
> + sampler_type = params->args[0]->data_type;
> + if (sampler_type->type != HLSL_CLASS_OBJECT || sampler_type->base_type != HLSL_TYPE_SAMPLER
> + || sampler_type->sampler_dim != HLSL_SAMPLER_DIM_GENERIC)
> + {
> + struct vkd3d_string_buffer *string;
> +
> + if ((string = hlsl_type_to_string(ctx, sampler_type)))
> + hlsl_error(ctx, *loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
> + "Wrong type for argument 0 of Sample(): expected 'sampler', but got '%s'.", string->buffer);
> + hlsl_release_string_buffer(ctx, string);
> + return false;
> + }
> +
> + /* Only HLSL_IR_LOAD can return an object. */
> + sampler_load = hlsl_ir_load(params->args[0]);
> +
> + if (!(coords = add_implicit_conversion(ctx, instrs, params->args[1],
> + hlsl_get_vector_type(ctx, HLSL_TYPE_FLOAT, sampler_dim), loc)))
> + coords = params->args[1];
> +
> + if (!(load = hlsl_new_resource_load(ctx, object_type->e.resource_format,
> + HLSL_RESOURCE_SAMPLE, object_load->src.var, object_load->src.offset.node,
> + sampler_load->src.var, sampler_load->src.offset.node, coords, loc)))
> return false;
> list_add_tail(instrs, &load->node.entry);
> return true;
> diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c
> index df10ca272..24b8205c1 100644
> --- a/libs/vkd3d-shader/hlsl_codegen.c
> +++ b/libs/vkd3d-shader/hlsl_codegen.c
> @@ -651,6 +651,14 @@ static void compute_liveness_recurse(struct hlsl_block *block, unsigned int loop
> var->last_read = max(var->last_read, var_last_read);
> if (load->resource.offset.node)
> load->resource.offset.node->last_read = instr->index;
> +
> + if ((var = load->sampler.var))
> + {
> + var->last_read = max(var->last_read, var_last_read);
> + if (load->sampler.offset.node)
> + load->sampler.offset.node->last_read = instr->index;
> + }
> +
> load->coords.node->last_read = instr->index;
> break;
> }
> diff --git a/libs/vkd3d-shader/hlsl_sm4.c b/libs/vkd3d-shader/hlsl_sm4.c
> index 5ab7df5f9..cef7d6b0f 100644
> --- a/libs/vkd3d-shader/hlsl_sm4.c
> +++ b/libs/vkd3d-shader/hlsl_sm4.c
> @@ -1449,6 +1449,10 @@ static void write_sm4_resource_load(struct hlsl_ctx *ctx,
> case HLSL_RESOURCE_LOAD:
> write_sm4_ld(ctx, buffer, resource_type, &load->node, &load->resource, coords);
> break;
> +
> + case HLSL_RESOURCE_SAMPLE:
> + hlsl_fixme(ctx, load->node.loc, "Resource sample instruction.");
> + break;
> }
> }
>
>
Nov. 3, 2021
Re: [PATCH vkd3d v2 6/7] vkd3d-shader/hlsl: Lex the SamplerState keyword.
by Giovanni Mascellani
Signed-off-by: Giovanni Mascellani <gmascellani(a)codeweavers.com>
On 02/11/21 22:31, Zebediah Figura wrote:
> Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
> ---
> libs/vkd3d-shader/hlsl.l | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/libs/vkd3d-shader/hlsl.l b/libs/vkd3d-shader/hlsl.l
> index 762a8a026..caf8fe8f9 100644
> --- a/libs/vkd3d-shader/hlsl.l
> +++ b/libs/vkd3d-shader/hlsl.l
> @@ -109,6 +109,7 @@ sampler3D {return KW_SAMPLER3D; }
> samplerCUBE {return KW_SAMPLERCUBE; }
> sampler_state {return KW_SAMPLER_STATE; }
> SamplerComparisonState {return KW_SAMPLERCOMPARISONSTATE;}
> +SamplerState {return KW_SAMPLER; }
> shared {return KW_SHARED; }
> stateblock {return KW_STATEBLOCK; }
> stateblock_state {return KW_STATEBLOCK_STATE; }
>
Nov. 3, 2021