mirror of
https://github.com/reactos/reactos.git
synced 2025-07-24 16:03:45 +00:00
[WINESYNC]: revert wine-staging patchset for d3dx9
This commit is contained in:
parent
c3ad01e3b2
commit
8cc1ec1b82
61 changed files with 117 additions and 4638 deletions
|
@ -306,7 +306,6 @@ static void test_ID3DXSprite(IDirect3DDevice9 *device)
|
|||
static void test_ID3DXFont(IDirect3DDevice9 *device)
|
||||
{
|
||||
static const WCHAR testW[] = {'t','e','s','t',0};
|
||||
static const char testA[] = "test";
|
||||
static const struct
|
||||
{
|
||||
int font_height;
|
||||
|
@ -638,67 +637,6 @@ static void test_ID3DXFont(IDirect3DDevice9 *device)
|
|||
|
||||
ID3DXFont_Release(font);
|
||||
}
|
||||
|
||||
/* ID3DXFont_DrawTextA, ID3DXFont_DrawTextW */
|
||||
hr = D3DXCreateFontA(device, 12, 0, FW_DONTCARE, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "Arial", &font);
|
||||
if (SUCCEEDED(hr)) {
|
||||
RECT rect;
|
||||
int height;
|
||||
|
||||
SetRect(&rect, 10, 10, 200, 200);
|
||||
|
||||
height = ID3DXFont_DrawTextA(font, NULL, testA, -2, &rect, 0, 0xFF00FF);
|
||||
ok(height == 12, "DrawTextA returned %d, expected 12.\n", height);
|
||||
|
||||
height = ID3DXFont_DrawTextA(font, NULL, testA, -1, &rect, 0, 0xFF00FF);
|
||||
ok(height == 12, "DrawTextA returned %d, expected 12.\n", height);
|
||||
|
||||
height = ID3DXFont_DrawTextA(font, NULL, testA, 0, &rect, 0, 0xFF00FF);
|
||||
ok(height == 0, "DrawTextA returned %d, expected 0.\n", height);
|
||||
|
||||
height = ID3DXFont_DrawTextA(font, NULL, testA, 1, &rect, 0, 0xFF00FF);
|
||||
ok(height == 12, "DrawTextA returned %d, expected 12.\n", height);
|
||||
|
||||
height = ID3DXFont_DrawTextA(font, NULL, testA, 2, &rect, 0, 0xFF00FF);
|
||||
ok(height == 12, "DrawTextA returned %d, expected 12.\n", height);
|
||||
|
||||
height = ID3DXFont_DrawTextA(font, NULL, testA, -1, NULL, 0, 0xFF00FF);
|
||||
ok(height == 12, "DrawTextA returned %d, expected 12.\n", height);
|
||||
|
||||
height = ID3DXFont_DrawTextA(font, NULL, testA, -1, NULL, DT_CALCRECT, 0xFF00FF);
|
||||
ok(height == 12, "DrawTextA returned %d, expected 12.\n", height);
|
||||
|
||||
height = ID3DXFont_DrawTextA(font, NULL, NULL, -1, NULL, 0, 0xFF00FF);
|
||||
ok(height == 0, "DrawTextA returned %d, expected 0.\n", height);
|
||||
|
||||
if (0) { /* Causes a lockup on windows 7. */
|
||||
height = ID3DXFont_DrawTextW(font, NULL, testW, -2, &rect, 0, 0xFF00FF);
|
||||
ok(height == 12, "DrawTextW returned %d, expected 12.\n", height);
|
||||
}
|
||||
|
||||
height = ID3DXFont_DrawTextW(font, NULL, testW, -1, &rect, 0, 0xFF00FF);
|
||||
ok(height == 12, "DrawTextW returned %d, expected 12.\n", height);
|
||||
|
||||
height = ID3DXFont_DrawTextW(font, NULL, testW, 0, &rect, 0, 0xFF00FF);
|
||||
ok(height == 0, "DrawTextW returned %d, expected 0.\n", height);
|
||||
|
||||
height = ID3DXFont_DrawTextW(font, NULL, testW, 1, &rect, 0, 0xFF00FF);
|
||||
ok(height == 12, "DrawTextW returned %d, expected 12.\n", height);
|
||||
|
||||
height = ID3DXFont_DrawTextW(font, NULL, testW, 2, &rect, 0, 0xFF00FF);
|
||||
ok(height == 12, "DrawTextW returned %d, expected 12.\n", height);
|
||||
|
||||
height = ID3DXFont_DrawTextW(font, NULL, testW, -1, NULL, 0, 0xFF00FF);
|
||||
ok(height == 12, "DrawTextA returned %d, expected 12.\n", height);
|
||||
|
||||
height = ID3DXFont_DrawTextW(font, NULL, testW, -1, NULL, DT_CALCRECT, 0xFF00FF);
|
||||
ok(height == 12, "DrawTextA returned %d, expected 12.\n", height);
|
||||
|
||||
height = ID3DXFont_DrawTextW(font, NULL, NULL, -1, NULL, 0, 0xFF00FF);
|
||||
ok(height == 0, "DrawTextA returned %d, expected 0.\n", height);
|
||||
|
||||
ID3DXFont_Release(font);
|
||||
}
|
||||
}
|
||||
|
||||
static void test_D3DXCreateRenderToSurface(IDirect3DDevice9 *device)
|
||||
|
|
|
@ -25,9 +25,6 @@
|
|||
#include <limits.h>
|
||||
#include "wine/test.h"
|
||||
#include "d3dx9.h"
|
||||
#include "initguid.h"
|
||||
#include "rmxftmpl.h"
|
||||
#include "rmxfguid.h"
|
||||
|
||||
#ifndef NAN
|
||||
/* From wine/port.h */
|
||||
|
@ -2547,129 +2544,6 @@ static void D3DXLoadMeshTest(void)
|
|||
free_test_context(test_context);
|
||||
}
|
||||
|
||||
static ID3DXFileData *get_mesh_data(const char *memory, SIZE_T length)
|
||||
{
|
||||
D3DXF_FILELOADMEMORY source;
|
||||
ID3DXFileEnumObject *enumobj = NULL;
|
||||
ID3DXFileData *filedata = NULL;
|
||||
ID3DXFileData *ret = NULL;
|
||||
ID3DXFile *d3dxfile = NULL;
|
||||
SIZE_T i, nb_children;
|
||||
HRESULT hr;
|
||||
GUID guid;
|
||||
|
||||
hr = D3DXFileCreate(&d3dxfile);
|
||||
if (FAILED(hr)) return NULL;
|
||||
|
||||
hr = d3dxfile->lpVtbl->RegisterTemplates(d3dxfile, D3DRM_XTEMPLATES, D3DRM_XTEMPLATE_BYTES);
|
||||
if (FAILED(hr)) goto cleanup;
|
||||
|
||||
source.lpMemory = (void *)memory;
|
||||
source.dSize = length;
|
||||
|
||||
hr = d3dxfile->lpVtbl->CreateEnumObject(d3dxfile, &source, D3DXF_FILELOAD_FROMMEMORY, &enumobj);
|
||||
if (FAILED(hr)) goto cleanup;
|
||||
|
||||
hr = enumobj->lpVtbl->GetChildren(enumobj, &nb_children);
|
||||
if (FAILED(hr)) goto cleanup;
|
||||
|
||||
for (i = 0; i < nb_children; i++)
|
||||
{
|
||||
hr = enumobj->lpVtbl->GetChild(enumobj, i, &filedata);
|
||||
if (FAILED(hr)) goto cleanup;
|
||||
|
||||
hr = filedata->lpVtbl->GetType(filedata, &guid);
|
||||
if (SUCCEEDED(hr) && IsEqualGUID(&guid, &TID_D3DRMMesh))
|
||||
{
|
||||
ret = filedata;
|
||||
break;
|
||||
}
|
||||
else
|
||||
filedata->lpVtbl->Release(filedata);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (enumobj) enumobj->lpVtbl->Release(enumobj);
|
||||
if (d3dxfile) d3dxfile->lpVtbl->Release(d3dxfile);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void D3DXLoadSkinMeshFromXofTest(void)
|
||||
{
|
||||
static const char simple_xfile[] =
|
||||
"xof 0303txt 0032"
|
||||
"Mesh {"
|
||||
"3;"
|
||||
"0.0; 0.0; 0.0;,"
|
||||
"0.0; 1.0; 0.0;,"
|
||||
"1.0; 1.0; 0.0;;"
|
||||
"1;"
|
||||
"3; 0, 1, 2;;"
|
||||
"}";
|
||||
ID3DXBuffer *adjacency, *materials, *effects;
|
||||
D3DPRESENT_PARAMETERS d3dpp;
|
||||
IDirect3DDevice9 *device;
|
||||
ID3DXFileData *filedata;
|
||||
ID3DXSkinInfo *skininfo;
|
||||
ID3DXMesh *mesh;
|
||||
IDirect3D9 *d3d;
|
||||
DWORD mat_count;
|
||||
HRESULT hr;
|
||||
HWND hwnd;
|
||||
|
||||
if (!(hwnd = CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW, 0, 0,
|
||||
640, 480, NULL, NULL, NULL, NULL)))
|
||||
{
|
||||
skip("Couldn't create application window\n");
|
||||
return;
|
||||
}
|
||||
|
||||
d3d = Direct3DCreate9(D3D_SDK_VERSION);
|
||||
if (!d3d)
|
||||
{
|
||||
skip("Couldn't create IDirect3D9 object\n");
|
||||
DestroyWindow(hwnd);
|
||||
return;
|
||||
}
|
||||
|
||||
ZeroMemory(&d3dpp, sizeof(d3dpp));
|
||||
d3dpp.Windowed = TRUE;
|
||||
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||
|
||||
hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &device);
|
||||
IDirect3D9_Release(d3d);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
skip("Failed to create IDirect3DDevice9 object %#x\n", hr);
|
||||
DestroyWindow(hwnd);
|
||||
return;
|
||||
}
|
||||
|
||||
filedata = get_mesh_data(simple_xfile, sizeof(simple_xfile) - 1);
|
||||
ok(filedata != NULL, "Failed to load mesh data\n");
|
||||
|
||||
adjacency = materials = effects = NULL;
|
||||
skininfo = NULL;
|
||||
mesh = NULL;
|
||||
|
||||
hr = D3DXLoadSkinMeshFromXof(filedata, 0, device, &adjacency, &materials, &effects, &mat_count, &skininfo, &mesh);
|
||||
ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
|
||||
ok(skininfo != NULL, "Expected non-null skininfo\n");
|
||||
|
||||
/* FIXME: Add additional tests for skininfo interface. */
|
||||
|
||||
if (adjacency) adjacency->lpVtbl->Release(adjacency);
|
||||
if (materials) materials->lpVtbl->Release(materials);
|
||||
if (effects) effects->lpVtbl->Release(effects);
|
||||
if (skininfo) skininfo->lpVtbl->Release(skininfo);
|
||||
if (mesh) mesh->lpVtbl->Release(mesh);
|
||||
|
||||
filedata->lpVtbl->Release(filedata);
|
||||
IDirect3DDevice9_Release(device);
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
static BOOL compute_box(struct mesh *mesh, float width, float height, float depth)
|
||||
{
|
||||
unsigned int i, face;
|
||||
|
@ -5316,88 +5190,6 @@ static void test_create_skin_info(void)
|
|||
ok(hr == D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, got %#x\n", hr);
|
||||
}
|
||||
|
||||
static void test_update_skinned_mesh(void)
|
||||
{
|
||||
static DWORD bone0_vertices[2] = { 1, 3 };
|
||||
static FLOAT bone0_weights[2] = { 1.0f, 0.5f };
|
||||
static DWORD bone1_vertices[2] = { 2, 3 };
|
||||
static FLOAT bone1_weights[2] = { 1.0f, 0.5f };
|
||||
static D3DMATRIX bones_matrix[2] =
|
||||
{ { { {
|
||||
1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 1.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
2.0f, 2.0f, 4.0f, 1.0f
|
||||
} } },
|
||||
{ { {
|
||||
1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 1.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
-4.0f, -4.0f, 4.0f, 1.0f
|
||||
} } } };
|
||||
static D3DVECTOR vertices_src[] = {{ 1.0f, 1.0f, 1.0f },
|
||||
{ 1.0f, 0.0f, 0.0f },
|
||||
{ 1.0f, 1.0f, -1.0f },
|
||||
{ 0.0f, 1.0f, 0.0f },
|
||||
{ -1.0f, -1.0f, 1.0f },
|
||||
{ 0.0f, 0.0f, 1.0f },
|
||||
{ -1.0f, -1.0f, -1.0f },
|
||||
{ -1.0f, 0.0f, 0.0f },
|
||||
};
|
||||
static D3DVECTOR vertices_ref[] = {{ 0.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 0.0f },
|
||||
{ 3.0f, 3.0f, 3.0f },
|
||||
{ 0.0f, 1.0f, 0.0f },
|
||||
{ -5.0f, -5.0f, 5.0f },
|
||||
{ 0.0f, 0.0f, 1.0f },
|
||||
{ -2.0f, -2.0f, 3.0f },
|
||||
{ -1.0f, 0.0f, 0.0f },
|
||||
};
|
||||
D3DVECTOR vertices_dest[8];
|
||||
HRESULT hr;
|
||||
ID3DXSkinInfo *skin_info;
|
||||
D3DXMATRIX matrix;
|
||||
int i;
|
||||
|
||||
D3DXMatrixIdentity(&matrix);
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
vertices_dest[i].x = 10000.0f;
|
||||
vertices_dest[i].y = 10000.0f;
|
||||
vertices_dest[i].z = 10000.0f;
|
||||
}
|
||||
|
||||
hr = D3DXCreateSkinInfoFVF(4, D3DFVF_XYZ | D3DFVF_NORMAL, 2, &skin_info);
|
||||
ok(hr == D3D_OK, "Expected D3D_OK, got %#x\n", hr);
|
||||
|
||||
skin_info->lpVtbl->SetBoneInfluence(skin_info, 0, 2, bone0_vertices, bone0_weights);
|
||||
ok(hr == D3D_OK, "Expected D3D_OK, got %#x\n", hr);
|
||||
skin_info->lpVtbl->SetBoneOffsetMatrix(skin_info, 0, &matrix);
|
||||
ok(hr == D3D_OK, "Expected D3D_OK, got %#x\n", hr);
|
||||
skin_info->lpVtbl->SetBoneInfluence(skin_info, 1, 2, bone1_vertices, bone1_weights);
|
||||
ok(hr == D3D_OK, "Expected D3D_OK, got %#x\n", hr);
|
||||
skin_info->lpVtbl->SetBoneOffsetMatrix(skin_info, 1, &matrix);
|
||||
ok(hr == D3D_OK, "Expected D3D_OK, got %#x\n", hr);
|
||||
skin_info->lpVtbl->UpdateSkinnedMesh(skin_info, bones_matrix, NULL, vertices_src, vertices_dest);
|
||||
ok(hr == D3D_OK, "Expected D3D_OK, got %#x\n", hr);
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
ok(compare(vertices_dest[i*2].x, vertices_ref[i*2].x), "Vertex[%d].position.x: got %g, expected %g\n",
|
||||
i, vertices_dest[i*2].x, vertices_ref[i*2].x);
|
||||
ok(compare(vertices_dest[i*2].y, vertices_ref[i*2].y), "Vertex[%d].position.y: got %g, expected %g\n",
|
||||
i, vertices_dest[i*2].y, vertices_ref[i*2].y);
|
||||
ok(compare(vertices_dest[i*2].z, vertices_ref[i*2].z), "Vertex[%d].position.z: got %g, expected %g\n",
|
||||
i, vertices_dest[i*2].z, vertices_ref[i*2].z);
|
||||
ok(compare(vertices_dest[i*2+1].x, vertices_ref[i*2+1].x), "Vertex[%d].normal.x: got %g, expected %g\n",
|
||||
i, vertices_dest[i*2+1].x, vertices_ref[i*2+1].x);
|
||||
ok(compare(vertices_dest[i*2+1].y, vertices_ref[i*2+1].y), "Vertex[%d].normal.y: got %g, expected %g\n",
|
||||
i, vertices_dest[i*2+1].y, vertices_ref[i*2+1].y);
|
||||
ok(compare(vertices_dest[i*2+1].z, vertices_ref[i*2+1].z), "Vertex[%d].normal.z: got %g, expected %g\n",
|
||||
i, vertices_dest[i*2+1].z, vertices_ref[i*2+1].z);
|
||||
}
|
||||
skin_info->lpVtbl->Release(skin_info);
|
||||
}
|
||||
|
||||
static void test_convert_adjacency_to_point_reps(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
@ -10362,10 +10154,10 @@ static void test_clone_mesh(void)
|
|||
|
||||
hr = mesh->lpVtbl->CloneMesh(mesh, tc[i].clone_options, tc[i].new_declaration,
|
||||
test_context->device, &mesh_clone);
|
||||
ok(hr == D3D_OK, "CloneMesh test case %d failed. Got %x, expected D3D_OK.\n", i, hr);
|
||||
ok(hr == D3D_OK, "CloneMesh test case %d failed. Got %x\n, expected D3D_OK\n", i, hr);
|
||||
|
||||
hr = mesh_clone->lpVtbl->GetDeclaration(mesh_clone, new_declaration);
|
||||
ok(hr == D3D_OK, "GetDeclaration test case %d failed. Got %x, expected D3D_OK.\n", i, hr);
|
||||
ok(hr == D3D_OK, "GetDeclaration test case %d failed. Got %x\n, expected D3D_OK\n", i, hr);
|
||||
/* Check declaration elements */
|
||||
for (j = 0; tc[i].new_declaration[j].Stream != 0xFF; j++)
|
||||
{
|
||||
|
@ -10552,7 +10344,7 @@ static void test_valid_mesh(void)
|
|||
|
||||
hr = D3DXValidMesh(mesh, tc[i].adjacency, &errors_and_warnings);
|
||||
todo_wine ok(hr == tc[i].exp_hr, "D3DXValidMesh test case %d failed. "
|
||||
"Got %x, expected %x.\n", i, hr, tc[i].exp_hr);
|
||||
"Got %x\n, expected %x\n", i, hr, tc[i].exp_hr);
|
||||
|
||||
/* Note errors_and_warnings is deliberately not checked because that
|
||||
* would require copying wast amounts of the text output. */
|
||||
|
@ -10570,27 +10362,6 @@ cleanup:
|
|||
free_test_context(test_context);
|
||||
}
|
||||
|
||||
static void test_optimize_vertices(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
DWORD vertex_remap[3];
|
||||
const DWORD indices[] = {0, 1, 2};
|
||||
const UINT num_faces = 1;
|
||||
const UINT num_vertices = 3;
|
||||
|
||||
hr = D3DXOptimizeVertices(indices, num_faces,
|
||||
num_vertices, FALSE,
|
||||
vertex_remap);
|
||||
ok(hr == D3D_OK, "D3DXOptimizeVertices failed. Got %x, expected D3D_OK.\n", hr);
|
||||
|
||||
/* vertex_remap must not be NULL */
|
||||
hr = D3DXOptimizeVertices(indices, num_faces,
|
||||
num_vertices, FALSE,
|
||||
NULL);
|
||||
ok(hr == D3DERR_INVALIDCALL, "D3DXOptimizeVertices passed NULL vertex_remap "
|
||||
"pointer. Got %x, expected D3DERR_INVALIDCALL.\n", hr);
|
||||
}
|
||||
|
||||
static void test_optimize_faces(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
@ -10717,7 +10488,7 @@ static void test_optimize_faces(void)
|
|||
tc[i].num_vertices, tc[i].indices_are_32bit,
|
||||
face_remap);
|
||||
ok(hr == D3D_OK, "D3DXOptimizeFaces test case %d failed. "
|
||||
"Got %x, expected D3D_OK.\n", i, hr);
|
||||
"Got %x\n, expected D3D_OK\n", i, hr);
|
||||
|
||||
/* Compare face remap with expected face remap */
|
||||
for (j = 0; j < tc[i].num_faces; j++)
|
||||
|
@ -10735,14 +10506,14 @@ static void test_optimize_faces(void)
|
|||
tc[0].num_vertices, tc[0].indices_are_32bit,
|
||||
NULL);
|
||||
ok(hr == D3DERR_INVALIDCALL, "D3DXOptimizeFaces passed NULL face_remap "
|
||||
"pointer. Got %x, expected D3DERR_INVALIDCALL.\n", hr);
|
||||
"pointer. Got %x\n, expected D3DERR_INVALIDCALL\n", hr);
|
||||
|
||||
/* Number of faces must be smaller than 2^15 */
|
||||
hr = D3DXOptimizeFaces(tc[0].indices, 2 << 15,
|
||||
tc[0].num_vertices, FALSE,
|
||||
&smallest_face_remap);
|
||||
ok(hr == D3DERR_INVALIDCALL, "D3DXOptimizeFaces should not accept 2^15 "
|
||||
"faces when using 16-bit indices. Got %x, expected D3DERR_INVALIDCALL.\n", hr);
|
||||
"faces when using 16-bit indices. Got %x\n, expected D3DERR_INVALIDCALL\n", hr);
|
||||
}
|
||||
|
||||
static HRESULT clear_normals(ID3DXMesh *mesh)
|
||||
|
@ -11461,7 +11232,6 @@ START_TEST(mesh)
|
|||
D3DXCreateMeshTest();
|
||||
D3DXCreateMeshFVFTest();
|
||||
D3DXLoadMeshTest();
|
||||
D3DXLoadSkinMeshFromXofTest();
|
||||
D3DXCreateBoxTest();
|
||||
D3DXCreatePolygonTest();
|
||||
D3DXCreateSphereTest();
|
||||
|
@ -11475,13 +11245,11 @@ START_TEST(mesh)
|
|||
D3DXGenerateAdjacencyTest();
|
||||
test_update_semantics();
|
||||
test_create_skin_info();
|
||||
test_update_skinned_mesh();
|
||||
test_convert_adjacency_to_point_reps();
|
||||
test_convert_point_reps_to_adjacency();
|
||||
test_weld_vertices();
|
||||
test_clone_mesh();
|
||||
test_valid_mesh();
|
||||
test_optimize_vertices();
|
||||
test_optimize_faces();
|
||||
test_compute_normals();
|
||||
test_D3DXFrameFind();
|
||||
|
|
|
@ -6575,214 +6575,6 @@ static void test_shader_semantics(void)
|
|||
}
|
||||
}
|
||||
|
||||
static const DWORD ps_tex[] = {
|
||||
0xffff0103, /* ps_1_3 */
|
||||
0x00000042, 0xb00f0000, /* tex t0 */
|
||||
0x00000000, /* nop */
|
||||
0x0000ffff};
|
||||
|
||||
static const DWORD ps_texld_1_4[] = {
|
||||
0xffff0104, /* ps_1_4 */
|
||||
0x00000042, 0xb00f0000, 0xa0e40000, /* texld t0, c0 */
|
||||
0x00000000, /* nop */
|
||||
0x0000ffff};
|
||||
|
||||
static const DWORD ps_texld_2_0[] = {
|
||||
0xffff0200, /* ps_2_0 */
|
||||
0x00000042, 0xb00f0000, 0xa0e40000, 0xa0e40001, /* texld t0, c0, c1 */
|
||||
0x00000000, /* nop */
|
||||
0x0000ffff};
|
||||
|
||||
static const DWORD ps_texcoord[] = {
|
||||
0xffff0103, /* ps_1_4 */
|
||||
0x00000040, 0xb00f0000, /* texcoord t0 */
|
||||
0x00000000, /* nop */
|
||||
0x0000ffff};
|
||||
|
||||
static const DWORD ps_texcrd[] = {
|
||||
0xffff0104, /* ps_2_0 */
|
||||
0x00000040, 0xb00f0000, 0xa0e40000, /* texcrd t0, c0 */
|
||||
0x00000000, /* nop */
|
||||
0x0000ffff};
|
||||
|
||||
static const DWORD ps_sincos_2_0[] = {
|
||||
0xffff0200, /* ps_2_0 */
|
||||
0x00000025, 0xb00f0000, 0xa0e40000, 0xa0e40001, 0xa0e40002, /* sincos t0, c0, c1, c2 */
|
||||
0x00000000, /* nop */
|
||||
0x0000ffff};
|
||||
|
||||
static const DWORD ps_sincos_3_0[] = {
|
||||
0xffff0300, /* ps_3_0 */
|
||||
0x00000025, 0xb00f0000, 0xa0e40000, /* sincos t0, c0 */
|
||||
0x00000000, /* nop */
|
||||
0x0000ffff};
|
||||
|
||||
static const DWORD vs_sincos_2_0[] = {
|
||||
0xfffe0200, /* vs_2_0 */
|
||||
0x00000025, 0xb00f0000, 0xa0e40000, 0xa0e40001, 0xa0e40002, /* sincos a0, c0, c1, c2 */
|
||||
0x00000000, /* nop */
|
||||
0x0000ffff};
|
||||
|
||||
static const DWORD vs_sincos_3_0[] = {
|
||||
0xfffe0300, /* vs_3_0 */
|
||||
0x00000025, 0xb00f0000, 0xa0e40000, /* sincos a0, c0 */
|
||||
0x00000000, /* nop */
|
||||
0x0000ffff};
|
||||
|
||||
static void test_disassemble_shader(void)
|
||||
{
|
||||
static const char disasm_vs[] = " vs_1_1\n"
|
||||
" dcl_position v0\n"
|
||||
" dp4 oPos.x, v0, c0\n"
|
||||
" dp4 oPos.y, v0, c1\n"
|
||||
" dp4 oPos.z, v0, c2\n"
|
||||
" dp4 oPos.w, v0, c3\n";
|
||||
static const char disasm_ps[] = " ps_1_1\n"
|
||||
" def c1, 1, 0, 0, 0\n"
|
||||
" tex t0\n"
|
||||
" dp3 r0, c1, c0\n"
|
||||
" mul r0, v0, r0\n"
|
||||
" mul r0, t0, r0\n";
|
||||
static const char disasm_ps_tex[] = " ps_1_3\n"
|
||||
" tex t0\n"
|
||||
" nop\n";
|
||||
static const char disasm_ps_texld_1_4[] = " ps_1_4\n"
|
||||
" texld t0, c0\n"
|
||||
" nop\n";
|
||||
static const char disasm_ps_texld_2_0[] = " ps_2_0\n"
|
||||
" texld t0, c0, c1\n"
|
||||
" nop\n";
|
||||
static const char disasm_ps_texcoord[] = " ps_1_3\n"
|
||||
" texcoord t0\n"
|
||||
" nop\n";
|
||||
static const char disasm_ps_texcrd[] = " ps_1_4\n"
|
||||
" texcrd t0, c0\n"
|
||||
" nop\n";
|
||||
static const char disasm_ps_sincos_2_0[] = " ps_2_0\n"
|
||||
" sincos t0, c0, c1, c2\n"
|
||||
" nop\n";
|
||||
static const char disasm_ps_sincos_3_0[] = " ps_3_0\n"
|
||||
" sincos t0, c0\n"
|
||||
" nop\n";
|
||||
static const char disasm_vs_sincos_2_0[] = " vs_2_0\n"
|
||||
" sincos a0, c0, c1, c2\n"
|
||||
" nop\n";
|
||||
static const char disasm_vs_sincos_3_0[] = " vs_3_0\n"
|
||||
" sincos a0, c0\n"
|
||||
" nop\n";
|
||||
ID3DXBuffer *disassembly;
|
||||
HRESULT ret;
|
||||
char *ptr;
|
||||
|
||||
/* Check wrong parameters */
|
||||
ret = D3DXDisassembleShader(NULL, FALSE, NULL, NULL);
|
||||
ok(ret == D3DERR_INVALIDCALL, "Returned %#x, expected %#x\n", ret, D3DERR_INVALIDCALL);
|
||||
ret = D3DXDisassembleShader(NULL, FALSE, NULL, &disassembly);
|
||||
ok(ret == D3DERR_INVALIDCALL, "Returned %#x, expected %#x\n", ret, D3DERR_INVALIDCALL);
|
||||
ret = D3DXDisassembleShader(simple_vs, FALSE, NULL, NULL);
|
||||
ok(ret == D3DERR_INVALIDCALL, "Returned %#x, expected %#x\n", ret, D3DERR_INVALIDCALL);
|
||||
|
||||
/* Test with vertex shader */
|
||||
disassembly = (void *)0xdeadbeef;
|
||||
ret = D3DXDisassembleShader(simple_vs, FALSE, NULL, &disassembly);
|
||||
ok(ret == D3D_OK, "Failed with %#x\n", ret);
|
||||
ptr = ID3DXBuffer_GetBufferPointer(disassembly);
|
||||
ok(!memcmp(ptr, disasm_vs, sizeof(disasm_vs) - 1), /* compare beginning */
|
||||
"Returned '%s', expected '%s'\n", ptr, disasm_vs);
|
||||
ID3DXBuffer_Release(disassembly);
|
||||
|
||||
/* Test with pixel shader */
|
||||
disassembly = (void *)0xdeadbeef;
|
||||
ret = D3DXDisassembleShader(simple_ps, FALSE, NULL, &disassembly);
|
||||
ok(ret == D3D_OK, "Failed with %#x\n", ret);
|
||||
ptr = ID3DXBuffer_GetBufferPointer(disassembly);
|
||||
ok(!memcmp(ptr, disasm_ps, sizeof(disasm_ps) - 1), /* compare beginning */
|
||||
"Returned '%s', expected '%s'\n", ptr, disasm_ps);
|
||||
ID3DXBuffer_Release(disassembly);
|
||||
|
||||
/* Test tex instruction with pixel shader 1.3 */
|
||||
disassembly = (void *)0xdeadbeef;
|
||||
ret = D3DXDisassembleShader(ps_tex, FALSE, NULL, &disassembly);
|
||||
ok(ret == D3D_OK, "Failed with %#x\n", ret);
|
||||
ptr = ID3DXBuffer_GetBufferPointer(disassembly);
|
||||
ok(!memcmp(ptr, disasm_ps_tex, sizeof(disasm_ps_tex) - 1), /* compare beginning */
|
||||
"Returned '%s', expected '%s'\n", ptr, disasm_ps_tex);
|
||||
ID3DXBuffer_Release(disassembly);
|
||||
|
||||
/* Test texld instruction with pixel shader 1.4 */
|
||||
disassembly = (void *)0xdeadbeef;
|
||||
ret = D3DXDisassembleShader(ps_texld_1_4, FALSE, NULL, &disassembly);
|
||||
ok(ret == D3D_OK, "Failed with %#x\n", ret);
|
||||
ptr = ID3DXBuffer_GetBufferPointer(disassembly);
|
||||
ok(!memcmp(ptr, disasm_ps_texld_1_4, sizeof(disasm_ps_texld_1_4) - 1), /* compare beginning */
|
||||
"Returned '%s', expected '%s'\n", ptr, disasm_ps_texld_1_4);
|
||||
ID3DXBuffer_Release(disassembly);
|
||||
|
||||
/* Test texld instruction with pixel shader 2.0 */
|
||||
disassembly = (void *)0xdeadbeef;
|
||||
ret = D3DXDisassembleShader(ps_texld_2_0, FALSE, NULL, &disassembly);
|
||||
ok(ret == D3D_OK, "Failed with %#x\n", ret);
|
||||
ptr = ID3DXBuffer_GetBufferPointer(disassembly);
|
||||
ok(!memcmp(ptr, disasm_ps_texld_2_0, sizeof(disasm_ps_texld_2_0) - 1), /* compare beginning */
|
||||
"Returned '%s', expected '%s'\n", ptr, disasm_ps_texld_2_0);
|
||||
ID3DXBuffer_Release(disassembly);
|
||||
|
||||
/* Test texcoord instruction with pixel shader 1.3 */
|
||||
disassembly = (void *)0xdeadbeef;
|
||||
ret = D3DXDisassembleShader(ps_texcoord, FALSE, NULL, &disassembly);
|
||||
ok(ret == D3D_OK, "Failed with %#x\n", ret);
|
||||
ptr = ID3DXBuffer_GetBufferPointer(disassembly);
|
||||
ok(!memcmp(ptr, disasm_ps_texcoord, sizeof(disasm_ps_texcoord) - 1), /* compare beginning */
|
||||
"Returned '%s', expected '%s'\n", ptr, disasm_ps_texcoord);
|
||||
ID3DXBuffer_Release(disassembly);
|
||||
|
||||
/* Test texcrd instruction with pixel shader 1.4 */
|
||||
disassembly = (void *)0xdeadbeef;
|
||||
ret = D3DXDisassembleShader(ps_texcrd, FALSE, NULL, &disassembly);
|
||||
ok(ret == D3D_OK, "Failed with %#x\n", ret);
|
||||
ptr = ID3DXBuffer_GetBufferPointer(disassembly);
|
||||
ok(!memcmp(ptr, disasm_ps_texcrd, sizeof(disasm_ps_texcrd) - 1), /* compare beginning */
|
||||
"Returned '%s', expected '%s'\n", ptr, disasm_ps_texcrd);
|
||||
ID3DXBuffer_Release(disassembly);
|
||||
|
||||
/* Test sincos instruction pixel shader 2.0 */
|
||||
disassembly = (void *)0xdeadbeef;
|
||||
ret = D3DXDisassembleShader(ps_sincos_2_0, FALSE, NULL, &disassembly);
|
||||
ok(ret == D3D_OK, "Failed with %#x\n", ret);
|
||||
ptr = ID3DXBuffer_GetBufferPointer(disassembly);
|
||||
ok(!memcmp(ptr, disasm_ps_sincos_2_0, sizeof(disasm_ps_sincos_2_0) - 1), /* compare beginning */
|
||||
"Returned '%s', expected '%s'\n", ptr, disasm_ps_sincos_2_0);
|
||||
ID3DXBuffer_Release(disassembly);
|
||||
|
||||
/* Test sincos instruction with pixel shader 3.0 */
|
||||
disassembly = (void *)0xdeadbeef;
|
||||
ret = D3DXDisassembleShader(ps_sincos_3_0, FALSE, NULL, &disassembly);
|
||||
ok(ret == D3D_OK, "Failed with %#x\n", ret);
|
||||
ptr = ID3DXBuffer_GetBufferPointer(disassembly);
|
||||
ok(!memcmp(ptr, disasm_ps_sincos_3_0, sizeof(disasm_ps_sincos_3_0) - 1), /* compare beginning */
|
||||
"Returned '%s', expected '%s'\n", ptr, disasm_ps_sincos_3_0);
|
||||
ID3DXBuffer_Release(disassembly);
|
||||
|
||||
/* Test sincos instruction with pixel shader 2.0 */
|
||||
disassembly = (void *)0xdeadbeef;
|
||||
ret = D3DXDisassembleShader(vs_sincos_2_0, FALSE, NULL, &disassembly);
|
||||
ok(ret == D3D_OK, "Failed with %#x\n", ret);
|
||||
ptr = ID3DXBuffer_GetBufferPointer(disassembly);
|
||||
ok(!memcmp(ptr, disasm_vs_sincos_2_0, sizeof(disasm_vs_sincos_2_0) - 1), /* compare beginning */
|
||||
"Returned '%s', expected '%s'\n", ptr, disasm_vs_sincos_2_0);
|
||||
ID3DXBuffer_Release(disassembly);
|
||||
|
||||
/* Test sincos instruction with pixel shader 3.0 */
|
||||
disassembly = (void *)0xdeadbeef;
|
||||
ret = D3DXDisassembleShader(vs_sincos_3_0, FALSE, NULL, &disassembly);
|
||||
ok(ret == D3D_OK, "Failed with %#x\n", ret);
|
||||
ptr = ID3DXBuffer_GetBufferPointer(disassembly);
|
||||
ok(!memcmp(ptr, disasm_vs_sincos_3_0, sizeof(disasm_vs_sincos_3_0) - 1), /* compare beginning */
|
||||
"Returned '%s', expected '%s'\n", ptr, disasm_vs_sincos_3_0);
|
||||
ID3DXBuffer_Release(disassembly);
|
||||
|
||||
}
|
||||
|
||||
START_TEST(shader)
|
||||
{
|
||||
test_get_shader_size();
|
||||
|
@ -6797,5 +6589,4 @@ START_TEST(shader)
|
|||
test_registerset();
|
||||
test_registerset_defaults();
|
||||
test_shader_semantics();
|
||||
test_disassemble_shader();
|
||||
}
|
||||
|
|
|
@ -67,24 +67,6 @@ static const unsigned char bmp_8bpp[] = {
|
|||
0x00,0x00
|
||||
};
|
||||
|
||||
/* 2x2 bmp (32 bpp XRGB) */
|
||||
static const unsigned char bmp_32bpp_xrgb[] = {
|
||||
0x42,0x4d,0x46,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x00,0x28,0x00,
|
||||
0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x01,0x00,0x20,0x00,0x00,0x00,
|
||||
0x00,0x00,0x10,0x00,0x00,0x00,0x12,0x0b,0x00,0x00,0x12,0x0b,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0xb0,0xc0,0x00,0xa1,0xb1,0xc1,0x00,0xa2,0xb2,
|
||||
0xc2,0x00,0xa3,0xb3,0xc3,0x00
|
||||
};
|
||||
|
||||
/* 2x2 bmp (32 bpp ARGB) */
|
||||
static const unsigned char bmp_32bpp_argb[] = {
|
||||
0x42,0x4d,0x46,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x00,0x28,0x00,
|
||||
0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x01,0x00,0x20,0x00,0x00,0x00,
|
||||
0x00,0x00,0x10,0x00,0x00,0x00,0x12,0x0b,0x00,0x00,0x12,0x0b,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0xb0,0xc0,0x00,0xa1,0xb1,0xc1,0x00,0xa2,0xb2,
|
||||
0xc2,0x00,0xa3,0xb3,0xc3,0x01
|
||||
};
|
||||
|
||||
static const unsigned char png_grayscale[] =
|
||||
{
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49,
|
||||
|
@ -577,14 +559,6 @@ static void test_D3DXGetImageInfo(void)
|
|||
ok(hr == D3D_OK, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK);
|
||||
ok(info.Depth == 1, "Got depth %u, expected 1\n", info.Depth);
|
||||
ok(info.Format == D3DFMT_P8, "Got format %u, expected %u\n", info.Format, D3DFMT_P8);
|
||||
hr = D3DXGetImageInfoFromFileInMemory(bmp_32bpp_xrgb, sizeof(bmp_32bpp_xrgb), &info);
|
||||
ok(hr == D3D_OK, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK);
|
||||
ok(info.Depth == 1, "Got depth %u, expected 1\n", info.Depth);
|
||||
ok(info.Format == D3DFMT_X8R8G8B8, "Got format %u, expected %u\n", info.Format, D3DFMT_X8R8G8B8);
|
||||
hr = D3DXGetImageInfoFromFileInMemory(bmp_32bpp_argb, sizeof(bmp_32bpp_argb), &info);
|
||||
ok(hr == D3D_OK, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK);
|
||||
ok(info.Depth == 1, "Got depth %u, expected 1\n", info.Depth);
|
||||
ok(info.Format == D3DFMT_A8R8G8B8, "Got format %u, expected %u\n", info.Format, D3DFMT_A8R8G8B8);
|
||||
|
||||
/* Grayscale PNG */
|
||||
hr = D3DXGetImageInfoFromFileInMemory(png_grayscale, sizeof(png_grayscale), &info);
|
||||
|
@ -1224,7 +1198,7 @@ static void test_D3DXLoadSurface(IDirect3DDevice9 *device)
|
|||
hr = IDirect3DTexture9_GetSurfaceLevel(tex, 0, &newsurf);
|
||||
ok(SUCCEEDED(hr), "Failed to get the surface, hr %#x.\n", hr);
|
||||
hr = D3DXLoadSurfaceFromSurface(newsurf, NULL, NULL, surf, NULL, NULL, D3DX_FILTER_NONE, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to convert pixels to DXT3 format.\n");
|
||||
todo_wine ok(SUCCEEDED(hr), "Failed to convert pixels to DXT3 format.\n");
|
||||
check_release((IUnknown*)newsurf, 1);
|
||||
check_release((IUnknown*)tex, 0);
|
||||
}
|
||||
|
@ -1250,7 +1224,7 @@ static void test_D3DXLoadSurface(IDirect3DDevice9 *device)
|
|||
hr = IDirect3DTexture9_GetSurfaceLevel(tex, 0, &newsurf);
|
||||
ok(SUCCEEDED(hr), "Failed to get the surface, hr %#x.\n", hr);
|
||||
hr = D3DXLoadSurfaceFromSurface(newsurf, NULL, NULL, surf, NULL, NULL, D3DX_FILTER_NONE, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to convert pixels to DXT5 format.\n");
|
||||
todo_wine ok(SUCCEEDED(hr), "Failed to convert pixels to DXT5 format.\n");
|
||||
check_release((IUnknown*)newsurf, 1);
|
||||
check_release((IUnknown*)tex, 0);
|
||||
}
|
||||
|
@ -1263,10 +1237,10 @@ static void test_D3DXLoadSurface(IDirect3DDevice9 *device)
|
|||
hr = IDirect3DTexture9_GetSurfaceLevel(tex, 0, &newsurf);
|
||||
ok(SUCCEEDED(hr), "Failed to get the surface, hr %#x.\n", hr);
|
||||
hr = D3DXLoadSurfaceFromSurface(newsurf, NULL, NULL, surf, NULL, NULL, D3DX_FILTER_NONE, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to convert pixels to DXT1 format.\n");
|
||||
todo_wine ok(SUCCEEDED(hr), "Failed to convert pixels to DXT1 format.\n");
|
||||
|
||||
hr = D3DXLoadSurfaceFromSurface(surf, NULL, NULL, newsurf, NULL, NULL, D3DX_FILTER_NONE, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to convert pixels from DXT1 format.\n");
|
||||
todo_wine ok(SUCCEEDED(hr), "Failed to convert pixels from DXT1 format.\n");
|
||||
|
||||
check_release((IUnknown*)newsurf, 1);
|
||||
check_release((IUnknown*)tex, 0);
|
||||
|
|
|
@ -400,16 +400,6 @@ static void test_D3DXCheckTextureRequirements(IDirect3DDevice9 *device)
|
|||
ok(height == 4, "Returned height %d, expected %d\n", height, 4);
|
||||
ok(mipmaps == 1, "Returned mipmaps %d, expected %d\n", mipmaps, 1);
|
||||
ok(format == D3DFMT_DXT5, "Returned format %u, expected %u\n", format, D3DFMT_DXT5);
|
||||
|
||||
format = D3DFMT_DXT5;
|
||||
width = 5; height = 5;
|
||||
mipmaps = 1;
|
||||
hr = D3DXCheckTextureRequirements(device, &width, &height, &mipmaps, 0, &format, D3DPOOL_DEFAULT);
|
||||
ok(hr == D3D_OK, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr, D3D_OK);
|
||||
ok(width == 8, "Returned width %d, expected %d\n", width, 8);
|
||||
ok(height == 8, "Returned height %d, expected %d\n", height, 8);
|
||||
ok(mipmaps == 1, "Returned mipmaps %d, expected %d\n", mipmaps, 1);
|
||||
ok(format == D3DFMT_DXT5, "Returned format %u, expected %u\n", format, D3DFMT_DXT5);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue