Similar changes were done before for views, that fixed actual issue when object couldn't and shouldn't have been created, but pointer was still used afterwards. These are the same kind of changes for shader objects.
From: Nikolay Sivov nsivov@codeweavers.com
--- dlls/d3d10core/tests/d3d10core.c | 6 ++++++ dlls/d3d11/device.c | 4 ++++ dlls/d3d11/tests/d3d11.c | 6 ++++++ 3 files changed, 16 insertions(+)
diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c index 15f306f9559..3d8a5621a49 100644 --- a/dlls/d3d10core/tests/d3d10core.c +++ b/dlls/d3d10core/tests/d3d10core.c @@ -3890,14 +3890,20 @@ void main(point float4 vin[1] : POSITION, inout TriangleStream<gs_out> vout) refcount = ID3D10VertexShader_Release(vs); ok(!refcount, "Vertex shader has %u references left.\n", refcount);
+ vs = (void *)0xdeadbeef; hr = ID3D10Device_CreateVertexShader(device, vs_2_0, sizeof(vs_2_0), &vs); ok(hr == E_INVALIDARG, "Created a SM2 vertex shader, hr %#x\n", hr); + ok(!vs, "Unexpected pointer %p.\n", vs);
+ vs = (void *)0xdeadbeef; hr = ID3D10Device_CreateVertexShader(device, vs_3_0, sizeof(vs_3_0), &vs); ok(hr == E_INVALIDARG, "Created a SM3 vertex shader, hr %#x\n", hr); + ok(!vs, "Unexpected pointer %p.\n", vs);
+ vs = (void *)0xdeadbeef; hr = ID3D10Device_CreateVertexShader(device, ps_4_0, sizeof(ps_4_0), &vs); ok(hr == E_INVALIDARG, "Created a SM4 vertex shader from a pixel shader source, hr %#x\n", hr); + ok(!vs, "Unexpected pointer %p.\n", vs);
/* pixel shader */ expected_refcount = get_refcount(device) + 1; diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 263613911f8..c1207bf7bc9 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -3469,6 +3469,8 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateVertexShader(ID3D11Device2 * TRACE("iface %p, byte_code %p, byte_code_length %Iu, class_linkage %p, shader %p.\n", iface, byte_code, byte_code_length, class_linkage, shader);
+ *shader = NULL; + if (class_linkage) FIXME("Class linkage is not implemented yet.\n");
@@ -6176,6 +6178,8 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device1 * TRACE("iface %p, byte_code %p, byte_code_length %Iu, shader %p.\n", iface, byte_code, byte_code_length, shader);
+ *shader = NULL; + if (FAILED(hr = d3d_vertex_shader_create(device, byte_code, byte_code_length, &object))) return hr;
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 8225237568f..7ba39cc3447 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -4849,14 +4849,20 @@ static void test_create_shader(const D3D_FEATURE_LEVEL feature_level) ID3D11PixelShader_Release(ps);
/* vertex shader */ + vs = (void *)0xdeadbeef; hr = ID3D11Device_CreateVertexShader(device, vs_2_0, sizeof(vs_2_0), NULL, &vs); ok(hr == E_INVALIDARG, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(!vs, "Unexpected pointer %p.\n", vs);
+ vs = (void *)0xdeadbeef; hr = ID3D11Device_CreateVertexShader(device, vs_3_0, sizeof(vs_3_0), NULL, &vs); ok(hr == E_INVALIDARG, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(!vs, "Unexpected pointer %p.\n", vs);
+ vs = (void *)0xdeadbeef; hr = ID3D11Device_CreateVertexShader(device, ps_4_0, sizeof(ps_4_0), NULL, &vs); ok(hr == E_INVALIDARG, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); + ok(!vs, "Unexpected pointer %p.\n", vs);
expected_refcount = get_refcount(device) + (feature_level >= D3D_FEATURE_LEVEL_10_0); hr = ID3D11Device_CreateVertexShader(device, vs_4_0, sizeof(vs_4_0), NULL, &vs);
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=115665
Your paranoid android.
=== w1064_2qxl (64 bit report) ===
d3d10core: d3d10core.c:4786: Test failed: Got unexpected IAVertices count: 0. d3d10core.c:4787: Test failed: Got unexpected IAPrimitives count: 0. d3d10core.c:4788: Test failed: Got unexpected VSInvocations count: 0. d3d10core.c:4791: Test failed: Got unexpected CInvocations count: 0. d3d10core.c:4792: Test failed: Got unexpected CPrimitives count: 0.
From: Nikolay Sivov nsivov@codeweavers.com
--- dlls/d3d10core/tests/d3d10core.c | 6 ++++++ dlls/d3d11/device.c | 4 ++++ dlls/d3d11/tests/d3d11.c | 6 ++++++ 3 files changed, 16 insertions(+)
diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c index 3d8a5621a49..e292c27f7a1 100644 --- a/dlls/d3d10core/tests/d3d10core.c +++ b/dlls/d3d10core/tests/d3d10core.c @@ -15121,6 +15121,12 @@ float4 main(struct ps_data ps_input) : SV_Target
device = test_context.device;
+ /* Failing case */ + gs = (void *)0xdeadbeef; + hr = ID3D10Device_CreateGeometryShader(device, vs_code, sizeof(vs_code), &gs); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + ok(!gs, "Unexpected pointer %p.\n", gs); + hr = ID3D10Device_CreateInputLayout(device, layout_desc, ARRAY_SIZE(layout_desc), vs_code, sizeof(vs_code), &input_layout); ok(SUCCEEDED(hr), "Failed to create input layout, hr %#x.\n", hr); diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index c1207bf7bc9..396211561ff 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -3492,6 +3492,8 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateGeometryShader(ID3D11Device2 TRACE("iface %p, byte_code %p, byte_code_length %Iu, class_linkage %p, shader %p.\n", iface, byte_code, byte_code_length, class_linkage, shader);
+ *shader = NULL; + if (class_linkage) FIXME("Class linkage is not implemented yet.\n");
@@ -6198,6 +6200,8 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device1 TRACE("iface %p, byte_code %p, byte_code_length %Iu, shader %p.\n", iface, byte_code, byte_code_length, shader);
+ *shader = NULL; + if (FAILED(hr = d3d_geometry_shader_create(device, byte_code, byte_code_length, NULL, 0, NULL, 0, 0, &object))) return hr; diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 7ba39cc3447..2096e6d25c5 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -25526,6 +25526,12 @@ float4 main(struct ps_data ps_input) : SV_Target device = test_context.device; context = test_context.immediate_context;
+ /* Failing case */ + gs = (void *)0xdeadbeef; + hr = ID3D11Device_CreateGeometryShader(device, vs_code, sizeof(vs_code), NULL, &gs); + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + ok(!gs, "Unexpected pointer %p.\n", gs); + hr = ID3D11Device_CreateInputLayout(device, layout_desc, ARRAY_SIZE(layout_desc), vs_code, sizeof(vs_code), &input_layout); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
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=115666
Your paranoid android.
=== w10pro64 (64 bit report) ===
d3d10core: d3d10core.c:4786: Test failed: Got unexpected IAVertices count: 0. d3d10core.c:4787: Test failed: Got unexpected IAPrimitives count: 0. d3d10core.c:4788: Test failed: Got unexpected VSInvocations count: 0. d3d10core.c:4791: Test failed: Got unexpected CInvocations count: 0. d3d10core.c:4792: Test failed: Got unexpected CPrimitives count: 0.
From: Nikolay Sivov nsivov@codeweavers.com
--- dlls/d3d11/device.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 396211561ff..c2cb941ecb0 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -3520,13 +3520,14 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateGeometryShaderWithStreamOutp iface, byte_code, byte_code_length, so_entries, entry_count, buffer_strides, strides_count, rasterizer_stream, class_linkage, shader);
+ *shader = NULL; + if (class_linkage) FIXME("Class linkage is not implemented yet.\n");
if (FAILED(hr = d3d_geometry_shader_create(device, byte_code, byte_code_length, so_entries, entry_count, buffer_strides, strides_count, rasterizer_stream, &object))) { - *shader = NULL; return hr; }
@@ -6226,10 +6227,11 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutp iface, byte_code, byte_code_length, output_stream_decls, output_stream_decl_count, output_stream_stride, shader);
+ *shader = NULL; + if (!output_stream_decl_count && output_stream_stride) { WARN("Stride must be 0 when declaration entry count is 0.\n"); - *shader = NULL; return E_INVALIDARG; }
@@ -6237,7 +6239,6 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutp && !(so_entries = heap_calloc(output_stream_decl_count, sizeof(*so_entries)))) { ERR("Failed to allocate D3D11 SO declaration array memory.\n"); - *shader = NULL; return E_OUTOFMEMORY; }
@@ -6257,7 +6258,6 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutp { WARN("Stride must be 0 when multiple output slots are used.\n"); heap_free(so_entries); - *shader = NULL; return E_INVALIDARG; } } @@ -6267,10 +6267,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutp so_entries, output_stream_decl_count, &output_stream_stride, stride_count, 0, &object); heap_free(so_entries); if (FAILED(hr)) - { - *shader = NULL; return hr; - }
*shader = &object->ID3D10GeometryShader_iface;
From: Nikolay Sivov nsivov@codeweavers.com
--- dlls/d3d10core/tests/d3d10core.c | 5 +++++ dlls/d3d11/device.c | 4 ++++ dlls/d3d11/tests/d3d11.c | 5 +++++ 3 files changed, 14 insertions(+)
diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c index e292c27f7a1..d796087ef3f 100644 --- a/dlls/d3d10core/tests/d3d10core.c +++ b/dlls/d3d10core/tests/d3d10core.c @@ -3906,6 +3906,11 @@ void main(point float4 vin[1] : POSITION, inout TriangleStream<gs_out> vout) ok(!vs, "Unexpected pointer %p.\n", vs);
/* pixel shader */ + ps = (void *)0xdeadbeef; + hr = ID3D10Device_CreatePixelShader(device, vs_2_0, sizeof(vs_2_0), &ps); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + ok(!ps, "Unexpected pointer %p.\n", ps); + expected_refcount = get_refcount(device) + 1; hr = ID3D10Device_CreatePixelShader(device, ps_4_0, sizeof(ps_4_0), &ps); ok(SUCCEEDED(hr), "Failed to create SM4 pixel shader, hr %#x.\n", hr); diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index c2cb941ecb0..7b1c1b9bae0 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -3546,6 +3546,8 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreatePixelShader(ID3D11Device2 *i TRACE("iface %p, byte_code %p, byte_code_length %Iu, class_linkage %p, shader %p.\n", iface, byte_code, byte_code_length, class_linkage, shader);
+ *shader = NULL; + if (class_linkage) FIXME("Class linkage is not implemented yet.\n");
@@ -6284,6 +6286,8 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device1 *i TRACE("iface %p, byte_code %p, byte_code_length %Iu, shader %p.\n", iface, byte_code, byte_code_length, shader);
+ *shader = NULL; + if (FAILED(hr = d3d_pixel_shader_create(device, byte_code, byte_code_length, &object))) return hr;
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 2096e6d25c5..eb3ac35b824 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -4848,6 +4848,11 @@ static void test_create_shader(const D3D_FEATURE_LEVEL feature_level) ok(hr == S_OK, "Feature level %#x: Got unexpected hr %#lx.\n", feature_level, hr); ID3D11PixelShader_Release(ps);
+ ps = (void *)0xdeadbeef; + hr = ID3D11Device_CreatePixelShader(device, vs_2_0, sizeof(vs_2_0), NULL, &ps); + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + ok(!ps, "Unexpected pointer %p.\n", ps); + /* vertex shader */ vs = (void *)0xdeadbeef; hr = ID3D11Device_CreateVertexShader(device, vs_2_0, sizeof(vs_2_0), NULL, &vs);
From: Nikolay Sivov nsivov@codeweavers.com
--- dlls/d3d11/device.c | 2 ++ dlls/d3d11/tests/d3d11.c | 7 +++++++ 2 files changed, 9 insertions(+)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 7b1c1b9bae0..286874af993 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -3569,6 +3569,8 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateHullShader(ID3D11Device2 *if TRACE("iface %p, byte_code %p, byte_code_length %Iu, class_linkage %p, shader %p.\n", iface, byte_code, byte_code_length, class_linkage, shader);
+ *shader = NULL; + if (class_linkage) FIXME("Class linkage is not implemented yet.\n");
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index eb3ac35b824..690f468e6cf 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -4825,6 +4825,7 @@ static void test_create_shader(const D3D_FEATURE_LEVEL feature_level) ID3D11GeometryShader *gs; ID3D11VertexShader *vs; ID3D11PixelShader *ps; + ID3D11HullShader *hs; HRESULT hr;
device_desc.feature_level = &feature_level; @@ -5000,6 +5001,12 @@ static void test_create_shader(const D3D_FEATURE_LEVEL feature_level) ID3D11GeometryShader_Release(gs); }
+ /* Hull shader */ + hs = (void *)0xdeadbeef; + hr = ID3D11Device_CreateHullShader(device, gs_4_0, sizeof(gs_4_0), NULL, &hs); + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + ok(!hs, "Unexpected pointer %p.\n", hs); + refcount = ID3D11Device_Release(device); ok(!refcount, "Device has %lu references left.\n", refcount); }
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=115669
Your paranoid android.
=== debian11 (64 bit WoW report) ===
d3d11: d3d11.c:20192: Test failed: d3d11.c:16507: Test marked todo: Got 0xdeadbeef, expected 0xdbeefaa or 0x80808080 at 128, uvec4 0xaaaaaaaa, 0xdeadbeef, 0xdeadbabe, 0xdeadf00d.
From: Nikolay Sivov nsivov@codeweavers.com
--- dlls/d3d11/device.c | 2 ++ dlls/d3d11/tests/d3d11.c | 7 +++++++ 2 files changed, 9 insertions(+)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 286874af993..b73df94b50c 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -3592,6 +3592,8 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDomainShader(ID3D11Device2 * TRACE("iface %p, byte_code %p, byte_code_length %Iu, class_linkage %p, shader %p.\n", iface, byte_code, byte_code_length, class_linkage, shader);
+ *shader = NULL; + if (class_linkage) FIXME("Class linkage is not implemented yet.\n");
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 690f468e6cf..06cb2bc4273 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -4824,6 +4824,7 @@ static void test_create_shader(const D3D_FEATURE_LEVEL feature_level) ID3D11Device *device, *tmp; ID3D11GeometryShader *gs; ID3D11VertexShader *vs; + ID3D11DomainShader *ds; ID3D11PixelShader *ps; ID3D11HullShader *hs; HRESULT hr; @@ -5007,6 +5008,12 @@ static void test_create_shader(const D3D_FEATURE_LEVEL feature_level) ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); ok(!hs, "Unexpected pointer %p.\n", hs);
+ /* Domain shader */ + ds = (void *)0xdeadbeef; + hr = ID3D11Device_CreateDomainShader(device, gs_4_0, sizeof(gs_4_0), NULL, &ds); + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + ok(!ds, "Unexpected pointer %p.\n", ds); + refcount = ID3D11Device_Release(device); ok(!refcount, "Device has %lu references left.\n", refcount); }
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=115670
Your paranoid android.
=== w1064_2qxl (64 bit report) ===
d3d11: d3d11.c:5822: Test failed: Got unexpected query result 0x0000000000000000.
From: Nikolay Sivov nsivov@codeweavers.com
--- dlls/d3d11/device.c | 2 ++ dlls/d3d11/tests/d3d11.c | 7 +++++++ 2 files changed, 9 insertions(+)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index b73df94b50c..3f08ae5f4f0 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -3615,6 +3615,8 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateComputeShader(ID3D11Device2 TRACE("iface %p, byte_code %p, byte_code_length %Iu, class_linkage %p, shader %p.\n", iface, byte_code, byte_code_length, class_linkage, shader);
+ *shader = NULL; + if (class_linkage) FIXME("Class linkage is not implemented yet.\n");
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 06cb2bc4273..9a1bd88dc8b 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -4823,6 +4823,7 @@ static void test_create_shader(const D3D_FEATURE_LEVEL feature_level) struct device_desc device_desc; ID3D11Device *device, *tmp; ID3D11GeometryShader *gs; + ID3D11ComputeShader *cs; ID3D11VertexShader *vs; ID3D11DomainShader *ds; ID3D11PixelShader *ps; @@ -5014,6 +5015,12 @@ static void test_create_shader(const D3D_FEATURE_LEVEL feature_level) ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); ok(!ds, "Unexpected pointer %p.\n", ds);
+ /* Compute shader */ + ds = (void *)0xdeadbeef; + hr = ID3D11Device_CreateComputeShader(device, gs_4_0, sizeof(gs_4_0), NULL, &cs); + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + ok(!cs, "Unexpected pointer %p.\n", cs); + refcount = ID3D11Device_Release(device); ok(!refcount, "Device has %lu references left.\n", refcount); }
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=115671
Your paranoid android.
=== w1064_tsign (32 bit report) ===
d3d11: d3d11.c:5829: Test failed: Got unexpected query result 0x0000000000000000.