Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dx11_42/d3dx11_42.spec | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/d3dx11_42/d3dx11_42.spec b/dlls/d3dx11_42/d3dx11_42.spec index eaec2fca628..f05e02cf443 100644 --- a/dlls/d3dx11_42/d3dx11_42.spec +++ b/dlls/d3dx11_42/d3dx11_42.spec @@ -6,18 +6,18 @@ @ stub D3DX11CompileFromResourceW @ stub D3DX11ComputeNormalMap @ stub D3DX11CreateAsyncCompilerProcessor -@ stub D3DX11CreateAsyncFileLoaderA -@ stub D3DX11CreateAsyncFileLoaderW -@ stub D3DX11CreateAsyncMemoryLoader -@ stub D3DX11CreateAsyncResourceLoaderA -@ stub D3DX11CreateAsyncResourceLoaderW +@ stdcall D3DX11CreateAsyncFileLoaderA(str ptr) d3dx11_43.D3DX11CreateAsyncFileLoaderA +@ stdcall D3DX11CreateAsyncFileLoaderW(wstr ptr) d3dx11_43.D3DX11CreateAsyncFileLoaderW +@ stdcall D3DX11CreateAsyncMemoryLoader(ptr long ptr) d3dx11_43.D3DX11CreateAsyncMemoryLoader +@ stdcall D3DX11CreateAsyncResourceLoaderA(long str ptr) d3dx11_43.D3DX11CreateAsyncResourceLoaderA +@ stdcall D3DX11CreateAsyncResourceLoaderW(long wstr ptr) d3dx11_43.D3DX11CreateAsyncResourceLoaderW @ stub D3DX11CreateAsyncShaderPreprocessProcessor @ stub D3DX11CreateAsyncShaderResourceViewProcessor @ stub D3DX11CreateAsyncTextureInfoProcessor @ stub D3DX11CreateAsyncTextureProcessor @ stub D3DX11CreateShaderResourceViewFromFileA @ stub D3DX11CreateShaderResourceViewFromFileW -@ stub D3DX11CreateShaderResourceViewFromMemory(ptr ptr long ptr ptr ptr ptr) +@ stdcall D3DX11CreateShaderResourceViewFromMemory(ptr ptr long ptr ptr ptr ptr) d3dx11_43.D3DX11CreateShaderResourceViewFromMemory @ stub D3DX11CreateShaderResourceViewFromResourceA @ stub D3DX11CreateShaderResourceViewFromResourceW @ stub D3DX11CreateTextureFromFileA
From: David Adam david.adam.cnrs@gmail.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- It gives values more similar to the native version and, incidentally, it's faster.
dlls/d3dx9_36/mesh.c | 10 ++++++---- dlls/d3dx9_36/tests/mesh.c | 11 +++++++---- 2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/dlls/d3dx9_36/mesh.c b/dlls/d3dx9_36/mesh.c index fc23745b0b1..62acd211148 100644 --- a/dlls/d3dx9_36/mesh.c +++ b/dlls/d3dx9_36/mesh.c @@ -4565,7 +4565,7 @@ HRESULT WINAPI D3DXCreatePolygon(struct IDirect3DDevice9 *device, float length, struct vertex *vertices; WORD (*faces)[3]; DWORD (*adjacency_buf)[3]; - float scale; + float angle, scale; unsigned int i;
TRACE("device %p, length %f, sides %u, mesh %p, adjacency %p.\n", @@ -4593,7 +4593,9 @@ HRESULT WINAPI D3DXCreatePolygon(struct IDirect3DDevice9 *device, float length, return hr; }
- scale = 0.5f * length / sinf(D3DX_PI / sides); + angle = D3DX_PI / sides; + scale = 0.5f * length / sinf(angle); + angle *= 2.0f;
vertices[0].position.x = 0.0f; vertices[0].position.y = 0.0f; @@ -4604,8 +4606,8 @@ HRESULT WINAPI D3DXCreatePolygon(struct IDirect3DDevice9 *device, float length,
for (i = 0; i < sides; ++i) { - vertices[i + 1].position.x = cosf(2.0f * D3DX_PI * i / sides) * scale; - vertices[i + 1].position.y = sinf(2.0f * D3DX_PI * i / sides) * scale; + vertices[i + 1].position.x = cosf(angle * i) * scale; + vertices[i + 1].position.y = sinf(angle * i) * scale; vertices[i + 1].position.z = 0.0f; vertices[i + 1].normal.x = 0.0f; vertices[i + 1].normal.y = 0.0f; diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c index 82ae90ef758..8fd5938fac6 100644 --- a/dlls/d3dx9_36/tests/mesh.c +++ b/dlls/d3dx9_36/tests/mesh.c @@ -2683,12 +2683,14 @@ static void D3DXCreateBoxTest(void) static BOOL compute_polygon(struct mesh *mesh, float length, unsigned int sides) { unsigned int i; - float scale; + float angle, scale;
if (!new_mesh(mesh, sides + 1, sides)) return FALSE;
- scale = 0.5f * length / sinf(D3DX_PI / sides); + angle = D3DX_PI / sides; + scale = 0.5f * length / sinf(angle); + angle *= 2.0f;
mesh->vertices[0].position.x = 0.0f; mesh->vertices[0].position.y = 0.0f; @@ -2699,8 +2701,8 @@ static BOOL compute_polygon(struct mesh *mesh, float length, unsigned int sides)
for (i = 0; i < sides; ++i) { - mesh->vertices[i + 1].position.x = cosf(2.0f * D3DX_PI * i / sides) * scale; - mesh->vertices[i + 1].position.y = sinf(2.0f * D3DX_PI * i / sides) * scale; + mesh->vertices[i + 1].position.x = cosf(angle * i) * scale; + mesh->vertices[i + 1].position.y = sinf(angle * i) * scale; mesh->vertices[i + 1].position.z = 0.0f; mesh->vertices[i + 1].normal.x = 0.0f; mesh->vertices[i + 1].normal.y = 0.0f; @@ -2807,6 +2809,7 @@ static void D3DXCreatePolygonTest(void) test_polygon(device, 10.0f, 5); test_polygon(device, 10.0f, 10); test_polygon(device, 20.0f, 10); + test_polygon(device, 20.0f, 32000);
free_test_context(test_context); }
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dx9_36/effect.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index a98495e5554..7f54e251a65 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -1555,13 +1555,16 @@ static HRESULT d3dx9_base_effect_set_value(struct d3dx9_base_effect *base, case D3DXPT_TEXTURECUBE: for (i = 0; i < (param->element_count ? param->element_count : 1); ++i) { - IUnknown *unk = ((IUnknown **)data)[i]; - if (unk) - IUnknown_AddRef(unk); + IUnknown *old_texture = ((IUnknown **)param->data)[i]; + IUnknown *new_texture = ((IUnknown **)data)[i];
- unk = ((IUnknown **)param->data)[i]; - if (unk) - IUnknown_Release(unk); + if (new_texture == old_texture) + continue; + + if (new_texture) + IUnknown_AddRef(new_texture); + if (old_texture) + IUnknown_Release(old_texture); } /* fallthrough */ case D3DXPT_VOID:
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- Spurred from a (now ~2 years-old...) patch by Andrey Gusev.
dlls/d3dx9_36/math.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/dlls/d3dx9_36/math.c b/dlls/d3dx9_36/math.c index 856e987cb96..8909c3c6b25 100644 --- a/dlls/d3dx9_36/math.c +++ b/dlls/d3dx9_36/math.c @@ -1987,27 +1987,33 @@ D3DXVECTOR3* WINAPI D3DXVec3TransformNormalArray(D3DXVECTOR3* out, UINT outstrid return out; }
-D3DXVECTOR3* WINAPI D3DXVec3Unproject(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DVIEWPORT9 *pviewport, const D3DXMATRIX *pprojection, const D3DXMATRIX *pview, const D3DXMATRIX *pworld) +D3DXVECTOR3 * WINAPI D3DXVec3Unproject(D3DXVECTOR3 *out, const D3DXVECTOR3 *v, + const D3DVIEWPORT9 *viewport, const D3DXMATRIX *projection, const D3DXMATRIX *view, + const D3DXMATRIX *world) { D3DXMATRIX m;
- TRACE("pout %p, pv %p, pviewport %p, pprojection %p, pview %p, pworlds %p\n", pout, pv, pviewport, pprojection, pview, pworld); + TRACE("out %p, v %p, viewport %p, projection %p, view %p, world %p.\n", + out, v, viewport, projection, view, world);
D3DXMatrixIdentity(&m); - if (pworld) D3DXMatrixMultiply(&m, &m, pworld); - if (pview) D3DXMatrixMultiply(&m, &m, pview); - if (pprojection) D3DXMatrixMultiply(&m, &m, pprojection); + if (world) + D3DXMatrixMultiply(&m, &m, world); + if (view) + D3DXMatrixMultiply(&m, &m, view); + if (projection) + D3DXMatrixMultiply(&m, &m, projection); D3DXMatrixInverse(&m, NULL, &m);
- *pout = *pv; - if (pviewport) + *out = *v; + if (viewport) { - pout->x = 2.0f * ( pout->x - pviewport->X ) / pviewport->Width - 1.0f; - pout->y = 1.0f - 2.0f * ( pout->y - pviewport->Y ) / pviewport->Height; - pout->z = ( pout->z - pviewport->MinZ) / ( pviewport->MaxZ - pviewport->MinZ ); + out->x = 2.0f * (out->x - viewport->X) / viewport->Width - 1.0f; + out->y = 1.0f - 2.0f * (out->y - viewport->Y) / viewport->Height; + out->z = (out->z - viewport->MinZ) / (viewport->MaxZ - viewport->MinZ); } - D3DXVec3TransformCoord(pout, pout, &m); - return pout; + D3DXVec3TransformCoord(out, out, &m); + return out; }
D3DXVECTOR3* WINAPI D3DXVec3UnprojectArray(D3DXVECTOR3* out, UINT outstride, const D3DXVECTOR3* in, UINT instride, const D3DVIEWPORT9* viewport, const D3DXMATRIX* projection, const D3DXMATRIX* view, const D3DXMATRIX* world, UINT elements)
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- Inspired by a (~1 year-old) patch by Alex Henrie.
I'm sure there is still a lot of room for improvement here and elsewhere. Patches welcome :)
dlls/d3dx9_36/tests/mesh.c | 213 ++++++++++++++------------------------------- 1 file changed, 67 insertions(+), 146 deletions(-)
diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c index 8fd5938fac6..6ebd5b82156 100644 --- a/dlls/d3dx9_36/tests/mesh.c +++ b/dlls/d3dx9_36/tests/mesh.c @@ -3791,7 +3791,21 @@ static HRESULT create_outline(struct glyphinfo *glyph, void *raw_outline, int da return S_OK; }
-static BOOL compute_text_mesh(struct mesh *mesh, const char *text, +static void free_outline(struct outline *outline) +{ + HeapFree(GetProcessHeap(), 0, outline->items); +} + +static void free_glyphinfo(struct glyphinfo *glyph) +{ + unsigned int i; + + for (i = 0; i < glyph->outlines.count; ++i) + free_outline(&glyph->outlines.items[i]); + HeapFree(GetProcessHeap(), 0, glyph->outlines.items); +} + +static void compute_text_mesh(struct mesh *mesh, const char *text, float deviation, float extrusion, float otmEMSquare, const struct glyphinfo *glyphs) { DWORD nb_vertices, nb_faces; @@ -3824,8 +3838,7 @@ static BOOL compute_text_mesh(struct mesh *mesh, const char *text, nb_vertices = (nb_outline_points + nb_corners) * 2 + textlen; nb_faces = nb_outline_points * 2;
- if (!new_mesh(mesh, nb_vertices, nb_faces)) - return FALSE; + ok(new_mesh(mesh, nb_vertices, nb_faces), "Failed to create reference text mesh.\n");
/* convert 2D vertices and faces into 3D mesh */ vertex_ptr = mesh->vertices; @@ -3934,8 +3947,6 @@ static BOOL compute_text_mesh(struct mesh *mesh, const char *text, vertex_ptr->normal.z = 1; vertex_ptr++; } - - return TRUE; }
static void compare_text_outline_mesh(const char *name, ID3DXMesh *d3dxmesh, struct mesh *mesh, @@ -3955,93 +3966,48 @@ static void compare_text_outline_mesh(const char *name, ID3DXMesh *d3dxmesh, str number_of_vertices = d3dxmesh->lpVtbl->GetNumVertices(d3dxmesh); number_of_faces = d3dxmesh->lpVtbl->GetNumFaces(d3dxmesh);
- /* vertex buffer */ hr = d3dxmesh->lpVtbl->GetVertexBuffer(d3dxmesh, &vertex_buffer); - ok(hr == D3D_OK, "Test %s, result %x, expected 0 (D3D_OK)\n", name, hr); - if (hr != D3D_OK) - { - skip("Couldn't get vertex buffers\n"); - goto error; - } - + ok(hr == D3D_OK, "Test %s, unexpected hr %#x.\n", name, hr); hr = IDirect3DVertexBuffer9_GetDesc(vertex_buffer, &vertex_buffer_description); - ok(hr == D3D_OK, "Test %s, result %x, expected 0 (D3D_OK)\n", name, hr); - - if (hr != D3D_OK) - { - skip("Couldn't get vertex buffer description\n"); - } + ok(hr == D3D_OK, "Test %s, unexpected hr %#x.\n", name, hr); + ok(vertex_buffer_description.Format == D3DFMT_VERTEXDATA, "Test %s, unexpected format %u.\n", + name, vertex_buffer_description.Format); + ok(vertex_buffer_description.Type == D3DRTYPE_VERTEXBUFFER, "Test %s, unexpected resource type %u.\n", + name, vertex_buffer_description.Type); + ok(!vertex_buffer_description.Usage, "Test %s, unexpected usage %#x.\n", name, vertex_buffer_description.Usage); + ok(vertex_buffer_description.Pool == D3DPOOL_MANAGED, "Test %s, unexpected pool %u.\n", + name, vertex_buffer_description.Pool); + ok(vertex_buffer_description.FVF == mesh->fvf, "Test %s, unexpected FVF %#x (expected %#x).\n", + name, vertex_buffer_description.FVF, mesh->fvf); + if (!mesh->fvf) + expected = number_of_vertices * mesh->vertex_size; else - { - ok(vertex_buffer_description.Format == D3DFMT_VERTEXDATA, "Test %s, result %x, expected %x (D3DFMT_VERTEXDATA)\n", - name, vertex_buffer_description.Format, D3DFMT_VERTEXDATA); - ok(vertex_buffer_description.Type == D3DRTYPE_VERTEXBUFFER, "Test %s, result %x, expected %x (D3DRTYPE_VERTEXBUFFER)\n", - name, vertex_buffer_description.Type, D3DRTYPE_VERTEXBUFFER); - ok(vertex_buffer_description.Usage == 0, "Test %s, result %x, expected %x\n", name, vertex_buffer_description.Usage, 0); - ok(vertex_buffer_description.Pool == D3DPOOL_MANAGED, "Test %s, result %x, expected %x (D3DPOOL_MANAGED)\n", - name, vertex_buffer_description.Pool, D3DPOOL_MANAGED); - ok(vertex_buffer_description.FVF == mesh->fvf, "Test %s, result %x, expected %x\n", - name, vertex_buffer_description.FVF, mesh->fvf); - if (mesh->fvf == 0) - { - expected = number_of_vertices * mesh->vertex_size; - } - else - { - expected = number_of_vertices * D3DXGetFVFVertexSize(mesh->fvf); - } - ok(vertex_buffer_description.Size == expected, "Test %s, result %x, expected %x\n", - name, vertex_buffer_description.Size, expected); - } + expected = number_of_vertices * D3DXGetFVFVertexSize(mesh->fvf); + ok(vertex_buffer_description.Size == expected, "Test %s, unexpected size %u (expected %u).\n", + name, vertex_buffer_description.Size, expected);
hr = d3dxmesh->lpVtbl->GetIndexBuffer(d3dxmesh, &index_buffer); - ok(hr == D3D_OK, "Test %s, result %x, expected 0 (D3D_OK)\n", name, hr); - if (hr != D3D_OK) - { - skip("Couldn't get index buffer\n"); - goto error; - } - + ok(hr == D3D_OK, "Test %s, unexpected hr %#x.\n", name, hr); hr = IDirect3DIndexBuffer9_GetDesc(index_buffer, &index_buffer_description); - ok(hr == D3D_OK, "Test %s, result %x, expected 0 (D3D_OK)\n", name, hr); + ok(hr == D3D_OK, "Test %s, unexpected hr %#x.\n", name, hr); + ok(index_buffer_description.Format == D3DFMT_INDEX16, "Test %s, unexpected format %u.\n", + name, index_buffer_description.Format); + ok(index_buffer_description.Type == D3DRTYPE_INDEXBUFFER, "Test %s, unexpected resource type %u.\n", + name, index_buffer_description.Type); + ok(!index_buffer_description.Usage, "Test %s, unexpected usage %#x.\n", + name, index_buffer_description.Usage); + ok(index_buffer_description.Pool == D3DPOOL_MANAGED, "Test %s, unexpected pool %u.\n", + name, index_buffer_description.Pool); + expected = number_of_faces * sizeof(WORD) * 3; + ok(index_buffer_description.Size == expected, "Test %s, unexpected size %u.\n", + name, index_buffer_description.Size);
- if (hr != D3D_OK) - { - skip("Couldn't get index buffer description\n"); - } - else - { - ok(index_buffer_description.Format == D3DFMT_INDEX16, "Test %s, result %x, expected %x (D3DFMT_INDEX16)\n", - name, index_buffer_description.Format, D3DFMT_INDEX16); - ok(index_buffer_description.Type == D3DRTYPE_INDEXBUFFER, "Test %s, result %x, expected %x (D3DRTYPE_INDEXBUFFER)\n", - name, index_buffer_description.Type, D3DRTYPE_INDEXBUFFER); - ok(index_buffer_description.Usage == 0, "Test %s, result %#x, expected %#x.\n", - name, index_buffer_description.Usage, 0); - ok(index_buffer_description.Pool == D3DPOOL_MANAGED, "Test %s, result %x, expected %x (D3DPOOL_MANAGED)\n", - name, index_buffer_description.Pool, D3DPOOL_MANAGED); - expected = number_of_faces * sizeof(WORD) * 3; - ok(index_buffer_description.Size == expected, "Test %s, result %x, expected %x\n", - name, index_buffer_description.Size, expected); - } - - /* specify offset and size to avoid potential overruns */ hr = IDirect3DVertexBuffer9_Lock(vertex_buffer, 0, number_of_vertices * sizeof(D3DXVECTOR3) * 2, (void **)&vertices, D3DLOCK_DISCARD); - ok(hr == D3D_OK, "Test %s, result %x, expected 0 (D3D_OK)\n", name, hr); - if (hr != D3D_OK) - { - skip("Couldn't lock vertex buffer\n"); - goto error; - } + ok(hr == D3D_OK, "Test %s, unexpected hr %#x.\n", name, hr); hr = IDirect3DIndexBuffer9_Lock(index_buffer, 0, number_of_faces * sizeof(WORD) * 3, (void **)&faces, D3DLOCK_DISCARD); - ok(hr == D3D_OK, "Test %s, result %x, expected 0 (D3D_OK)\n", name, hr); - if (hr != D3D_OK) - { - skip("Couldn't lock index buffer\n"); - goto error; - } - + ok(hr == D3D_OK, "Test %s, unexpected hr %#x.\n", name, hr); face_idx1 = 0; vtx_idx2 = 0; face_idx2 = 0; @@ -4242,66 +4208,49 @@ static void compare_text_outline_mesh(const char *name, ID3DXMesh *d3dxmesh, str } }
-error: - if (vertices) IDirect3DVertexBuffer9_Unlock(vertex_buffer); - if (faces) IDirect3DIndexBuffer9_Unlock(index_buffer); - if (index_buffer) IDirect3DIndexBuffer9_Release(index_buffer); - if (vertex_buffer) IDirect3DVertexBuffer9_Release(vertex_buffer); + IDirect3DIndexBuffer9_Unlock(index_buffer); + IDirect3DVertexBuffer9_Unlock(vertex_buffer); + IDirect3DIndexBuffer9_Release(index_buffer); + IDirect3DVertexBuffer9_Release(vertex_buffer); }
static void test_createtext(IDirect3DDevice9 *device, HDC hdc, const char *text, float deviation, float extrusion) { + static const MAT2 identity = {{0, 1}, {0, 0}, {0, 0}, {0, 1}}; HRESULT hr; ID3DXMesh *d3dxmesh = NULL; struct mesh mesh = {0}; char name[256]; OUTLINETEXTMETRICA otm; GLYPHMETRICS gm; - struct glyphinfo *glyphs = NULL; + struct glyphinfo *glyphs; GLYPHMETRICSFLOAT *glyphmetrics_float = HeapAlloc(GetProcessHeap(), 0, sizeof(GLYPHMETRICSFLOAT) * strlen(text)); int i; LOGFONTA lf; float offset_x; size_t textlen; HFONT font = NULL, oldfont = NULL; - char *raw_outline = NULL; + char *raw_outline;
sprintf(name, "text ('%s', %f, %f)", text, deviation, extrusion);
hr = D3DXCreateTextA(device, hdc, text, deviation, extrusion, &d3dxmesh, NULL, glyphmetrics_float); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr); - if (hr != D3D_OK) - { - skip("Couldn't create text with D3DXCreateText\n"); - goto error; - }
/* must select a modified font having lfHeight = otm.otmEMSquare before * calling GetGlyphOutline to get the expected values */ - if (!GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(lf), &lf) - || !GetOutlineTextMetricsA(hdc, sizeof(otm), &otm)) - { - skip("Couldn't get text outline\n"); - goto error; - } + ok(GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(lf), &lf), "Failed to get current DC font.\n"); + ok(GetOutlineTextMetricsA(hdc, sizeof(otm), &otm), "Failed to get DC font outline.\n"); lf.lfHeight = otm.otmEMSquare; lf.lfWidth = 0; - if (!(font = CreateFontIndirectA(&lf))) - { - skip("Couldn't create the modified font\n"); - goto error; - } + ok(!!(font = CreateFontIndirectA(&lf)), "Failed to create font.\n");
textlen = strlen(text); glyphs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, textlen * sizeof(*glyphs)); - if (!glyphs) - goto error; - oldfont = SelectObject(hdc, font);
for (i = 0; i < textlen; i++) { - const MAT2 identity = {{0, 1}, {0, 0}, {0, 0}, {0, 1}}; GetGlyphOutlineA(hdc, text[i], GGO_NATIVE, &gm, 0, NULL, &identity); compare_float(glyphmetrics_float[i].gmfBlackBoxX, gm.gmBlackBoxX / (float)otm.otmEMSquare); compare_float(glyphmetrics_float[i].gmfBlackBoxY, gm.gmBlackBoxY / (float)otm.otmEMSquare); @@ -4317,64 +4266,36 @@ static void test_createtext(IDirect3DDevice9 *device, HDC hdc, const char *text, offset_x = 0.0f; for (i = 0; i < textlen; i++) { - /* get outline points from data returned from GetGlyphOutline */ - const MAT2 identity = {{0, 1}, {0, 0}, {0, 0}, {0, 1}}; - int datasize; + DWORD datasize;
glyphs[i].offset_x = offset_x;
datasize = GetGlyphOutlineA(hdc, text[i], GGO_NATIVE, &gm, 0, NULL, &identity); - if (datasize < 0) - { - SelectObject(hdc, oldfont); - goto error; - } - HeapFree(GetProcessHeap(), 0, raw_outline); + ok(datasize != GDI_ERROR, "Failed to retrieve GDI glyph outline size.\n"); raw_outline = HeapAlloc(GetProcessHeap(), 0, datasize); - if (!raw_outline) - { - SelectObject(hdc, oldfont); - goto error; - } datasize = GetGlyphOutlineA(hdc, text[i], GGO_NATIVE, &gm, datasize, raw_outline, &identity); - + ok(datasize != GDI_ERROR, "Failed to retrieve GDI glyph outline.\n"); create_outline(&glyphs[i], raw_outline, datasize, deviation, otm.otmEMSquare); + HeapFree(GetProcessHeap(), 0, raw_outline);
offset_x += gm.gmCellIncX / (float)otm.otmEMSquare; }
SelectObject(hdc, oldfont);
- ZeroMemory(&mesh, sizeof(mesh)); - if (!compute_text_mesh(&mesh, text, deviation, extrusion, otm.otmEMSquare, glyphs)) - { - skip("Couldn't create mesh\n"); - d3dxmesh->lpVtbl->Release(d3dxmesh); - return; - } + compute_text_mesh(&mesh, text, deviation, extrusion, otm.otmEMSquare, glyphs); mesh.fvf = D3DFVF_XYZ | D3DFVF_NORMAL;
compare_text_outline_mesh(name, d3dxmesh, &mesh, textlen, extrusion, glyphs);
-error: free_mesh(&mesh); - - if (d3dxmesh) d3dxmesh->lpVtbl->Release(d3dxmesh); - if (font) DeleteObject(font); + d3dxmesh->lpVtbl->Release(d3dxmesh); + DeleteObject(font); HeapFree(GetProcessHeap(), 0, glyphmetrics_float);
- if (glyphs) - { - for (i = 0; i < textlen; i++) - { - int j; - for (j = 0; j < glyphs[i].outlines.count; j++) - HeapFree(GetProcessHeap(), 0, glyphs[i].outlines.items[j].items); - HeapFree(GetProcessHeap(), 0, glyphs[i].outlines.items); - } - HeapFree(GetProcessHeap(), 0, glyphs); - } - HeapFree(GetProcessHeap(), 0, raw_outline); + for (i = 0; i < textlen; i++) + free_glyphinfo(&glyphs[i]); + HeapFree(GetProcessHeap(), 0, glyphs); }
static void D3DXCreateTextTest(void)
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v2: Add / fix broken() checks for AMD.
dlls/d3d8/tests/device.c | 116 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 851de3fac30..4d0ef714701 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -8586,6 +8586,121 @@ static void test_swapchain_multisample_reset(void) DestroyWindow(window); }
+static void test_device_caps(void) +{ + IDirect3DDevice8 *device; + IDirect3D8 *d3d; + ULONG refcount; + D3DCAPS8 caps; + HWND window; + HRESULT hr; + + window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, NULL))) + { + skip("Failed to create a D3D device.\n"); + IDirect3D8_Release(d3d); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice8_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr); + + ok(!(caps.Caps & ~D3DCAPS_READ_SCANLINE), "Caps field has unexpected flags %#x.\n", caps.Caps); + ok(!(caps.Caps2 & ~(D3DCAPS2_CANCALIBRATEGAMMA | D3DCAPS2_CANRENDERWINDOWED + | D3DCAPS2_CANMANAGERESOURCE | D3DCAPS2_DYNAMICTEXTURES | D3DCAPS2_FULLSCREENGAMMA + | D3DCAPS2_NO2DDURING3DSCENE | D3DCAPS2_RESERVED)), + "Caps2 field has unexpected flags %#x.\n", caps.Caps2); + /* Nvidia returns that 0x400 flag, which is is probably Vista+ + * D3DCAPS3_DXVAHD from d3d9caps.h */ + /* AMD doesn't filter all the ddraw / d3d9 caps. Consider that behavior + * broken. */ + ok(!(caps.Caps3 & ~(D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD | D3DCAPS3_RESERVED | 0x400)) + || broken(!(caps.Caps3 & ~(D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD | 0x80))), + "Caps3 field has unexpected flags %#x.\n", caps.Caps3); + ok(!(caps.PrimitiveMiscCaps & ~(D3DPMISCCAPS_MASKZ | D3DPMISCCAPS_LINEPATTERNREP + | D3DPMISCCAPS_CULLNONE | D3DPMISCCAPS_CULLCW | D3DPMISCCAPS_CULLCCW + | D3DPMISCCAPS_COLORWRITEENABLE | D3DPMISCCAPS_CLIPPLANESCALEDPOINTS + | D3DPMISCCAPS_CLIPTLVERTS | D3DPMISCCAPS_TSSARGTEMP | D3DPMISCCAPS_BLENDOP + | D3DPMISCCAPS_NULLREFERENCE)) + || broken(!(caps.PrimitiveMiscCaps & ~0x003fdff6)), + "PrimitiveMiscCaps field has unexpected flags %#x.\n", caps.PrimitiveMiscCaps); + /* AMD includes an unknown 0x2 flag. */ + ok(!(caps.RasterCaps & ~(D3DPRASTERCAPS_DITHER | D3DPRASTERCAPS_PAT | D3DPRASTERCAPS_ZTEST + | D3DPRASTERCAPS_FOGVERTEX | D3DPRASTERCAPS_FOGTABLE | D3DPRASTERCAPS_ANTIALIASEDGES + | D3DPRASTERCAPS_MIPMAPLODBIAS | D3DPRASTERCAPS_ZBIAS | D3DPRASTERCAPS_ZBUFFERLESSHSR + | D3DPRASTERCAPS_FOGRANGE | D3DPRASTERCAPS_ANISOTROPY | D3DPRASTERCAPS_WBUFFER + | D3DPRASTERCAPS_WFOG | D3DPRASTERCAPS_ZFOG | D3DPRASTERCAPS_COLORPERSPECTIVE + | D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE)) + || broken(!(caps.RasterCaps & ~0x0ff7f19b)), + "RasterCaps field has unexpected flags %#x.\n", caps.RasterCaps); + ok(!(caps.SrcBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR + | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA + | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR + | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA + | D3DPBLENDCAPS_BOTHINVSRCALPHA)), + "SrcBlendCaps field has unexpected flags %#x.\n", caps.SrcBlendCaps); + ok(!(caps.DestBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR + | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA + | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR + | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA + | D3DPBLENDCAPS_BOTHINVSRCALPHA)), + "DestBlendCaps field has unexpected flags %#x.\n", caps.DestBlendCaps); + ok(!(caps.TextureCaps & ~(D3DPTEXTURECAPS_PERSPECTIVE | D3DPTEXTURECAPS_POW2 + | D3DPTEXTURECAPS_ALPHA | D3DPTEXTURECAPS_SQUAREONLY + | D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE | D3DPTEXTURECAPS_ALPHAPALETTE + | D3DPTEXTURECAPS_NONPOW2CONDITIONAL | D3DPTEXTURECAPS_PROJECTED + | D3DPTEXTURECAPS_CUBEMAP | D3DPTEXTURECAPS_VOLUMEMAP | D3DPTEXTURECAPS_MIPMAP + | D3DPTEXTURECAPS_MIPVOLUMEMAP | D3DPTEXTURECAPS_MIPCUBEMAP + | D3DPTEXTURECAPS_CUBEMAP_POW2 | D3DPTEXTURECAPS_VOLUMEMAP_POW2)), + "TextureCaps field has unexpected flags %#x.\n", caps.TextureCaps); + ok(!(caps.TextureFilterCaps & ~(D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR + | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MIPFPOINT + | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR + | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFAFLATCUBIC + | D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC)) + || broken(!(caps.TextureFilterCaps & ~0x0703073f)), + "TextureFilterCaps field has unexpected flags %#x.\n", caps.TextureFilterCaps); + ok(!(caps.CubeTextureFilterCaps & ~(D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR + | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MIPFPOINT + | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR + | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFAFLATCUBIC + | D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC)), + "CubeTextureFilterCaps field has unexpected flags %#x.\n", caps.CubeTextureFilterCaps); + ok(!(caps.VolumeTextureFilterCaps & ~(D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR + | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MIPFPOINT + | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR + | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFAFLATCUBIC + | D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC)), + "VolumeTextureFilterCaps field has unexpected flags %#x.\n", caps.VolumeTextureFilterCaps); + ok(!(caps.LineCaps & ~(D3DLINECAPS_TEXTURE | D3DLINECAPS_ZTEST | D3DLINECAPS_BLEND + | D3DLINECAPS_ALPHACMP | D3DLINECAPS_FOG)), + "LineCaps field has unexpected flags %#x.\n", caps.LineCaps); + ok(!(caps.StencilCaps & ~(D3DSTENCILCAPS_KEEP | D3DSTENCILCAPS_ZERO | D3DSTENCILCAPS_REPLACE + | D3DSTENCILCAPS_INCRSAT | D3DSTENCILCAPS_DECRSAT | D3DSTENCILCAPS_INVERT + | D3DSTENCILCAPS_INCR | D3DSTENCILCAPS_DECR)), + "StencilCaps field has unexpected flags %#x.\n", caps.StencilCaps); + ok(!(caps.VertexProcessingCaps & ~(D3DVTXPCAPS_TEXGEN | D3DVTXPCAPS_MATERIALSOURCE7 + | D3DVTXPCAPS_DIRECTIONALLIGHTS | D3DVTXPCAPS_POSITIONALLIGHTS | D3DVTXPCAPS_LOCALVIEWER + | D3DVTXPCAPS_TWEENING | D3DVTXPCAPS_NO_VSDT_UBYTE4)), + "VertexProcessingCaps field has unexpected flags %#x.\n", caps.VertexProcessingCaps); + /* Both Nvidia and AMD give 10 here. */ + ok(caps.MaxActiveLights <= 10, + "MaxActiveLights field has unexpected value %u.\n", caps.MaxActiveLights); + /* AMD gives 6, Nvidia returns 8. */ + ok(caps.MaxUserClipPlanes <= 8, + "MaxUserClipPlanes field has unexpected value %u.\n", caps.MaxUserClipPlanes); + + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + START_TEST(device) { HMODULE d3d8_handle = GetModuleHandleA("d3d8.dll"); @@ -8695,6 +8810,7 @@ START_TEST(device) test_destroyed_window(); test_clip_planes_limits(); test_swapchain_multisample_reset(); + test_device_caps();
UnregisterClassA("d3d8_test_wc", GetModuleHandleA(NULL)); }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v2: Add broken() checks for WARP.
dlls/d3d9/tests/device.c | 139 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 547e0d07e21..dc900f19232 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -12470,6 +12470,144 @@ static void test_stretch_rect(void) DestroyWindow(window); }
+static void test_device_caps(void) +{ + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; + HWND window; + HRESULT hr; + + window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, 0, 0, 0, 0); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + + if (!(device = create_device(d3d, window, NULL))) + { + skip("Failed to create a D3D device.\n"); + IDirect3D9_Release(d3d); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr); + + ok(!(caps.Caps & ~D3DCAPS_READ_SCANLINE), "Caps field has unexpected flags %#x.\n", caps.Caps); + ok(!(caps.Caps2 & ~(D3DCAPS2_NO2DDURING3DSCENE | D3DCAPS2_FULLSCREENGAMMA + | D3DCAPS2_CANRENDERWINDOWED | D3DCAPS2_CANCALIBRATEGAMMA | D3DCAPS2_RESERVED + | D3DCAPS2_CANMANAGERESOURCE | D3DCAPS2_DYNAMICTEXTURES | D3DCAPS2_CANAUTOGENMIPMAP + | D3DCAPS2_CANSHARERESOURCE)), + "Caps2 field has unexpected flags %#x.\n", caps.Caps2); + /* AMD doesn't filter all the ddraw / d3d9 caps. Consider that behavior + * broken. */ + ok(!(caps.Caps3 & ~(D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD + | D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION | D3DCAPS3_COPY_TO_VIDMEM + | D3DCAPS3_COPY_TO_SYSTEMMEM | D3DCAPS3_DXVAHD | D3DCAPS3_DXVAHD_LIMITED + | D3DCAPS3_RESERVED)), + "Caps3 field has unexpected flags %#x.\n", caps.Caps3); + ok(!(caps.PrimitiveMiscCaps & ~(D3DPMISCCAPS_MASKZ | D3DPMISCCAPS_LINEPATTERNREP + | D3DPMISCCAPS_CULLNONE | D3DPMISCCAPS_CULLCW | D3DPMISCCAPS_CULLCCW + | D3DPMISCCAPS_COLORWRITEENABLE | D3DPMISCCAPS_CLIPPLANESCALEDPOINTS + | D3DPMISCCAPS_CLIPTLVERTS | D3DPMISCCAPS_TSSARGTEMP | D3DPMISCCAPS_BLENDOP + | D3DPMISCCAPS_NULLREFERENCE | D3DPMISCCAPS_INDEPENDENTWRITEMASKS + | D3DPMISCCAPS_PERSTAGECONSTANT | D3DPMISCCAPS_FOGANDSPECULARALPHA + | D3DPMISCCAPS_SEPARATEALPHABLEND | D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS + | D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING | D3DPMISCCAPS_FOGVERTEXCLAMPED + | D3DPMISCCAPS_POSTBLENDSRGBCONVERT)), + "PrimitiveMiscCaps field has unexpected flags %#x.\n", caps.PrimitiveMiscCaps); + ok(!(caps.RasterCaps & ~(D3DPRASTERCAPS_DITHER | D3DPRASTERCAPS_PAT | D3DPRASTERCAPS_ZTEST + | D3DPRASTERCAPS_FOGVERTEX | D3DPRASTERCAPS_FOGTABLE | D3DPRASTERCAPS_ANTIALIASEDGES + | D3DPRASTERCAPS_MIPMAPLODBIAS | D3DPRASTERCAPS_ZBIAS | D3DPRASTERCAPS_ZBUFFERLESSHSR + | D3DPRASTERCAPS_FOGRANGE | D3DPRASTERCAPS_ANISOTROPY | D3DPRASTERCAPS_WBUFFER + | D3DPRASTERCAPS_WFOG | D3DPRASTERCAPS_ZFOG | D3DPRASTERCAPS_COLORPERSPECTIVE + | D3DPRASTERCAPS_SCISSORTEST | D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS + | D3DPRASTERCAPS_DEPTHBIAS | D3DPRASTERCAPS_MULTISAMPLE_TOGGLE)), + "RasterCaps field has unexpected flags %#x.\n", caps.RasterCaps); + /* D3DPBLENDCAPS_SRCCOLOR2 and D3DPBLENDCAPS_INVSRCCOLOR2 are only + * advertised on the reference rasterizer and WARP. */ + ok(!(caps.SrcBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR + | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA + | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR + | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA + | D3DPBLENDCAPS_BOTHINVSRCALPHA | D3DPBLENDCAPS_BLENDFACTOR)) + || broken(!(caps.SrcBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR + | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA + | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR + | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA + | D3DPBLENDCAPS_BOTHINVSRCALPHA | D3DPBLENDCAPS_BLENDFACTOR + | D3DPBLENDCAPS_SRCCOLOR2 | D3DPBLENDCAPS_INVSRCCOLOR2))), + "SrcBlendCaps field has unexpected flags %#x.\n", caps.SrcBlendCaps); + ok(!(caps.DestBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR + | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA + | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR + | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA + | D3DPBLENDCAPS_BOTHINVSRCALPHA | D3DPBLENDCAPS_BLENDFACTOR)) + || broken(!(caps.SrcBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR + | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA + | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR + | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA + | D3DPBLENDCAPS_BOTHINVSRCALPHA | D3DPBLENDCAPS_BLENDFACTOR + | D3DPBLENDCAPS_SRCCOLOR2 | D3DPBLENDCAPS_INVSRCCOLOR2))), + "DestBlendCaps field has unexpected flags %#x.\n", caps.DestBlendCaps); + ok(!(caps.TextureCaps & ~(D3DPTEXTURECAPS_PERSPECTIVE | D3DPTEXTURECAPS_POW2 + | D3DPTEXTURECAPS_ALPHA | D3DPTEXTURECAPS_SQUAREONLY + | D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE | D3DPTEXTURECAPS_ALPHAPALETTE + | D3DPTEXTURECAPS_NONPOW2CONDITIONAL | D3DPTEXTURECAPS_PROJECTED + | D3DPTEXTURECAPS_CUBEMAP | D3DPTEXTURECAPS_VOLUMEMAP | D3DPTEXTURECAPS_MIPMAP + | D3DPTEXTURECAPS_MIPVOLUMEMAP | D3DPTEXTURECAPS_MIPCUBEMAP + | D3DPTEXTURECAPS_CUBEMAP_POW2 | D3DPTEXTURECAPS_VOLUMEMAP_POW2 + | D3DPTEXTURECAPS_NOPROJECTEDBUMPENV)), + "TextureCaps field has unexpected flags %#x.\n", caps.TextureCaps); + ok(!(caps.TextureFilterCaps & ~(D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR + | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MINFPYRAMIDALQUAD + | D3DPTFILTERCAPS_MINFGAUSSIANQUAD | D3DPTFILTERCAPS_MIPFPOINT + | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_CONVOLUTIONMONO + | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR + | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD + | D3DPTFILTERCAPS_MAGFGAUSSIANQUAD)), + "TextureFilterCaps field has unexpected flags %#x.\n", caps.TextureFilterCaps); + ok(!(caps.CubeTextureFilterCaps & ~(D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR + | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MINFPYRAMIDALQUAD + | D3DPTFILTERCAPS_MINFGAUSSIANQUAD | D3DPTFILTERCAPS_MIPFPOINT + | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR + | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD + | D3DPTFILTERCAPS_MAGFGAUSSIANQUAD)), + "CubeTextureFilterCaps field has unexpected flags %#x.\n", caps.CubeTextureFilterCaps); + ok(!(caps.VolumeTextureFilterCaps & ~(D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR + | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MINFPYRAMIDALQUAD + | D3DPTFILTERCAPS_MINFGAUSSIANQUAD | D3DPTFILTERCAPS_MIPFPOINT + | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR + | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD + | D3DPTFILTERCAPS_MAGFGAUSSIANQUAD)), + "VolumeTextureFilterCaps field has unexpected flags %#x.\n", caps.VolumeTextureFilterCaps); + ok(!(caps.LineCaps & ~(D3DLINECAPS_TEXTURE | D3DLINECAPS_ZTEST | D3DLINECAPS_BLEND + | D3DLINECAPS_ALPHACMP | D3DLINECAPS_FOG | D3DLINECAPS_ANTIALIAS)), + "LineCaps field has unexpected flags %#x.\n", caps.LineCaps); + ok(!(caps.StencilCaps & ~(D3DSTENCILCAPS_KEEP | D3DSTENCILCAPS_ZERO | D3DSTENCILCAPS_REPLACE + | D3DSTENCILCAPS_INCRSAT | D3DSTENCILCAPS_DECRSAT | D3DSTENCILCAPS_INVERT + | D3DSTENCILCAPS_INCR | D3DSTENCILCAPS_DECR | D3DSTENCILCAPS_TWOSIDED)), + "StencilCaps field has unexpected flags %#x.\n", caps.StencilCaps); + ok(!(caps.VertexProcessingCaps & ~(D3DVTXPCAPS_TEXGEN | D3DVTXPCAPS_MATERIALSOURCE7 + | D3DVTXPCAPS_DIRECTIONALLIGHTS | D3DVTXPCAPS_POSITIONALLIGHTS | D3DVTXPCAPS_LOCALVIEWER + | D3DVTXPCAPS_TWEENING | D3DVTXPCAPS_TEXGEN_SPHEREMAP + | D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER)), + "VertexProcessingCaps field has unexpected flags %#x.\n", caps.VertexProcessingCaps); + /* Both Nvidia and AMD give 10 here. */ + ok(caps.MaxActiveLights <= 10, + "MaxActiveLights field has unexpected value %u.\n", caps.MaxActiveLights); + /* AMD gives 6, Nvidia returns 8. */ + ok(caps.MaxUserClipPlanes <= 8, + "MaxUserClipPlanes field has unexpected value %u.\n", caps.MaxUserClipPlanes); + + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D9_Release(d3d); + DestroyWindow(window); +} + START_TEST(device) { WNDCLASSA wc = {0}; @@ -12593,6 +12731,7 @@ START_TEST(device) test_clip_planes_limits(); test_swapchain_multisample_reset(); test_stretch_rect(); + test_device_caps();
UnregisterClassA("d3d9_test_wc", GetModuleHandleA(NULL)); }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v2: Add broken() checks for WARP.
dlls/d3d9/tests/d3d9ex.c | 133 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+)
diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index 6d7bd2282a8..77e09c3cee6 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -3911,6 +3911,138 @@ static void test_format_unknown(void) DestroyWindow(window); }
+static void test_device_caps(void) +{ + IDirect3DDevice9Ex *device; + ULONG refcount; + D3DCAPS9 caps; + HWND window; + HRESULT hr; + + window = create_window(); + if (!(device = create_device(window, NULL))) + { + skip("Failed to create a D3D device.\n"); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice9Ex_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr); + + ok(!(caps.Caps & ~(D3DCAPS_OVERLAY | D3DCAPS_READ_SCANLINE)), + "Caps field has unexpected flags %#x.\n", caps.Caps); + ok(!(caps.Caps2 & ~(D3DCAPS2_NO2DDURING3DSCENE | D3DCAPS2_FULLSCREENGAMMA + | D3DCAPS2_CANRENDERWINDOWED | D3DCAPS2_CANCALIBRATEGAMMA | D3DCAPS2_RESERVED + | D3DCAPS2_CANMANAGERESOURCE | D3DCAPS2_DYNAMICTEXTURES | D3DCAPS2_CANAUTOGENMIPMAP + | D3DCAPS2_CANSHARERESOURCE)), + "Caps2 field has unexpected flags %#x.\n", caps.Caps2); + /* AMD doesn't filter all the ddraw / d3d9 caps. Consider that behavior + * broken. */ + ok(!(caps.Caps3 & ~(D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD + | D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION | D3DCAPS3_COPY_TO_VIDMEM + | D3DCAPS3_COPY_TO_SYSTEMMEM | D3DCAPS3_DXVAHD | D3DCAPS3_DXVAHD_LIMITED + | D3DCAPS3_RESERVED)), + "Caps3 field has unexpected flags %#x.\n", caps.Caps3); + ok(!(caps.PrimitiveMiscCaps & ~(D3DPMISCCAPS_MASKZ | D3DPMISCCAPS_LINEPATTERNREP + | D3DPMISCCAPS_CULLNONE | D3DPMISCCAPS_CULLCW | D3DPMISCCAPS_CULLCCW + | D3DPMISCCAPS_COLORWRITEENABLE | D3DPMISCCAPS_CLIPPLANESCALEDPOINTS + | D3DPMISCCAPS_CLIPTLVERTS | D3DPMISCCAPS_TSSARGTEMP | D3DPMISCCAPS_BLENDOP + | D3DPMISCCAPS_NULLREFERENCE | D3DPMISCCAPS_INDEPENDENTWRITEMASKS + | D3DPMISCCAPS_PERSTAGECONSTANT | D3DPMISCCAPS_FOGANDSPECULARALPHA + | D3DPMISCCAPS_SEPARATEALPHABLEND | D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS + | D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING | D3DPMISCCAPS_FOGVERTEXCLAMPED + | D3DPMISCCAPS_POSTBLENDSRGBCONVERT)), + "PrimitiveMiscCaps field has unexpected flags %#x.\n", caps.PrimitiveMiscCaps); + ok(!(caps.RasterCaps & ~(D3DPRASTERCAPS_DITHER | D3DPRASTERCAPS_PAT | D3DPRASTERCAPS_ZTEST + | D3DPRASTERCAPS_FOGVERTEX | D3DPRASTERCAPS_FOGTABLE | D3DPRASTERCAPS_ANTIALIASEDGES + | D3DPRASTERCAPS_MIPMAPLODBIAS | D3DPRASTERCAPS_ZBIAS | D3DPRASTERCAPS_ZBUFFERLESSHSR + | D3DPRASTERCAPS_FOGRANGE | D3DPRASTERCAPS_ANISOTROPY | D3DPRASTERCAPS_WBUFFER + | D3DPRASTERCAPS_WFOG | D3DPRASTERCAPS_ZFOG | D3DPRASTERCAPS_COLORPERSPECTIVE + | D3DPRASTERCAPS_SCISSORTEST | D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS + | D3DPRASTERCAPS_DEPTHBIAS | D3DPRASTERCAPS_MULTISAMPLE_TOGGLE)), + "RasterCaps field has unexpected flags %#x.\n", caps.RasterCaps); + /* D3DPBLENDCAPS_SRCCOLOR2 and D3DPBLENDCAPS_INVSRCCOLOR2 are only + * advertised on the reference rasterizer and WARP. */ + ok(!(caps.SrcBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR + | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA + | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR + | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA + | D3DPBLENDCAPS_BOTHINVSRCALPHA | D3DPBLENDCAPS_BLENDFACTOR)) + || broken(!(caps.SrcBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR + | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA + | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR + | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA + | D3DPBLENDCAPS_BOTHINVSRCALPHA | D3DPBLENDCAPS_BLENDFACTOR + | D3DPBLENDCAPS_SRCCOLOR2 | D3DPBLENDCAPS_INVSRCCOLOR2))), + "SrcBlendCaps field has unexpected flags %#x.\n", caps.SrcBlendCaps); + ok(!(caps.DestBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR + | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA + | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR + | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA + | D3DPBLENDCAPS_BOTHINVSRCALPHA | D3DPBLENDCAPS_BLENDFACTOR)) + || broken(!(caps.SrcBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR + | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA + | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR + | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA + | D3DPBLENDCAPS_BOTHINVSRCALPHA | D3DPBLENDCAPS_BLENDFACTOR + | D3DPBLENDCAPS_SRCCOLOR2 | D3DPBLENDCAPS_INVSRCCOLOR2))), + "DestBlendCaps field has unexpected flags %#x.\n", caps.DestBlendCaps); + ok(!(caps.TextureCaps & ~(D3DPTEXTURECAPS_PERSPECTIVE | D3DPTEXTURECAPS_POW2 + | D3DPTEXTURECAPS_ALPHA | D3DPTEXTURECAPS_SQUAREONLY + | D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE | D3DPTEXTURECAPS_ALPHAPALETTE + | D3DPTEXTURECAPS_NONPOW2CONDITIONAL | D3DPTEXTURECAPS_PROJECTED + | D3DPTEXTURECAPS_CUBEMAP | D3DPTEXTURECAPS_VOLUMEMAP | D3DPTEXTURECAPS_MIPMAP + | D3DPTEXTURECAPS_MIPVOLUMEMAP | D3DPTEXTURECAPS_MIPCUBEMAP + | D3DPTEXTURECAPS_CUBEMAP_POW2 | D3DPTEXTURECAPS_VOLUMEMAP_POW2 + | D3DPTEXTURECAPS_NOPROJECTEDBUMPENV)), + "TextureCaps field has unexpected flags %#x.\n", caps.TextureCaps); + ok(!(caps.TextureFilterCaps & ~(D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR + | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MINFPYRAMIDALQUAD + | D3DPTFILTERCAPS_MINFGAUSSIANQUAD | D3DPTFILTERCAPS_MIPFPOINT + | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_CONVOLUTIONMONO + | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR + | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD + | D3DPTFILTERCAPS_MAGFGAUSSIANQUAD)), + "TextureFilterCaps field has unexpected flags %#x.\n", caps.TextureFilterCaps); + ok(!(caps.CubeTextureFilterCaps & ~(D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR + | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MINFPYRAMIDALQUAD + | D3DPTFILTERCAPS_MINFGAUSSIANQUAD | D3DPTFILTERCAPS_MIPFPOINT + | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR + | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD + | D3DPTFILTERCAPS_MAGFGAUSSIANQUAD)), + "CubeTextureFilterCaps field has unexpected flags %#x.\n", caps.CubeTextureFilterCaps); + ok(!(caps.VolumeTextureFilterCaps & ~(D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR + | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MINFPYRAMIDALQUAD + | D3DPTFILTERCAPS_MINFGAUSSIANQUAD | D3DPTFILTERCAPS_MIPFPOINT + | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR + | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD + | D3DPTFILTERCAPS_MAGFGAUSSIANQUAD)), + "VolumeTextureFilterCaps field has unexpected flags %#x.\n", caps.VolumeTextureFilterCaps); + ok(!(caps.LineCaps & ~(D3DLINECAPS_TEXTURE | D3DLINECAPS_ZTEST | D3DLINECAPS_BLEND + | D3DLINECAPS_ALPHACMP | D3DLINECAPS_FOG | D3DLINECAPS_ANTIALIAS)), + "LineCaps field has unexpected flags %#x.\n", caps.LineCaps); + ok(!(caps.StencilCaps & ~(D3DSTENCILCAPS_KEEP | D3DSTENCILCAPS_ZERO | D3DSTENCILCAPS_REPLACE + | D3DSTENCILCAPS_INCRSAT | D3DSTENCILCAPS_DECRSAT | D3DSTENCILCAPS_INVERT + | D3DSTENCILCAPS_INCR | D3DSTENCILCAPS_DECR | D3DSTENCILCAPS_TWOSIDED)), + "StencilCaps field has unexpected flags %#x.\n", caps.StencilCaps); + ok(!(caps.VertexProcessingCaps & ~(D3DVTXPCAPS_TEXGEN | D3DVTXPCAPS_MATERIALSOURCE7 + | D3DVTXPCAPS_DIRECTIONALLIGHTS | D3DVTXPCAPS_POSITIONALLIGHTS | D3DVTXPCAPS_LOCALVIEWER + | D3DVTXPCAPS_TWEENING | D3DVTXPCAPS_TEXGEN_SPHEREMAP + | D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER)), + "VertexProcessingCaps field has unexpected flags %#x.\n", caps.VertexProcessingCaps); + /* Both Nvidia and AMD give 10 here. */ + ok(caps.MaxActiveLights <= 10, + "MaxActiveLights field has unexpected value %u.\n", caps.MaxActiveLights); + /* AMD gives 6, Nvidia returns 8. */ + ok(caps.MaxUserClipPlanes <= 8, + "MaxUserClipPlanes field has unexpected value %u.\n", caps.MaxUserClipPlanes); + + refcount = IDirect3DDevice9Ex_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + START_TEST(d3d9ex) { DEVMODEW current_mode; @@ -3960,4 +4092,5 @@ START_TEST(d3d9ex) test_swapchain_parameters(); test_backbuffer_resize(); test_format_unknown(); + test_device_caps(); }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- Might have an effect on bug 42118.
dlls/d3d8/device.c | 6 ++++-- dlls/d3d8/tests/device.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 17e02a3b1c6..8c3b644c136 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -2187,9 +2187,11 @@ static HRESULT WINAPI d3d8_device_ValidateDevice(IDirect3DDevice8 *iface, DWORD static HRESULT WINAPI d3d8_device_GetInfo(IDirect3DDevice8 *iface, DWORD info_id, void *info, DWORD info_size) { - FIXME("iface %p, info_id %#x, info %p, info_size %u stub!\n", iface, info_id, info, info_size); + TRACE("iface %p, info_id %#x, info %p, info_size %u.\n", iface, info_id, info, info_size);
- return D3D_OK; + if (info_id < 4) + return E_FAIL; + return S_FALSE; }
static HRESULT WINAPI d3d8_device_SetPaletteEntries(IDirect3DDevice8 *iface, diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 4d0ef714701..ce4b92ec98f 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -8701,6 +8701,44 @@ static void test_device_caps(void) DestroyWindow(window); }
+static void test_get_info(void) +{ + IDirect3DDevice8 *device; + IDirect3D8 *d3d; + BYTE info[1024]; + ULONG refcount; + unsigned int i; + HWND window; + HRESULT hr; + + window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, NULL))) + { + skip("Failed to create a D3D device.\n"); + IDirect3D8_Release(d3d); + DestroyWindow(window); + return; + } + + /* As called by Chessmaster 9000 (bug 42118). */ + hr = IDirect3DDevice8_GetInfo(device, 4, info, 16); + ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr); + + for (i = 0; i < 256; ++i) + { + hr = IDirect3DDevice8_GetInfo(device, i, info, sizeof(info)); + ok(hr == (i < 4 ? E_FAIL : S_FALSE), "info_id %u, unexpected hr %#x.\n", i, hr); + } + + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + START_TEST(device) { HMODULE d3d8_handle = GetModuleHandleA("d3d8.dll"); @@ -8811,6 +8849,7 @@ START_TEST(device) test_clip_planes_limits(); test_swapchain_multisample_reset(); test_device_caps(); + test_get_info();
UnregisterClassA("d3d8_test_wc", GetModuleHandleA(NULL)); }
On 14 March 2018 at 22:23, Matteo Bruni mbruni@codeweavers.com wrote:
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
Might have an effect on bug 42118.
dlls/d3d8/device.c | 6 ++++-- dlls/d3d8/tests/device.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-)
This fails here on Windows:
device.c:8733: Test failed: info_id 5, unexpected hr 0x80004005. device.c:8733: Test failed: info_id 6, unexpected hr 0x80004005. ... device.c:8733: Test failed: info_id 254, unexpected hr 0x80004005. device.c:8733: Test failed: info_id 255, unexpected hr 0x80004005. 135c:device: 47431 tests executed (0 marked as todo, 251 failures), 2 skipped.
2018-03-15 14:34 GMT+01:00 Henri Verbeet hverbeet@gmail.com:
On 14 March 2018 at 22:23, Matteo Bruni mbruni@codeweavers.com wrote:
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
Might have an effect on bug 42118.
dlls/d3d8/device.c | 6 ++++-- dlls/d3d8/tests/device.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-)
This fails here on Windows:
device.c:8733: Test failed: info_id 5, unexpected hr 0x80004005. device.c:8733: Test failed: info_id 6, unexpected hr 0x80004005. ... device.c:8733: Test failed: info_id 254, unexpected hr 0x80004005. device.c:8733: Test failed: info_id 255, unexpected hr 0x80004005. 135c:device: 47431 tests executed (0 marked as todo, 251
failures), 2 skipped.
Not that it matters a lot, but which Windows version / GPU?
On 15 March 2018 at 20:06, Matteo Bruni matteo.mystral@gmail.com wrote:
Not that it matters a lot, but which Windows version / GPU?
Windows 7, AMD Radeon HD 6300 series.
Otherwise we'd limit the cleared area to the size of the render target.
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3d9/tests/visual.c | 46 ++++++++++++++++++++++++---------------------- dlls/wined3d/cs.c | 5 ++++- 2 files changed, 28 insertions(+), 23 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 358ed1d1602..16e1c7598ec 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -19764,9 +19764,12 @@ static void test_multisample_mismatch(void) hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
- /* Check depth buffer values. AMD GPUs (r500 and evergreen tested) clear the depth buffer - * like you'd expect in a correct framebuffer setup. Nvidia doesn't clear it, neither in - * the Z only clear case nor in the combined clear case. */ + /* Check depth buffer values. AMD GPUs (r500 and evergreen tested) clear + * the depth buffer like you'd expect in a correct framebuffer + * setup. Nvidia doesn't clear it, neither in the Z only clear case nor in + * the combined clear case. + * In Wine we currently happen to allow the clear-only case but disallow + * the combined one. It seems like an acceptable outcome. */ hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_DIFFUSE); ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr); hr = IDirect3DDevice9_BeginScene(device); @@ -19778,7 +19781,7 @@ static void test_multisample_mismatch(void) color = getPixelColor(device, 62, 240); ok(color_match(color, 0x000000ff, 1), "Got unexpected color 0x%08x.\n", color); color = getPixelColor(device, 64, 240); - ok(color_match(color, 0x0000ff00, 1) || broken(color_match(color, 0x000000ff, 1)), + ok(color_match(color, 0x0000ff00, 1) || color_match(color, 0x000000ff, 1), "Got unexpected color 0x%08x.\n", color); color = getPixelColor(device, 318, 240); ok(color_match(color, 0x0000ff00, 1) || broken(color_match(color, 0x000000ff, 1)), @@ -23508,26 +23511,25 @@ static void test_null_format(void) { unsigned int x, y; D3DCOLOR color; - BOOL todo; } expected_colors[] = { - {200, 30, 0x0000ff00, FALSE}, - {440, 30, 0x0000ff00, FALSE}, - {520, 30, 0x0000ff00, FALSE}, - {600, 30, 0x0000ff00, FALSE}, - {200, 90, 0x00000000, FALSE}, - {440, 90, 0x0000ff00, FALSE}, - {520, 90, 0x0000ff00, FALSE}, - {600, 90, 0x0000ff00, FALSE}, - {200, 150, 0x000000ff, FALSE}, - {440, 150, 0x000000ff, FALSE}, - {520, 150, 0x0000ff00, FALSE}, - {600, 150, 0x0000ff00, FALSE}, - {200, 320, 0x000000ff, FALSE}, - {440, 320, 0x000000ff, FALSE}, - {520, 320, 0x00000000, TRUE}, - {600, 320, 0x0000ff00, FALSE}, + {200, 30, 0x0000ff00}, + {440, 30, 0x0000ff00}, + {520, 30, 0x0000ff00}, + {600, 30, 0x0000ff00}, + {200, 90, 0x00000000}, + {440, 90, 0x0000ff00}, + {520, 90, 0x0000ff00}, + {600, 90, 0x0000ff00}, + {200, 150, 0x000000ff}, + {440, 150, 0x000000ff}, + {520, 150, 0x0000ff00}, + {600, 150, 0x0000ff00}, + {200, 320, 0x000000ff}, + {440, 320, 0x000000ff}, + {520, 320, 0x00000000}, + {600, 320, 0x0000ff00}, }; IDirect3DSurface9 *original_rt, *small_rt, *null_rt, *small_null_rt; IDirect3DDevice9 *device; @@ -23648,7 +23650,7 @@ static void test_null_format(void) for (i = 0; i < ARRAY_SIZE(expected_colors); ++i) { color = getPixelColor(device, expected_colors[i].x, expected_colors[i].y); - todo_wine_if(expected_colors[i].todo) ok(color_match(color, expected_colors[i].color, 1), + ok(color_match(color, expected_colors[i].color, 1), "Expected color 0x%08x at (%u, %u), got 0x%08x.\n", expected_colors[i].color, expected_colors[i].x, expected_colors[i].y, color); } diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 0db2daa4893..2c8718d436a 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -534,7 +534,10 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * WINED3D_CS_QUEUE_DEFAULT); op->opcode = WINED3D_CS_OP_CLEAR; op->flags = flags; - op->rt_count = rt_count; + if (flags & WINED3DCLEAR_TARGET) + op->rt_count = rt_count; + else + op->rt_count = 0; op->fb = &cs->fb; SetRect(&op->draw_rect, vp->x, vp->y, vp->x + vp->width, vp->y + vp->height); if (state->render_states[WINED3D_RS_SCISSORTESTENABLE])
On 14 March 2018 at 22:23, Matteo Bruni mbruni@codeweavers.com wrote:
Otherwise we'd limit the cleared area to the size of the render target.
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
dlls/d3d9/tests/visual.c | 46 ++++++++++++++++++++++++---------------------- dlls/wined3d/cs.c | 5 ++++- 2 files changed, 28 insertions(+), 23 deletions(-)
This fails here on Linux, Intel SKL:
visual.c:23653: Test failed: Expected color 0x00000000 at (520, 320), got 0x0000ff00.
2018-03-15 14:34 GMT+01:00 Henri Verbeet hverbeet@gmail.com:
On 14 March 2018 at 22:23, Matteo Bruni mbruni@codeweavers.com wrote:
Otherwise we'd limit the cleared area to the size of the render target.
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
dlls/d3d9/tests/visual.c | 46 ++++++++++++++++++++++++---------------------- dlls/wined3d/cs.c | 5 ++++- 2 files changed, 28 insertions(+), 23 deletions(-)
This fails here on Linux, Intel SKL:
visual.c:23653: Test failed: Expected color 0x00000000 at (520,
320), got 0x0000ff00.
It turns out this test also depends on not clamping the viewport to the render target size (and shows that I didn't retest this patch on its own...)
I guess I'm going to focus on those patches sooner rather than later. IIRC last time I got stuck on various test failures on multiple drivers, hopefully coming back after a while will help...