[d3dx9 2/4] Implement ID3DXConstantTable::GetConstant
Matijn Woudt
tijnema at gmail.com
Tue Jun 8 08:00:13 CDT 2010
Implement ID3DXConstantTable::GetConstant
-------------- next part --------------
From 42487c506d1bc0f49b3ef512370ca701de93a502 Mon Sep 17 00:00:00 2001
From: Matijn Woudt <tijnema at gmail.com>
Date: Tue, 8 Jun 2010 14:42:37 +0200
Subject: [d3dx9 2/4] Implement ID3DXConstantTable::GetConstant
---
dlls/d3dx9_36/shader.c | 12 ++++-
dlls/d3dx9_36/tests/shader.c | 94 +++++++++++++++++++++---------------------
2 files changed, 57 insertions(+), 49 deletions(-)
diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c
index 3a7824a..63732a6 100644
--- a/dlls/d3dx9_36/shader.c
+++ b/dlls/d3dx9_36/shader.c
@@ -672,6 +672,7 @@ typedef struct ID3DXConstantTableImpl {
LPVOID ctab;
DWORD size;
D3DXCONSTANTTABLE_DESC desc;
+ D3DXSHADER_CONSTANTINFO *ConstantInfo;
} ID3DXConstantTableImpl;
/*** IUnknown methods ***/
@@ -777,9 +778,15 @@ static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstant(ID3DXConstantTable*
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
- FIXME("(%p)->(%p, %d): stub\n", This, constant, index);
+ TRACE("(%p)->(%p, %d)\n", This, constant, index);
- return NULL;
+ if(constant)
+ FIXME("Parent used\n");
+
+ if(index >= This->desc.Constants)
+ return NULL;
+
+ return (D3DXHANDLE)&This->ConstantInfo[index];
}
static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstantByName(ID3DXConstantTable* iface, D3DXHANDLE constant, LPCSTR name)
@@ -1040,6 +1047,7 @@ HRESULT WINAPI D3DXGetShaderConstantTableEx(CONST DWORD* byte_code,
object->desc.Creator = ctab_header->Creator ? (LPCSTR)object->ctab + ctab_header->Creator : NULL;
object->desc.Version = ctab_header->Version;
object->desc.Constants = ctab_header->Constants;
+ object->ConstantInfo = (D3DXSHADER_CONSTANTINFO *) (ctab_header->ConstantInfo ? (LPCSTR)object->ctab + ctab_header->ConstantInfo : NULL);
*constant_table = (LPD3DXCONSTANTTABLE)object;
diff --git a/dlls/d3dx9_36/tests/shader.c b/dlls/d3dx9_36/tests/shader.c
index 0abe9f6..c2cc5f9 100644
--- a/dlls/d3dx9_36/tests/shader.c
+++ b/dlls/d3dx9_36/tests/shader.c
@@ -205,90 +205,90 @@ static void test_get_shader_constant_table_ex(void)
ok(constant == NULL, "Got result %p, expected NULL\n", constant);
constant = ID3DXConstantTable_GetConstant(constant_table, NULL, 0);
- todo_wine ok(constant != NULL, "GetConstant failed.\n");
+ ok(constant != NULL, "GetConstant failed.\n");
if(constant) {
hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &const_desc, NULL);
- ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
+ todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
const_size = 1;
hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, NULL, &const_size);
- ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
+ todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
ok(const_size == 1, "Got size %x, expected 1\n", const_size);
hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, NULL, NULL);
- ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
+ todo_wine ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
const_size = 1;
hr = ID3DXConstantTable_GetConstantDesc(constant_table, NULL, &const_desc, &const_size);
- ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
+ todo_wine ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
const_size = 0;
hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &const_desc, &const_size);
- ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
- ok(const_size == 1, "Got size %x, expected 1\n", const_size);
+ todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
+ todo_wine ok(const_size == 1, "Got size %x, expected 1\n", const_size);
const_size = 2;
hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &const_desc, &const_size);
- ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
- ok(const_size == 1, "Got size %x, expected 1\n", const_size);
+ todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
+ todo_wine ok(const_size == 1, "Got size %x, expected 1\n", const_size);
const_size = 1;
hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &const_desc, &const_size);
- ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
+ todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
ok(const_size == 1, "Got size %x, expected 1\n", const_size);
- ok(const_desc.Name == (LPCSTR)data + 0x58, "Got result %p, expected %p\n", const_desc.Name, (LPCSTR)data + 0x58);
- ok(const_desc.RegisterSet == D3DXRS_FLOAT4, "Got result %x, expected %x (D3DXRS_FLOAT4)\n", const_desc.RegisterSet, D3DXRS_FLOAT4);
- ok(const_desc.RegisterIndex == 4, "Got result %x, expected 4\n", const_desc.RegisterIndex);
- ok(const_desc.RegisterCount == 1, "Got result %x, expected 4\n", const_desc.RegisterCount);
- ok(const_desc.Class == D3DXPC_VECTOR, "Got result %x, expected %x (D3DXPC_VECTOR)\n", const_desc.Class, D3DXPC_VECTOR);
- ok(const_desc.Type == D3DXPT_FLOAT, "Got result %x, expected %x (D3DXPT_FLOAT)\n", const_desc.Type, D3DXPT_FLOAT);
- ok(const_desc.Rows == 1, "Got result %x, expected 1\n", const_desc.Rows);
- ok(const_desc.Columns == 4, "Got result %x, expected 4\n", const_desc.Columns);
- ok(const_desc.Elements == 1, "Got result %x, expected 1\n", const_desc.Elements);
- ok(const_desc.StructMembers == 0, "Got result %x, expected 0\n", const_desc.StructMembers);
- ok(const_desc.Bytes == 16, "Got result %x, expected 16\n", const_desc.Bytes);
+ todo_wine ok(const_desc.Name == (LPCSTR)data + 0x58, "Got result %p, expected %p\n", const_desc.Name, (LPCSTR)data + 0x58);
+ todo_wine ok(const_desc.RegisterSet == D3DXRS_FLOAT4, "Got result %x, expected %x (D3DXRS_FLOAT4)\n", const_desc.RegisterSet, D3DXRS_FLOAT4);
+ todo_wine ok(const_desc.RegisterIndex == 4, "Got result %x, expected 4\n", const_desc.RegisterIndex);
+ todo_wine ok(const_desc.RegisterCount == 1, "Got result %x, expected 4\n", const_desc.RegisterCount);
+ todo_wine ok(const_desc.Class == D3DXPC_VECTOR, "Got result %x, expected %x (D3DXPC_VECTOR)\n", const_desc.Class, D3DXPC_VECTOR);
+ todo_wine ok(const_desc.Type == D3DXPT_FLOAT, "Got result %x, expected %x (D3DXPT_FLOAT)\n", const_desc.Type, D3DXPT_FLOAT);
+ todo_wine ok(const_desc.Rows == 1, "Got result %x, expected 1\n", const_desc.Rows);
+ todo_wine ok(const_desc.Columns == 4, "Got result %x, expected 4\n", const_desc.Columns);
+ todo_wine ok(const_desc.Elements == 1, "Got result %x, expected 1\n", const_desc.Elements);
+ todo_wine ok(const_desc.StructMembers == 0, "Got result %x, expected 0\n", const_desc.StructMembers);
+ todo_wine ok(const_desc.Bytes == 16, "Got result %x, expected 16\n", const_desc.Bytes);
ok(const_desc.DefaultValue == NULL, "Got result %p, expected NULL\n", const_desc.DefaultValue);
}
constant = ID3DXConstantTable_GetConstant(constant_table, NULL, 1);
- todo_wine ok(constant != NULL, "GetConstant failed.\n");
+ ok(constant != NULL, "GetConstant failed.\n");
if(constant) {
const_size = 1;
hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &const_desc, &const_size);
- ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
+ todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
ok(const_size == 1, "Got size %x, expected 1\n", const_size);
- ok(const_desc.Name == (LPCSTR)data + 0x7C, "Got result %p, expected %p\n", const_desc.Name, (LPCSTR)data + 0x7C);
- ok(const_desc.RegisterSet == D3DXRS_FLOAT4, "Got result %x, expected %x (D3DXRS_FLOAT4)\n", const_desc.RegisterSet, D3DXRS_FLOAT4);
- ok(const_desc.RegisterIndex == 2, "Got result %x, expected 2\n", const_desc.RegisterIndex);
- ok(const_desc.RegisterCount == 1, "Got result %x, expected 4\n", const_desc.RegisterCount);
- ok(const_desc.Class == D3DXPC_SCALAR, "Got result %x, expected %x (D3DXPC_SCALAR)\n", const_desc.Class, D3DXPC_SCALAR);
- ok(const_desc.Type == D3DXPT_FLOAT, "Got result %x, expected %x (D3DXPT_FLOAT)\n", const_desc.Type, D3DXPT_FLOAT);
- ok(const_desc.Rows == 1, "Got result %x, expected 1\n", const_desc.Rows);
- ok(const_desc.Columns == 1, "Got result %x, expected 1\n", const_desc.Columns);
- ok(const_desc.Elements == 1, "Got result %x, expected 1\n", const_desc.Elements);
- ok(const_desc.StructMembers == 0, "Got result %x, expected 0\n", const_desc.StructMembers);
- ok(const_desc.Bytes == 4, "Got result %x, expected 4\n", const_desc.Bytes);
+ todo_wine ok(const_desc.Name == (LPCSTR)data + 0x7C, "Got result %p, expected %p\n", const_desc.Name, (LPCSTR)data + 0x7C);
+ todo_wine ok(const_desc.RegisterSet == D3DXRS_FLOAT4, "Got result %x, expected %x (D3DXRS_FLOAT4)\n", const_desc.RegisterSet, D3DXRS_FLOAT4);
+ todo_wine ok(const_desc.RegisterIndex == 2, "Got result %x, expected 2\n", const_desc.RegisterIndex);
+ todo_wine ok(const_desc.RegisterCount == 1, "Got result %x, expected 4\n", const_desc.RegisterCount);
+ todo_wine ok(const_desc.Class == D3DXPC_SCALAR, "Got result %x, expected %x (D3DXPC_SCALAR)\n", const_desc.Class, D3DXPC_SCALAR);
+ todo_wine ok(const_desc.Type == D3DXPT_FLOAT, "Got result %x, expected %x (D3DXPT_FLOAT)\n", const_desc.Type, D3DXPT_FLOAT);
+ todo_wine ok(const_desc.Rows == 1, "Got result %x, expected 1\n", const_desc.Rows);
+ todo_wine ok(const_desc.Columns == 1, "Got result %x, expected 1\n", const_desc.Columns);
+ todo_wine ok(const_desc.Elements == 1, "Got result %x, expected 1\n", const_desc.Elements);
+ todo_wine ok(const_desc.StructMembers == 0, "Got result %x, expected 0\n", const_desc.StructMembers);
+ todo_wine ok(const_desc.Bytes == 4, "Got result %x, expected 4\n", const_desc.Bytes);
ok(const_desc.DefaultValue == NULL, "Got result %p, expected NULL\n", const_desc.DefaultValue);
}
constant = ID3DXConstantTable_GetConstant(constant_table, NULL, 2);
- todo_wine ok(constant != NULL, "GetConstant failed.\n");
+ ok(constant != NULL, "GetConstant failed.\n");
if(constant) {
const_size = 1;
hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &const_desc, &const_size);
- ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
+ todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
ok(const_size == 1, "Got size %x, expected 1\n", const_size);
- ok(const_desc.Name == (LPCSTR)data + 0x94, "Got result %p, expected %p\n", const_desc.Name, (LPCSTR)data + 0x94);
- ok(const_desc.RegisterSet == D3DXRS_FLOAT4, "Got result %x, expected %x (D3DXRS_FLOAT4)\n", const_desc.RegisterSet, D3DXRS_FLOAT4);
- ok(const_desc.RegisterIndex == 5, "Got result %x, expected 5\n", const_desc.RegisterIndex);
- ok(const_desc.RegisterCount == 4, "Got result %x, expected 4\n", const_desc.RegisterCount);
- ok(const_desc.Class == D3DXPC_MATRIX_COLUMNS, "Got result %x, expected %x (D3DXPC_MATRIX_COLUMNS)\n", const_desc.Class, D3DXPC_MATRIX_COLUMNS);
- ok(const_desc.Type == D3DXPT_FLOAT, "Got result %x, expected %x (D3DXPT_FLOAT)\n", const_desc.Type, D3DXPT_FLOAT);
- ok(const_desc.Rows == 4, "Got result %x, expected 4\n", const_desc.Rows);
- ok(const_desc.Columns == 4, "Got result %x, expected 4\n", const_desc.Columns);
- ok(const_desc.Elements == 1, "Got result %x, expected 1\n", const_desc.Elements);
- ok(const_desc.StructMembers == 0, "Got result %x, expected 0\n", const_desc.StructMembers);
- ok(const_desc.Bytes == 64, "Got result %x, expected 64\n", const_desc.Bytes);
+ todo_wine ok(const_desc.Name == (LPCSTR)data + 0x94, "Got result %p, expected %p\n", const_desc.Name, (LPCSTR)data + 0x94);
+ todo_wine ok(const_desc.RegisterSet == D3DXRS_FLOAT4, "Got result %x, expected %x (D3DXRS_FLOAT4)\n", const_desc.RegisterSet, D3DXRS_FLOAT4);
+ todo_wine ok(const_desc.RegisterIndex == 5, "Got result %x, expected 5\n", const_desc.RegisterIndex);
+ todo_wine ok(const_desc.RegisterCount == 4, "Got result %x, expected 4\n", const_desc.RegisterCount);
+ todo_wine ok(const_desc.Class == D3DXPC_MATRIX_COLUMNS, "Got result %x, expected %x (D3DXPC_MATRIX_COLUMNS)\n", const_desc.Class, D3DXPC_MATRIX_COLUMNS);
+ todo_wine ok(const_desc.Type == D3DXPT_FLOAT, "Got result %x, expected %x (D3DXPT_FLOAT)\n", const_desc.Type, D3DXPT_FLOAT);
+ todo_wine ok(const_desc.Rows == 4, "Got result %x, expected 4\n", const_desc.Rows);
+ todo_wine ok(const_desc.Columns == 4, "Got result %x, expected 4\n", const_desc.Columns);
+ todo_wine ok(const_desc.Elements == 1, "Got result %x, expected 1\n", const_desc.Elements);
+ todo_wine ok(const_desc.StructMembers == 0, "Got result %x, expected 0\n", const_desc.StructMembers);
+ todo_wine ok(const_desc.Bytes == 64, "Got result %x, expected 64\n", const_desc.Bytes);
ok(const_desc.DefaultValue == NULL, "Got result %p, expected NULL\n", const_desc.DefaultValue);
}
--
1.7.0.4
More information about the wine-patches
mailing list