From: Matteo Bruni mbruni@codeweavers.com
It might still be bound in GL.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/wined3d/buffer.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index d259b64bfaf..1d0d4d23cc5 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -145,12 +145,16 @@ 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) + && isStateDirty(&context_gl->c, STATE_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 + * meed to end transform feedback here if this buffer was bound. + * + * This should only be possible if STATE_STREAM_OUTPUT is dirty; if we + * do a draw call before destroying this buffer then the draw call will + * already rebind the GL target. */ WARN("Deleting buffer object for buffer %p, disabling transform feedback.\n", buffer_gl); wined3d_context_gl_end_transform_feedback(context_gl); }
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=100382
Your paranoid android.
=== 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.
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
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=100383
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.
=== w1064 (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.
=== w1064_tsign (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: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.
=== debiant2 (32 bit report) ===
d3d11: d3d11.c:9770: Test failed: d3d11.c:15131: Test marked todo: Got hr 0 for WRITE.
=== debiant2 (32 bit French report) ===
d3d11: d3d11.c:5943: Test failed: d3d11.c:6253: Test marked todo: Got unexpected PrimitivesStorageNeeded: 2. d3d11.c:9770: Test failed: d3d11.c:15222: Test marked todo: Got hr 0 for WRITE_DISCARD.
=== debiant2 (32 bit Hindi:India report) ===
d3d11: d3d11.c:9770: Test failed: d3d11.c:15131: Test marked todo: Got hr 0 for WRITE_DISCARD.
=== debiant2 (32 bit Japanese:Japan report) ===
d3d11: d3d11.c:9770: Test failed: d3d11.c:15153: Test marked todo: Test 60: Got unexpected color 0xff00ff00 at (2, 0). d3d11.c:9770: Test failed: Got hr 0 for WRITE_DISCARD.
=== debiant2 (64 bit WoW report) ===
d3d11: d3d11.c:9770: Test failed: d3d11.c:15390: Test marked todo: Got unexpected hr 0 for typeless format (feature level 0xa000).
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com