Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dx9_24/Makefile.in | 3 +- dlls/d3dx9_24/d3dx9_24_main.c | 60 ------------------------ dlls/d3dx9_25/Makefile.in | 3 +- dlls/d3dx9_25/d3dx9_25_main.c | 60 ------------------------ dlls/d3dx9_26/Makefile.in | 3 +- dlls/d3dx9_26/d3dx9_26_main.c | 60 ------------------------ dlls/d3dx9_27/Makefile.in | 3 +- dlls/d3dx9_27/d3dx9_27_main.c | 60 ------------------------ dlls/d3dx9_28/Makefile.in | 3 +- dlls/d3dx9_28/d3dx9_28_main.c | 60 ------------------------ dlls/d3dx9_29/Makefile.in | 3 +- dlls/d3dx9_29/d3dx9_29_main.c | 60 ------------------------ dlls/d3dx9_30/Makefile.in | 3 +- dlls/d3dx9_30/d3dx9_30_main.c | 77 ------------------------------- dlls/d3dx9_31/Makefile.in | 3 +- dlls/d3dx9_31/d3dx9_31_main.c | 60 ------------------------ dlls/d3dx9_32/Makefile.in | 3 +- dlls/d3dx9_32/d3dx9_32_main.c | 61 ------------------------ dlls/d3dx9_33/Makefile.in | 3 +- dlls/d3dx9_33/d3dx9_33_main.c | 62 ------------------------- dlls/d3dx9_34/Makefile.in | 3 +- dlls/d3dx9_34/d3dx9_34_main.c | 60 ------------------------ dlls/d3dx9_35/Makefile.in | 3 +- dlls/d3dx9_35/d3dx9_35_main.c | 60 ------------------------ dlls/d3dx9_36/Makefile.in | 4 +- dlls/d3dx9_36/{d3dx9_36_main.c => main.c} | 22 ++++----- dlls/d3dx9_37/Makefile.in | 3 +- dlls/d3dx9_37/d3dx9_37_main.c | 60 ------------------------ dlls/d3dx9_38/Makefile.in | 3 +- dlls/d3dx9_38/d3dx9_38_main.c | 60 ------------------------ dlls/d3dx9_39/Makefile.in | 3 +- dlls/d3dx9_39/d3dx9_39_main.c | 60 ------------------------ dlls/d3dx9_40/Makefile.in | 3 +- dlls/d3dx9_40/d3dx9_40_main.c | 61 ------------------------ dlls/d3dx9_41/Makefile.in | 3 +- dlls/d3dx9_41/d3dx9_41_main.c | 61 ------------------------ dlls/d3dx9_42/Makefile.in | 3 +- dlls/d3dx9_42/d3dx9_42_main.c | 62 ------------------------- dlls/d3dx9_43/Makefile.in | 3 +- dlls/d3dx9_43/d3dx9_43_main.c | 61 ------------------------ include/d3dx9core.h | 4 +- 41 files changed, 52 insertions(+), 1200 deletions(-) delete mode 100644 dlls/d3dx9_24/d3dx9_24_main.c delete mode 100644 dlls/d3dx9_25/d3dx9_25_main.c delete mode 100644 dlls/d3dx9_26/d3dx9_26_main.c delete mode 100644 dlls/d3dx9_27/d3dx9_27_main.c delete mode 100644 dlls/d3dx9_28/d3dx9_28_main.c delete mode 100644 dlls/d3dx9_29/d3dx9_29_main.c delete mode 100644 dlls/d3dx9_30/d3dx9_30_main.c delete mode 100644 dlls/d3dx9_31/d3dx9_31_main.c delete mode 100644 dlls/d3dx9_32/d3dx9_32_main.c delete mode 100644 dlls/d3dx9_33/d3dx9_33_main.c delete mode 100644 dlls/d3dx9_34/d3dx9_34_main.c delete mode 100644 dlls/d3dx9_35/d3dx9_35_main.c rename dlls/d3dx9_36/{d3dx9_36_main.c => main.c} (73%) delete mode 100644 dlls/d3dx9_37/d3dx9_37_main.c delete mode 100644 dlls/d3dx9_38/d3dx9_38_main.c delete mode 100644 dlls/d3dx9_39/d3dx9_39_main.c delete mode 100644 dlls/d3dx9_40/d3dx9_40_main.c delete mode 100644 dlls/d3dx9_41/d3dx9_41_main.c delete mode 100644 dlls/d3dx9_42/d3dx9_42_main.c delete mode 100644 dlls/d3dx9_43/d3dx9_43_main.c
diff --git a/dlls/d3dx9_24/Makefile.in b/dlls/d3dx9_24/Makefile.in index 71dee7f7740..bd8d3a1df52 100644 --- a/dlls/d3dx9_24/Makefile.in +++ b/dlls/d3dx9_24/Makefile.in @@ -1,3 +1,4 @@ +EXTRADEFS = -DD3DX_SDK_VERSION=24 MODULE = d3dx9_24.dll IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 PARENTSRC = ../d3dx9_36 @@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36 C_SRCS = \ animation.c \ core.c \ - d3dx9_24_main.c \ + main.c \ effect.c \ font.c \ line.c \ diff --git a/dlls/d3dx9_24/d3dx9_24_main.c b/dlls/d3dx9_24/d3dx9_24_main.c deleted file mode 100644 index 613061675a0..00000000000 --- a/dlls/d3dx9_24/d3dx9_24_main.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Direct3D X 9 main file - * - * Copyright (C) 2007 David Adam - * - * 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 "config.h" -#include "wine/port.h" -#include "initguid.h" -#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" - -#include "d3dx9.h" - -/*********************************************************************** - * DllMain. - */ -BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) -{ - switch(reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(inst); - break; - } - return TRUE; -} - -/*********************************************************************** - * D3DXCheckVersion - * Checks whether we are compiling against the correct d3d and d3dx library. - */ -BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers) -{ - if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==24) - return TRUE; - else - return FALSE; -} diff --git a/dlls/d3dx9_25/Makefile.in b/dlls/d3dx9_25/Makefile.in index 9b44be8567d..17871f386fd 100644 --- a/dlls/d3dx9_25/Makefile.in +++ b/dlls/d3dx9_25/Makefile.in @@ -1,3 +1,4 @@ +EXTRADEFS = -DD3DX_SDK_VERSION=25 MODULE = d3dx9_25.dll IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 PARENTSRC = ../d3dx9_36 @@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36 C_SRCS = \ animation.c \ core.c \ - d3dx9_25_main.c \ + main.c \ effect.c \ font.c \ line.c \ diff --git a/dlls/d3dx9_25/d3dx9_25_main.c b/dlls/d3dx9_25/d3dx9_25_main.c deleted file mode 100644 index ae4591772d6..00000000000 --- a/dlls/d3dx9_25/d3dx9_25_main.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Direct3D X 9 main file - * - * Copyright (C) 2007 David Adam - * - * 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 "config.h" -#include "wine/port.h" -#include "initguid.h" -#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" - -#include "d3dx9.h" - -/*********************************************************************** - * DllMain. - */ -BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) -{ - switch(reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(inst); - break; - } - return TRUE; -} - -/*********************************************************************** - * D3DXCheckVersion - * Checks whether we are compiling against the correct d3d and d3dx library. - */ -BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers) -{ - if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==25) - return TRUE; - else - return FALSE; -} diff --git a/dlls/d3dx9_26/Makefile.in b/dlls/d3dx9_26/Makefile.in index 14a52d1a574..6a16016473d 100644 --- a/dlls/d3dx9_26/Makefile.in +++ b/dlls/d3dx9_26/Makefile.in @@ -1,3 +1,4 @@ +EXTRADEFS = -DD3DX_SDK_VERSION=26 MODULE = d3dx9_26.dll IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 PARENTSRC = ../d3dx9_36 @@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36 C_SRCS = \ animation.c \ core.c \ - d3dx9_26_main.c \ + main.c \ effect.c \ font.c \ line.c \ diff --git a/dlls/d3dx9_26/d3dx9_26_main.c b/dlls/d3dx9_26/d3dx9_26_main.c deleted file mode 100644 index 08b48d94cbd..00000000000 --- a/dlls/d3dx9_26/d3dx9_26_main.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Direct3D X 9 main file - * - * Copyright (C) 2007 David Adam - * - * 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 "config.h" -#include "wine/port.h" -#include "initguid.h" -#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" - -#include "d3dx9.h" - -/*********************************************************************** - * DllMain. - */ -BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) -{ - switch(reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(inst); - break; - } - return TRUE; -} - -/*********************************************************************** - * D3DXCheckVersion - * Checks whether we are compiling against the correct d3d and d3dx library. - */ -BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers) -{ - if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==26) - return TRUE; - else - return FALSE; -} diff --git a/dlls/d3dx9_27/Makefile.in b/dlls/d3dx9_27/Makefile.in index b2784fc619d..b3def98d6eb 100644 --- a/dlls/d3dx9_27/Makefile.in +++ b/dlls/d3dx9_27/Makefile.in @@ -1,3 +1,4 @@ +EXTRADEFS = -DD3DX_SDK_VERSION=27 MODULE = d3dx9_27.dll IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 PARENTSRC = ../d3dx9_36 @@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36 C_SRCS = \ animation.c \ core.c \ - d3dx9_27_main.c \ + main.c \ effect.c \ font.c \ line.c \ diff --git a/dlls/d3dx9_27/d3dx9_27_main.c b/dlls/d3dx9_27/d3dx9_27_main.c deleted file mode 100644 index c418071f6b4..00000000000 --- a/dlls/d3dx9_27/d3dx9_27_main.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Direct3D X 9 main file - * - * Copyright (C) 2007 David Adam - * - * 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 "config.h" -#include "wine/port.h" -#include "initguid.h" -#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" - -#include "d3dx9.h" - -/*********************************************************************** - * DllMain. - */ -BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) -{ - switch(reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(inst); - break; - } - return TRUE; -} - -/*********************************************************************** - * D3DXCheckVersion - * Checks whether we are compiling against the correct d3d and d3dx library. - */ -BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers) -{ - if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==27) - return TRUE; - else - return FALSE; -} diff --git a/dlls/d3dx9_28/Makefile.in b/dlls/d3dx9_28/Makefile.in index f6b31d658a9..c4542135e66 100644 --- a/dlls/d3dx9_28/Makefile.in +++ b/dlls/d3dx9_28/Makefile.in @@ -1,3 +1,4 @@ +EXTRADEFS = -DD3DX_SDK_VERSION=28 MODULE = d3dx9_28.dll IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 PARENTSRC = ../d3dx9_36 @@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36 C_SRCS = \ animation.c \ core.c \ - d3dx9_28_main.c \ + main.c \ effect.c \ font.c \ line.c \ diff --git a/dlls/d3dx9_28/d3dx9_28_main.c b/dlls/d3dx9_28/d3dx9_28_main.c deleted file mode 100644 index c8292d8a15c..00000000000 --- a/dlls/d3dx9_28/d3dx9_28_main.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Direct3D X 9 main file - * - * Copyright (C) 2007 David Adam - * - * 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 "config.h" -#include "wine/port.h" -#include "initguid.h" -#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" - -#include "d3dx9.h" - -/*********************************************************************** - * DllMain. - */ -BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) -{ - switch(reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(inst); - break; - } - return TRUE; -} - -/*********************************************************************** - * D3DXCheckVersion - * Checks whether we are compiling against the correct d3d and d3dx library. - */ -BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers) -{ - if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==28) - return TRUE; - else - return FALSE; -} diff --git a/dlls/d3dx9_29/Makefile.in b/dlls/d3dx9_29/Makefile.in index 9bd84beeaaf..e1b50d0e2a4 100644 --- a/dlls/d3dx9_29/Makefile.in +++ b/dlls/d3dx9_29/Makefile.in @@ -1,3 +1,4 @@ +EXTRADEFS = -DD3DX_SDK_VERSION=29 MODULE = d3dx9_29.dll IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 PARENTSRC = ../d3dx9_36 @@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36 C_SRCS = \ animation.c \ core.c \ - d3dx9_29_main.c \ + main.c \ effect.c \ font.c \ line.c \ diff --git a/dlls/d3dx9_29/d3dx9_29_main.c b/dlls/d3dx9_29/d3dx9_29_main.c deleted file mode 100644 index 6a1174c59d4..00000000000 --- a/dlls/d3dx9_29/d3dx9_29_main.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Direct3D X 9 main file - * - * Copyright (C) 2007 David Adam - * - * 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 "config.h" -#include "wine/port.h" -#include "initguid.h" -#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" - -#include "d3dx9.h" - -/*********************************************************************** - * DllMain. - */ -BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) -{ - switch(reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(inst); - break; - } - return TRUE; -} - -/*********************************************************************** - * D3DXCheckVersion - * Checks whether we are compiling against the correct d3d and d3dx library. - */ -BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers) -{ - if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==29) - return TRUE; - else - return FALSE; -} diff --git a/dlls/d3dx9_30/Makefile.in b/dlls/d3dx9_30/Makefile.in index a8ee15d46f6..6f18d145210 100644 --- a/dlls/d3dx9_30/Makefile.in +++ b/dlls/d3dx9_30/Makefile.in @@ -1,3 +1,4 @@ +EXTRADEFS = -DD3DX_SDK_VERSION=30 MODULE = d3dx9_30.dll IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 PARENTSRC = ../d3dx9_36 @@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36 C_SRCS = \ animation.c \ core.c \ - d3dx9_30_main.c \ + main.c \ effect.c \ font.c \ line.c \ diff --git a/dlls/d3dx9_30/d3dx9_30_main.c b/dlls/d3dx9_30/d3dx9_30_main.c deleted file mode 100644 index dba15fe752b..00000000000 --- a/dlls/d3dx9_30/d3dx9_30_main.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Direct3D X 9 main file - * - * Copyright (C) 2007 David Adam - * - * 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 "config.h" -#include "wine/port.h" -#include "initguid.h" -#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" - -#include "d3dx9.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(d3dx); - -/*********************************************************************** - * DllMain. - */ -BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) -{ - switch(reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(inst); - break; - } - return TRUE; -} - -/*********************************************************************** - * D3DXCheckVersion - * Checks whether we are compiling against the correct d3d and d3dx library. - */ -BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers) -{ - if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==30) - return TRUE; - else - return FALSE; -} - -typedef enum _D3DX_CPU_OPTIMIZATION -{ - D3DX_NOT_OPTIMIZED = 0, - D3DX_3DNOW_OPTIMIZED = 1, - D3DX_SSE2_OPTIMIZED = 2, - D3DX_SSE_OPTIMIZED = 3 -} D3DX_CPU_OPTIMIZATION; - -D3DX_CPU_OPTIMIZATION WINAPI D3DXCpuOptimizations(BOOL enable) -{ - FIXME("%i - stub\n", enable); - return D3DX_NOT_OPTIMIZED; -} diff --git a/dlls/d3dx9_31/Makefile.in b/dlls/d3dx9_31/Makefile.in index 27bd337df11..be5cdb9878f 100644 --- a/dlls/d3dx9_31/Makefile.in +++ b/dlls/d3dx9_31/Makefile.in @@ -1,3 +1,4 @@ +EXTRADEFS = -DD3DX_SDK_VERSION=31 MODULE = d3dx9_31.dll IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 PARENTSRC = ../d3dx9_36 @@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36 C_SRCS = \ animation.c \ core.c \ - d3dx9_31_main.c \ + main.c \ effect.c \ font.c \ line.c \ diff --git a/dlls/d3dx9_31/d3dx9_31_main.c b/dlls/d3dx9_31/d3dx9_31_main.c deleted file mode 100644 index 47dc3044c9e..00000000000 --- a/dlls/d3dx9_31/d3dx9_31_main.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Direct3D X 9 main file - * - * Copyright (C) 2007 David Adam - * - * 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 "config.h" -#include "wine/port.h" -#include "initguid.h" -#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" - -#include "d3dx9.h" - -/*********************************************************************** - * DllMain. - */ -BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) -{ - switch(reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(inst); - break; - } - return TRUE; -} - -/*********************************************************************** - * D3DXCheckVersion - * Checks whether we are compiling against the correct d3d and d3dx library. - */ -BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers) -{ - if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==31) - return TRUE; - else - return FALSE; -} diff --git a/dlls/d3dx9_32/Makefile.in b/dlls/d3dx9_32/Makefile.in index 1229c7fe9bf..6373c821e8a 100644 --- a/dlls/d3dx9_32/Makefile.in +++ b/dlls/d3dx9_32/Makefile.in @@ -1,3 +1,4 @@ +EXTRADEFS = -DD3DX_SDK_VERSION=32 MODULE = d3dx9_32.dll IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 PARENTSRC = ../d3dx9_36 @@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36 C_SRCS = \ animation.c \ core.c \ - d3dx9_32_main.c \ + main.c \ effect.c \ font.c \ line.c \ diff --git a/dlls/d3dx9_32/d3dx9_32_main.c b/dlls/d3dx9_32/d3dx9_32_main.c deleted file mode 100644 index 414baa37135..00000000000 --- a/dlls/d3dx9_32/d3dx9_32_main.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Direct3D X 9 main file - * - * Copyright (C) 2007 David Adam - * - * 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 "config.h" -#include "wine/port.h" -#include "initguid.h" -#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" - -#include "d3dx9.h" - -/*********************************************************************** - * DllMain. - */ -BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) -{ - switch(reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(inst); - break; - } - return TRUE; -} - - -/*********************************************************************** - * D3DXCheckVersion - * Checks whether we are compiling against the correct d3d and d3dx library. - */ -BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers) -{ - if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==32) - return TRUE; - else - return FALSE; -} diff --git a/dlls/d3dx9_33/Makefile.in b/dlls/d3dx9_33/Makefile.in index 44bd9917713..10d0dd3ba28 100644 --- a/dlls/d3dx9_33/Makefile.in +++ b/dlls/d3dx9_33/Makefile.in @@ -1,3 +1,4 @@ +EXTRADEFS = -DD3DX_SDK_VERSION=33 MODULE = d3dx9_33.dll IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 PARENTSRC = ../d3dx9_36 @@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36 C_SRCS = \ animation.c \ core.c \ - d3dx9_33_main.c \ + main.c \ effect.c \ font.c \ line.c \ diff --git a/dlls/d3dx9_33/d3dx9_33_main.c b/dlls/d3dx9_33/d3dx9_33_main.c deleted file mode 100644 index 3e409e329fc..00000000000 --- a/dlls/d3dx9_33/d3dx9_33_main.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Direct3D X 9 main file - * - * Copyright (C) 2007 David Adam - * - * 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 "config.h" -#include "wine/port.h" -#include "initguid.h" - -#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" - -#include "d3dx9.h" - -/*********************************************************************** - * DllMain. - */ -BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) -{ - switch(reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(inst); - break; - } - return TRUE; -} - - -/*********************************************************************** - * D3DXCheckVersion - * Checks whether we are compiling against the correct d3d and d3dx library. - */ -BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers) -{ - if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==33) - return TRUE; - else - return FALSE; -} diff --git a/dlls/d3dx9_34/Makefile.in b/dlls/d3dx9_34/Makefile.in index 4ba14c22cbb..4f592bc3e79 100644 --- a/dlls/d3dx9_34/Makefile.in +++ b/dlls/d3dx9_34/Makefile.in @@ -1,3 +1,4 @@ +EXTRADEFS = -DD3DX_SDK_VERSION=34 MODULE = d3dx9_34.dll IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 PARENTSRC = ../d3dx9_36 @@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36 C_SRCS = \ animation.c \ core.c \ - d3dx9_34_main.c \ + main.c \ effect.c \ font.c \ line.c \ diff --git a/dlls/d3dx9_34/d3dx9_34_main.c b/dlls/d3dx9_34/d3dx9_34_main.c deleted file mode 100644 index 17115f23eff..00000000000 --- a/dlls/d3dx9_34/d3dx9_34_main.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Direct3D X 9 main file - * - * Copyright (C) 2007 David Adam - * - * 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 "config.h" -#include "wine/port.h" -#include "initguid.h" -#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" - -#include "d3dx9.h" - -/*********************************************************************** - * DllMain. - */ -BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) -{ - switch(reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(inst); - break; - } - return TRUE; -} - -/*********************************************************************** - * D3DXCheckVersion - * Checks whether we are compiling against the correct d3d and d3dx library. - */ -BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers) -{ - if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==34) - return TRUE; - else - return FALSE; -} diff --git a/dlls/d3dx9_35/Makefile.in b/dlls/d3dx9_35/Makefile.in index ee527d55e49..8ae7a9bb1b8 100644 --- a/dlls/d3dx9_35/Makefile.in +++ b/dlls/d3dx9_35/Makefile.in @@ -1,3 +1,4 @@ +EXTRADEFS = -DD3DX_SDK_VERSION=35 MODULE = d3dx9_35.dll IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 PARENTSRC = ../d3dx9_36 @@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36 C_SRCS = \ animation.c \ core.c \ - d3dx9_35_main.c \ + main.c \ effect.c \ font.c \ line.c \ diff --git a/dlls/d3dx9_35/d3dx9_35_main.c b/dlls/d3dx9_35/d3dx9_35_main.c deleted file mode 100644 index bf0fd756dd3..00000000000 --- a/dlls/d3dx9_35/d3dx9_35_main.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Direct3D X 9 main file - * - * Copyright (C) 2007 David Adam - * - * 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 "config.h" -#include "wine/port.h" -#include "initguid.h" -#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" - -#include "d3dx9.h" - -/*********************************************************************** - * DllMain. - */ -BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) -{ - switch(reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(inst); - break; - } - return TRUE; -} - -/*********************************************************************** - * D3DXCheckVersion - * Checks whether we are compiling against the correct d3d and d3dx library. - */ -BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers) -{ - if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==35) - return TRUE; - else - return FALSE; -} diff --git a/dlls/d3dx9_36/Makefile.in b/dlls/d3dx9_36/Makefile.in index 83f7d1c61b7..dec7f32472b 100644 --- a/dlls/d3dx9_36/Makefile.in +++ b/dlls/d3dx9_36/Makefile.in @@ -1,3 +1,5 @@ +EXTRADEFS = -DD3DX_SDK_VERSION=36 +EXTRADEFS = -DD3DX_SDK_VERSION=36 MODULE = d3dx9_36.dll IMPORTLIB = d3dx9 IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 @@ -5,7 +7,7 @@ IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 C_SRCS = \ animation.c \ core.c \ - d3dx9_36_main.c \ + main.c \ effect.c \ font.c \ line.c \ diff --git a/dlls/d3dx9_36/d3dx9_36_main.c b/dlls/d3dx9_36/main.c similarity index 73% rename from dlls/d3dx9_36/d3dx9_36_main.c rename to dlls/d3dx9_36/main.c index 599b76a62e8..a256d425266 100644 --- a/dlls/d3dx9_36/d3dx9_36_main.c +++ b/dlls/d3dx9_36/main.c @@ -26,9 +26,8 @@ #include "initguid.h" #include "d3dx9_private.h"
-/*********************************************************************** - * DllMain. - */ +WINE_DEFAULT_DEBUG_CHANNEL(d3dx); + BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, void *reserved) { switch(reason) @@ -42,14 +41,13 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, void *reserved) return TRUE; }
-/*********************************************************************** - * D3DXCheckVersion - * Checks whether we are compiling against the correct d3d and d3dx library. - */ -BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers) +BOOL WINAPI D3DXCheckVersion(UINT d3d_sdk_ver, UINT d3dx_sdk_ver) +{ + return d3d_sdk_ver == D3D_SDK_VERSION && d3dx_sdk_ver == D3DX_SDK_VERSION; +} + +DWORD WINAPI D3DXCpuOptimizations(BOOL enable) { - if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==36) - return TRUE; - else - return FALSE; + FIXME("%#x - stub\n", enable); + return 0; } diff --git a/dlls/d3dx9_37/Makefile.in b/dlls/d3dx9_37/Makefile.in index 61528a337e8..6b33e2e5096 100644 --- a/dlls/d3dx9_37/Makefile.in +++ b/dlls/d3dx9_37/Makefile.in @@ -1,3 +1,4 @@ +EXTRADEFS = -DD3DX_SDK_VERSION=37 MODULE = d3dx9_37.dll IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 PARENTSRC = ../d3dx9_36 @@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36 C_SRCS = \ animation.c \ core.c \ - d3dx9_37_main.c \ + main.c \ effect.c \ font.c \ line.c \ diff --git a/dlls/d3dx9_37/d3dx9_37_main.c b/dlls/d3dx9_37/d3dx9_37_main.c deleted file mode 100644 index bbe8e7313eb..00000000000 --- a/dlls/d3dx9_37/d3dx9_37_main.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Direct3D X 9 main file - * - * Copyright (C) 2007 David Adam - * - * 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 "config.h" -#include "wine/port.h" -#include "initguid.h" -#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" - -#include "d3dx9.h" - -/*********************************************************************** - * DllMain. - */ -BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) -{ - switch(reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(inst); - break; - } - return TRUE; -} - -/*********************************************************************** - * D3DXCheckVersion - * Checks whether we are compiling against the correct d3d and d3dx library. - */ -BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers) -{ - if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==37) - return TRUE; - else - return FALSE; -} diff --git a/dlls/d3dx9_38/Makefile.in b/dlls/d3dx9_38/Makefile.in index cb1507c00f0..420f93e5164 100644 --- a/dlls/d3dx9_38/Makefile.in +++ b/dlls/d3dx9_38/Makefile.in @@ -1,3 +1,4 @@ +EXTRADEFS = -DD3DX_SDK_VERSION=38 MODULE = d3dx9_38.dll IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 PARENTSRC = ../d3dx9_36 @@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36 C_SRCS = \ animation.c \ core.c \ - d3dx9_38_main.c \ + main.c \ effect.c \ font.c \ line.c \ diff --git a/dlls/d3dx9_38/d3dx9_38_main.c b/dlls/d3dx9_38/d3dx9_38_main.c deleted file mode 100644 index 304a7ee7217..00000000000 --- a/dlls/d3dx9_38/d3dx9_38_main.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Direct3D X 9 main file - * - * Copyright (C) 2007 David Adam - * - * 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 "config.h" -#include "wine/port.h" -#include "initguid.h" -#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" - -#include "d3dx9.h" - -/*********************************************************************** - * DllMain. - */ -BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) -{ - switch(reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(inst); - break; - } - return TRUE; -} - -/*********************************************************************** - * D3DXCheckVersion - * Checks whether we are compiling against the correct d3d and d3dx library. - */ -BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers) -{ - if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==38) - return TRUE; - else - return FALSE; -} diff --git a/dlls/d3dx9_39/Makefile.in b/dlls/d3dx9_39/Makefile.in index e372816ac48..faba12ec7d2 100644 --- a/dlls/d3dx9_39/Makefile.in +++ b/dlls/d3dx9_39/Makefile.in @@ -1,3 +1,4 @@ +EXTRADEFS = -DD3DX_SDK_VERSION=39 MODULE = d3dx9_39.dll IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 PARENTSRC = ../d3dx9_36 @@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36 C_SRCS = \ animation.c \ core.c \ - d3dx9_39_main.c \ + main.c \ effect.c \ font.c \ line.c \ diff --git a/dlls/d3dx9_39/d3dx9_39_main.c b/dlls/d3dx9_39/d3dx9_39_main.c deleted file mode 100644 index 892ccf36278..00000000000 --- a/dlls/d3dx9_39/d3dx9_39_main.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Direct3D X 9 main file - * - * Copyright (C) 2007 David Adam - * - * 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 "config.h" -#include "wine/port.h" -#include "initguid.h" -#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" - -#include "d3dx9.h" - -/*********************************************************************** - * DllMain. - */ -BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) -{ - switch(reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(inst); - break; - } - return TRUE; -} - -/*********************************************************************** - * D3DXCheckVersion - * Checks whether we are compiling against the correct d3d and d3dx library. - */ -BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers) -{ - if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==39) - return TRUE; - else - return FALSE; -} diff --git a/dlls/d3dx9_40/Makefile.in b/dlls/d3dx9_40/Makefile.in index b6c4dcdf0f7..2d6ac814c59 100644 --- a/dlls/d3dx9_40/Makefile.in +++ b/dlls/d3dx9_40/Makefile.in @@ -1,3 +1,4 @@ +EXTRADEFS = -DD3DX_SDK_VERSION=40 MODULE = d3dx9_40.dll IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 PARENTSRC = ../d3dx9_36 @@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36 C_SRCS = \ animation.c \ core.c \ - d3dx9_40_main.c \ + main.c \ effect.c \ font.c \ line.c \ diff --git a/dlls/d3dx9_40/d3dx9_40_main.c b/dlls/d3dx9_40/d3dx9_40_main.c deleted file mode 100644 index 6c9cc45b95d..00000000000 --- a/dlls/d3dx9_40/d3dx9_40_main.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Direct3D X 9 main file - * - * Copyright (C) 2007 David Adam - * Copyright (C) 2009 Rico Schüller - * - * 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 "config.h" -#include "wine/port.h" -#include "initguid.h" -#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" - -#include "d3dx9.h" - -/*********************************************************************** - * DllMain. - */ -BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) -{ - switch(reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(inst); - break; - } - return TRUE; -} - -/*********************************************************************** - * D3DXCheckVersion - * Checks whether we are compiling against the correct d3d and d3dx library. - */ -BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers) -{ - if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==40) - return TRUE; - else - return FALSE; -} diff --git a/dlls/d3dx9_41/Makefile.in b/dlls/d3dx9_41/Makefile.in index 9aa91a9bac7..fbabfcb289b 100644 --- a/dlls/d3dx9_41/Makefile.in +++ b/dlls/d3dx9_41/Makefile.in @@ -1,3 +1,4 @@ +EXTRADEFS = -DD3DX_SDK_VERSION=41 MODULE = d3dx9_41.dll IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 PARENTSRC = ../d3dx9_36 @@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36 C_SRCS = \ animation.c \ core.c \ - d3dx9_41_main.c \ + main.c \ effect.c \ font.c \ line.c \ diff --git a/dlls/d3dx9_41/d3dx9_41_main.c b/dlls/d3dx9_41/d3dx9_41_main.c deleted file mode 100644 index f37cee7f47f..00000000000 --- a/dlls/d3dx9_41/d3dx9_41_main.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Direct3D X 9 main file - * - * Copyright (C) 2007 David Adam - * Copyright (C) 2009 Rico Schüller - * - * 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 "config.h" -#include "wine/port.h" -#include "initguid.h" -#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" - -#include "d3dx9.h" - -/*********************************************************************** - * DllMain. - */ -BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) -{ - switch(reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(inst); - break; - } - return TRUE; -} - -/*********************************************************************** - * D3DXCheckVersion - * Checks whether we are compiling against the correct d3d and d3dx library. - */ -BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers) -{ - if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==41) - return TRUE; - else - return FALSE; -} diff --git a/dlls/d3dx9_42/Makefile.in b/dlls/d3dx9_42/Makefile.in index a5cc60e556f..c60062b61bf 100644 --- a/dlls/d3dx9_42/Makefile.in +++ b/dlls/d3dx9_42/Makefile.in @@ -1,3 +1,4 @@ +EXTRADEFS = -DD3DX_SDK_VERSION=42 MODULE = d3dx9_42.dll IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 PARENTSRC = ../d3dx9_36 @@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36 C_SRCS = \ animation.c \ core.c \ - d3dx9_42_main.c \ + main.c \ effect.c \ font.c \ line.c \ diff --git a/dlls/d3dx9_42/d3dx9_42_main.c b/dlls/d3dx9_42/d3dx9_42_main.c deleted file mode 100644 index 631bd3bf407..00000000000 --- a/dlls/d3dx9_42/d3dx9_42_main.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Direct3D X 9 main file - * - * Copyright (C) 2007 David Adam - * Copyright (C) 2009 Rico Schüller - * Copyright (C) 2009 Ričardas Barkauskas - * - * 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 "config.h" -#include "wine/port.h" -#include "initguid.h" -#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" - -#include "d3dx9.h" - -/*********************************************************************** - * DllMain. - */ -BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) -{ - switch(reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(inst); - break; - } - return TRUE; -} - -/*********************************************************************** - * D3DXCheckVersion - * Checks whether we are compiling against the correct d3d and d3dx library. - */ -BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers) -{ - if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==42) - return TRUE; - else - return FALSE; -} diff --git a/dlls/d3dx9_43/Makefile.in b/dlls/d3dx9_43/Makefile.in index cb787075690..89610de9e56 100644 --- a/dlls/d3dx9_43/Makefile.in +++ b/dlls/d3dx9_43/Makefile.in @@ -1,3 +1,4 @@ +EXTRADEFS = -DD3DX_SDK_VERSION=43 MODULE = d3dx9_43.dll IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32 PARENTSRC = ../d3dx9_36 @@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36 C_SRCS = \ animation.c \ core.c \ - d3dx9_43_main.c \ + main.c \ effect.c \ font.c \ line.c \ diff --git a/dlls/d3dx9_43/d3dx9_43_main.c b/dlls/d3dx9_43/d3dx9_43_main.c deleted file mode 100644 index b4a5e2b655f..00000000000 --- a/dlls/d3dx9_43/d3dx9_43_main.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Direct3D X 9 main file - * - * Copyright (C) 2007 David Adam - * Copyright (C) 2009 Rico Schüller - * - * 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 "config.h" -#include "wine/port.h" -#include "initguid.h" -#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" - -#include "d3dx9.h" - -/*********************************************************************** - * DllMain. - */ -BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) -{ - switch(reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(inst); - break; - } - return TRUE; -} - -/*********************************************************************** - * D3DXCheckVersion - * Checks whether we are compiling against the correct d3d and d3dx library. - */ -BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers) -{ - if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==43) - return TRUE; - else - return FALSE; -} diff --git a/include/d3dx9core.h b/include/d3dx9core.h index a04bced0227..e66afc4b832 100644 --- a/include/d3dx9core.h +++ b/include/d3dx9core.h @@ -24,11 +24,9 @@ /********************************************** ***************** Definitions **************** **********************************************/ -/* D3DX_VERSION will be completely ignored since we are - implementing all dlls from d3dx9_24 to d3dx9_36 */ #define D3DX_VERSION 0x0902 #ifndef D3DX_SDK_VERSION -#define D3DX_SDK_VERSION 36 +#define D3DX_SDK_VERSION 43 #endif #define D3DXSPRITE_DONOTSAVESTATE 0x00000001 #define D3DXSPRITE_DONOTMODIFY_RENDERSTATE 0x00000002
Some manual testing shows that the behavior changed with d3dx9_37.
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- This should avoid issues with effect syntax which was deprecated in newer d3dx9 / d3dcompiler versions. It should help with bug 41990.
dlls/d3dx9_36/effect.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index ce2e5d86e5f..f8c480303ca 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -6455,6 +6455,11 @@ static HRESULT d3dx9_base_effect_init(struct d3dx9_base_effect *base, char *skip_constants_buffer = NULL; const char **skip_constants = NULL; unsigned int skip_constants_count = 0; +#if D3DX_SDK_VERSION <= 36 + UINT compile_flags = D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY; +#else + UINT compile_flags = 0; +#endif unsigned int i, j;
TRACE("base %p, data %p, data_size %lu, effect %p, pool %p, skip_constants %s.\n", @@ -6471,7 +6476,7 @@ static HRESULT d3dx9_base_effect_init(struct d3dx9_base_effect *base, { TRACE("HLSL ASCII effect, trying to compile it.\n"); hr = D3DCompile(data, data_size, NULL, defines, include, - "main", "fx_2_0", 0, eflags, &bytecode, &temp_errors); + "main", "fx_2_0", compile_flags, eflags, &bytecode, &temp_errors); if (FAILED(hr)) { WARN("Failed to compile ASCII effect.\n");
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dx9_24/d3dx9_24.spec | 4 +- dlls/d3dx9_25/d3dx9_25.spec | 4 +- dlls/d3dx9_26/d3dx9_26.spec | 4 +- dlls/d3dx9_27/d3dx9_27.spec | 4 +- dlls/d3dx9_28/d3dx9_28.spec | 4 +- dlls/d3dx9_29/d3dx9_29.spec | 4 +- dlls/d3dx9_30/d3dx9_30.spec | 4 +- dlls/d3dx9_31/d3dx9_31.spec | 4 +- dlls/d3dx9_32/d3dx9_32.spec | 4 +- dlls/d3dx9_33/d3dx9_33.spec | 4 +- dlls/d3dx9_34/d3dx9_34.spec | 4 +- dlls/d3dx9_35/d3dx9_35.spec | 4 +- dlls/d3dx9_36/d3dx9_36.spec | 4 +- dlls/d3dx9_36/shader.c | 246 ++++++++++++++++++++++++++++++++++++++++++++ dlls/d3dx9_37/d3dx9_37.spec | 4 +- dlls/d3dx9_38/d3dx9_38.spec | 4 +- dlls/d3dx9_39/d3dx9_39.spec | 4 +- dlls/d3dx9_40/d3dx9_40.spec | 4 +- dlls/d3dx9_41/d3dx9_41.spec | 4 +- dlls/d3dx9_42/d3dx9_42.spec | 4 +- dlls/d3dx9_43/d3dx9_43.spec | 4 +- 21 files changed, 286 insertions(+), 40 deletions(-)
diff --git a/dlls/d3dx9_24/d3dx9_24.spec b/dlls/d3dx9_24/d3dx9_24.spec index 0ca8777efe6..d816fd830d1 100644 --- a/dlls/d3dx9_24/d3dx9_24.spec +++ b/dlls/d3dx9_24/d3dx9_24.spec @@ -154,8 +154,8 @@ @ stdcall D3DXGetImageInfoFromResourceW(long wstr ptr) @ stdcall D3DXGetPixelShaderProfile(ptr) @ stdcall D3DXGetShaderConstantTable(ptr ptr) -@ stub D3DXGetShaderInputSemantics(ptr ptr ptr) -@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) @ stdcall D3DXGetShaderSize(ptr) @ stdcall D3DXGetShaderVersion(ptr) diff --git a/dlls/d3dx9_25/d3dx9_25.spec b/dlls/d3dx9_25/d3dx9_25.spec index a5449810a43..e15230d417b 100644 --- a/dlls/d3dx9_25/d3dx9_25.spec +++ b/dlls/d3dx9_25/d3dx9_25.spec @@ -154,8 +154,8 @@ @ stdcall D3DXGetImageInfoFromResourceW(long wstr ptr) @ stdcall D3DXGetPixelShaderProfile(ptr) @ stdcall D3DXGetShaderConstantTable(ptr ptr) -@ stub D3DXGetShaderInputSemantics(ptr ptr ptr) -@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) @ stdcall D3DXGetShaderSize(ptr) @ stdcall D3DXGetShaderVersion(ptr) diff --git a/dlls/d3dx9_26/d3dx9_26.spec b/dlls/d3dx9_26/d3dx9_26.spec index 9e1200442f4..ac25d066dbb 100644 --- a/dlls/d3dx9_26/d3dx9_26.spec +++ b/dlls/d3dx9_26/d3dx9_26.spec @@ -158,8 +158,8 @@ @ stdcall D3DXGetImageInfoFromResourceW(long wstr ptr) @ stdcall D3DXGetPixelShaderProfile(ptr) @ stdcall D3DXGetShaderConstantTable(ptr ptr) -@ stub D3DXGetShaderInputSemantics(ptr ptr ptr) -@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) @ stdcall D3DXGetShaderSize(ptr) @ stdcall D3DXGetShaderVersion(ptr) diff --git a/dlls/d3dx9_27/d3dx9_27.spec b/dlls/d3dx9_27/d3dx9_27.spec index 9e1200442f4..ac25d066dbb 100644 --- a/dlls/d3dx9_27/d3dx9_27.spec +++ b/dlls/d3dx9_27/d3dx9_27.spec @@ -158,8 +158,8 @@ @ stdcall D3DXGetImageInfoFromResourceW(long wstr ptr) @ stdcall D3DXGetPixelShaderProfile(ptr) @ stdcall D3DXGetShaderConstantTable(ptr ptr) -@ stub D3DXGetShaderInputSemantics(ptr ptr ptr) -@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) @ stdcall D3DXGetShaderSize(ptr) @ stdcall D3DXGetShaderVersion(ptr) diff --git a/dlls/d3dx9_28/d3dx9_28.spec b/dlls/d3dx9_28/d3dx9_28.spec index b316a23baf1..a6378d86ae5 100644 --- a/dlls/d3dx9_28/d3dx9_28.spec +++ b/dlls/d3dx9_28/d3dx9_28.spec @@ -158,8 +158,8 @@ @ stdcall D3DXGetImageInfoFromResourceW(long wstr ptr) @ stdcall D3DXGetPixelShaderProfile(ptr) @ stdcall D3DXGetShaderConstantTable(ptr ptr) -@ stub D3DXGetShaderInputSemantics(ptr ptr ptr) -@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) @ stdcall D3DXGetShaderSize(ptr) @ stdcall D3DXGetShaderVersion(ptr) diff --git a/dlls/d3dx9_29/d3dx9_29.spec b/dlls/d3dx9_29/d3dx9_29.spec index b316a23baf1..a6378d86ae5 100644 --- a/dlls/d3dx9_29/d3dx9_29.spec +++ b/dlls/d3dx9_29/d3dx9_29.spec @@ -158,8 +158,8 @@ @ stdcall D3DXGetImageInfoFromResourceW(long wstr ptr) @ stdcall D3DXGetPixelShaderProfile(ptr) @ stdcall D3DXGetShaderConstantTable(ptr ptr) -@ stub D3DXGetShaderInputSemantics(ptr ptr ptr) -@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) @ stdcall D3DXGetShaderSize(ptr) @ stdcall D3DXGetShaderVersion(ptr) diff --git a/dlls/d3dx9_30/d3dx9_30.spec b/dlls/d3dx9_30/d3dx9_30.spec index e00fa547862..f1225837814 100644 --- a/dlls/d3dx9_30/d3dx9_30.spec +++ b/dlls/d3dx9_30/d3dx9_30.spec @@ -158,8 +158,8 @@ @ stdcall D3DXGetImageInfoFromResourceW(long wstr ptr) @ stdcall D3DXGetPixelShaderProfile(ptr) @ stdcall D3DXGetShaderConstantTable(ptr ptr) -@ stub D3DXGetShaderInputSemantics(ptr ptr ptr) -@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) @ stdcall D3DXGetShaderSize(ptr) @ stdcall D3DXGetShaderVersion(ptr) diff --git a/dlls/d3dx9_31/d3dx9_31.spec b/dlls/d3dx9_31/d3dx9_31.spec index d308939ef67..a0a74a59e1a 100644 --- a/dlls/d3dx9_31/d3dx9_31.spec +++ b/dlls/d3dx9_31/d3dx9_31.spec @@ -157,8 +157,8 @@ @ stdcall D3DXGetImageInfoFromResourceW(long wstr ptr) @ stdcall D3DXGetPixelShaderProfile(ptr) @ stdcall D3DXGetShaderConstantTable(ptr ptr) -@ stub D3DXGetShaderInputSemantics(ptr ptr ptr) -@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) @ stdcall D3DXGetShaderSize(ptr) @ stdcall D3DXGetShaderVersion(ptr) diff --git a/dlls/d3dx9_32/d3dx9_32.spec b/dlls/d3dx9_32/d3dx9_32.spec index c2292dff396..e4e4fc65257 100644 --- a/dlls/d3dx9_32/d3dx9_32.spec +++ b/dlls/d3dx9_32/d3dx9_32.spec @@ -157,8 +157,8 @@ @ stdcall D3DXGetImageInfoFromResourceW(long wstr ptr) @ stdcall D3DXGetPixelShaderProfile(ptr) @ stdcall D3DXGetShaderConstantTable(ptr ptr) -@ stub D3DXGetShaderInputSemantics(ptr ptr ptr) -@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) @ stdcall D3DXGetShaderSize(ptr) @ stdcall D3DXGetShaderVersion(ptr) diff --git a/dlls/d3dx9_33/d3dx9_33.spec b/dlls/d3dx9_33/d3dx9_33.spec index c2292dff396..e4e4fc65257 100644 --- a/dlls/d3dx9_33/d3dx9_33.spec +++ b/dlls/d3dx9_33/d3dx9_33.spec @@ -157,8 +157,8 @@ @ stdcall D3DXGetImageInfoFromResourceW(long wstr ptr) @ stdcall D3DXGetPixelShaderProfile(ptr) @ stdcall D3DXGetShaderConstantTable(ptr ptr) -@ stub D3DXGetShaderInputSemantics(ptr ptr ptr) -@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) @ stdcall D3DXGetShaderSize(ptr) @ stdcall D3DXGetShaderVersion(ptr) diff --git a/dlls/d3dx9_34/d3dx9_34.spec b/dlls/d3dx9_34/d3dx9_34.spec index c2292dff396..e4e4fc65257 100644 --- a/dlls/d3dx9_34/d3dx9_34.spec +++ b/dlls/d3dx9_34/d3dx9_34.spec @@ -157,8 +157,8 @@ @ stdcall D3DXGetImageInfoFromResourceW(long wstr ptr) @ stdcall D3DXGetPixelShaderProfile(ptr) @ stdcall D3DXGetShaderConstantTable(ptr ptr) -@ stub D3DXGetShaderInputSemantics(ptr ptr ptr) -@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) @ stdcall D3DXGetShaderSize(ptr) @ stdcall D3DXGetShaderVersion(ptr) diff --git a/dlls/d3dx9_35/d3dx9_35.spec b/dlls/d3dx9_35/d3dx9_35.spec index c2292dff396..e4e4fc65257 100644 --- a/dlls/d3dx9_35/d3dx9_35.spec +++ b/dlls/d3dx9_35/d3dx9_35.spec @@ -157,8 +157,8 @@ @ stdcall D3DXGetImageInfoFromResourceW(long wstr ptr) @ stdcall D3DXGetPixelShaderProfile(ptr) @ stdcall D3DXGetShaderConstantTable(ptr ptr) -@ stub D3DXGetShaderInputSemantics(ptr ptr ptr) -@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) @ stdcall D3DXGetShaderSize(ptr) @ stdcall D3DXGetShaderVersion(ptr) diff --git a/dlls/d3dx9_36/d3dx9_36.spec b/dlls/d3dx9_36/d3dx9_36.spec index 0fdf4e135e1..0d9fdabb44f 100644 --- a/dlls/d3dx9_36/d3dx9_36.spec +++ b/dlls/d3dx9_36/d3dx9_36.spec @@ -159,8 +159,8 @@ @ stdcall D3DXGetPixelShaderProfile(ptr) @ stdcall D3DXGetShaderConstantTable(ptr ptr) @ stdcall D3DXGetShaderConstantTableEx(ptr long ptr) -@ stub D3DXGetShaderInputSemantics(ptr ptr ptr) -@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) @ stdcall D3DXGetShaderSize(ptr) @ stdcall D3DXGetShaderVersion(ptr) diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c index e46e0ae04bd..f3724947601 100644 --- a/dlls/d3dx9_36/shader.c +++ b/dlls/d3dx9_36/shader.c @@ -2416,3 +2416,249 @@ HRESULT WINAPI D3DXCreateTextureShader(const DWORD *function, ID3DXTextureShader
return D3D_OK; } + +static unsigned int get_instr_length(const DWORD *byte_code, unsigned int major, unsigned int minor) +{ + unsigned int len = 0; + + if (major > 1) + return (*byte_code & D3DSI_INSTLENGTH_MASK) >> D3DSI_INSTLENGTH_SHIFT; + + switch (*byte_code & 0xffff) + { + case D3DSIO_END: + ERR("Unexpected END token.\n"); + return 0; + case D3DSIO_COMMENT: + return (*byte_code & D3DSI_COMMENTSIZE_MASK) >> D3DSI_COMMENTSIZE_SHIFT; + case D3DSIO_DEF: + case D3DSIO_DEFI: + return 5; + case D3DSIO_DEFB: + return 2; + default: + ++byte_code; + while (*byte_code & 0x80000000) + { + ++byte_code; + ++len; + } + } + + return len; +} + +static HRESULT get_shader_semantics(const DWORD *byte_code, D3DXSEMANTIC *semantics, UINT *count, BOOL output) +{ + static const D3DDECLUSAGE regtype_usage[] = + { + D3DDECLUSAGE_COLOR, + D3DDECLUSAGE_COLOR, + 0, + D3DDECLUSAGE_TEXCOORD, + 0, + D3DDECLUSAGE_COLOR, + D3DDECLUSAGE_TEXCOORD, + 0, + 0, + D3DDECLUSAGE_DEPTH + }; + static const D3DDECLUSAGE rast_usage[] = + { + D3DDECLUSAGE_POSITION, + D3DDECLUSAGE_FOG, + D3DDECLUSAGE_PSIZE + }; + DWORD reg_type, usage, index, version_token = *byte_code; + BOOL is_ps = version_token >> 16 == 0xffff; + unsigned int major, minor, i = 0, j; + BYTE colors = 0, rastout = 0; + BOOL has_dcl, depth = 0; + WORD texcoords = 0; + + if ((version_token & 0xffff0000) != 0xfffe0000 && (version_token & 0xffff0000) != 0xffff0000) + return D3DXERR_INVALIDDATA; + + major = version_token >> 8 & 0xff; + minor = version_token & 0xff; + + TRACE("%s shader, version %u.%u.\n", is_ps ? "Pixel" : "Vertex", major, minor); + ++byte_code; + + has_dcl = (!is_ps && (!output || major == 3)) || (is_ps && !output && major >= 2); + + while (*byte_code != D3DSIO_END) + { + if (has_dcl && (*byte_code & 0xffff) == D3DSIO_DCL) + { + DWORD usage_token = byte_code[1]; + DWORD reg = byte_code[2]; + + reg_type = ((reg & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT) + | ((reg & D3DSP_REGTYPE_MASK2) >> D3DSP_REGTYPE_SHIFT2); + + if (is_ps && !output && major == 2) + { + /* dcl with no explicit usage, look at the register. */ + reg_type = ((reg & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT) + | ((reg & D3DSP_REGTYPE_MASK2) >> D3DSP_REGTYPE_SHIFT2); + index = reg & D3DSP_REGNUM_MASK; + if (reg_type >= ARRAY_SIZE(regtype_usage)) + { + WARN("Invalid register type %u.\n", reg_type); + reg_type = 0; + } + usage = regtype_usage[reg_type]; + if (semantics) + { + semantics[i].Usage = usage; + semantics[i].UsageIndex = index; + } + ++i; + } + else if ((!output && reg_type == D3DSPR_INPUT) || (output && reg_type == D3DSPR_OUTPUT)) + { + if (semantics) + { + semantics[i].Usage = + (usage_token & D3DSP_DCL_USAGE_MASK) >> D3DSP_DCL_USAGE_SHIFT; + semantics[i].UsageIndex = + (usage_token & D3DSP_DCL_USAGEINDEX_MASK) >> D3DSP_DCL_USAGEINDEX_SHIFT; + } + ++i; + } + byte_code += 3; + } + else if (!has_dcl) + { + unsigned int len = get_instr_length(byte_code, major, minor) + 1; + + switch (*byte_code & 0xffff) + { + case D3DSIO_COMMENT: + case D3DSIO_DEF: + case D3DSIO_DEFB: + case D3DSIO_DEFI: + byte_code += len; + break; + default: + ++byte_code; + while (*byte_code & 0x80000000) + { + reg_type = ((*byte_code & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT) + | ((*byte_code & D3DSP_REGTYPE_MASK2) >> D3DSP_REGTYPE_SHIFT2); + index = *byte_code & D3DSP_REGNUM_MASK; + + if ((reg_type == D3DSPR_TEMP && is_ps && major == 1) + || (reg_type == D3DSPR_INPUT && is_ps) + || (reg_type == D3DSPR_TEXTURE && is_ps && !output) + || reg_type == D3DSPR_RASTOUT + || reg_type == D3DSPR_ATTROUT + || reg_type == D3DSPR_OUTPUT + || reg_type == D3DSPR_DEPTHOUT) + { + if (reg_type == D3DSPR_RASTOUT) + rastout |= 1u << index; + else if (reg_type == D3DSPR_DEPTHOUT) + depth = TRUE; + else if (reg_type == D3DSPR_TEXTURE || reg_type == D3DSPR_OUTPUT) + texcoords |= 1u << index; + else + colors |= 1u << index; + } + ++byte_code; + } + } + } + else + { + byte_code += get_instr_length(byte_code, major, minor) + 1; + } + } + + if (!has_dcl) + { + i = j = 0; + while (texcoords) + { + if (texcoords & 1) + { + if (semantics) + { + semantics[i].Usage = D3DDECLUSAGE_TEXCOORD; + semantics[i].UsageIndex = j; + } + ++i; + } + texcoords >>= 1; + ++j; + } + j = 0; + while (colors) + { + if (colors & 1) + { + if (semantics) + { + semantics[i].Usage = D3DDECLUSAGE_COLOR; + semantics[i].UsageIndex = j; + } + ++i; + } + colors >>= 1; + ++j; + } + j = 0; + while (rastout) + { + if (rastout & 1) + { + if (j >= ARRAY_SIZE(rast_usage)) + { + WARN("Invalid RASTOUT register index.\n"); + usage = 0; + } + else + { + usage = rast_usage[j]; + } + if (semantics) + { + semantics[i].Usage = usage; + semantics[i].UsageIndex = 0; + } + ++i; + } + rastout >>= 1; + ++j; + } + if (depth) + { + if (semantics) + { + semantics[i].Usage = D3DDECLUSAGE_DEPTH; + semantics[i].UsageIndex = 0; + } + ++i; + } + } + + if (count) + *count = i; + + return D3D_OK; +} + +HRESULT WINAPI D3DXGetShaderInputSemantics(const DWORD *byte_code, D3DXSEMANTIC *semantics, UINT *count) +{ + TRACE("byte_code %p, semantics %p, count %p.\n", byte_code, semantics, count); + + return get_shader_semantics(byte_code, semantics, count, FALSE); +} + +HRESULT WINAPI D3DXGetShaderOutputSemantics(const DWORD *byte_code, D3DXSEMANTIC *semantics, UINT *count) +{ + TRACE("byte_code %p, semantics %p, count %p.\n", byte_code, semantics, count); + + return get_shader_semantics(byte_code, semantics, count, TRUE); +} diff --git a/dlls/d3dx9_37/d3dx9_37.spec b/dlls/d3dx9_37/d3dx9_37.spec index 0fdf4e135e1..0d9fdabb44f 100644 --- a/dlls/d3dx9_37/d3dx9_37.spec +++ b/dlls/d3dx9_37/d3dx9_37.spec @@ -159,8 +159,8 @@ @ stdcall D3DXGetPixelShaderProfile(ptr) @ stdcall D3DXGetShaderConstantTable(ptr ptr) @ stdcall D3DXGetShaderConstantTableEx(ptr long ptr) -@ stub D3DXGetShaderInputSemantics(ptr ptr ptr) -@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) @ stdcall D3DXGetShaderSize(ptr) @ stdcall D3DXGetShaderVersion(ptr) diff --git a/dlls/d3dx9_38/d3dx9_38.spec b/dlls/d3dx9_38/d3dx9_38.spec index 0fdf4e135e1..0d9fdabb44f 100644 --- a/dlls/d3dx9_38/d3dx9_38.spec +++ b/dlls/d3dx9_38/d3dx9_38.spec @@ -159,8 +159,8 @@ @ stdcall D3DXGetPixelShaderProfile(ptr) @ stdcall D3DXGetShaderConstantTable(ptr ptr) @ stdcall D3DXGetShaderConstantTableEx(ptr long ptr) -@ stub D3DXGetShaderInputSemantics(ptr ptr ptr) -@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) @ stdcall D3DXGetShaderSize(ptr) @ stdcall D3DXGetShaderVersion(ptr) diff --git a/dlls/d3dx9_39/d3dx9_39.spec b/dlls/d3dx9_39/d3dx9_39.spec index 0fdf4e135e1..0d9fdabb44f 100644 --- a/dlls/d3dx9_39/d3dx9_39.spec +++ b/dlls/d3dx9_39/d3dx9_39.spec @@ -159,8 +159,8 @@ @ stdcall D3DXGetPixelShaderProfile(ptr) @ stdcall D3DXGetShaderConstantTable(ptr ptr) @ stdcall D3DXGetShaderConstantTableEx(ptr long ptr) -@ stub D3DXGetShaderInputSemantics(ptr ptr ptr) -@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) @ stdcall D3DXGetShaderSize(ptr) @ stdcall D3DXGetShaderVersion(ptr) diff --git a/dlls/d3dx9_40/d3dx9_40.spec b/dlls/d3dx9_40/d3dx9_40.spec index 0fdf4e135e1..0d9fdabb44f 100644 --- a/dlls/d3dx9_40/d3dx9_40.spec +++ b/dlls/d3dx9_40/d3dx9_40.spec @@ -159,8 +159,8 @@ @ stdcall D3DXGetPixelShaderProfile(ptr) @ stdcall D3DXGetShaderConstantTable(ptr ptr) @ stdcall D3DXGetShaderConstantTableEx(ptr long ptr) -@ stub D3DXGetShaderInputSemantics(ptr ptr ptr) -@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) @ stdcall D3DXGetShaderSize(ptr) @ stdcall D3DXGetShaderVersion(ptr) diff --git a/dlls/d3dx9_41/d3dx9_41.spec b/dlls/d3dx9_41/d3dx9_41.spec index 0fdf4e135e1..0d9fdabb44f 100644 --- a/dlls/d3dx9_41/d3dx9_41.spec +++ b/dlls/d3dx9_41/d3dx9_41.spec @@ -159,8 +159,8 @@ @ stdcall D3DXGetPixelShaderProfile(ptr) @ stdcall D3DXGetShaderConstantTable(ptr ptr) @ stdcall D3DXGetShaderConstantTableEx(ptr long ptr) -@ stub D3DXGetShaderInputSemantics(ptr ptr ptr) -@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) @ stdcall D3DXGetShaderSize(ptr) @ stdcall D3DXGetShaderVersion(ptr) diff --git a/dlls/d3dx9_42/d3dx9_42.spec b/dlls/d3dx9_42/d3dx9_42.spec index 2f2ac5fd619..086d0b5c5d4 100644 --- a/dlls/d3dx9_42/d3dx9_42.spec +++ b/dlls/d3dx9_42/d3dx9_42.spec @@ -152,8 +152,8 @@ @ stdcall D3DXGetPixelShaderProfile(ptr) @ stdcall D3DXGetShaderConstantTable(ptr ptr) @ stdcall D3DXGetShaderConstantTableEx(ptr long ptr) -@ stub D3DXGetShaderInputSemantics(ptr ptr ptr) -@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) @ stdcall D3DXGetShaderSize(ptr) @ stdcall D3DXGetShaderVersion(ptr) diff --git a/dlls/d3dx9_43/d3dx9_43.spec b/dlls/d3dx9_43/d3dx9_43.spec index 2f2ac5fd619..086d0b5c5d4 100644 --- a/dlls/d3dx9_43/d3dx9_43.spec +++ b/dlls/d3dx9_43/d3dx9_43.spec @@ -152,8 +152,8 @@ @ stdcall D3DXGetPixelShaderProfile(ptr) @ stdcall D3DXGetShaderConstantTable(ptr ptr) @ stdcall D3DXGetShaderConstantTableEx(ptr long ptr) -@ stub D3DXGetShaderInputSemantics(ptr ptr ptr) -@ stub D3DXGetShaderOutputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderInputSemantics(ptr ptr ptr) +@ stdcall D3DXGetShaderOutputSemantics(ptr ptr ptr) @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) @ stdcall D3DXGetShaderSize(ptr) @ stdcall D3DXGetShaderVersion(ptr)
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dx9_36/tests/shader.c | 163 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+)
diff --git a/dlls/d3dx9_36/tests/shader.c b/dlls/d3dx9_36/tests/shader.c index 4a7ae67ccda..2f01a46e421 100644 --- a/dlls/d3dx9_36/tests/shader.c +++ b/dlls/d3dx9_36/tests/shader.c @@ -6489,6 +6489,168 @@ static void test_registerset_defaults(void) if (wnd) DestroyWindow(wnd); }
+static void test_shader_semantics(void) +{ + static const DWORD invalid_1[] = + { + 0x00000200 + }, + invalid_2[] = + { + 0xfffe0400 + }, + invalid_3[] = + { + 0xfffe0000 + }, + vs_1_1[] = + { + 0xfffe0101, /* vs_1_1 */ + 0x0000001f, 0x80000000, 0x900f0000, /* dcl_position v0 */ + 0x0000001f, 0x80000003, 0x900f0001, /* dcl_normal v1 */ + 0x0000001f, 0x8001000a, 0x900f0002, /* dcl_color1 v2 */ + 0x0000001f, 0x80000005, 0x900f0003, /* dcl_texcoord0 v3 */ + 0x00000001, 0xc00f0000, 0x90e40000, /* mov oPos, v0 */ + 0x00000001, 0xd00f0001, 0x90e40002, /* mov oD1, v2 */ + 0x00000001, 0xe0070000, 0x90e40001, /* mov oT0.xyz, v1 */ + 0x00000001, 0xc00f0001, 0x90ff0002, /* mov oFog, v2.w */ + 0x00000001, 0xc00f0002, 0x90ff0001, /* mov oPts, v1.w */ + 0x0000ffff + }, + vs_2_0[] = + { + 0xfffe0200, /* vs_2_0 */ + 0x0200001f, 0x80000000, 0x900f0000, /* dcl_position v0 */ + 0x0200001f, 0x80000003, 0x900f0001, /* dcl_normal v1 */ + 0x0200001f, 0x8001000a, 0x900f0002, /* dcl_color1 v2 */ + 0x0200001f, 0x80000005, 0x900f0003, /* dcl_texcoord0 v3 */ + 0x02000001, 0xc00f0000, 0x90e40000, /* mov oPos, v0 */ + 0x02000001, 0xd00f0001, 0x90e40002, /* mov oD1, v2 */ + 0x02000001, 0xe0070000, 0x90e40003, /* mov oT0.xyz, v3 */ + 0x02000001, 0xc00f0001, 0x90ff0002, /* mov oFog, v2.w */ + 0x02000001, 0xc00f0002, 0x90ff0001, /* mov oPts, v1.w */ + 0x0000ffff + }, + vs_3_0[] = + { + 0xfffe0300, /* vs_3_0 */ + 0x0200001f, 0x80000000, 0x900f0000, /* dcl_position v0 */ + 0x0200001f, 0x80000003, 0x900f0001, /* dcl_normal v1 */ + 0x0200001f, 0x8001000a, 0x900f0002, /* dcl_color1 v2 */ + 0x0200001f, 0x80000005, 0x900f0003, /* dcl_texcoord0 v3 */ + 0x0200001f, 0x80000000, 0xe00f0000, /* dcl_position o0 */ + 0x0200001f, 0x8001000a, 0xe00f0001, /* dcl_color1 o1 */ + 0x0200001f, 0x80000005, 0xe00f0002, /* dcl_texcoord0 o2 */ + 0x0200001f, 0x8000000b, 0xe00f0003, /* dcl_fog o3 */ + 0x0200001f, 0x80000004, 0xe00f0004, /* dcl_psize o4 */ + 0x02000001, 0xe00f0000, 0x90e40000, /* mov o0, v0 */ + 0x02000001, 0xe00f0001, 0x90e40002, /* mov o1, v2 */ + 0x02000001, 0xe0070002, 0x90e40003, /* mov o2.xyz, v3 */ + 0x02000001, 0xe00f0003, 0x90ff0002, /* mov o3, v2.w */ + 0x02000001, 0xe00f0004, 0x90ff0001, /* mov o4, v1.w */ + 0x0000ffff + }, + ps_1_1[] = + { + 0xffff0101, /* ps_1_1 */ + 0x00000042, 0xb00f0000, /* tex t0 */ + 0x00000002, 0x800f0000, 0x90e40000, 0xb0e40000, /* add r0, v0, t0 */ + 0x0000ffff + }, + ps_2_0[] = + { + 0xffff0200, /* ps_2_0 */ + 0x0200001f, 0x80000000, 0x900f0000, /* dcl v0 */ + 0x0200001f, 0x80000000, 0xb00f0000, /* dcl t0 */ + 0x02000001, 0x800f0800, 0x90e40000, /* mov oC0, v0 */ + 0x0000ffff + }, + ps_3_0[] = + { + 0xffff0300, /* ps_3_0 */ + 0x0200001f, 0x8001000a, 0x900f0000, /* dcl_color1 v0 */ + 0x0200001f, 0x80000003, 0x900f0001, /* dcl_normal v1 */ + 0x0200001f, 0x80000005, 0x900f0002, /* dcl_texcoord0 v2 */ + 0x0200001f, 0x8000000b, 0x900f0003, /* dcl_fog v3 */ + 0x0200001f, 0x80000000, 0x90031000, /* dcl vPos.xy */ + 0x0200001f, 0x80000000, 0x900f1001, /* dcl vFace */ + 0x05000051, 0xa00f0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, /* def c0, 0.0, 0.0, 0.0, 0.0 */ + 0x02000001, 0x800f0000, 0x90e40000, /* mov r0, v0 */ + 0x03000002, 0x800f0800, 0x80e40000, 0x90e40003, /* add oC0, r0, v3 */ + 0x02000001, 0x800f0001, 0x90e40001, /* mov r1, v1 */ + 0x03000005, 0x800f0801, 0x80e40001, 0x90e40002, /* mul oC1, r1, v2 */ + 0x02000001, 0x800f0802, 0x90441000, /* mov oC2, vPos.xyxy */ + 0x04000058, 0x800f0803, 0x90e41001, 0x90e40000, 0xa0e40000, /* cmp oC3, vFace, v0, c0 */ + 0x02000001, 0x900f0800, 0x90ff0001, /* mov oDepth, v1.w */ + 0x0000ffff + }; + static const struct + { + const DWORD *shader; + D3DXSEMANTIC expected_input[MAXD3DDECLLENGTH]; + D3DXSEMANTIC expected_output[MAXD3DDECLLENGTH]; + } + tests[] = + { + {vs_1_1, {{0, 0}, {3, 0}, {10, 1}, {5, 0}, {~0, ~0}}, {{5, 0}, {10, 1}, {0, 0}, {11, 0}, {4, 0}, {~0, ~0}}}, + {vs_2_0, {{0, 0}, {3, 0}, {10, 1}, {5, 0}, {~0, ~0}}, {{5, 0}, {10, 1}, {0, 0}, {11, 0}, {4, 0}, {~0, ~0}}}, + {vs_3_0, {{0, 0}, {3, 0}, {10, 1}, {5, 0}, {~0, ~0}}, {{0, 0}, {10, 1}, {5, 0}, {11, 0}, {4, 0}, {~0, ~0}}}, + {ps_1_1, {{5, 0}, {10, 0}, {~0, ~0}}, {{10, 0}, {~0, ~0}}}, + {ps_2_0, {{10, 0}, {5, 0}, {~0, ~0}}, {{10, 0}, {~0, ~0}}}, + {ps_3_0, {{10, 1}, {3,0}, {5, 0}, {11, 0}, {~0, ~0}}, {{10, 0}, {10, 1}, {10, 2}, {10, 3}, {12, 0}, {~0, ~0}}}, + }; + D3DXSEMANTIC semantics[MAXD3DDECLLENGTH]; + unsigned int count, count2; + unsigned int i, j; + HRESULT hr; + + hr = D3DXGetShaderInputSemantics(invalid_1, NULL, NULL); + ok(hr == D3DXERR_INVALIDDATA, "Unexpected hr %#x.\n", hr); + hr = D3DXGetShaderInputSemantics(invalid_2, NULL, NULL); + ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr); + hr = D3DXGetShaderInputSemantics(invalid_3, NULL, NULL); + ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr); + + hr = D3DXGetShaderInputSemantics(vs_1_1, NULL, NULL); + ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr); + hr = D3DXGetShaderInputSemantics(vs_1_1, semantics, NULL); + ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr); + + for (i = 0; i < sizeof(tests) / sizeof(tests[0]); ++i) + { + const DWORD *shader = tests[i].shader; + + hr = D3DXGetShaderInputSemantics(shader, NULL, &count); + ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr); + hr = D3DXGetShaderInputSemantics(shader, semantics, &count2); + ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr); + ok(count == count2, "Semantics count %u differs from previous count %u.\n", count2, count); + for (j = 0; j < count; ++j) + { + ok(semantics[j].Usage == tests[i].expected_input[j].Usage + && semantics[j].UsageIndex == tests[i].expected_input[j].UsageIndex, + "Unexpected semantic %u, %u, test %u, idx %u.\n", + semantics[j].Usage, semantics[j].UsageIndex, i, j); + } + ok(tests[i].expected_input[j].Usage == ~0 && tests[i].expected_input[j].UsageIndex == ~0, + "Unexpected semantics count %u.\n", count); + hr = D3DXGetShaderOutputSemantics(shader, NULL, &count); + ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr); + hr = D3DXGetShaderOutputSemantics(shader, semantics, &count2); + ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr); + ok(count == count2, "Semantics count %u differs from previous count %u.\n", count2, count); + for (j = 0; j < count; ++j) + { + ok(semantics[j].Usage == tests[i].expected_output[j].Usage + && semantics[j].UsageIndex == tests[i].expected_output[j].UsageIndex, + "Unexpected semantic %u, %u, test %u, idx %u.\n", + semantics[j].Usage, semantics[j].UsageIndex, i, j); + } + ok(tests[i].expected_output[j].Usage == ~0 && tests[i].expected_output[j].UsageIndex == ~0, + "Unexpected semantics count %u.\n", count); + } +} + START_TEST(shader) { test_get_shader_size(); @@ -6502,4 +6664,5 @@ START_TEST(shader) test_get_shader_constant_variables(); test_registerset(); test_registerset_defaults(); + test_shader_semantics(); }
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- Józef noticed that GL_TEXTURE_BASE_LEVEL and GL_TEXTURE_MAX_LEVEL are specified to be relative to the view, not to the original texture. That mostly means that we don't want to set them here if we have a texture view.
dlls/wined3d/view.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c index a8651ab8bbb..828845827f4 100644 --- a/dlls/wined3d/view.c +++ b/dlls/wined3d/view.c @@ -844,14 +844,20 @@ void shader_resource_view_generate_mipmaps(struct wined3d_shader_resource_view * location = srgb ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB; for (i = 0; i < layer_count; ++i) wined3d_texture_load_location(texture, i * level_count + base_level, context, location); + if (view->gl_view.name) + { shader_resource_view_bind_and_dirtify(view, context); + } else + { wined3d_texture_bind_and_dirtify(texture, context, srgb); + gl_info->gl_ops.gl.p_glTexParameteri(texture->target, GL_TEXTURE_BASE_LEVEL, base_level); + gl_info->gl_ops.gl.p_glTexParameteri(texture->target, GL_TEXTURE_MAX_LEVEL, max_level); + } + if (gl_info->supported[ARB_SAMPLER_OBJECTS]) GL_EXTCALL(glBindSampler(context->active_texture, 0)); - gl_info->gl_ops.gl.p_glTexParameteri(texture->target, GL_TEXTURE_BASE_LEVEL, base_level); - gl_info->gl_ops.gl.p_glTexParameteri(texture->target, GL_TEXTURE_MAX_LEVEL, max_level); gl_tex = wined3d_texture_get_gl_texture(texture, srgb); if (context->d3d_info->wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL) { @@ -872,11 +878,11 @@ void shader_resource_view_generate_mipmaps(struct wined3d_shader_resource_view * } }
- gl_info->gl_ops.gl.p_glTexParameteri(texture->target, GL_TEXTURE_MAX_LEVEL, level_count - 1); - if (srgb) - texture->texture_srgb.base_level = base_level; - else - texture->texture_rgb.base_level = base_level; + if (!view->gl_view.name) + { + gl_tex->base_level = base_level; + gl_info->gl_ops.gl.p_glTexParameteri(texture->target, GL_TEXTURE_MAX_LEVEL, texture->level_count - 1); + }
context_release(context); }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- Additional tests show that "sRGB compatibility" is only a thing for swapchain texture resources (with thanks to Józef, again :).
dlls/d3d10core/tests/device.c | 2 +- dlls/d3d11/tests/d3d11.c | 2 +- dlls/wined3d/view.c | 19 ++++++++++++++----- 3 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index cdac5ecb96e..5221c0ea3a3 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -8540,7 +8540,7 @@ static void test_swapchain_views(void) U(srv_desc).Texture2D.MostDetailedMip = 0; U(srv_desc).Texture2D.MipLevels = 1; hr = ID3D10Device_CreateShaderResourceView(device, (ID3D10Resource *)test_context.backbuffer, &srv_desc, &srv); - todo_wine ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); if (SUCCEEDED(hr)) ID3D10ShaderResourceView_Release(srv);
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 7d317dc1817..8c9f66f27a5 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -11002,7 +11002,7 @@ static void test_swapchain_views(void) U(srv_desc).Texture2D.MostDetailedMip = 0; U(srv_desc).Texture2D.MipLevels = 1; hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)test_context.backbuffer, &srv_desc, &srv); - todo_wine ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); if (SUCCEEDED(hr)) ID3D11ShaderResourceView_Release(srv);
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c index 828845827f4..a8e025965df 100644 --- a/dlls/wined3d/view.c +++ b/dlls/wined3d/view.c @@ -71,7 +71,7 @@ static GLenum get_texture_view_target(const struct wined3d_gl_info *gl_info, }
static const struct wined3d_format *validate_resource_view(const struct wined3d_view_desc *desc, - struct wined3d_resource *resource, BOOL mip_slice) + struct wined3d_resource *resource, BOOL mip_slice, BOOL allow_srgb_toggle) { const struct wined3d_gl_info *gl_info = &resource->device->adapter->gl_info; const struct wined3d_format *format; @@ -129,7 +129,7 @@ static const struct wined3d_format *validate_resource_view(const struct wined3d_ unsigned int depth_or_layer_count;
if (resource->format->id != format->id && !wined3d_format_is_typeless(resource->format) - && !wined3d_formats_are_srgb_variants(resource->format->id, format->id)) + && (!allow_srgb_toggle || !wined3d_formats_are_srgb_variants(resource->format->id, format->id))) { WARN("Trying to create incompatible view for non typeless format %s.\n", debug_d3dformat(format->id)); @@ -540,11 +540,20 @@ static HRESULT wined3d_rendertarget_view_init(struct wined3d_rendertarget_view * const struct wined3d_view_desc *desc, struct wined3d_resource *resource, void *parent, const struct wined3d_parent_ops *parent_ops) { + BOOL allow_srgb_toggle = FALSE; + view->refcount = 1; view->parent = parent; view->parent_ops = parent_ops;
- if (!(view->format = validate_resource_view(desc, resource, TRUE))) + if (resource->type != WINED3D_RTYPE_BUFFER) + { + struct wined3d_texture *texture = texture_from_resource(resource); + + if (texture->swapchain) + allow_srgb_toggle = TRUE; + } + if (!(view->format = validate_resource_view(desc, resource, TRUE, allow_srgb_toggle))) return E_INVALIDARG; view->format_flags = view->format->flags[resource->gl_type]; view->desc = *desc; @@ -740,7 +749,7 @@ static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_ view->parent = parent; view->parent_ops = parent_ops;
- if (!(view->format = validate_resource_view(desc, resource, FALSE))) + if (!(view->format = validate_resource_view(desc, resource, FALSE, FALSE))) return E_INVALIDARG; view->desc = *desc;
@@ -1108,7 +1117,7 @@ static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_acces view->parent = parent; view->parent_ops = parent_ops;
- if (!(view->format = validate_resource_view(desc, resource, TRUE))) + if (!(view->format = validate_resource_view(desc, resource, TRUE, FALSE))) return E_INVALIDARG; view->desc = *desc;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3d11/tests/d3d11.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 8c9f66f27a5..4f0065975f5 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -14103,6 +14103,8 @@ static void test_create_unordered_access_view(void)
#define FMT_UNKNOWN DXGI_FORMAT_UNKNOWN #define RGBA8_UNORM DXGI_FORMAT_R8G8B8A8_UNORM +#define RGBA8_SRGB DXGI_FORMAT_R8G8B8A8_UNORM_SRGB +#define RGBA8_UINT DXGI_FORMAT_R8G8B8A8_UINT #define RGBA8_TL DXGI_FORMAT_R8G8B8A8_TYPELESS #define DIM_UNKNOWN D3D11_UAV_DIMENSION_UNKNOWN #define TEX_1D D3D11_UAV_DIMENSION_TEXTURE1D @@ -14130,6 +14132,8 @@ static void test_create_unordered_access_view(void) {{10, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2D, 9}, {RGBA8_UNORM, TEX_2D, 9}}, {{ 1, 1, RGBA8_TL}, {RGBA8_UNORM, TEX_2D, 0}, {RGBA8_UNORM, TEX_2D, 0}}, {{10, 1, RGBA8_TL}, {RGBA8_UNORM, TEX_2D, 0}, {RGBA8_UNORM, TEX_2D, 0}}, + {{ 1, 1, RGBA8_UINT}, {0}, {RGBA8_UINT, TEX_2D, 0, 0, 1}}, + {{ 1, 1, RGBA8_TL}, {RGBA8_UINT, TEX_2D, 0, 0, ~0u}, {RGBA8_UINT, TEX_2D, 0, 0, 1}}, {{ 1, 4, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 0, 4}}, {{10, 4, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 0, 4}}, {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2D_ARRAY, 0, 0, ~0u}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 0, 4}}, @@ -14184,6 +14188,10 @@ static void test_create_unordered_access_view(void) {{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D_ARRAY, 1, 0, 1}}, {{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 0, 2}}, {{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 1, 1}}, + {{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UINT, TEX_2D, 0, 0, 1}}, + {{TEX_2D, 1, 1, RGBA8_UINT}, {RGBA8_UNORM, TEX_2D, 0, 0, 1}}, + {{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_SRGB, TEX_2D, 0, 0, 1}}, + {{TEX_2D, 1, 1, RGBA8_SRGB}, {RGBA8_UNORM, TEX_2D, 0, 0, 1}}, {{TEX_3D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_1D, 0}}, {{TEX_3D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 0, 1}}, {{TEX_3D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D, 0}},
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3d11/tests/d3d11.c | 117 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 4f0065975f5..d3db0c17ab9 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -7986,13 +7986,87 @@ static void test_render_target_views(void) {{2, 2}, {DXGI_FORMAT_UNKNOWN, D3D11_RTV_DIMENSION_TEXTURE2DARRAY, 1, 1, 1}, {0x00000000, 0x00000000, 0x00000000, 0xff0000ff}}, }; +#define FMT_UNKNOWN DXGI_FORMAT_UNKNOWN +#define RGBA8_UNORM DXGI_FORMAT_R8G8B8A8_UNORM +#define RGBA8_SRGB DXGI_FORMAT_R8G8B8A8_UNORM_SRGB +#define RGBA8_TL DXGI_FORMAT_R8G8B8A8_TYPELESS +#define DIM_UNKNOWN D3D11_RTV_DIMENSION_UNKNOWN +#define TEX_1D D3D11_RTV_DIMENSION_TEXTURE1D +#define TEX_1D_ARRAY D3D11_RTV_DIMENSION_TEXTURE1DARRAY +#define TEX_2D D3D11_RTV_DIMENSION_TEXTURE2D +#define TEX_2D_ARRAY D3D11_RTV_DIMENSION_TEXTURE2DARRAY +#define TEX_3D D3D11_RTV_DIMENSION_TEXTURE3D + static const struct + { + struct + { + D3D11_RTV_DIMENSION dimension; + unsigned int miplevel_count; + unsigned int depth_or_array_size; + DXGI_FORMAT format; + } texture; + struct rtv_desc rtv_desc; + } + invalid_desc_tests[] = + { + {{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, DIM_UNKNOWN}}, + {{TEX_2D, 6, 4, RGBA8_UNORM}, {RGBA8_UNORM, DIM_UNKNOWN}}, + {{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_1D, 0}}, + {{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 0, 1}}, + {{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 0, 0, 1}}, + {{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 0, 0, ~0u}}, + {{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_TL, TEX_2D, 0}}, + {{TEX_2D, 1, 1, RGBA8_TL}, {FMT_UNKNOWN, TEX_2D, 0}}, + {{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D, 1}}, + {{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 0, 0}}, + {{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D_ARRAY, 1, 0, 1}}, + {{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 0, 2}}, + {{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 1, 1}}, + {{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UINT, TEX_2D, 0, 0, 1}}, + {{TEX_2D, 1, 1, RGBA8_UINT}, {RGBA8_UNORM, TEX_2D, 0, 0, 1}}, + {{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_SRGB, TEX_2D, 0, 0, 1}}, + {{TEX_2D, 1, 1, RGBA8_SRGB}, {RGBA8_UNORM, TEX_2D, 0, 0, 1}}, + {{TEX_3D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_1D, 0}}, + {{TEX_3D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 0, 1}}, + {{TEX_3D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D, 0}}, + {{TEX_3D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 0, 1}}, + {{TEX_3D, 1, 9, RGBA8_UNORM}, {RGBA8_UNORM, TEX_1D, 0}}, + {{TEX_3D, 1, 9, RGBA8_UNORM}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 0, 1}}, + {{TEX_3D, 1, 9, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D, 0}}, + {{TEX_3D, 1, 9, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 0, 1}}, + {{TEX_3D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 0, 0, 0}}, + {{TEX_3D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 1, 0, 1}}, + {{TEX_3D, 1, 1, RGBA8_UNORM}, {RGBA8_TL, TEX_3D, 0, 0, 1}}, + {{TEX_3D, 1, 9, RGBA8_UNORM}, {RGBA8_TL, TEX_3D, 0, 0, 1}}, + {{TEX_3D, 4, 8, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 0, 0, 9}}, + {{TEX_3D, 4, 8, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 3, 0, 2}}, + {{TEX_3D, 4, 8, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 2, 0, 4}}, + {{TEX_3D, 4, 8, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 1, 0, 8}}, + {{TEX_3D, 4, 8, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 0, 8, ~0u}}, + {{TEX_3D, 4, 8, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 1, 4, ~0u}}, + {{TEX_3D, 4, 8, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 2, 2, ~0u}}, + {{TEX_3D, 4, 8, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 3, 1, ~0u}}, + }; +#undef FMT_UNKNOWN +#undef RGBA8_UNORM +#undef RGBA8_SRGB +#undef RGBA8_TL +#undef DIM_UNKNOWN +#undef TEX_1D +#undef TEX_1D_ARRAY +#undef TEX_2D +#undef TEX_2D_ARRAY +#undef TEX_3D
struct d3d11_test_context test_context; D3D11_RENDER_TARGET_VIEW_DESC rtv_desc; + D3D11_TEXTURE3D_DESC texture3d_desc; D3D11_TEXTURE2D_DESC texture_desc; ID3D11DeviceContext *context; ID3D11RenderTargetView *rtv; + ID3D11Texture3D *texture3d; ID3D11Texture2D *texture; + ID3D11Resource *resource; ID3D11Device *device; unsigned int i, j, k; void *data; @@ -8055,6 +8129,49 @@ static void test_render_target_views(void) ID3D11Texture2D_Release(texture); }
+ texture3d_desc.Width = 32; + texture3d_desc.Height = 32; + texture3d_desc.Depth = 32; + texture3d_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + texture3d_desc.Usage = D3D11_USAGE_DEFAULT; + texture3d_desc.BindFlags = D3D11_BIND_RENDER_TARGET; + texture3d_desc.CPUAccessFlags = 0; + texture3d_desc.MiscFlags = 0; + + for (i = 0; i < ARRAY_SIZE(invalid_desc_tests); ++i) + { + assert(invalid_desc_tests[i].texture.dimension == D3D11_RTV_DIMENSION_TEXTURE2D + || invalid_desc_tests[i].texture.dimension == D3D11_RTV_DIMENSION_TEXTURE3D); + + if (invalid_desc_tests[i].texture.dimension == D3D11_RTV_DIMENSION_TEXTURE2D) + { + texture_desc.MipLevels = invalid_desc_tests[i].texture.miplevel_count; + texture_desc.ArraySize = invalid_desc_tests[i].texture.depth_or_array_size; + texture_desc.Format = invalid_desc_tests[i].texture.format; + texture_desc.MiscFlags = 0; + + hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, &texture); + ok(SUCCEEDED(hr), "Test %u: Failed to create 2d texture, hr %#x.\n", i, hr); + resource = (ID3D11Resource *)texture; + } + else + { + texture3d_desc.MipLevels = invalid_desc_tests[i].texture.miplevel_count; + texture3d_desc.Depth = invalid_desc_tests[i].texture.depth_or_array_size; + texture3d_desc.Format = invalid_desc_tests[i].texture.format; + + hr = ID3D11Device_CreateTexture3D(device, &texture3d_desc, NULL, &texture3d); + ok(SUCCEEDED(hr), "Test %u: Failed to create 3d texture, hr %#x.\n", i, hr); + resource = (ID3D11Resource *)texture3d; + } + + get_rtv_desc(&rtv_desc, &invalid_desc_tests[i].rtv_desc); + hr = ID3D11Device_CreateRenderTargetView(device, resource, &rtv_desc, &rtv); + ok(hr == E_INVALIDARG, "Test %u: Got unexpected hr %#x.\n", i, hr); + + ID3D11Resource_Release(resource); + } + HeapFree(GetProcessHeap(), 0, data); release_test_context(&test_context); }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3d11/tests/d3d11.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index d3db0c17ab9..e21478a09a3 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -3275,6 +3275,7 @@ static void test_create_shader_resource_view(void)
#define FMT_UNKNOWN DXGI_FORMAT_UNKNOWN #define RGBA8_UNORM DXGI_FORMAT_R8G8B8A8_UNORM +#define RGBA8_SRGB DXGI_FORMAT_R8G8B8A8_UNORM_SRGB #define RGBA8_UINT DXGI_FORMAT_R8G8B8A8_UINT #define RGBA8_TL DXGI_FORMAT_R8G8B8A8_TYPELESS #define DIM_UNKNOWN D3D11_SRV_DIMENSION_UNKNOWN @@ -3400,6 +3401,8 @@ static void test_create_shader_resource_view(void) {{TEX_2D, 1, 9, RGBA8_UNORM}, {RGBA8_UNORM, CUBE_ARRAY, 0, 1, 0, 2}}, {{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UINT, TEX_2D, 0, 1}}, {{TEX_2D, 1, 1, RGBA8_UINT}, {RGBA8_UNORM, TEX_2D, 0, 1}}, + {{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_SRGB, TEX_2D, 0, 1}}, + {{TEX_2D, 1, 1, RGBA8_SRGB}, {RGBA8_UNORM, TEX_2D, 0, 1}}, {{TEX_3D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_1D, 0, 1}}, {{TEX_3D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 1, 0, 1}}, {{TEX_3D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D, 0, 1}},
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- An alternative is to explicitly zero-initialize the smaller texture levels in the 3D texture case and always check the contents there too.
WRT sRGB, we could also drop the broken() and consider both behaviors acceptable.
dlls/d3d11/tests/d3d11.c | 441 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 441 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index e21478a09a3..45809351dd5 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -23614,6 +23614,446 @@ static void test_combined_clip_and_cull_distances(void) release_test_context(&test_context); }
+static void test_generate_mips(void) +{ + static const DWORD ps_code[] = + { +#if 0 + Texture2D t; + SamplerState s; + + float4 main(float4 position : SV_POSITION) : SV_Target + { + float2 p; + + p.x = position.x / 640.0f; + p.y = position.y / 480.0f; + return t.Sample(s, p); + } +#endif + 0x43425844, 0x1ce9b612, 0xc8176faa, 0xd37844af, 0xdb515605, 0x00000001, 0x00000134, 0x00000003, + 0x0000002c, 0x00000060, 0x00000094, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000030f, 0x505f5653, 0x5449534f, 0x004e4f49, + 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000098, 0x00000040, + 0x00000026, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, + 0x04002064, 0x00101032, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, + 0x00000001, 0x0a000038, 0x00100032, 0x00000000, 0x00101046, 0x00000000, 0x00004002, 0x3acccccd, + 0x3b088889, 0x00000000, 0x00000000, 0x09000045, 0x001020f2, 0x00000000, 0x00100046, 0x00000000, + 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0100003e, + }; + static const DWORD ps_code_3d[] = + { +#if 0 + Texture3D t; + SamplerState s; + + float4 main(float4 position : SV_POSITION) : SV_Target + { + float3 p; + + p.x = position.x / 640.0f; + p.y = position.y / 480.0f; + p.z = 0.5f; + return t.Sample(s, p); + } +#endif + 0x43425844, 0xa1e26083, 0xeb45763e, 0x1e5a5089, 0xdfbbe0df, 0x00000001, 0x00000148, 0x00000003, + 0x0000002c, 0x00000060, 0x00000094, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000030f, 0x505f5653, 0x5449534f, 0x004e4f49, + 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000000ac, 0x00000040, + 0x0000002b, 0x0300005a, 0x00106000, 0x00000000, 0x04002858, 0x00107000, 0x00000000, 0x00005555, + 0x04002064, 0x00101032, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, + 0x00000001, 0x0a000038, 0x00100032, 0x00000000, 0x00101046, 0x00000000, 0x00004002, 0x3acccccd, + 0x3b088889, 0x00000000, 0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x00004001, 0x3f000000, + 0x09000045, 0x001020f2, 0x00000000, 0x00100246, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x0100003e, + }; + static const struct vec4 white = {1.0f, 1.0f, 1.0f, 1.0f}; + static const RECT r1 = {8, 8, 16, 16}; + static const RECT r2 = {16, 8, 24, 16}; + static const RECT r3 = {8, 16, 16, 24}; + static const RECT r4 = {16, 16, 24, 24}; + ID3D11ShaderResourceView *srv, *srv_sampling; + D3D11_SHADER_RESOURCE_VIEW_DESC srv_desc; + struct d3d11_test_context test_context; + D3D11_TEXTURE2D_DESC texture2d_desc; + D3D11_TEXTURE3D_DESC texture3d_desc; + DWORD *data, color, expected_color; + ID3D11SamplerState *sampler_state; + D3D11_SAMPLER_DESC sampler_desc; + D3D11_BUFFER_DESC buffer_desc; + unsigned int i, j, k, x, y, z; + ID3D11PixelShader *ps, *ps_3d; + ID3D11DeviceContext *context; + struct resource_readback rb; + ID3D11Resource *resource; + ID3D11Device *device; + HRESULT hr; + static const struct + { + D3D11_RESOURCE_DIMENSION dim; + D3D11_SRV_DIMENSION srv_dim; + unsigned int array_size; + } + resource_types[] = + { + {D3D11_RESOURCE_DIMENSION_BUFFER, D3D11_SRV_DIMENSION_BUFFER, 1}, + {D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3D11_SRV_DIMENSION_TEXTURE2D, 1}, + {D3D11_RESOURCE_DIMENSION_TEXTURE2D, D3D11_SRV_DIMENSION_TEXTURE2DARRAY, 4}, + {D3D11_RESOURCE_DIMENSION_TEXTURE3D, D3D11_SRV_DIMENSION_TEXTURE3D, 1}, + }; + static const struct + { + DXGI_FORMAT texture_format; + UINT bind_flags; + UINT misc_flags; + BOOL null_srv; + UINT base_level; + BOOL expected_creation; + BOOL expected_mips; + } + tests[] = + { + {DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, + 0, TRUE, FALSE}, + {DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE, 0, TRUE, + 0, TRUE, FALSE}, + {DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_BIND_SHADER_RESOURCE, 0, FALSE, + 0, TRUE, FALSE}, + {DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE, 0, FALSE, + 0, TRUE, FALSE}, + {DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_BIND_SHADER_RESOURCE, D3D11_RESOURCE_MISC_GENERATE_MIPS, FALSE, + 0, FALSE, FALSE}, + {DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_BIND_RENDER_TARGET, D3D11_RESOURCE_MISC_GENERATE_MIPS, FALSE, + 0, FALSE, FALSE}, + {DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE, D3D11_RESOURCE_MISC_GENERATE_MIPS, FALSE, + 0, TRUE, TRUE}, + {DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE, D3D11_RESOURCE_MISC_GENERATE_MIPS, FALSE, + 1, TRUE, TRUE}, + {DXGI_FORMAT_R8G8B8A8_TYPELESS, D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE, D3D11_RESOURCE_MISC_GENERATE_MIPS, FALSE, + 1, TRUE, TRUE}, + {DXGI_FORMAT_R8G8B8A8_UINT, D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE, D3D11_RESOURCE_MISC_GENERATE_MIPS, TRUE, + 1, TRUE, FALSE}, + }; + static const struct + { + POINT pos; + DWORD color; + } + expected[] = + { + {{200, 200}, 0xffff0000}, + {{280, 200}, 0xffff0000}, + {{360, 200}, 0xff00ff00}, + {{440, 200}, 0xff00ff00}, + {{200, 270}, 0xff0000ff}, + {{280, 270}, 0xff0000ff}, + {{360, 270}, 0xff000000}, + {{440, 270}, 0xff000000}, + }; + + if (!init_test_context(&test_context, NULL)) + return; + + device = test_context.device; + context = test_context.immediate_context; + + hr = ID3D11Device_CreatePixelShader(device, ps_code, sizeof(ps_code), NULL, &ps); + ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr); + + hr = ID3D11Device_CreatePixelShader(device, ps_code_3d, sizeof(ps_code_3d), NULL, &ps_3d); + ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr); + + sampler_desc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT; + sampler_desc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; + sampler_desc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; + sampler_desc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; + sampler_desc.MipLODBias = 0.0f; + sampler_desc.MaxAnisotropy = 0; + sampler_desc.ComparisonFunc = D3D11_COMPARISON_NEVER; + sampler_desc.BorderColor[0] = 0.0f; + sampler_desc.BorderColor[1] = 0.0f; + sampler_desc.BorderColor[2] = 0.0f; + sampler_desc.BorderColor[3] = 0.0f; + sampler_desc.MinLOD = 0.0f; + sampler_desc.MaxLOD = D3D11_FLOAT32_MAX; + + hr = ID3D11Device_CreateSamplerState(device, &sampler_desc, &sampler_state); + ok(SUCCEEDED(hr), "Failed to create sampler state, hr %#x.\n", hr); + ID3D11DeviceContext_PSSetSamplers(context, 0, 1, &sampler_state); + + data = HeapAlloc(GetProcessHeap(), 0, sizeof(*data) * 32 * 32 * 32); + + for (z = 0; z < 32; ++z) + { + for (y = 0; y < 32; ++y) + { + for (x = 0; x < 32; ++x) + { + DWORD *dst = &data[z * 32 * 32 + y * 32 + x]; + POINT pt; + + pt.x = x; + pt.y = y; + if (PtInRect(&r1, pt)) + *dst = 0xffff0000; + else if (PtInRect(&r2, pt)) + *dst = 0xff00ff00; + else if (PtInRect(&r3, pt)) + *dst = 0xff0000ff; + else if (PtInRect(&r4, pt)) + *dst = 0xff000000; + else + *dst = 0xffffffff; + } + } + } + + for (i = 0; i < ARRAY_SIZE(resource_types); ++i) + { + for (j = 0; j < ARRAY_SIZE(tests); ++j) + { + unsigned int base_multiplier = 1u << tests[j].base_level; + + switch (resource_types[i].dim) + { + case D3D11_RESOURCE_DIMENSION_BUFFER: + buffer_desc.ByteWidth = 32 * base_multiplier; + buffer_desc.Usage = D3D11_USAGE_DEFAULT; + buffer_desc.BindFlags = tests[j].bind_flags; + buffer_desc.CPUAccessFlags = 0; + buffer_desc.MiscFlags = tests[j].misc_flags; + buffer_desc.StructureByteStride = 0; + + hr = ID3D11Device_CreateBuffer(device, &buffer_desc, NULL, (ID3D11Buffer **)&resource); + break; + case D3D11_RESOURCE_DIMENSION_TEXTURE2D: + texture2d_desc.Width = 32 * base_multiplier; + texture2d_desc.Height = 32 * base_multiplier; + texture2d_desc.MipLevels = 0; + texture2d_desc.ArraySize = resource_types[i].array_size; + texture2d_desc.Format = tests[j].texture_format; + texture2d_desc.SampleDesc.Count = 1; + texture2d_desc.SampleDesc.Quality = 0; + texture2d_desc.Usage = D3D11_USAGE_DEFAULT; + texture2d_desc.BindFlags = tests[j].bind_flags; + texture2d_desc.CPUAccessFlags = 0; + texture2d_desc.MiscFlags = tests[j].misc_flags; + + hr = ID3D11Device_CreateTexture2D(device, &texture2d_desc, NULL, (ID3D11Texture2D **)&resource); + break; + case D3D11_RESOURCE_DIMENSION_TEXTURE3D: + texture3d_desc.Width = 32 * base_multiplier; + texture3d_desc.Height = 32 * base_multiplier; + texture3d_desc.Depth = 32 * base_multiplier; + texture3d_desc.MipLevels = 0; + texture3d_desc.Format = tests[j].texture_format; + texture3d_desc.Usage = D3D11_USAGE_DEFAULT; + texture3d_desc.BindFlags = tests[j].bind_flags; + texture3d_desc.CPUAccessFlags = 0; + texture3d_desc.MiscFlags = tests[j].misc_flags; + + hr = ID3D11Device_CreateTexture3D(device, &texture3d_desc, NULL, (ID3D11Texture3D **)&resource); + break; + default: + break; + } + if (tests[j].expected_creation && (resource_types[i].dim != D3D11_RESOURCE_DIMENSION_BUFFER + || !(tests[j].misc_flags & D3D11_RESOURCE_MISC_GENERATE_MIPS))) + { + ok(SUCCEEDED(hr), "Resource type %u, test %u: failed to create resource, hr %#x.\n", i, j, hr); + } + else + { + ok(hr == E_INVALIDARG, "Resource type %u, test %u: unexpectedly succeeded to create resource, hr %#x.\n", i, j, hr); + continue; + } + + if (tests[j].null_srv) + { + hr = ID3D11Device_CreateShaderResourceView(device, resource, NULL, &srv); + } + else + { + srv_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + srv_desc.ViewDimension = resource_types[i].srv_dim; + switch (resource_types[i].srv_dim) + { + case D3D11_SRV_DIMENSION_BUFFER: + srv_desc.Buffer.ElementOffset = 0; + srv_desc.Buffer.ElementWidth = 0; + break; + case D3D11_SRV_DIMENSION_TEXTURE2D: + srv_desc.Texture2D.MostDetailedMip = tests[j].base_level; + srv_desc.Texture2D.MipLevels = ~0u; + break; + case D3D11_SRV_DIMENSION_TEXTURE2DARRAY: + srv_desc.Texture2DArray.MostDetailedMip = tests[j].base_level; + srv_desc.Texture2DArray.MipLevels = ~0u; + srv_desc.Texture2DArray.FirstArraySlice = 0; + srv_desc.Texture2DArray.ArraySize = resource_types[i].array_size; + break; + case D3D11_SRV_DIMENSION_TEXTURE3D: + srv_desc.Texture3D.MostDetailedMip = tests[j].base_level; + srv_desc.Texture3D.MipLevels = ~0u; + break; + default: + break; + } + hr = ID3D11Device_CreateShaderResourceView(device, resource, &srv_desc, &srv); + } + if (resource_types[i].dim == D3D11_RESOURCE_DIMENSION_BUFFER) + { + ok(FAILED(hr), "Test %u: unexpectedly succeeded to create shader resource view, hr %#x.\n", j, hr); + ID3D11Resource_Release(resource); + continue; + } + else + { + ok(SUCCEEDED(hr), "Resource type %u, test %u: failed to create shader resource view, hr %#x.\n", i, j, hr); + } + + ID3D11DeviceContext_UpdateSubresource(context, resource, + tests[j].base_level, NULL, data, sizeof(*data) * 32, sizeof(*data) * 32 * 32); + + ID3D11DeviceContext_GenerateMips(context, srv); + + ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, &white.w); + + srv_desc.Format = tests[j].texture_format == DXGI_FORMAT_R8G8B8A8_UINT + ? DXGI_FORMAT_R8G8B8A8_UINT : DXGI_FORMAT_R8G8B8A8_UNORM; + srv_desc.ViewDimension = resource_types[i].dim == D3D11_RESOURCE_DIMENSION_TEXTURE3D + ? D3D11_SRV_DIMENSION_TEXTURE3D : D3D11_SRV_DIMENSION_TEXTURE2D; + srv_desc.Texture2D.MostDetailedMip = tests[j].base_level + 1; + srv_desc.Texture2D.MipLevels = ~0u; + hr = ID3D11Device_CreateShaderResourceView(device, resource, &srv_desc, &srv_sampling); + ok(SUCCEEDED(hr), "Resource type %u, test %u: failed to create shader resource view, " + "hr %#x.\n", i, j, hr); + ID3D11DeviceContext_PSSetShader(context, resource_types[i].dim + == D3D11_RESOURCE_DIMENSION_TEXTURE3D ? ps_3d : ps, NULL, 0); + ID3D11DeviceContext_PSSetShaderResources(context, 0, 1, &srv_sampling); + + draw_quad(&test_context); + + /* 3D textures aren't necessarily zero-initialized. */ + if (tests[j].expected_mips || resource_types[i].dim != D3D11_RESOURCE_DIMENSION_TEXTURE3D) + { + get_texture_readback(test_context.backbuffer, 0, &rb); + for (k = 0; k < ARRAY_SIZE(expected); ++k) + { + color = get_readback_color(&rb, expected[k].pos.x, expected[k].pos.y); + expected_color = tests[j].expected_mips ? expected[k].color : 0; + ok(color == expected_color, "Resource type %u, test %u: pixel (%u, %u) has color %08x, expected %08x.\n", + i, j, expected[k].pos.x, expected[k].pos.y, color, expected_color); + } + release_resource_readback(&rb); + } + ID3D11ShaderResourceView_Release(srv_sampling); + ID3D11ShaderResourceView_Release(srv); + ID3D11Resource_Release(resource); + } + } + + /* Test the effect of sRGB views. */ + for (y = 0; y < 32; ++y) + { + for (x = 0; x < 32; ++x) + { + DWORD *dst = &data[y * 32 + x]; + + *dst = (x + y) % 2 * 0xffffffff; + } + } + texture2d_desc.Width = 32; + texture2d_desc.Height = 32; + texture2d_desc.MipLevels = 0; + texture2d_desc.ArraySize = 1; + texture2d_desc.Format = DXGI_FORMAT_R8G8B8A8_TYPELESS; + texture2d_desc.SampleDesc.Count = 1; + texture2d_desc.SampleDesc.Quality = 0; + texture2d_desc.Usage = D3D11_USAGE_DEFAULT; + texture2d_desc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE; + texture2d_desc.CPUAccessFlags = 0; + texture2d_desc.MiscFlags = D3D11_RESOURCE_MISC_GENERATE_MIPS; + + hr = ID3D11Device_CreateTexture2D(device, &texture2d_desc, NULL, (ID3D11Texture2D **)&resource); + ok(SUCCEEDED(hr), "Failed to create resource, hr %#x.\n", hr); + hr = ID3D11Device_CreateShaderResourceView(device, resource, NULL, &srv); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + srv_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; + srv_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; + srv_desc.Texture2D.MostDetailedMip = 0; + srv_desc.Texture2D.MipLevels = ~0u; + hr = ID3D11Device_CreateShaderResourceView(device, resource, &srv_desc, &srv); + ID3D11DeviceContext_UpdateSubresource(context, resource, + 0, NULL, data, sizeof(*data) * 32, sizeof(*data) * 32 * 32); + + ID3D11DeviceContext_GenerateMips(context, srv); + + ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, &white.w); + + srv_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + srv_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; + srv_desc.Texture2D.MostDetailedMip = 1; + srv_desc.Texture2D.MipLevels = ~0u; + hr = ID3D11Device_CreateShaderResourceView(device, resource, &srv_desc, &srv_sampling); + ok(SUCCEEDED(hr), "Failed to create shader resource view, hr %#x.\n", hr); + ID3D11DeviceContext_PSSetShader(context, ps, NULL, 0); + ID3D11DeviceContext_PSSetShaderResources(context, 0, 1, &srv_sampling); + + draw_quad(&test_context); + + get_texture_readback(test_context.backbuffer, 0, &rb); + color = get_readback_color(&rb, 320, 240); + ok(compare_color(color, 0x7fbcbcbc, 1) || broken(compare_color(color, 0x7f7f7f7f, 1)), /* AMD */ + "Unexpected color %08x.\n", color); + release_resource_readback(&rb); + + ID3D11ShaderResourceView_Release(srv_sampling); + ID3D11ShaderResourceView_Release(srv); + + srv_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + srv_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; + srv_desc.Texture2D.MostDetailedMip = 0; + srv_desc.Texture2D.MipLevels = ~0u; + hr = ID3D11Device_CreateShaderResourceView(device, resource, &srv_desc, &srv); + ID3D11DeviceContext_UpdateSubresource(context, resource, + 0, NULL, data, sizeof(*data) * 32, sizeof(*data) * 32 * 32); + + ID3D11DeviceContext_GenerateMips(context, srv); + + ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, &white.w); + + srv_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + srv_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; + srv_desc.Texture2D.MostDetailedMip = 1; + srv_desc.Texture2D.MipLevels = ~0u; + hr = ID3D11Device_CreateShaderResourceView(device, resource, &srv_desc, &srv_sampling); + ok(SUCCEEDED(hr), "Failed to create shader resource view, hr %#x.\n", hr); + ID3D11DeviceContext_PSSetShader(context, ps, NULL, 0); + ID3D11DeviceContext_PSSetShaderResources(context, 0, 1, &srv_sampling); + + draw_quad(&test_context); + + get_texture_readback(test_context.backbuffer, 0, &rb); + check_readback_data_color(&rb, NULL, 0x7f7f7f7f, 1); + release_resource_readback(&rb); + + ID3D11ShaderResourceView_Release(srv_sampling); + ID3D11ShaderResourceView_Release(srv); + + ID3D11Resource_Release(resource); + + HeapFree(GetProcessHeap(), 0, data); + + ID3D11SamplerState_Release(sampler_state); + ID3D11PixelShader_Release(ps_3d); + ID3D11PixelShader_Release(ps); + release_test_context(&test_context); +} + START_TEST(d3d11) { test_create_device(); @@ -23725,4 +24165,5 @@ START_TEST(d3d11) test_format_compatibility(); test_clip_distance(); test_combined_clip_and_cull_distances(); + test_generate_mips(); }
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at https://testbot.winehq.org/JobDetails.pl?Key=34670
Your paranoid android.
=== wvistau64 (32 bit d3d11) === d3d11.c:23932: Test failed: Resource type 1, test 9: failed to create shader resource view, hr 0x887a0005. 0504:d3d11: unhandled exception c0000005 at 0043273F
=== w2008s64 (32 bit d3d11) === d3d11.c:23932: Test failed: Resource type 1, test 9: failed to create shader resource view, hr 0x887a0005. 0b30:d3d11: unhandled exception c0000005 at 0043273F
=== w7u (32 bit d3d11) === d3d11.c:23932: Test failed: Resource type 1, test 9: failed to create shader resource view, hr 0x887a0005. 0c84:d3d11: unhandled exception c0000005 at 0043273F
=== w7pro64 (32 bit d3d11) === d3d11.c:23932: Test failed: Resource type 1, test 9: failed to create shader resource view, hr 0x887a0005. 0894:d3d11: unhandled exception c0000005 at 0043273F
=== w8 (32 bit d3d11) === d3d11.c:23932: Test failed: Resource type 1, test 9: failed to create shader resource view, hr 0x887a0005. 0f70:d3d11: unhandled exception c0000005 at 0043273F
=== w864 (32 bit d3d11) === d3d11.c:23932: Test failed: Resource type 1, test 9: failed to create shader resource view, hr 0x887a0005. 0ebc:d3d11: unhandled exception c0000005 at 0043273F
=== w1064 (32 bit d3d11) === d3d11.c:23932: Test failed: Resource type 1, test 9: failed to create shader resource view, hr 0x887a0005. 0f00:d3d11: unhandled exception c0000005 at 0043273F
=== wvistau64 (64 bit d3d11) === d3d11.c:23932: Test failed: Resource type 1, test 9: failed to create shader resource view, hr 0x887a0005. 0a80:d3d11: unhandled exception c0000005 at 000000000042E2C7
=== w2008s64 (64 bit d3d11) === d3d11.c:23932: Test failed: Resource type 1, test 9: failed to create shader resource view, hr 0x887a0005. 0b30:d3d11: unhandled exception c0000005 at 000000000042E2C7
=== w7pro64 (64 bit d3d11) === d3d11.c:23932: Test failed: Resource type 1, test 9: failed to create shader resource view, hr 0x887a0005. 0854:d3d11: unhandled exception c0000005 at 000000000042E2C7
=== w864 (64 bit d3d11) === d3d11.c:23932: Test failed: Resource type 1, test 9: failed to create shader resource view, hr 0x887a0005. 0f78:d3d11: unhandled exception c0000005 at 000000000042E2C7
=== w1064 (64 bit d3d11) === d3d11.c:23932: Test failed: Resource type 1, test 9: failed to create shader resource view, hr 0x887a0005. 0f18:d3d11: unhandled exception c0000005 at 000000000042E2C7
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3d10core/tests/device.c | 438 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 438 insertions(+)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index 5221c0ea3a3..fd764cc4766 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -13156,6 +13156,443 @@ static void test_format_compatibility(void) ok(!refcount, "Device has %u references left.\n", refcount); }
+static void test_generate_mips(void) +{ + static const DWORD ps_code[] = + { +#if 0 + Texture2D t; + SamplerState s; + + float4 main(float4 position : SV_POSITION) : SV_Target + { + float2 p; + + p.x = position.x / 640.0f; + p.y = position.y / 480.0f; + return t.Sample(s, p); + } +#endif + 0x43425844, 0x1ce9b612, 0xc8176faa, 0xd37844af, 0xdb515605, 0x00000001, 0x00000134, 0x00000003, + 0x0000002c, 0x00000060, 0x00000094, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000030f, 0x505f5653, 0x5449534f, 0x004e4f49, + 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000098, 0x00000040, + 0x00000026, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, + 0x04002064, 0x00101032, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, + 0x00000001, 0x0a000038, 0x00100032, 0x00000000, 0x00101046, 0x00000000, 0x00004002, 0x3acccccd, + 0x3b088889, 0x00000000, 0x00000000, 0x09000045, 0x001020f2, 0x00000000, 0x00100046, 0x00000000, + 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0100003e, + }; + static const DWORD ps_code_3d[] = + { +#if 0 + Texture3D t; + SamplerState s; + + float4 main(float4 position : SV_POSITION) : SV_Target + { + float3 p; + + p.x = position.x / 640.0f; + p.y = position.y / 480.0f; + p.z = 0.5f; + return t.Sample(s, p); + } +#endif + 0x43425844, 0xa1e26083, 0xeb45763e, 0x1e5a5089, 0xdfbbe0df, 0x00000001, 0x00000148, 0x00000003, + 0x0000002c, 0x00000060, 0x00000094, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000030f, 0x505f5653, 0x5449534f, 0x004e4f49, + 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000000ac, 0x00000040, + 0x0000002b, 0x0300005a, 0x00106000, 0x00000000, 0x04002858, 0x00107000, 0x00000000, 0x00005555, + 0x04002064, 0x00101032, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, + 0x00000001, 0x0a000038, 0x00100032, 0x00000000, 0x00101046, 0x00000000, 0x00004002, 0x3acccccd, + 0x3b088889, 0x00000000, 0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x00004001, 0x3f000000, + 0x09000045, 0x001020f2, 0x00000000, 0x00100246, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x0100003e, + }; + static const struct + { + D3D10_RESOURCE_DIMENSION dim; + D3D10_SRV_DIMENSION srv_dim; + unsigned int array_size; + } + resource_types[] = + { + {D3D10_RESOURCE_DIMENSION_BUFFER, D3D10_SRV_DIMENSION_BUFFER, 1}, + {D3D10_RESOURCE_DIMENSION_TEXTURE2D, D3D10_SRV_DIMENSION_TEXTURE2D, 1}, + {D3D10_RESOURCE_DIMENSION_TEXTURE2D, D3D10_SRV_DIMENSION_TEXTURE2DARRAY, 4}, + {D3D10_RESOURCE_DIMENSION_TEXTURE3D, D3D10_SRV_DIMENSION_TEXTURE3D, 1}, + }; + static const struct + { + DXGI_FORMAT texture_format; + UINT bind_flags; + UINT misc_flags; + BOOL null_srv; + UINT base_level; + BOOL expected_creation; + BOOL expected_mips; + } + tests[] = + { + {DXGI_FORMAT_R8G8B8A8_UNORM, D3D10_BIND_SHADER_RESOURCE, 0, TRUE, + 0, TRUE, FALSE}, + {DXGI_FORMAT_R8G8B8A8_UNORM, D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE, 0, TRUE, + 0, TRUE, FALSE}, + {DXGI_FORMAT_R8G8B8A8_UNORM, D3D10_BIND_SHADER_RESOURCE, 0, FALSE, + 0, TRUE, FALSE}, + {DXGI_FORMAT_R8G8B8A8_UNORM, D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE, 0, FALSE, + 0, TRUE, FALSE}, + {DXGI_FORMAT_R8G8B8A8_UNORM, D3D10_BIND_SHADER_RESOURCE, D3D10_RESOURCE_MISC_GENERATE_MIPS, FALSE, + 0, FALSE, FALSE}, + {DXGI_FORMAT_R8G8B8A8_UNORM, D3D10_BIND_RENDER_TARGET, D3D10_RESOURCE_MISC_GENERATE_MIPS, FALSE, + 0, FALSE, FALSE}, + {DXGI_FORMAT_R8G8B8A8_UNORM, D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE, D3D10_RESOURCE_MISC_GENERATE_MIPS, FALSE, + 0, TRUE, TRUE}, + {DXGI_FORMAT_R8G8B8A8_UNORM, D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE, D3D10_RESOURCE_MISC_GENERATE_MIPS, FALSE, + 1, TRUE, TRUE}, + {DXGI_FORMAT_R8G8B8A8_TYPELESS, D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE, D3D10_RESOURCE_MISC_GENERATE_MIPS, FALSE, + 1, TRUE, TRUE}, + {DXGI_FORMAT_R8G8B8A8_UINT, D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE, D3D10_RESOURCE_MISC_GENERATE_MIPS, TRUE, + 1, TRUE, FALSE}, + }; + static const struct + { + POINT pos; + DWORD color; + } + expected[] = + { + {{200, 200}, 0xffff0000}, + {{280, 200}, 0xffff0000}, + {{360, 200}, 0xff00ff00}, + {{440, 200}, 0xff00ff00}, + {{200, 270}, 0xff0000ff}, + {{280, 270}, 0xff0000ff}, + {{360, 270}, 0xff000000}, + {{440, 270}, 0xff000000}, + }; + static const struct vec4 white = {1.0f, 1.0f, 1.0f, 1.0f}; + static const RECT r1 = {8, 8, 16, 16}; + static const RECT r2 = {16, 8, 24, 16}; + static const RECT r3 = {8, 16, 16, 24}; + static const RECT r4 = {16, 16, 24, 24}; + ID3D10ShaderResourceView *srv, *srv_sampling; + struct d3d10core_test_context test_context; + D3D10_SHADER_RESOURCE_VIEW_DESC srv_desc; + D3D10_TEXTURE2D_DESC texture2d_desc; + D3D10_TEXTURE3D_DESC texture3d_desc; + DWORD *data, color, expected_color; + ID3D10SamplerState *sampler_state; + D3D10_SAMPLER_DESC sampler_desc; + D3D10_BUFFER_DESC buffer_desc; + unsigned int i, j, k, x, y, z; + ID3D10PixelShader *ps, *ps_3d; + struct resource_readback rb; + ID3D10Resource *resource; + ID3D10Device *device; + HRESULT hr; + + if (!init_test_context(&test_context)) + return; + + device = test_context.device; + + hr = ID3D10Device_CreatePixelShader(device, ps_code, sizeof(ps_code), &ps); + ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr); + + hr = ID3D10Device_CreatePixelShader(device, ps_code_3d, sizeof(ps_code_3d), &ps_3d); + ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr); + + sampler_desc.Filter = D3D10_FILTER_MIN_MAG_MIP_POINT; + sampler_desc.AddressU = D3D10_TEXTURE_ADDRESS_CLAMP; + sampler_desc.AddressV = D3D10_TEXTURE_ADDRESS_CLAMP; + sampler_desc.AddressW = D3D10_TEXTURE_ADDRESS_CLAMP; + sampler_desc.MipLODBias = 0.0f; + sampler_desc.MaxAnisotropy = 0; + sampler_desc.ComparisonFunc = D3D10_COMPARISON_NEVER; + sampler_desc.BorderColor[0] = 0.0f; + sampler_desc.BorderColor[1] = 0.0f; + sampler_desc.BorderColor[2] = 0.0f; + sampler_desc.BorderColor[3] = 0.0f; + sampler_desc.MinLOD = 0.0f; + sampler_desc.MaxLOD = D3D10_FLOAT32_MAX; + + hr = ID3D10Device_CreateSamplerState(device, &sampler_desc, &sampler_state); + ok(SUCCEEDED(hr), "Failed to create sampler state, hr %#x.\n", hr); + ID3D10Device_PSSetSamplers(device, 0, 1, &sampler_state); + + data = HeapAlloc(GetProcessHeap(), 0, sizeof(*data) * 32 * 32 * 32); + + for (z = 0; z < 32; ++z) + { + for (y = 0; y < 32; ++y) + { + for (x = 0; x < 32; ++x) + { + DWORD *dst = &data[z * 32 * 32 + y * 32 + x]; + POINT pt; + + pt.x = x; + pt.y = y; + if (PtInRect(&r1, pt)) + *dst = 0xffff0000; + else if (PtInRect(&r2, pt)) + *dst = 0xff00ff00; + else if (PtInRect(&r3, pt)) + *dst = 0xff0000ff; + else if (PtInRect(&r4, pt)) + *dst = 0xff000000; + else + *dst = 0xffffffff; + } + } + } + + for (i = 0; i < ARRAY_SIZE(resource_types); ++i) + { + for (j = 0; j < ARRAY_SIZE(tests); ++j) + { + unsigned int base_multiplier = 1u << tests[j].base_level; + + switch (resource_types[i].dim) + { + case D3D10_RESOURCE_DIMENSION_BUFFER: + buffer_desc.ByteWidth = 32 * base_multiplier; + buffer_desc.Usage = D3D10_USAGE_DEFAULT; + buffer_desc.BindFlags = tests[j].bind_flags; + buffer_desc.CPUAccessFlags = 0; + buffer_desc.MiscFlags = tests[j].misc_flags; + + hr = ID3D10Device_CreateBuffer(device, &buffer_desc, NULL, (ID3D10Buffer **)&resource); + break; + case D3D10_RESOURCE_DIMENSION_TEXTURE2D: + texture2d_desc.Width = 32 * base_multiplier; + texture2d_desc.Height = 32 * base_multiplier; + texture2d_desc.MipLevels = 0; + texture2d_desc.ArraySize = resource_types[i].array_size; + texture2d_desc.Format = tests[j].texture_format; + texture2d_desc.SampleDesc.Count = 1; + texture2d_desc.SampleDesc.Quality = 0; + texture2d_desc.Usage = D3D10_USAGE_DEFAULT; + texture2d_desc.BindFlags = tests[j].bind_flags; + texture2d_desc.CPUAccessFlags = 0; + texture2d_desc.MiscFlags = tests[j].misc_flags; + + hr = ID3D10Device_CreateTexture2D(device, &texture2d_desc, NULL, (ID3D10Texture2D **)&resource); + break; + case D3D10_RESOURCE_DIMENSION_TEXTURE3D: + texture3d_desc.Width = 32 * base_multiplier; + texture3d_desc.Height = 32 * base_multiplier; + texture3d_desc.Depth = 32 * base_multiplier; + texture3d_desc.MipLevels = 0; + texture3d_desc.Format = tests[j].texture_format; + texture3d_desc.Usage = D3D10_USAGE_DEFAULT; + texture3d_desc.BindFlags = tests[j].bind_flags; + texture3d_desc.CPUAccessFlags = 0; + texture3d_desc.MiscFlags = tests[j].misc_flags; + + hr = ID3D10Device_CreateTexture3D(device, &texture3d_desc, NULL, (ID3D10Texture3D **)&resource); + break; + default: + break; + } + if (tests[j].expected_creation && (resource_types[i].dim != D3D10_RESOURCE_DIMENSION_BUFFER + || !(tests[j].misc_flags & D3D10_RESOURCE_MISC_GENERATE_MIPS))) + { + ok(SUCCEEDED(hr), "Resource type %u, test %u: failed to create resource, hr %#x.\n", i, j, hr); + } + else + { + ok(hr == E_INVALIDARG, "Resource type %u, test %u: unexpectedly succeeded to create resource, hr %#x.\n", i, j, hr); + continue; + } + + if (tests[j].null_srv) + { + hr = ID3D10Device_CreateShaderResourceView(device, resource, NULL, &srv); + } + else + { + srv_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + srv_desc.ViewDimension = resource_types[i].srv_dim; + switch (resource_types[i].srv_dim) + { + case D3D10_SRV_DIMENSION_BUFFER: + srv_desc.Buffer.ElementOffset = 0; + srv_desc.Buffer.ElementWidth = 0; + break; + case D3D10_SRV_DIMENSION_TEXTURE2D: + srv_desc.Texture2D.MostDetailedMip = tests[j].base_level; + srv_desc.Texture2D.MipLevels = ~0u; + break; + case D3D10_SRV_DIMENSION_TEXTURE2DARRAY: + srv_desc.Texture2DArray.MostDetailedMip = tests[j].base_level; + srv_desc.Texture2DArray.MipLevels = ~0u; + srv_desc.Texture2DArray.FirstArraySlice = 0; + srv_desc.Texture2DArray.ArraySize = resource_types[i].array_size; + break; + case D3D10_SRV_DIMENSION_TEXTURE3D: + srv_desc.Texture3D.MostDetailedMip = tests[j].base_level; + srv_desc.Texture3D.MipLevels = ~0u; + break; + default: + break; + } + hr = ID3D10Device_CreateShaderResourceView(device, resource, &srv_desc, &srv); + } + if (resource_types[i].dim == D3D10_RESOURCE_DIMENSION_BUFFER) + { + ok(FAILED(hr), "Test %u: unexpectedly succeeded to create shader resource view, hr %#x.\n", j, hr); + ID3D10Resource_Release(resource); + continue; + } + else + { + ok(SUCCEEDED(hr), "Resource type %u, test %u: failed to create shader resource view, hr %#x.\n", i, j, hr); + } + + ID3D10Device_UpdateSubresource(device, resource, + tests[j].base_level, NULL, data, sizeof(*data) * 32, sizeof(*data) * 32 * 32); + + ID3D10Device_GenerateMips(device, srv); + + ID3D10Device_ClearRenderTargetView(device, test_context.backbuffer_rtv, &white.w); + + srv_desc.Format = tests[j].texture_format == DXGI_FORMAT_R8G8B8A8_UINT + ? DXGI_FORMAT_R8G8B8A8_UINT : DXGI_FORMAT_R8G8B8A8_UNORM; + srv_desc.ViewDimension = resource_types[i].dim == D3D10_RESOURCE_DIMENSION_TEXTURE3D + ? D3D10_SRV_DIMENSION_TEXTURE3D : D3D10_SRV_DIMENSION_TEXTURE2D; + srv_desc.Texture2D.MostDetailedMip = tests[j].base_level + 1; + srv_desc.Texture2D.MipLevels = ~0u; + hr = ID3D10Device_CreateShaderResourceView(device, resource, &srv_desc, &srv_sampling); + ok(SUCCEEDED(hr), "Resource type %u, test %u: failed to create shader resource view, " + "hr %#x.\n", i, j, hr); + ID3D10Device_PSSetShader(device, resource_types[i].dim + == D3D10_RESOURCE_DIMENSION_TEXTURE3D ? ps_3d : ps); + ID3D10Device_PSSetShaderResources(device, 0, 1, &srv_sampling); + + draw_quad(&test_context); + + /* 3D textures aren't necessarily zero-initialized. */ + if (tests[j].expected_mips || resource_types[i].dim != D3D10_RESOURCE_DIMENSION_TEXTURE3D) + { + get_texture_readback(test_context.backbuffer, 0, &rb); + for (k = 0; k < ARRAY_SIZE(expected); ++k) + { + color = get_readback_color(&rb, expected[k].pos.x, expected[k].pos.y); + expected_color = tests[j].expected_mips ? expected[k].color : 0; + ok(color == expected_color, "Resource type %u, test %u: pixel (%u, %u) has color %08x, expected %08x.\n", + i, j, expected[k].pos.x, expected[k].pos.y, color, expected_color); + } + release_resource_readback(&rb); + } + ID3D10ShaderResourceView_Release(srv_sampling); + ID3D10ShaderResourceView_Release(srv); + ID3D10Resource_Release(resource); + } + } + + /* Test the effect of sRGB views. */ + for (y = 0; y < 32; ++y) + { + for (x = 0; x < 32; ++x) + { + DWORD *dst = &data[y * 32 + x]; + + *dst = (x + y) % 2 * 0xffffffff; + } + } + texture2d_desc.Width = 32; + texture2d_desc.Height = 32; + texture2d_desc.MipLevels = 0; + texture2d_desc.ArraySize = 1; + texture2d_desc.Format = DXGI_FORMAT_R8G8B8A8_TYPELESS; + texture2d_desc.SampleDesc.Count = 1; + texture2d_desc.SampleDesc.Quality = 0; + texture2d_desc.Usage = D3D10_USAGE_DEFAULT; + texture2d_desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE; + texture2d_desc.CPUAccessFlags = 0; + texture2d_desc.MiscFlags = D3D10_RESOURCE_MISC_GENERATE_MIPS; + + hr = ID3D10Device_CreateTexture2D(device, &texture2d_desc, NULL, (ID3D10Texture2D **)&resource); + ok(SUCCEEDED(hr), "Failed to create resource, hr %#x.\n", hr); + hr = ID3D10Device_CreateShaderResourceView(device, resource, NULL, &srv); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + srv_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; + srv_desc.ViewDimension = D3D10_SRV_DIMENSION_TEXTURE2D; + srv_desc.Texture2D.MostDetailedMip = 0; + srv_desc.Texture2D.MipLevels = ~0u; + hr = ID3D10Device_CreateShaderResourceView(device, resource, &srv_desc, &srv); + ID3D10Device_UpdateSubresource(device, resource, + 0, NULL, data, sizeof(*data) * 32, sizeof(*data) * 32 * 32); + + ID3D10Device_GenerateMips(device, srv); + + ID3D10Device_ClearRenderTargetView(device, test_context.backbuffer_rtv, &white.w); + + srv_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + srv_desc.ViewDimension = D3D10_SRV_DIMENSION_TEXTURE2D; + srv_desc.Texture2D.MostDetailedMip = 1; + srv_desc.Texture2D.MipLevels = ~0u; + hr = ID3D10Device_CreateShaderResourceView(device, resource, &srv_desc, &srv_sampling); + ok(SUCCEEDED(hr), "Failed to create shader resource view, hr %#x.\n", hr); + ID3D10Device_PSSetShader(device, ps); + ID3D10Device_PSSetShaderResources(device, 0, 1, &srv_sampling); + + draw_quad(&test_context); + + get_texture_readback(test_context.backbuffer, 0, &rb); + color = get_readback_color(&rb, 320, 240); + ok(compare_color(color, 0x7fbcbcbc, 1) || broken(compare_color(color, 0x7f7f7f7f, 1)), /* AMD */ + "Unexpected color %08x.\n", color); + release_resource_readback(&rb); + + ID3D10ShaderResourceView_Release(srv_sampling); + ID3D10ShaderResourceView_Release(srv); + + srv_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + srv_desc.ViewDimension = D3D10_SRV_DIMENSION_TEXTURE2D; + srv_desc.Texture2D.MostDetailedMip = 0; + srv_desc.Texture2D.MipLevels = ~0u; + hr = ID3D10Device_CreateShaderResourceView(device, resource, &srv_desc, &srv); + ID3D10Device_UpdateSubresource(device, resource, + 0, NULL, data, sizeof(*data) * 32, sizeof(*data) * 32 * 32); + + ID3D10Device_GenerateMips(device, srv); + + ID3D10Device_ClearRenderTargetView(device, test_context.backbuffer_rtv, &white.w); + + srv_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + srv_desc.ViewDimension = D3D10_SRV_DIMENSION_TEXTURE2D; + srv_desc.Texture2D.MostDetailedMip = 1; + srv_desc.Texture2D.MipLevels = ~0u; + hr = ID3D10Device_CreateShaderResourceView(device, resource, &srv_desc, &srv_sampling); + ok(SUCCEEDED(hr), "Failed to create shader resource view, hr %#x.\n", hr); + ID3D10Device_PSSetShader(device, ps); + ID3D10Device_PSSetShaderResources(device, 0, 1, &srv_sampling); + + draw_quad(&test_context); + + get_texture_readback(test_context.backbuffer, 0, &rb); + check_readback_data_color(&rb, NULL, 0x7f7f7f7f, 1); + release_resource_readback(&rb); + + ID3D10ShaderResourceView_Release(srv_sampling); + ID3D10ShaderResourceView_Release(srv); + + ID3D10Resource_Release(resource); + + HeapFree(GetProcessHeap(), 0, data); + + ID3D10SamplerState_Release(sampler_state); + ID3D10PixelShader_Release(ps_3d); + ID3D10PixelShader_Release(ps); + release_test_context(&test_context); +} + START_TEST(device) { test_feature_level(); @@ -13230,4 +13667,5 @@ START_TEST(device) test_stream_output(); test_stream_output_resume(); test_format_compatibility(); + test_generate_mips(); }
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at https://testbot.winehq.org/JobDetails.pl?Key=34671
Your paranoid android.
=== wvistau64 (32 bit device) === 0634:device: unhandled exception c0000005 at 0041C0A2
=== w2008s64 (32 bit device) === 07ec:device: unhandled exception c0000005 at 0041C0A2
=== w7u (32 bit device) === 0de0:device: unhandled exception c0000005 at 0041C0A2
=== w7pro64 (32 bit device) === 0890:device: unhandled exception c0000005 at 0041C0A2
=== w8 (32 bit device) === 0f90:device: unhandled exception c0000005 at 0041C0A2
=== w864 (32 bit device) === 0ea4:device: unhandled exception c0000005 at 0041C0A2
=== w1064 (32 bit device) === 0f18:device: unhandled exception c0000005 at 0041C0A2
=== wvistau64 (64 bit device) === 00c4:device: unhandled exception c0000005 at 0000000000419AFC
=== w2008s64 (64 bit device) === 0b28:device: unhandled exception c0000005 at 0000000000419AFC
=== w7pro64 (64 bit device) === 06ec:device: unhandled exception c0000005 at 0000000000419AFC
=== w864 (64 bit device) === 0fa8:device: unhandled exception c0000005 at 0000000000419AFC
=== w1064 (64 bit device) === 0db0:device: unhandled exception c0000005 at 0000000000419AFC