d3dx9: Correctly handle constants without default values in D3DXGetShaderConstantTableEx.
This commit is contained in:
parent
e67920f12f
commit
711ee8a792
|
@ -1261,7 +1261,8 @@ HRESULT WINAPI D3DXGetShaderConstantTableEx(CONST DWORD *byte_code,
|
||||||
object->constants[i].desc.RegisterSet = constant_info[i].RegisterSet;
|
object->constants[i].desc.RegisterSet = constant_info[i].RegisterSet;
|
||||||
object->constants[i].desc.RegisterIndex = constant_info[i].RegisterIndex;
|
object->constants[i].desc.RegisterIndex = constant_info[i].RegisterIndex;
|
||||||
object->constants[i].desc.RegisterCount = constant_info[i].RegisterCount;
|
object->constants[i].desc.RegisterCount = constant_info[i].RegisterCount;
|
||||||
object->constants[i].desc.DefaultValue = object->ctab + constant_info[i].DefaultValue;
|
object->constants[i].desc.DefaultValue = constant_info[i].DefaultValue
|
||||||
|
? object->ctab + constant_info[i].DefaultValue : NULL;
|
||||||
|
|
||||||
hr = parse_ctab_constant_type((LPD3DXSHADER_TYPEINFO)(object->ctab + constant_info[i].TypeInfo),
|
hr = parse_ctab_constant_type((LPD3DXSHADER_TYPEINFO)(object->ctab + constant_info[i].TypeInfo),
|
||||||
&object->constants[i]);
|
&object->constants[i]);
|
||||||
|
|
|
@ -93,11 +93,11 @@ static const DWORD ctab_basic[] = {
|
||||||
0x0000ffff}; /* END */
|
0x0000ffff}; /* END */
|
||||||
|
|
||||||
static const D3DXCONSTANT_DESC ctab_basic_expected[] = {
|
static const D3DXCONSTANT_DESC ctab_basic_expected[] = {
|
||||||
{"mvp", D3DXRS_FLOAT4, 0, 4, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 4, 4, 1, 0, 64, 0},
|
{"mvp", D3DXRS_FLOAT4, 0, 4, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 4, 4, 1, 0, 64, NULL},
|
||||||
{"i", D3DXRS_FLOAT4, 4, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, 0},
|
{"i", D3DXRS_FLOAT4, 4, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4, NULL},
|
||||||
{"i4", D3DXRS_FLOAT4, 5, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 4, 1, 0, 16, 0},
|
{"i4", D3DXRS_FLOAT4, 5, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 4, 1, 0, 16, NULL},
|
||||||
{"f", D3DXRS_FLOAT4, 6, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, 0},
|
{"f", D3DXRS_FLOAT4, 6, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4, NULL},
|
||||||
{"f4", D3DXRS_FLOAT4, 7, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 1, 0, 16, 0}};
|
{"f4", D3DXRS_FLOAT4, 7, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 1, 0, 16, NULL}};
|
||||||
|
|
||||||
static const DWORD ctab_matrices[] = {
|
static const DWORD ctab_matrices[] = {
|
||||||
0xfffe0300, /* vs_3_0 */
|
0xfffe0300, /* vs_3_0 */
|
||||||
|
@ -118,9 +118,9 @@ static const DWORD ctab_matrices[] = {
|
||||||
0x0000ffff}; /* END */
|
0x0000ffff}; /* END */
|
||||||
|
|
||||||
static const D3DXCONSTANT_DESC ctab_matrices_expected[] = {
|
static const D3DXCONSTANT_DESC ctab_matrices_expected[] = {
|
||||||
{"fmatrix4x4", D3DXRS_FLOAT4, 0, 4, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 4, 4, 1, 0, 64, 0},
|
{"fmatrix4x4", D3DXRS_FLOAT4, 0, 4, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 4, 4, 1, 0, 64, NULL},
|
||||||
{"imatrix2x3", D3DXRS_FLOAT4, 4, 3, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 3, 1, 0, 24, 0},
|
{"imatrix2x3", D3DXRS_FLOAT4, 4, 3, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 3, 1, 0, 24, NULL},
|
||||||
{"fmatrix3x1", D3DXRS_FLOAT4, 7, 1, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 1, 1, 0, 12, 0}};
|
{"fmatrix3x1", D3DXRS_FLOAT4, 7, 1, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 1, 1, 0, 12, NULL}};
|
||||||
|
|
||||||
static const DWORD ctab_arrays[] = {
|
static const DWORD ctab_arrays[] = {
|
||||||
0xfffe0300, /* vs_3_0 */
|
0xfffe0300, /* vs_3_0 */
|
||||||
|
@ -150,12 +150,12 @@ static const DWORD ctab_arrays[] = {
|
||||||
0x0000ffff}; /* END */
|
0x0000ffff}; /* END */
|
||||||
|
|
||||||
static const D3DXCONSTANT_DESC ctab_arrays_expected[] = {
|
static const D3DXCONSTANT_DESC ctab_arrays_expected[] = {
|
||||||
{"fmtxarray", D3DXRS_FLOAT4, 0, 8, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 4, 2, 0, 128, 0},
|
{"fmtxarray", D3DXRS_FLOAT4, 0, 8, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 4, 2, 0, 128, NULL},
|
||||||
{"farray", D3DXRS_FLOAT4, 8, 4, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 4, 0, 16, 0},
|
{"farray", D3DXRS_FLOAT4, 8, 4, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 4, 0, 16, NULL},
|
||||||
{"fvecarray", D3DXRS_FLOAT4, 12, 2, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 2, 0, 32, 0},
|
{"fvecarray", D3DXRS_FLOAT4, 12, 2, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 2, 0, 32, NULL},
|
||||||
{"barray", D3DXRS_FLOAT4, 14, 2, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 2, 0, 8, 0},
|
{"barray", D3DXRS_FLOAT4, 14, 2, D3DXPC_SCALAR, D3DXPT_BOOL, 1, 1, 2, 0, 8, NULL},
|
||||||
{"bvecarray", D3DXRS_FLOAT4, 16, 2, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 3, 0, 36, 0},
|
{"bvecarray", D3DXRS_FLOAT4, 16, 2, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 3, 0, 36, NULL},
|
||||||
{"ivecarray", D3DXRS_FLOAT4, 18, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 4, 1, 0, 16, 0}};
|
{"ivecarray", D3DXRS_FLOAT4, 18, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 4, 1, 0, 16, NULL}};
|
||||||
|
|
||||||
static const DWORD ctab_samplers[] = {
|
static const DWORD ctab_samplers[] = {
|
||||||
0xfffe0300, /* vs_3_0 */
|
0xfffe0300, /* vs_3_0 */
|
||||||
|
@ -176,9 +176,9 @@ static const DWORD ctab_samplers[] = {
|
||||||
0x0000ffff}; /* END */
|
0x0000ffff}; /* END */
|
||||||
|
|
||||||
static const D3DXCONSTANT_DESC ctab_samplers_expected[] = {
|
static const D3DXCONSTANT_DESC ctab_samplers_expected[] = {
|
||||||
{"sampler1", D3DXRS_SAMPLER, 0, 1, D3DXPC_OBJECT, D3DXPT_SAMPLER2D, 1, 1, 1, 0, 4, 0},
|
{"sampler1", D3DXRS_SAMPLER, 0, 1, D3DXPC_OBJECT, D3DXPT_SAMPLER2D, 1, 1, 1, 0, 4, NULL},
|
||||||
{"sampler2", D3DXRS_SAMPLER, 3, 1, D3DXPC_OBJECT, D3DXPT_SAMPLER3D, 1, 1, 1, 0, 4, 0},
|
{"sampler2", D3DXRS_SAMPLER, 3, 1, D3DXPC_OBJECT, D3DXPT_SAMPLER3D, 1, 1, 1, 0, 4, NULL},
|
||||||
{"notsampler", D3DXRS_FLOAT4, 2, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 1, 0, 16, 0}};
|
{"notsampler", D3DXRS_FLOAT4, 2, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 1, 0, 16, NULL}};
|
||||||
|
|
||||||
static void test_get_shader_size(void)
|
static void test_get_shader_size(void)
|
||||||
{
|
{
|
||||||
|
@ -437,6 +437,9 @@ static void test_constant_table(const char *test_name, const DWORD *ctable_fn,
|
||||||
ok(actual.Bytes == expected->Bytes,
|
ok(actual.Bytes == expected->Bytes,
|
||||||
"%s in %s: Got different byte count: Got %d, expected %d\n",
|
"%s in %s: Got different byte count: Got %d, expected %d\n",
|
||||||
expected->Name, test_name, actual.Bytes, expected->Bytes);
|
expected->Name, test_name, actual.Bytes, expected->Bytes);
|
||||||
|
ok(actual.DefaultValue == expected->DefaultValue,
|
||||||
|
"%s in %s: Got different default value: Got %p, expected %p\n",
|
||||||
|
expected->Name, test_name, actual.DefaultValue, expected->DefaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Finally, release the constant table */
|
/* Finally, release the constant table */
|
||||||
|
|
Loading…
Reference in New Issue