I'm currently implementing the D3DXMatrixStack interface. Could someone try these tests on a windows machine before I go further ?
I did several patches about D3DXMAtrixStack. All were uncorrect.
The idea of Henri to implement it is this one: it is very time -comsumming to allocate or to free memory. So one needs to do that as less as possible.
So, we start with a stack with predefined size. When the stack is full, one multiplies by 2 its size. When one releases items enough of the stack, one divides its size by 2.
Here are patches that implemented that idea.
When looking at your patch, I saw that in my patch, in the D3dxMatrixstackImpl_release function, I do not free the memory of the array of matrix. It should be done.
In the tests patch, I did not check if d3dxmatrixstackcreate fails. If it fails, tests should be skipped. At the end of the test, I did not call the _Release function. It should be done too.
Maybe, you should use these patches and try to improve them.
All the tests passed on my Windows XP box.
David
Actually, I just cleaned up your patches, and will probably submit the first few later today.
Henri Verbeet a écrit :
Actually, I just cleaned up your patches, and will probably submit the first few later today.
Are you going to finish it or can I send the few missing functions ?
2008/10/31 Jérôme Gardou jerome.gardou@gmail.com:
Henri Verbeet a écrit :
Actually, I just cleaned up your patches, and will probably submit the first few later today.
Are you going to finish it or can I send the few missing functions ?
Sure, go ahead. I sent all the patches I wrote for this.
Henri Verbeet a écrit :
2008/10/31 Jérôme Gardou jerome.gardou@gmail.com:
Henri Verbeet a écrit :
Actually, I just cleaned up your patches, and will probably submit the first few later today.
Are you going to finish it or can I send the few missing functions ?
Sure, go ahead. I sent all the patches I wrote for this.
OK, patches will be sent soon. By the way, what if I call multiply on a new stack, the push, then pop ? Will the top matrix be identity, or the one with which I multiplied the first time ?
I guess this calls a testcase ...
2008/10/31 Jérôme Gardou jerome.gardou@gmail.com:
OK, patches will be sent soon. By the way, what if I call multiply on a new stack, the push, then pop ? Will the top matrix be identity, or the one with which I multiplied the first time ?
I guess this calls a testcase ...
I think it should return the result of the multiplication, but tests wouldn't hurt, of course.
Henri Verbeet a écrit :
2008/10/31 Jérôme Gardou jerome.gardou@gmail.com:
OK, patches will be sent soon. By the way, what if I call multiply on a new stack, the push, then pop ? Will the top matrix be identity, or the one with which I multiplied the first time ?
I guess this calls a testcase ...
I think it should return the result of the multiplication, but tests wouldn't hurt, of course.
I think this should return identity... Anyway, could someone try this one on a native installation ?
Jérôme Gardou a écrit :
Henri Verbeet a écrit :
2008/10/31 Jérôme Gardou jerome.gardou@gmail.com:
OK, patches will be sent soon. By the way, what if I call multiply on a new stack, the push, then pop ? Will the top matrix be identity, or the one with which I multiplied the first time ?
I guess this calls a testcase ...
I think it should return the result of the multiplication, but tests wouldn't hurt, of course.
I think this should return identity... Anyway, could someone try this one on a native installation ?
This might be a silly question, but... d3dx8 is supposed to be linked statically in applications that might use it.... is there any sense to implement it? (this is not the case for d3dx9_xx.dll)
I found this information there : http://www.microsoft.com/downloads/details.aspx?FamilyID=fc60231e-895d-489d-... in the readme of the file to download.
If you have a windows license, you can use a native d3dx8.dll to check your test. That is I do ;) And as said henri said, the result matix will be the previous. I had a test to prove it David
--- En date de : Sam 1.11.08, Jérôme Gardou jerome.gardou@gmail.com a écrit : De: Jérôme Gardou jerome.gardou@gmail.com Objet: Re: D3DXMatrixstack: where to go.... À: "Henri Verbeet" hverbeet@gmail.com Cc: "wine-devel" wine-devel@winehq.org Date: Samedi 1 Novembre 2008, 0h17
Henri Verbeet a écrit :
2008/10/31 Jérôme Gardou jerome.gardou@gmail.com:
OK, patches will be sent soon. By the way, what if I call multiply on
a new
stack, the push, then pop ? Will the top matrix be identity, or the
one with
which I multiplied the first time ?
I guess this calls a testcase ...
I think it should return the result of the multiplication, but tests wouldn't hurt, of course.
I think this should return identity... Anyway, could someone try this one on a native installation ?
From b4c72e5e0737d6fa98f352765298bbc5f86d390a Mon Sep 17 00:00:00 2001
From: =?utf-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Sat, 1 Nov 2008 00:13:53 +0100 Subject: [PATCH] Test to know whether the top of a matrix stack is ALWAYS identity
--- dlls/d3dx8/tests/math.c | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index f38ff26..9f5207a 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -1442,7 +1442,7 @@ static void test_matrix_stack(void)
hr = ID3DXMatrixStack_LoadMatrix(stack, NULL); ok(hr == D3DERR_INVALIDCALL, "LoadMatrix returned %#x, expected D3DERR_INVALIDCALL\n", hr); - + hr = ID3DXMatrixStack_LoadMatrix(stack, &mat1); ok(SUCCEEDED(hr), "LoadMatrix failed, hr %#x\n", hr); expect_mat(&mat1, ID3DXMatrixStack_GetTop(stack)); @@ -1479,6 +1479,19 @@ static void test_matrix_stack(void) ok(SUCCEEDED(hr), "Pop failed, hr %#x\n", hr); ok(D3DXMatrixIsIdentity(ID3DXMatrixStack_GetTop(stack)), "The top should be an identity matrix\n");
+ hr = ID3DXMatrixStack_MultMatrix(stack, &mat2) ; + ok(SUCCEEDED(hr), "Multiplication failed"); + /* Identity * mat2 = mat2 */ + expect_mat(&mat2, ID3DXMatrixStack_GetTop(stack)) ; + + hr = ID3DXMatrixStack_Push(stack); + ok(SUCCEEDED(hr), "Push failed, hr %#x\n", hr); + + hr = ID3DXMatrixStack_Pop(stack); + ok(SUCCEEDED(hr), "Pop failed, hr %#x\n", hr); + /* here we are on the bottom of the stack... is it always identity? */ + ok(D3DXMatrixIsIdentity(ID3DXMatrixStack_GetTop(stack)), "The top should be an identity matrix\n"); + refcount = ID3DXMatrixStack_Release(stack); ok(!refcount, "Matrix stack has %u references left.\n", refcount); }