On Wed, Jun 8, 2011 at 8:32 PM, Stefan Dösinger stefandoesinger@gmx.at wrote:
On Wednesday 08 June 2011 18:51:41 Michael Mc Donnell wrote:
unsigned int faces[] = {0, 1, 2}; unsigned int num_faces = sizeof(faces) / 3;
Does this do what you want? As far as I can see you want ARRAY_SIZE(faces) / 3.
You're right that was a bug
- struct {
- D3DXVECTOR3 position0;
- D3DXVECTOR3 position1;
- D3DXVECTOR3 normal;
- DWORD color;
- } vertices[] = {
...
Another style nitpick: Bracket placing.
Change it to brackets on new lines? I actually copied the style from the method above mine. Is this better?:
+ struct + { + D3DXVECTOR3 position0; + D3DXVECTOR3 position1; + D3DXVECTOR3 normal; + DWORD color; + } vertices[] = + { + { { 0.0f, 1.0f, 0.f}, { 1.0f, 0.0f, 0.f}, {0.0f, 0.0f, 1.0f}, 0xffff0000 }, + { { 1.0f, -1.0f, 0.f}, {-1.0f, -1.0f, 0.f}, {0.0f, 0.0f, 1.0f}, 0xff00ff00 }, + { {-1.0f, -1.0f, 0.f}, {-1.0f, 1.0f, 0.f}, {0.0f, 0.0f, 1.0f}, 0xff0000ff }, + };
- /* Two null pointers. Setting only the mesh to null will result in an
- * exception on Windows.
- */
- hr = mesh->lpVtbl->UpdateSemantics(NULL, NULL);
I think setting the instance pointer to NULL when invoking a method doesn't need a test, it will give you odd results. What you show here is that native checks the only method parameter before it accesses the object instance. Remember, usually apps will invoke this via C++:
mesh->UpdateSemantics(declaration);
Similarly it isn't necessary to check iface or This against NULL in the implementations.
Ok, I've removed that check. That wasn't what was causing the exception though. The problem was that it failed to get a device on the testbot. I had forgotten to set the mesh to NULL, so in the cleanup part it tried to release a random pointer, which caused an exception.
On a side note, failing to get a device means that the d3dx tests are always skipped on the testbot?
Otherwise this looks OK
Ok, I'll try again later.