From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v2: use default include handler v3 (Matteo): move the function out of d3dx10_43_main.c, make a few tweaks.
dlls/d3dx10_43/Makefile.in | 1 + dlls/d3dx10_43/compiler.c | 62 +++++++++++++++++++++++++++++++++ dlls/d3dx10_43/d3dx10_43_main.c | 13 ------- 3 files changed, 63 insertions(+), 13 deletions(-) create mode 100644 dlls/d3dx10_43/compiler.c
diff --git a/dlls/d3dx10_43/Makefile.in b/dlls/d3dx10_43/Makefile.in index 1108dcb0948..1fae34191ee 100644 --- a/dlls/d3dx10_43/Makefile.in +++ b/dlls/d3dx10_43/Makefile.in @@ -7,6 +7,7 @@ EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native
C_SRCS = \ async.c \ + compiler.c \ d3dx10_43_main.c \ texture.c
diff --git a/dlls/d3dx10_43/compiler.c b/dlls/d3dx10_43/compiler.c new file mode 100644 index 00000000000..1ccb0e45a69 --- /dev/null +++ b/dlls/d3dx10_43/compiler.c @@ -0,0 +1,62 @@ +/* + * Copyright 2021 Nikolay Sivov for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + * + */ + +#include "wine/debug.h" + +#define COBJMACROS + +#include "d3d10_1.h" +#include "d3dx10.h" +#include "d3dcompiler.h" + +WINE_DEFAULT_DEBUG_CHANNEL(d3dx); + + +HRESULT WINAPI D3DX10CreateEffectFromMemory(const void *data, SIZE_T datasize, const char *filename, + const D3D10_SHADER_MACRO *defines, ID3D10Include *include, const char *profile, + UINT shader_flags, UINT effect_flags, ID3D10Device *device, ID3D10EffectPool *effect_pool, + ID3DX10ThreadPump *pump, ID3D10Effect **effect, ID3D10Blob **errors, HRESULT *hresult) +{ + ID3D10Blob *code; + HRESULT hr; + + TRACE("data %p, datasize %lu, filename %s, defines %p, include %p, profile %s, shader_flags %#x," + "effect_flags %#x, device %p, effect_pool %p, pump %p, effect %p, errors %p, hresult %p.\n", + data, datasize, debugstr_a(filename), defines, include, debugstr_a(profile), + shader_flags, effect_flags, device, effect_pool, pump, effect, errors, hresult); + + if (pump) + FIXME("Asynchronous mode is not supported.\n"); + + if (!include) + include = D3D_COMPILE_STANDARD_FILE_INCLUDE; + + if (FAILED(hr = D3DCompile(data, datasize, filename, defines, include, "main", profile, + shader_flags, effect_flags, &code, errors))) + { + WARN("Effect compilation failed, hr %#x.\n", hr); + return hr; + } + + hr = D3D10CreateEffectFromMemory(ID3D10Blob_GetBufferPointer(code), ID3D10Blob_GetBufferSize(code), + effect_flags, device, effect_pool, effect); + ID3D10Blob_Release(code); + + return hr; +} diff --git a/dlls/d3dx10_43/d3dx10_43_main.c b/dlls/d3dx10_43/d3dx10_43_main.c index 06b00cb0393..2bbfac9c632 100644 --- a/dlls/d3dx10_43/d3dx10_43_main.c +++ b/dlls/d3dx10_43/d3dx10_43_main.c @@ -74,19 +74,6 @@ HRESULT WINAPI D3DX10CreateEffectFromFileW(const WCHAR *filename, const D3D10_SH return E_NOTIMPL; }
-HRESULT WINAPI D3DX10CreateEffectFromMemory(const void *data, SIZE_T datasize, const char *filename, - const D3D10_SHADER_MACRO *defines, ID3D10Include *include, const char *profile, UINT hlslflags, - UINT fxflags, ID3D10Device *device, ID3D10EffectPool *effectpool, ID3DX10ThreadPump *pump, - ID3D10Effect **effect, ID3D10Blob **errors, HRESULT *hresult) -{ - FIXME("data %p, datasize %lu, filename %s, defines %p, include %p, profile %s, hlslflags %#x, fxflags %#x, " - "device %p, effectpool %p, pump %p, effect %p, errors %p, hresult %p\n", - data, datasize, debugstr_a(filename), defines, include, debugstr_a(profile), hlslflags, fxflags, device, - effectpool, pump, effect, errors, hresult); - - return E_NOTIMPL; -} - HRESULT WINAPI D3DX10CreateEffectPoolFromMemory(const void *data, SIZE_T datasize, const char *filename, const D3D10_SHADER_MACRO *defines, ID3D10Include *include, const char *profile, UINT hlslflags, UINT fxflags, ID3D10Device *device, ID3DX10ThreadPump *pump, ID3D10EffectPool **effectpool,
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v2: use default include handler v3 (Matteo): move the function out of d3dx10_43_main.c, make a few tweaks.
dlls/d3dx10_43/compiler.c | 33 +++++++++++++++++++++++++++++++++ dlls/d3dx10_43/d3dx10_43_main.c | 13 ------------- 2 files changed, 33 insertions(+), 13 deletions(-)
diff --git a/dlls/d3dx10_43/compiler.c b/dlls/d3dx10_43/compiler.c index 1ccb0e45a69..932bdadea1a 100644 --- a/dlls/d3dx10_43/compiler.c +++ b/dlls/d3dx10_43/compiler.c @@ -60,3 +60,36 @@ HRESULT WINAPI D3DX10CreateEffectFromMemory(const void *data, SIZE_T datasize, c
return hr; } + +HRESULT WINAPI D3DX10CreateEffectFromFileW(const WCHAR *filename, const D3D10_SHADER_MACRO *defines, + ID3D10Include *include, const char *profile, UINT shader_flags, UINT effect_flags, + ID3D10Device *device, ID3D10EffectPool *effect_pool, ID3DX10ThreadPump *pump, + ID3D10Effect **effect, ID3D10Blob **errors, HRESULT *hresult) +{ + ID3D10Blob *code; + HRESULT hr; + + TRACE("filename %s, defines %p, include %p, profile %s, shader_flags %#x, effect_flags %#x, " + "device %p, effect_pool %p, pump %p, effect %p, errors %p, hresult %p.\n", + debugstr_w(filename), defines, include, debugstr_a(profile), shader_flags, effect_flags, + device, effect_pool, pump, effect, errors, hresult); + + if (pump) + FIXME("Asynchronous mode is not supported.\n"); + + if (!include) + include = D3D_COMPILE_STANDARD_FILE_INCLUDE; + + if (FAILED(hr = D3DCompileFromFile(filename, defines, include, "main", profile, shader_flags, + effect_flags, &code, errors))) + { + WARN("Effect compilation failed, hr %#x.\n", hr); + return hr; + } + + hr = D3D10CreateEffectFromMemory(ID3D10Blob_GetBufferPointer(code), ID3D10Blob_GetBufferSize(code), + effect_flags, device, effect_pool, effect); + ID3D10Blob_Release(code); + + return hr; +} diff --git a/dlls/d3dx10_43/d3dx10_43_main.c b/dlls/d3dx10_43/d3dx10_43_main.c index 2bbfac9c632..2c53924ac20 100644 --- a/dlls/d3dx10_43/d3dx10_43_main.c +++ b/dlls/d3dx10_43/d3dx10_43_main.c @@ -61,19 +61,6 @@ HRESULT WINAPI D3DX10CreateEffectFromFileA(const char *filename, const D3D10_SHA return E_NOTIMPL; }
-HRESULT WINAPI D3DX10CreateEffectFromFileW(const WCHAR *filename, const D3D10_SHADER_MACRO *defines, - ID3D10Include *include, const char *profile, UINT hlslflags, UINT fxflags, ID3D10Device *device, - ID3D10EffectPool *effectpool, ID3DX10ThreadPump *pump, ID3D10Effect **effect, ID3D10Blob **errors, - HRESULT *hresult) -{ - FIXME("filename %s, defines %p, include %p, profile %s, hlslflags %#x, fxflags %#x, " - "device %p, effectpool %p, pump %p, effect %p, errors %p, hresult %p\n", - debugstr_w(filename), defines, include, debugstr_a(profile), hlslflags, fxflags, device, - effectpool, pump, effect, errors, hresult); - - return E_NOTIMPL; -} - HRESULT WINAPI D3DX10CreateEffectPoolFromMemory(const void *data, SIZE_T datasize, const char *filename, const D3D10_SHADER_MACRO *defines, ID3D10Include *include, const char *profile, UINT hlslflags, UINT fxflags, ID3D10Device *device, ID3DX10ThreadPump *pump, ID3D10EffectPool **effectpool,
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v3 (Matteo): minor clean up
dlls/d3d10/effect.c | 22 ++++- dlls/d3d10/tests/effect.c | 182 ++++++++++++++++---------------------- 2 files changed, 97 insertions(+), 107 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 86ef50aac01..e121ad9cac2 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -1330,12 +1330,28 @@ static HRESULT parse_fx10_variable_head(const char *data, size_t data_size, static HRESULT parse_fx10_annotation(const char *data, size_t data_size, const char **ptr, struct d3d10_effect_variable *a) { + DWORD offset; HRESULT hr;
if (FAILED(hr = parse_fx10_variable_head(data, data_size, ptr, a))) return hr;
- skip_dword_unknown("annotation", ptr, 1); + read_dword(ptr, &offset); + TRACE("Annotation value is at offset %#x.\n", offset); + + switch (a->type->basetype) + { + case D3D10_SVT_STRING: + if (!fx10_copy_string(data, data_size, offset, (char **)&a->u.buffer.local_buffer)) + { + ERR("Failed to copy name.\n"); + return E_OUTOFMEMORY; + } + break; + + default: + FIXME("Unhandled object type %#x.\n", a->type->basetype); + }
/* mark the variable as annotation */ a->flag = D3D10_EFFECT_VARIABLE_ANNOTATION; @@ -2826,6 +2842,10 @@ static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v) heap_free(v->u.resource.srv); break;
+ case D3D10_SVT_STRING: + heap_free(v->u.buffer.local_buffer); + break; + default: break; } diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index fc0b8180b97..18560705049 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -1161,7 +1161,7 @@ static void test_effect_variable_element(void) * test_effect_variable_type_class */ #if 0 -cbuffer cb <String s = "STRING";> +cbuffer cb <String s = "STRING"; String s2 = "STRING"; > { float f; vector <int, 2> i; @@ -1186,109 +1186,60 @@ GeometryShader gs[2]; PixelShader ps; VertexShader vs[1]; #endif -static DWORD fx_test_evtc[] = { -0x43425844, 0xc04c50cb, 0x0afeb4ef, 0xbb93f346, -0x97a29499, 0x00000001, 0x00000659, 0x00000001, -0x00000024, 0x30315846, 0x0000062d, 0xfeff1001, -0x00000001, 0x00000004, 0x00000011, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x000003d9, -0x00000000, 0x00000008, 0x00000001, 0x00000001, -0x00000001, 0x00000001, 0x00000001, 0x00000001, -0x00000004, 0x00000000, 0x00000000, 0x53006263, -0x6e697274, 0x00070067, 0x00020000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00010000, -0x00730000, 0x49525453, 0x6600474e, 0x74616f6c, -0x00003300, 0x00000100, 0x00000000, 0x00000400, -0x00001000, 0x00000400, 0x00090900, 0x69006600, -0x0032746e, 0x00000057, 0x00000001, 0x00000000, -0x00000008, 0x00000010, 0x00000008, 0x00001112, -0x69750069, 0x7832746e, 0x007a0033, 0x00010000, -0x00000000, 0x00280000, 0x00300000, 0x00180000, -0x5a1b0000, 0x00750000, 0x6c6f6f62, 0x00337832, -0x000000a0, 0x00000001, 0x00000000, 0x0000001c, -0x00000020, 0x00000018, 0x00001a23, 0x6c420062, -0x53646e65, 0x65746174, 0x0000c600, 0x00000200, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000200, 0x656c6200, 0x4400646e, 0x68747065, -0x6e657453, 0x536c6963, 0x65746174, 0x0000f300, -0x00000200, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000300, 0x70656400, 0x74736874, -0x69636e65, 0x6152006c, 0x72657473, 0x72657a69, -0x74617453, 0x012e0065, 0x00020000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00040000, -0x61720000, 0x53007473, 0x6c706d61, 0x74537265, -0x00657461, 0x0000015f, 0x00000002, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000015, -0x006d6173, 0x646e6552, 0x61547265, 0x74656772, -0x77656956, 0x00018c00, 0x00000200, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00001300, -0x76747200, 0x70654400, 0x74536874, 0x69636e65, -0x6569566c, 0x01bd0077, 0x00020000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00140000, -0x73640000, 0x65540076, 0x72757478, 0x00443165, -0x000001ee, 0x00000002, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x0000000a, 0x54003174, -0x75747865, 0x44316572, 0x61727241, 0x02170079, -0x00020000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x000b0000, 0x31740000, 0x65540061, -0x72757478, 0x00443265, 0x00000246, 0x00000002, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x0000000c, 0x54003274, 0x75747865, 0x44326572, -0x6f00534d, 0x02000002, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x0e000000, 0x74000000, -0x736d6432, 0x78655400, 0x65727574, 0x72414432, -0x00796172, 0x0000029d, 0x00000002, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x0000000d, -0x00613274, 0x74786554, 0x32657275, 0x41534d44, -0x79617272, 0x0002cc00, 0x00000200, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000f00, -0x64327400, 0x0061736d, 0x74786554, 0x33657275, -0x03000044, 0x00020000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00100000, 0x33740000, -0x78655400, 0x65727574, 0x65627543, 0x00032900, -0x00000200, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00001100, 0x00717400, 0x6d6f6547, -0x79727465, 0x64616853, 0x54007265, 0x02000003, -0x02000000, 0x00000000, 0x00000000, 0x00000000, -0x07000000, 0x67000000, 0x69500073, 0x536c6578, -0x65646168, 0x03820072, 0x00020000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00050000, -0x73700000, 0x72655600, 0x53786574, 0x65646168, -0x03ad0072, 0x00020000, 0x00010000, 0x00000000, -0x00000000, 0x00000000, 0x00060000, 0x73760000, -0x00000400, 0x00006000, 0x00000000, 0x00000400, -0xffffff00, 0x000001ff, 0x00002a00, 0x00000e00, -0x00002c00, 0x00005500, 0x00003900, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00007800, 0x00005c00, 0x00000000, 0x00000400, -0x00000000, 0x00000000, 0x00000000, 0x00009e00, -0x00008200, 0x00000000, 0x00001000, 0x00000000, -0x00000000, 0x00000000, 0x0000c400, 0x0000a800, -0x00000000, 0x00004000, 0x00000000, 0x00000000, -0x00000000, 0x0000ed00, 0x0000d100, 0x00000000, -0xffffff00, 0x000000ff, 0x00000000, 0x00012100, -0x00010500, 0x00000000, 0xffffff00, 0x000000ff, -0x00000000, 0x00015a00, 0x00013e00, 0x00000000, -0xffffff00, 0x000000ff, 0x00000000, 0x00018800, -0x00016c00, 0x00000000, 0xffffff00, 0x000000ff, -0x00000000, 0x0001b900, 0x00019d00, 0x00000000, -0xffffff00, 0x000000ff, 0x0001ea00, 0x0001ce00, -0x00000000, 0xffffff00, 0x000000ff, 0x00021400, -0x0001f800, 0x00000000, 0xffffff00, 0x000000ff, -0x00024200, 0x00022600, 0x00000000, 0xffffff00, -0x000000ff, 0x00026c00, 0x00025000, 0x00000000, -0xffffff00, 0x000000ff, 0x00029700, 0x00027b00, -0x00000000, 0xffffff00, 0x000000ff, 0x0002c800, -0x0002ac00, 0x00000000, 0xffffff00, 0x000000ff, -0x0002f900, 0x0002dd00, 0x00000000, 0xffffff00, -0x000000ff, 0x00032600, 0x00030a00, 0x00000000, -0xffffff00, 0x000000ff, 0x00035100, 0x00033500, -0x00000000, 0xffffff00, 0x000000ff, 0x00037f00, -0x00036300, 0x00000000, 0xffffff00, 0x000000ff, -0x00000000, 0x00000000, 0x0003aa00, 0x00038e00, -0x00000000, 0xffffff00, 0x000000ff, 0x00000000, -0x0003d600, 0x0003ba00, 0x00000000, 0xffffff00, -0x000000ff, 0x00000000, 0x00000000, +static DWORD fx_test_evtc[] = +{ +0x43425844, 0x16ff7a62, 0x6eb690dc, 0x60dd5ba4, 0x903b0ce7, 0x00000001, 0x00000668, 0x00000001, +0x00000024, 0x30315846, 0x0000063c, 0xfeff1001, 0x00000001, 0x00000004, 0x00000011, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x000003dc, 0x00000000, 0x00000008, 0x00000001, 0x00000001, +0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000004, 0x00000000, 0x00000000, 0x53006263, +0x6e697274, 0x00070067, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, +0x00730000, 0x49525453, 0x7300474e, 0x6c660032, 0x0074616f, 0x00000036, 0x00000001, 0x00000000, +0x00000004, 0x00000010, 0x00000004, 0x00000909, 0x6e690066, 0x5a003274, 0x01000000, 0x00000000, +0x08000000, 0x10000000, 0x08000000, 0x12000000, 0x69000011, 0x6e697500, 0x33783274, 0x00007d00, +0x00000100, 0x00000000, 0x00002800, 0x00003000, 0x00001800, 0x005a1b00, 0x62007500, 0x326c6f6f, +0xa3003378, 0x01000000, 0x00000000, 0x1c000000, 0x20000000, 0x18000000, 0x23000000, 0x6200001a, +0x656c4200, 0x7453646e, 0x00657461, 0x000000c9, 0x00000002, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000002, 0x6e656c62, 0x65440064, 0x53687470, 0x636e6574, 0x74536c69, 0x00657461, +0x000000f6, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x74706564, +0x65747368, 0x6c69636e, 0x73615200, 0x69726574, 0x5372657a, 0x65746174, 0x00013100, 0x00000200, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0x73617200, 0x61530074, 0x656c706d, +0x61745372, 0x62006574, 0x02000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x15000000, +0x73000000, 0x52006d61, 0x65646e65, 0x72615472, 0x56746567, 0x00776569, 0x0000018f, 0x00000002, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000013, 0x00767472, 0x74706544, 0x65745368, +0x6c69636e, 0x77656956, 0x0001c000, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00001400, 0x76736400, 0x78655400, 0x65727574, 0xf1004431, 0x02000001, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x0a000000, 0x74000000, 0x65540031, 0x72757478, 0x41443165, 0x79617272, +0x00021a00, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000b00, 0x61317400, +0x78655400, 0x65727574, 0x49004432, 0x02000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x0c000000, 0x74000000, 0x65540032, 0x72757478, 0x4d443265, 0x02720053, 0x00020000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x000e0000, 0x32740000, 0x00736d64, 0x74786554, 0x32657275, +0x72724144, 0xa0007961, 0x02000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0d000000, +0x74000000, 0x54006132, 0x75747865, 0x44326572, 0x7241534d, 0x00796172, 0x000002cf, 0x00000002, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000000f, 0x6d643274, 0x54006173, 0x75747865, +0x44336572, 0x00030300, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00001000, +0x00337400, 0x74786554, 0x43657275, 0x00656275, 0x0000032c, 0x00000002, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000011, 0x47007174, 0x656d6f65, 0x53797274, 0x65646168, 0x03570072, +0x00020000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00070000, 0x73670000, 0x78695000, +0x68536c65, 0x72656461, 0x00038500, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000500, 0x00737000, 0x74726556, 0x68537865, 0x72656461, 0x0003b000, 0x00000200, 0x00000100, +0x00000000, 0x00000000, 0x00000000, 0x00000600, 0x00737600, 0x00000004, 0x00000060, 0x00000000, +0x00000004, 0xffffffff, 0x00000002, 0x0000002a, 0x0000000e, 0x0000002c, 0x00000033, 0x0000000e, +0x0000002c, 0x00000058, 0x0000003c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x0000007b, 0x0000005f, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x000000a1, +0x00000085, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x000000c7, 0x000000ab, +0x00000000, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x000000f0, 0x000000d4, 0x00000000, +0xffffffff, 0x00000000, 0x00000000, 0x00000124, 0x00000108, 0x00000000, 0xffffffff, 0x00000000, +0x00000000, 0x0000015d, 0x00000141, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x0000018b, +0x0000016f, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x000001bc, 0x000001a0, 0x00000000, +0xffffffff, 0x00000000, 0x000001ed, 0x000001d1, 0x00000000, 0xffffffff, 0x00000000, 0x00000217, +0x000001fb, 0x00000000, 0xffffffff, 0x00000000, 0x00000245, 0x00000229, 0x00000000, 0xffffffff, +0x00000000, 0x0000026f, 0x00000253, 0x00000000, 0xffffffff, 0x00000000, 0x0000029a, 0x0000027e, +0x00000000, 0xffffffff, 0x00000000, 0x000002cb, 0x000002af, 0x00000000, 0xffffffff, 0x00000000, +0x000002fc, 0x000002e0, 0x00000000, 0xffffffff, 0x00000000, 0x00000329, 0x0000030d, 0x00000000, +0xffffffff, 0x00000000, 0x00000354, 0x00000338, 0x00000000, 0xffffffff, 0x00000000, 0x00000382, +0x00000366, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x000003ad, 0x00000391, +0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x000003d9, 0x000003bd, 0x00000000, 0xffffffff, +0x00000000, 0x00000000, };
static BOOL is_valid_check(BOOL a, BOOL b) @@ -1382,6 +1333,7 @@ static void check_as(ID3D10EffectVariable *variable)
static void test_effect_variable_type_class(void) { + ID3D10EffectStringVariable *string_var; ID3D10Effect *effect; ID3D10EffectConstantBuffer *constantbuffer, *null_buffer, *parent; ID3D10EffectVariable *variable; @@ -1392,6 +1344,7 @@ static void test_effect_variable_type_class(void) ULONG refcount; HRESULT hr; unsigned int variable_nr = 0; + const char *str1, *str2;
if (!(device = create_device())) { @@ -1413,7 +1366,7 @@ static void test_effect_variable_type_class(void) ok(strcmp(vd.Name, "cb") == 0, "Name is "%s", expected "cb"\n", vd.Name); ok(vd.Semantic == NULL, "Semantic is "%s", expected NULL\n", vd.Semantic); ok(vd.Flags == 0, "Type is %u, expected 0\n", vd.Flags); - ok(vd.Annotations == 1, "Elements is %u, expected 1\n", vd.Annotations); + ok(vd.Annotations == 2, "Unexpected Annotations %u.\n", vd.Annotations); ok(vd.BufferOffset == 0, "Members is %u, expected 0\n", vd.BufferOffset); ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
@@ -1437,7 +1390,6 @@ static void test_effect_variable_type_class(void) ok(td.UnpackedSize == 0x60, "UnpackedSize is %#x, expected 0x60\n", td.UnpackedSize); ok(td.Stride == 0x60, "Stride is %#x, expected 0x60\n", td.Stride);
- /* check annotation a */ variable = constantbuffer->lpVtbl->GetAnnotationByIndex(constantbuffer, 0); hr = variable->lpVtbl->GetDesc(variable, &vd); ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); @@ -1469,6 +1421,24 @@ static void test_effect_variable_type_class(void) ok(td.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", td.UnpackedSize); ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
+ string_var = variable->lpVtbl->AsString(variable); + hr = string_var->lpVtbl->GetString(string_var, &str1); +todo_wine + ok(SUCCEEDED(hr), "GetString failed, hr %#x.\n", hr); + if (SUCCEEDED(hr)) + ok(!strcmp(str1, "STRING"), "Unexpected value %s.\n", str1); + + variable = constantbuffer->lpVtbl->GetAnnotationByIndex(constantbuffer, 1); + string_var = variable->lpVtbl->AsString(variable); + hr = string_var->lpVtbl->GetString(string_var, &str2); +todo_wine + ok(SUCCEEDED(hr), "GetString failed, hr %#x.\n", hr); + if (SUCCEEDED(hr)) + { + ok(str2 != str1, "Unexpected string pointer.\n"); + ok(!strcmp(str2, "STRING"), "Unexpected value %s.\n", str1); + } + /* check float f */ variable = constantbuffer->lpVtbl->GetMemberByIndex(constantbuffer, variable_nr++); hr = variable->lpVtbl->GetDesc(variable, &vd);
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v3: minor tests clean up
dlls/d3d10/effect.c | 20 ++++++++++++++++++-- dlls/d3d10/tests/effect.c | 24 +++++++++++++++--------- 2 files changed, 33 insertions(+), 11 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index e121ad9cac2..12cfb457399 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -5794,6 +5794,11 @@ static const struct ID3D10EffectMatrixVariableVtbl d3d10_effect_matrix_variable_
/* ID3D10EffectVariable methods */
+static inline struct d3d10_effect_variable *impl_from_ID3D10EffectStringVariable(ID3D10EffectStringVariable *iface) +{ + return CONTAINING_RECORD(iface, struct d3d10_effect_variable, ID3D10EffectVariable_iface); +} + static BOOL STDMETHODCALLTYPE d3d10_effect_string_variable_IsValid(ID3D10EffectStringVariable *iface) { TRACE("iface %p\n", iface); @@ -5950,9 +5955,20 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetRawValue(ID3D10 static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetString(ID3D10EffectStringVariable *iface, const char **str) { - FIXME("iface %p, str %p stub!\n", iface, str); + struct d3d10_effect_variable *var = impl_from_ID3D10EffectStringVariable(iface); + char *value = (char *)var->u.buffer.local_buffer;
- return E_NOTIMPL; + TRACE("iface %p, str %p.\n", iface, str); + + if (!value) + return E_FAIL; + + if (!str) + return E_INVALIDARG; + + *str = value; + + return S_OK; }
static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetStringArray(ID3D10EffectStringVariable *iface, diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 18560705049..fd0c7f7830a 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -1422,22 +1422,28 @@ static void test_effect_variable_type_class(void) ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
string_var = variable->lpVtbl->AsString(variable); + hr = string_var->lpVtbl->GetString(string_var, NULL); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); hr = string_var->lpVtbl->GetString(string_var, &str1); -todo_wine ok(SUCCEEDED(hr), "GetString failed, hr %#x.\n", hr); - if (SUCCEEDED(hr)) - ok(!strcmp(str1, "STRING"), "Unexpected value %s.\n", str1); + ok(!strcmp(str1, "STRING"), "Unexpected value %s.\n", str1);
variable = constantbuffer->lpVtbl->GetAnnotationByIndex(constantbuffer, 1); string_var = variable->lpVtbl->AsString(variable); hr = string_var->lpVtbl->GetString(string_var, &str2); -todo_wine ok(SUCCEEDED(hr), "GetString failed, hr %#x.\n", hr); - if (SUCCEEDED(hr)) - { - ok(str2 != str1, "Unexpected string pointer.\n"); - ok(!strcmp(str2, "STRING"), "Unexpected value %s.\n", str1); - } + ok(str2 != str1, "Unexpected string pointer.\n"); + ok(!strcmp(str2, "STRING"), "Unexpected value %s.\n", str1); + + /* Only two annotations */ + variable = constantbuffer->lpVtbl->GetAnnotationByIndex(constantbuffer, 2); + string_var = variable->lpVtbl->AsString(variable); + hr = string_var->lpVtbl->GetString(string_var, NULL); + ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr); + str1 = (void *)0xdeadbeef; + hr = string_var->lpVtbl->GetString(string_var, &str1); + ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr); + ok(str1 == (void *)0xdeadbeef, "Unexpected pointer.\n");
/* check float f */ variable = constantbuffer->lpVtbl->GetMemberByIndex(constantbuffer, variable_nr++);
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v3: minor tests clean up
dlls/d3d10/effect.c | 24 ++++- dlls/d3d10/tests/effect.c | 195 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 217 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 12cfb457399..15b71aab1b7 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -3104,9 +3104,29 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDevice(ID3D10Effect *iface, ID3
static HRESULT STDMETHODCALLTYPE d3d10_effect_GetDesc(ID3D10Effect *iface, D3D10_EFFECT_DESC *desc) { - FIXME("iface %p, desc %p stub!\n", iface, desc); + struct d3d10_effect *effect = impl_from_ID3D10Effect(iface); + unsigned int i;
- return E_NOTIMPL; + FIXME("iface %p, desc %p.\n", iface, desc); + + if (!desc) + return E_INVALIDARG; + + /* FIXME */ + desc->IsChildEffect = FALSE; + desc->SharedConstantBuffers = 0; + desc->SharedGlobalVariables = 0; + + desc->ConstantBuffers = effect->local_buffer_count; + desc->Techniques = effect->technique_count; + desc->GlobalVariables = effect->local_variable_count; + for (i = 0; i < effect->local_buffer_count; ++i) + { + struct d3d10_effect_variable *l = &effect->local_buffers[i]; + desc->GlobalVariables += l->type->member_count; + } + + return S_OK; }
static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetConstantBufferByIndex(ID3D10Effect *iface, diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index fd0c7f7830a..e19f4a0f694 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -86,6 +86,7 @@ static void test_effect_constant_buffer_type(void) ID3D10EffectConstantBuffer *constantbuffer; ID3D10EffectType *type, *type2, *null_type; D3D10_EFFECT_TYPE_DESC type_desc; + D3D10_EFFECT_DESC desc; ID3D10Device *device; ULONG refcount; HRESULT hr; @@ -101,6 +102,20 @@ static void test_effect_constant_buffer_type(void) hr = create_effect(fx_test_ecbt, 0, device, NULL, &effect); ok(SUCCEEDED(hr), "D3D10CreateEffectFromMemory failed (%x)\n", hr);
+ hr = effect->lpVtbl->GetDesc(effect, NULL); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + + hr = effect->lpVtbl->GetDesc(effect, &desc); + ok(SUCCEEDED(hr), "Failed to get effect description, hr %#x.\n", hr); + ok(!desc.IsChildEffect, "Unexpected IsChildEffect.\n"); + ok(desc.ConstantBuffers == 1, "Unexpected constant buffers count %u.\n", desc.ConstantBuffers); + ok(desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n", + desc.SharedConstantBuffers); + ok(desc.GlobalVariables == 2, "Unexpected global variables count %u.\n", desc.GlobalVariables); + ok(desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n", + desc.SharedGlobalVariables); + ok(desc.Techniques == 0, "Unexpected techniques count %u.\n", desc.Techniques); + constantbuffer = effect->lpVtbl->GetConstantBufferByIndex(effect, 0); type = constantbuffer->lpVtbl->GetType(constantbuffer);
@@ -259,6 +274,7 @@ static void test_effect_variable_type(void) ID3D10EffectVariable *variable; ID3D10EffectType *type, *type2, *type3; D3D10_EFFECT_TYPE_DESC type_desc; + D3D10_EFFECT_DESC desc; ID3D10Device *device; ULONG refcount; HRESULT hr; @@ -274,6 +290,17 @@ static void test_effect_variable_type(void) hr = create_effect(fx_test_evt, 0, device, NULL, &effect); ok(SUCCEEDED(hr), "D3D10CreateEffectFromMemory failed (%x)\n", hr);
+ hr = effect->lpVtbl->GetDesc(effect, &desc); + ok(SUCCEEDED(hr), "Failed to get effect description, hr %#x.\n", hr); + ok(!desc.IsChildEffect, "Unexpected IsChildEffect.\n"); + ok(desc.ConstantBuffers == 1, "Unexpected constant buffers count %u.\n", desc.ConstantBuffers); + ok(desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n", + desc.SharedConstantBuffers); + ok(desc.GlobalVariables == 1, "Unexpected global variables count %u.\n", desc.GlobalVariables); + ok(desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n", + desc.SharedGlobalVariables); + ok(desc.Techniques == 0, "Unexpected techniques count %u.\n", desc.Techniques); + constantbuffer = effect->lpVtbl->GetConstantBufferByIndex(effect, 0); type = constantbuffer->lpVtbl->GetType(constantbuffer); hr = type->lpVtbl->GetDesc(type, &type_desc); @@ -492,6 +519,7 @@ static void test_effect_variable_member(void) ID3D10EffectConstantBuffer *constantbuffer; ID3D10EffectVariable *variable, *variable2, *variable3, *null_variable; D3D10_EFFECT_VARIABLE_DESC desc; + D3D10_EFFECT_DESC effect_desc; ID3D10Device *device; ULONG refcount; HRESULT hr; @@ -505,6 +533,19 @@ static void test_effect_variable_member(void) hr = create_effect(fx_test_evm, 0, device, NULL, &effect); ok(SUCCEEDED(hr), "D3D10CreateEffectFromMemory failed (%x)\n", hr);
+ hr = effect->lpVtbl->GetDesc(effect, &effect_desc); + ok(SUCCEEDED(hr), "Failed to get effect description, hr %#x.\n", hr); + ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n"); + ok(effect_desc.ConstantBuffers == 1, "Unexpected constant buffers count %u.\n", + effect_desc.ConstantBuffers); + ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n", + effect_desc.SharedConstantBuffers); + ok(effect_desc.GlobalVariables == 1, "Unexpected global variables count %u.\n", + effect_desc.GlobalVariables); + ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n", + effect_desc.SharedGlobalVariables); + ok(effect_desc.Techniques == 0, "Unexpected techniques count %u.\n", effect_desc.Techniques); + constantbuffer = effect->lpVtbl->GetConstantBufferByIndex(effect, 0); hr = constantbuffer->lpVtbl->GetDesc(constantbuffer, &desc); ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); @@ -693,6 +734,7 @@ static void test_effect_variable_element(void) ID3D10EffectType *type, *type2; D3D10_EFFECT_VARIABLE_DESC desc; D3D10_EFFECT_TYPE_DESC type_desc; + D3D10_EFFECT_DESC effect_desc; ID3D10Device *device; ULONG refcount; HRESULT hr; @@ -706,6 +748,19 @@ static void test_effect_variable_element(void) hr = create_effect(fx_test_eve, 0, device, NULL, &effect); ok(SUCCEEDED(hr), "D3D10CreateEffectFromMemory failed (%x)\n", hr);
+ hr = effect->lpVtbl->GetDesc(effect, &effect_desc); + ok(SUCCEEDED(hr), "Failed to get effect description, hr %#x.\n", hr); + ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n"); + ok(effect_desc.ConstantBuffers == 1, "Unexpected constant buffers count %u.\n", + effect_desc.ConstantBuffers); + ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n", + effect_desc.SharedConstantBuffers); + ok(effect_desc.GlobalVariables == 1, "Unexpected global variables count %u.\n", + effect_desc.GlobalVariables); + ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n", + effect_desc.SharedGlobalVariables); + ok(effect_desc.Techniques == 0, "Unexpected techniques count %u.\n", effect_desc.Techniques); + constantbuffer = effect->lpVtbl->GetConstantBufferByIndex(effect, 0); hr = constantbuffer->lpVtbl->GetDesc(constantbuffer, &desc); ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr); @@ -1340,6 +1395,7 @@ static void test_effect_variable_type_class(void) ID3D10EffectType *type; D3D10_EFFECT_VARIABLE_DESC vd; D3D10_EFFECT_TYPE_DESC td; + D3D10_EFFECT_DESC effect_desc; ID3D10Device *device; ULONG refcount; HRESULT hr; @@ -1355,6 +1411,19 @@ static void test_effect_variable_type_class(void) hr = create_effect(fx_test_evtc, 0, device, NULL, &effect); ok(SUCCEEDED(hr), "D3D10CreateEffectFromMemory failed (%x)\n", hr);
+ hr = effect->lpVtbl->GetDesc(effect, &effect_desc); + ok(SUCCEEDED(hr), "Failed to get effect description, hr %#x.\n", hr); + ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n"); + ok(effect_desc.ConstantBuffers == 1, "Unexpected constant buffers count %u.\n", + effect_desc.ConstantBuffers); + ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n", + effect_desc.SharedConstantBuffers); + ok(effect_desc.GlobalVariables == 21, "Unexpected global variables count %u.\n", + effect_desc.GlobalVariables); + ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n", + effect_desc.SharedGlobalVariables); + ok(effect_desc.Techniques == 0, "Unexpected techniques count %u.\n", effect_desc.Techniques); + /* get the null_constantbuffer, so that we can compare it to variables->GetParentConstantBuffer */ null_buffer = effect->lpVtbl->GetConstantBufferByIndex(effect, 1);
@@ -2364,6 +2433,7 @@ static void test_effect_constant_buffer_stride(void) ID3D10EffectConstantBuffer *constantbuffer; ID3D10EffectType *type; D3D10_EFFECT_TYPE_DESC tdesc; + D3D10_EFFECT_DESC effect_desc; ID3D10Device *device; ULONG refcount; HRESULT hr; @@ -2401,6 +2471,19 @@ static void test_effect_constant_buffer_stride(void) hr = create_effect(fx_test_ecbs, 0, device, NULL, &effect); ok(SUCCEEDED(hr), "D3D10CreateEffectFromMemory failed (%x)\n", hr);
+ hr = effect->lpVtbl->GetDesc(effect, &effect_desc); + ok(SUCCEEDED(hr), "Failed to get effect description, hr %#x.\n", hr); + ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n"); + ok(effect_desc.ConstantBuffers == 15, "Unexpected constant buffers count %u.\n", + effect_desc.ConstantBuffers); + ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n", + effect_desc.SharedConstantBuffers); + ok(effect_desc.GlobalVariables == 36, "Unexpected global variables count %u.\n", + effect_desc.GlobalVariables); + ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n", + effect_desc.SharedGlobalVariables); + ok(effect_desc.Techniques == 0, "Unexpected techniques count %u.\n", effect_desc.Techniques); + for (i=0; i<ARRAY_SIZE(tv_ecbs); i++) { constantbuffer = effect->lpVtbl->GetConstantBufferByIndex(effect, i); @@ -2691,6 +2774,7 @@ static void test_effect_local_shader(void) D3D10_EFFECT_VARIABLE_DESC vdesc = {0}; ID3D10EffectType *type; D3D10_EFFECT_TYPE_DESC typedesc; + D3D10_EFFECT_DESC effect_desc; ID3D10EffectShaderVariable *null_shader, *null_anon_vs, *null_anon_ps, *null_anon_gs, *p3_anon_vs, *p3_anon_ps, *p3_anon_gs, *p6_vs, *p6_ps, *p6_gs; ID3D10Device *device; @@ -2705,6 +2789,19 @@ static void test_effect_local_shader(void) hr = create_effect(fx_local_shader, 0, device, NULL, &effect); ok(SUCCEEDED(hr), "D3D10CreateEffectFromMemory failed!\n");
+ hr = effect->lpVtbl->GetDesc(effect, &effect_desc); + ok(SUCCEEDED(hr), "Failed to get effect description, hr %#x.\n", hr); + ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n"); + ok(effect_desc.ConstantBuffers == 0, "Unexpected constant buffers count %u.\n", + effect_desc.ConstantBuffers); + ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n", + effect_desc.SharedConstantBuffers); + ok(effect_desc.GlobalVariables == 6, "Unexpected global variables count %u.\n", + effect_desc.GlobalVariables); + ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n", + effect_desc.SharedGlobalVariables); + ok(effect_desc.Techniques == 1, "Unexpected techniques count %u.\n", effect_desc.Techniques); + null_technique = effect->lpVtbl->GetTechniqueByIndex(effect, 0xffffffff); null_pass = null_technique->lpVtbl->GetPassByIndex(null_technique, 0xffffffff);
@@ -3562,6 +3659,7 @@ static void test_effect_get_variable_by(void) { ID3D10Effect *effect; ID3D10EffectVariable *variable_by_index, *variable, *null_variable; + D3D10_EFFECT_DESC effect_desc; ID3D10Device *device; ULONG refcount; HRESULT hr; @@ -3575,6 +3673,19 @@ static void test_effect_get_variable_by(void) hr = create_effect(fx_test_egvb, 0, device, NULL, &effect); ok(SUCCEEDED(hr), "D3D10CreateEffectFromMemory failed (%x)\n", hr);
+ hr = effect->lpVtbl->GetDesc(effect, &effect_desc); + ok(SUCCEEDED(hr), "Failed to get effect description, hr %#x.\n", hr); + ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n"); + ok(effect_desc.ConstantBuffers == 2, "Unexpected constant buffers count %u.\n", + effect_desc.ConstantBuffers); + ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n", + effect_desc.SharedConstantBuffers); + ok(effect_desc.GlobalVariables == 6, "Unexpected global variables count %u.\n", + effect_desc.GlobalVariables); + ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n", + effect_desc.SharedGlobalVariables); + ok(effect_desc.Techniques == 0, "Unexpected techniques count %u.\n", effect_desc.Techniques); + /* get the null variable */ null_variable = effect->lpVtbl->GetVariableByIndex(effect, 0xffffffff);
@@ -3868,6 +3979,7 @@ static void test_effect_state_groups(void) D3D10_RASTERIZER_DESC rast_desc; D3D10_SAMPLER_DESC sampler_desc; ID3D10EffectSamplerVariable *s; + D3D10_EFFECT_DESC effect_desc; ID3D10BlendState *blend_state; UINT sample_mask, stencil_ref; ID3D10EffectBlendVariable *b; @@ -3890,6 +4002,19 @@ static void test_effect_state_groups(void) hr = create_effect(fx_test_state_groups, 0, device, NULL, &effect); ok(SUCCEEDED(hr), "Failed to create effect, hr %#x.\n", hr);
+ hr = effect->lpVtbl->GetDesc(effect, &effect_desc); + ok(SUCCEEDED(hr), "Failed to get effect description, hr %#x.\n", hr); + ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n"); + ok(effect_desc.ConstantBuffers == 1, "Unexpected constant buffers count %u.\n", + effect_desc.ConstantBuffers); + ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n", + effect_desc.SharedConstantBuffers); + ok(effect_desc.GlobalVariables == 4, "Unexpected global variables count %u.\n", + effect_desc.GlobalVariables); + ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n", + effect_desc.SharedGlobalVariables); + ok(effect_desc.Techniques == 1, "Unexpected techniques count %u.\n", effect_desc.Techniques); + v = effect->lpVtbl->GetVariableByName(effect, "sampler0"); s = v->lpVtbl->AsSampler(v); s->lpVtbl->GetBackingStore(s, 0, &sampler_desc); @@ -4124,6 +4249,7 @@ static void test_effect_state_group_defaults(void) D3D10_RASTERIZER_DESC rast_desc; D3D10_SAMPLER_DESC sampler_desc; ID3D10EffectSamplerVariable *s; + D3D10_EFFECT_DESC effect_desc; ID3D10EffectBlendVariable *b; D3D10_BLEND_DESC blend_desc; D3D10_PASS_DESC pass_desc; @@ -4143,6 +4269,19 @@ static void test_effect_state_group_defaults(void) hr = create_effect(fx_test_state_group_defaults, 0, device, NULL, &effect); ok(SUCCEEDED(hr), "Failed to create effect, hr %#x.\n", hr);
+ hr = effect->lpVtbl->GetDesc(effect, &effect_desc); + ok(SUCCEEDED(hr), "Failed to get effect description, hr %#x.\n", hr); + ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n"); + ok(effect_desc.ConstantBuffers == 1, "Unexpected constant buffers count %u.\n", + effect_desc.ConstantBuffers); + ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n", + effect_desc.SharedConstantBuffers); + ok(effect_desc.GlobalVariables == 4, "Unexpected global variables count %u.\n", + effect_desc.GlobalVariables); + ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n", + effect_desc.SharedGlobalVariables); + ok(effect_desc.Techniques == 1, "Unexpected techniques count %u.\n", effect_desc.Techniques); + v = effect->lpVtbl->GetVariableByName(effect, "sampler0"); s = v->lpVtbl->AsSampler(v); memset(&sampler_desc, 0, sizeof(sampler_desc)); @@ -4566,6 +4705,7 @@ static void test_effect_scalar_variable(void) {"b_a", D3D10_SVT_BOOL, TRUE}, }; D3D10_EFFECT_TYPE_DESC type_desc; + D3D10_EFFECT_DESC effect_desc; ID3D10EffectScalarVariable *s_v; ID3D10EffectVariable *var; ID3D10EffectType *type; @@ -4584,6 +4724,19 @@ static void test_effect_scalar_variable(void) hr = create_effect(fx_test_scalar_variable, 0, device, NULL, &effect); ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ hr = effect->lpVtbl->GetDesc(effect, &effect_desc); + ok(SUCCEEDED(hr), "Failed to get effect description, hr %#x.\n", hr); + ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n"); + ok(effect_desc.ConstantBuffers == 1, "Unexpected constant buffers count %u.\n", + effect_desc.ConstantBuffers); + ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n", + effect_desc.SharedConstantBuffers); + ok(effect_desc.GlobalVariables == 6, "Unexpected global variables count %u.\n", + effect_desc.GlobalVariables); + ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n", + effect_desc.SharedGlobalVariables); + ok(effect_desc.Techniques == 0, "Unexpected techniques count %u.\n", effect_desc.Techniques); + /* Check each different scalar type, make sure the variable returned is * valid, set it to a value, and make sure what we get back is the same * as what we set it to. */ @@ -4966,6 +5119,7 @@ static void test_effect_vector_variable(void) }; ID3D10EffectVectorVariable *v_var; D3D10_EFFECT_TYPE_DESC type_desc; + D3D10_EFFECT_DESC effect_desc; ID3D10EffectVariable *var; ID3D10EffectType *type; ID3D10Device *device; @@ -4983,6 +5137,19 @@ static void test_effect_vector_variable(void) hr = create_effect(fx_test_vector_variable, 0, device, NULL, &effect); ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ hr = effect->lpVtbl->GetDesc(effect, &effect_desc); + ok(SUCCEEDED(hr), "Failed to get effect description, hr %#x.\n", hr); + ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n"); + ok(effect_desc.ConstantBuffers == 1, "Unexpected constant buffers count %u.\n", + effect_desc.ConstantBuffers); + ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n", + effect_desc.SharedConstantBuffers); + ok(effect_desc.GlobalVariables == 6, "Unexpected global variables count %u.\n", + effect_desc.GlobalVariables); + ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n", + effect_desc.SharedGlobalVariables); + ok(effect_desc.Techniques == 0, "Unexpected techniques count %u.\n", effect_desc.Techniques); + for (i = 0; i < ARRAY_SIZE(tests); ++i) { var = effect->lpVtbl->GetVariableByName(effect, tests[i].name); @@ -5298,6 +5465,7 @@ static void test_effect_matrix_variable(void) }; ID3D10EffectMatrixVariable *m_var; D3D10_EFFECT_TYPE_DESC type_desc; + D3D10_EFFECT_DESC effect_desc; ID3D10EffectVariable *var; ID3D10EffectType *type; ID3D10Device *device; @@ -5315,6 +5483,19 @@ static void test_effect_matrix_variable(void) hr = create_effect(fx_test_matrix_variable, 0, device, NULL, &effect); ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ hr = effect->lpVtbl->GetDesc(effect, &effect_desc); + ok(SUCCEEDED(hr), "Failed to get effect description, hr %#x.\n", hr); + ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n"); + ok(effect_desc.ConstantBuffers == 1, "Unexpected constant buffers count %u.\n", + effect_desc.ConstantBuffers); + ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n", + effect_desc.SharedConstantBuffers); + ok(effect_desc.GlobalVariables == 5, "Unexpected global variables count %u.\n", + effect_desc.GlobalVariables); + ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n", + effect_desc.SharedGlobalVariables); + ok(effect_desc.Techniques == 0, "Unexpected techniques count %u.\n", effect_desc.Techniques); + for (i = 0; i < ARRAY_SIZE(tests); ++i) { var = effect->lpVtbl->GetVariableByName(effect, tests[i].name); @@ -5466,6 +5647,7 @@ static void test_effect_resource_variable(void) ID3D10EffectShaderResourceVariable *t0, *t_a, *t_a_0; ID3D10EffectTechnique *technique; ID3D10Texture2D *tex0, *tex_a[2]; + D3D10_EFFECT_DESC effect_desc; ID3D10EffectVariable *var; ID3D10EffectPass *pass; ID3D10Device *device; @@ -5483,6 +5665,19 @@ static void test_effect_resource_variable(void) hr = create_effect(fx_test_resource_variable, 0, device, NULL, &effect); ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ hr = effect->lpVtbl->GetDesc(effect, &effect_desc); + ok(SUCCEEDED(hr), "Failed to get effect description, hr %#x.\n", hr); + ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n"); + ok(effect_desc.ConstantBuffers == 0, "Unexpected constant buffers count %u.\n", + effect_desc.ConstantBuffers); + ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n", + effect_desc.SharedConstantBuffers); + ok(effect_desc.GlobalVariables == 2, "Unexpected global variables count %u.\n", + effect_desc.GlobalVariables); + ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n", + effect_desc.SharedGlobalVariables); + ok(effect_desc.Techniques == 1, "Unexpected techniques count %u.\n", effect_desc.Techniques); + var = effect->lpVtbl->GetVariableByName(effect, "t0"); t0 = get_effect_shader_resource_variable(var); create_effect_texture_resource(device, &srv0, &tex0);