Implement ID3DXConstantTable::GetConstantDesc
Matijn Woudt
tijnema at gmail.com
Tue Jun 8 08:01:24 CDT 2010
Implement ID3DXConstantTable::GetConstantDesc
-------------- next part --------------
From e0b3a3a77aebaa29227d38dc5e5d331c6c7a0d49 Mon Sep 17 00:00:00 2001
From: Matijn Woudt <tijnema at gmail.com>
Date: Tue, 8 Jun 2010 14:55:34 +0200
Subject: [d3dx9 4/4] Implement ID3DXConstantTable::GetConstantDesc
---
dlls/d3dx9_36/shader.c | 28 ++++++++++++-
dlls/d3dx9_36/tests/shader.c | 88 +++++++++++++++++++++---------------------
2 files changed, 70 insertions(+), 46 deletions(-)
diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c
index 6ac5f75..01fb088 100644
--- a/dlls/d3dx9_36/shader.c
+++ b/dlls/d3dx9_36/shader.c
@@ -759,10 +759,34 @@ static HRESULT WINAPI ID3DXConstantTableImpl_GetConstantDesc(ID3DXConstantTable*
D3DXCONSTANT_DESC *desc, UINT *count)
{
ID3DXConstantTableImpl *This = (ID3DXConstantTableImpl *)iface;
+ D3DXSHADER_CONSTANTINFO *info;
+ D3DXSHADER_TYPEINFO *typeinfo;
- FIXME("(%p)->(%p, %p, %p): stub\n", This, constant, desc, count);
+ TRACE("(%p)->(%p, %p, %p)\n", This, constant, desc, count);
- return E_NOTIMPL;
+ if ((!desc && !count) || !constant)
+ return D3DERR_INVALIDCALL;
+
+ info = (D3DXSHADER_CONSTANTINFO *)constant;
+ typeinfo = (D3DXSHADER_TYPEINFO *)((LPCSTR)This->ctab + info->TypeInfo);
+
+ if(count)
+ *count = 1;
+ if(desc) {
+ desc->Name = info->Name ? (LPCSTR)This->ctab + info->Name : NULL;
+ desc->RegisterSet = info->RegisterSet;
+ desc->RegisterIndex = info->RegisterIndex;
+ desc->RegisterCount = info->RegisterCount;
+ desc->Class = typeinfo->Class;
+ desc->Type = typeinfo->Type;
+ desc->Rows = typeinfo->Rows;
+ desc->Columns = typeinfo->Columns;
+ desc->Elements = typeinfo->Elements;
+ desc->StructMembers = typeinfo->StructMembers;
+ desc->Bytes = 4 * desc->Rows * desc->Columns;
+ desc->DefaultValue = info->DefaultValue ? (LPCSTR)This->ctab + info->DefaultValue : NULL;
+ }
+ return D3D_OK;
}
static UINT WINAPI ID3DXConstantTableImpl_GetSamplerIndex(LPD3DXCONSTANTTABLE iface, D3DXHANDLE constant)
diff --git a/dlls/d3dx9_36/tests/shader.c b/dlls/d3dx9_36/tests/shader.c
index e7f63c5..5f1f2d1 100644
--- a/dlls/d3dx9_36/tests/shader.c
+++ b/dlls/d3dx9_36/tests/shader.c
@@ -208,45 +208,45 @@ static void test_get_shader_constant_table_ex(void)
ok(constant != NULL, "GetConstant failed.\n");
if(constant) {
hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &const_desc, NULL);
- todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
+ 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);
- todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
+ 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);
- todo_wine ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
+ 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);
- todo_wine ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
+ 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);
- 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);
+ 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);
const_size = 2;
hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &const_desc, &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);
+ 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);
const_size = 1;
hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &const_desc, &const_size);
- todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
+ 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(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.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);
ok(const_desc.DefaultValue == NULL, "Got result %p, expected NULL\n", const_desc.DefaultValue);
}
@@ -255,19 +255,19 @@ static void test_get_shader_constant_table_ex(void)
if(constant) {
const_size = 1;
hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &const_desc, &const_size);
- todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
+ 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(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.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);
ok(const_desc.DefaultValue == NULL, "Got result %p, expected NULL\n", const_desc.DefaultValue);
}
@@ -276,19 +276,19 @@ static void test_get_shader_constant_table_ex(void)
if(constant) {
const_size = 1;
hr = ID3DXConstantTable_GetConstantDesc(constant_table, constant, &const_desc, &const_size);
- todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
+ 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(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.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);
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