Allows the allocator to be uninitialized and reinitialized.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/wined3d/utils.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 47718c9f710..29326668e07 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -7432,5 +7432,7 @@ bool wined3d_allocator_init(struct wined3d_allocator *allocator, list_init(&allocator->pools[i].chunks); }
+ allocator->free = NULL; + return true; }
From: Matteo Bruni mbruni@codeweavers.com
The buffer might not be bound anymore at the d3d level but that doesn't mean it's not still bound in GL.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/wined3d/buffer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index d259b64bfaf..b994d625f12 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -145,8 +145,7 @@ static void wined3d_buffer_gl_destroy_buffer_object(struct wined3d_buffer_gl *bu if (!buffer_gl->b.buffer_object) return;
- if (context_gl->c.transform_feedback_active && resource->bind_count - && resource->bind_flags & WINED3D_BIND_STREAM_OUTPUT) + if (context_gl->c.transform_feedback_active && resource->bind_flags & WINED3D_BIND_STREAM_OUTPUT) { /* We have to make sure that transform feedback is not active * when deleting a potentially bound transform feedback buffer.
On Sun, 17 Oct 2021 at 22:25, Zebediah Figura zfigura@codeweavers.com wrote:
The buffer might not be bound anymore at the d3d level but that doesn't mean it's not still bound in GL.
Given the amount of effort you put in figuring out why this was needed, I would have expected a somewhat more elaborate commit message, or a (preferably) a comment in the code itself. And in that regard, it wouldn't seem inappropriate to merge patch 5/5 with this one.
- if (context_gl->c.transform_feedback_active && resource->bind_count
&& resource->bind_flags & WINED3D_BIND_STREAM_OUTPUT)
- if (context_gl->c.transform_feedback_active && resource->bind_flags & WINED3D_BIND_STREAM_OUTPUT) { /* We have to make sure that transform feedback is not active * when deleting a potentially bound transform feedback buffer.
It seems a little unfortunate to (potentially) end transform feedback any time a WINED3D_BIND_STREAM_OUTPUT buffer is destroyed. Perhaps it's fine in practice, but it also seems to be the case that we can only get in this particular situation when STATE_STREAM_OUTPUT has been invalidated, in which case we'd end transform feedback later anyway. I.e., calling wined3d_context_gl_end_transform_feedback() here would effectively be free when STATE_STREAM_OUTPUT has been invalidated.
Without the previous patch this yields a GL error on Mesa.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/d3d10core/tests/d3d10core.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c index 157656a22f0..eb49850a5c1 100644 --- a/dlls/d3d10core/tests/d3d10core.c +++ b/dlls/d3d10core/tests/d3d10core.c @@ -15576,8 +15576,8 @@ static void test_stream_output(void)
static void test_stream_output_resume(void) { + ID3D10Buffer *cb, *so_buffer, *so_buffer2, *buffer; struct d3d10core_test_context test_context; - ID3D10Buffer *cb, *so_buffer, *buffer; unsigned int i, j, idx, offset; struct resource_readback rb; ID3D10GeometryShader *gs; @@ -15654,16 +15654,22 @@ static void test_stream_output_resume(void)
cb = create_buffer(device, D3D10_BIND_CONSTANT_BUFFER, sizeof(constants[0]), &constants[0]); so_buffer = create_buffer(device, D3D10_BIND_STREAM_OUTPUT, 1024, NULL); + so_buffer2 = create_buffer(device, D3D10_BIND_STREAM_OUTPUT, 1024, NULL);
ID3D10Device_GSSetShader(device, gs); ID3D10Device_GSSetConstantBuffers(device, 0, 1, &cb);
- offset = 0; - ID3D10Device_SOSetTargets(device, 1, &so_buffer, &offset); - ID3D10Device_ClearRenderTargetView(device, test_context.backbuffer_rtv, &white.x); check_texture_color(test_context.backbuffer, 0xffffffff, 0);
+ /* Draw into a SO buffer and then immediately destroy it, to make sure that + * wined3d doesn't try to rebind transform feedback buffers while transform + * feedback is active. */ + offset = 0; + ID3D10Device_SOSetTargets(device, 1, &so_buffer2, &offset); + draw_color_quad(&test_context, &red); + ID3D10Device_SOSetTargets(device, 1, &so_buffer, &offset); + ID3D10Buffer_Release(so_buffer2); draw_color_quad(&test_context, &red); check_texture_color(test_context.backbuffer, 0xff0000ff, 0);
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=100247
Your paranoid android.
=== w10pro64_ar (64 bit report) ===
d3d10core: d3d10core.c:5608: Test failed: Got unexpected sampler 0000000000000000 in slot 1, expected 0000000000970DA8.
=== debiant2 (32 bit report) ===
d3d10core: d3d10core.c:13166: Test failed: Got {0x80000000, 0x00000000, 0x00000000, 0x00000000}, expected {0x00000000, 0xffffffff, 0x00000000, 0x00000000} at (0, 0), sub-resource 0. d3d10core.c:13166: Test failed: Got {0x00000000, 0x80000000, 0x00000000, 0x00000000}, expected {0xffffffff, 0x00000000, 0x00000000, 0x00000000} at (0, 0), sub-resource 0. d3d10core.c:13166: Test failed: Got {0xffffffff, 0x00000001, 0x00000000, 0x00000000}, expected {0x00000000, 0x00000001, 0x00000000, 0x00000000} at (0, 0), sub-resource 0. d3d10core.c:13166: Test failed: Got {0x00000001, 0xffffffff, 0x00000000, 0x00000000}, expected {0x00000001, 0x00000000, 0x00000000, 0x00000000} at (0, 0), sub-resource 0.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/d3d11/tests/d3d11.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index b701d173e63..9eec5507db7 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -26716,8 +26716,8 @@ static void test_fl10_stream_output_desc(void)
static void test_stream_output_resume(void) { + ID3D11Buffer *cb, *so_buffer, *so_buffer2, *buffer; struct d3d11_test_context test_context; - ID3D11Buffer *cb, *so_buffer, *buffer; unsigned int i, j, idx, offset; ID3D11DeviceContext *context; struct resource_readback rb; @@ -26797,16 +26797,22 @@ static void test_stream_output_resume(void)
cb = create_buffer(device, D3D11_BIND_CONSTANT_BUFFER, sizeof(constants[0]), &constants[0]); so_buffer = create_buffer(device, D3D11_BIND_STREAM_OUTPUT, 1024, NULL); + so_buffer2 = create_buffer(device, D3D11_BIND_STREAM_OUTPUT, 1024, NULL);
ID3D11DeviceContext_GSSetShader(context, gs, NULL, 0); ID3D11DeviceContext_GSSetConstantBuffers(context, 0, 1, &cb);
- offset = 0; - ID3D11DeviceContext_SOSetTargets(context, 1, &so_buffer, &offset); - ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, &white.x); check_texture_color(test_context.backbuffer, 0xffffffff, 0);
+ /* Draw into a SO buffer and then immediately destroy it, to make sure that + * wined3d doesn't try to rebind transform feedback buffers while transform + * feedback is active. */ + offset = 0; + ID3D11DeviceContext_SOSetTargets(context, 1, &so_buffer2, &offset); + draw_color_quad(&test_context, &red); + ID3D11DeviceContext_SOSetTargets(context, 1, &so_buffer, &offset); + ID3D11Buffer_Release(so_buffer2); draw_color_quad(&test_context, &red); check_texture_color(test_context.backbuffer, 0xffffffff, 0);
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=100248
Your paranoid android.
=== w1064v1809 (32 bit report) ===
d3d11: d3d11.c:5920: Test failed: Got unexpected IAVertices count: 0. d3d11.c:5921: Test failed: Got unexpected IAPrimitives count: 0. d3d11.c:5922: Test failed: Got unexpected VSInvocations count: 0. d3d11.c:5925: Test failed: Got unexpected CInvocations count: 0. d3d11.c:5926: Test failed: Got unexpected CPrimitives count: 0.
=== w10pro64 (32 bit report) ===
d3d11: d3d11.c:5765: Test failed: Got unexpected query result 0x0000000000000000.
=== debiant2 (32 bit French report) ===
d3d11: d3d11.c:20087: Test failed: Got 0xdeadbeef, expected 0xfefefefe or 0x80808080 at 128, uvec4 0xfefefefe, 0xfefefefe, 0xfefefefe, 0xfefefefe.
=== debiant2 (32 bit Hebrew:Israel report) ===
d3d11: d3d11.c:5926: Test failed: d3d11.c:6263: Test marked todo: Got unexpected PrimitivesStorageNeeded: 2.
=== debiant2 (32 bit Japanese:Japan report) ===
d3d11: d3d11.c:5943: Test failed: d3d11.c:6002: Test marked todo: Got unexpected hr 0x1.
=== debiant2 (64 bit WoW report) ===
d3d11: d3d11.c:6263: Test failed: d3d11.c:7739: Test marked todo: Got unexpected sampler 00000000029A8C90.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/wined3d/buffer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index b994d625f12..4bb2b210265 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -147,9 +147,9 @@ static void wined3d_buffer_gl_destroy_buffer_object(struct wined3d_buffer_gl *bu
if (context_gl->c.transform_feedback_active && resource->bind_flags & WINED3D_BIND_STREAM_OUTPUT) { - /* We have to make sure that transform feedback is not active - * when deleting a potentially bound transform feedback buffer. - * This may happen when the device is being destroyed. */ + /* It's illegal to (un)bind GL_TRANSFORM_FEEDBACK_BUFFER while transform + * feedback is active. Deleting a buffer implicitly unbinds it, so we + * always end transform feedback here in case this buffer was bound. */ WARN("Deleting buffer object for buffer %p, disabling transform feedback.\n", buffer_gl); wined3d_context_gl_end_transform_feedback(context_gl); }