https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9cb965ea9bda719133b31…
commit 9cb965ea9bda719133b31ef79f969319eeaa5b06
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Mon Sep 21 23:03:27 2020 +0200
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Thu Feb 4 16:37:05 2021 +0100
[WINESYNC] d3dx9: Reimplement make_pow2() in d3dx9_private.h.
Signed-off-by: Sven Baars <sbaars(a)codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 1b0ad92db1c21d5052c45be2291759d60553476c by Sven Baars
<sbaars(a)codeweavers.com>
---
dll/directx/wine/d3dx9_36/d3dx9_private.h | 19 +++++++++++++++++++
dll/directx/wine/d3dx9_36/texture.c | 15 ---------------
sdk/tools/winesync/d3dx9.cfg | 2 +-
3 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/dll/directx/wine/d3dx9_36/d3dx9_private.h
b/dll/directx/wine/d3dx9_36/d3dx9_private.h
index 69dcb033fdb..92116b163f2 100644
--- a/dll/directx/wine/d3dx9_36/d3dx9_private.h
+++ b/dll/directx/wine/d3dx9_36/d3dx9_private.h
@@ -22,6 +22,7 @@
#ifndef __WINE_D3DX9_PRIVATE_H
#define __WINE_D3DX9_PRIVATE_H
+#include <stdint.h>
#define NONAMELESSUNION
#include "wine/debug.h"
#include "wine/heap.h"
@@ -225,6 +226,24 @@ static inline BOOL is_param_type_sampler(D3DXPARAMETER_TYPE type)
|| type == D3DXPT_SAMPLER3D || type == D3DXPT_SAMPLERCUBE;
}
+/* Returns the smallest power of 2 which is greater than or equal to num */
+static inline uint32_t make_pow2(uint32_t num)
+{
+#if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) &&
(__GNUC_MINOR__ >= 3)))
+ return num == 1 ? 1 : 1u << ((__builtin_clz(num - 1) ^ 0x1f) + 1);
+#else
+ num--;
+ num |= num >> 1;
+ num |= num >> 2;
+ num |= num >> 4;
+ num |= num >> 8;
+ num |= num >> 16;
+ num++;
+
+ return num;
+#endif
+}
+
struct d3dx_parameter;
enum pres_reg_tables
diff --git a/dll/directx/wine/d3dx9_36/texture.c b/dll/directx/wine/d3dx9_36/texture.c
index 8f836694527..055a68ad305 100644
--- a/dll/directx/wine/d3dx9_36/texture.c
+++ b/dll/directx/wine/d3dx9_36/texture.c
@@ -34,21 +34,6 @@ static BOOL is_pow2(UINT num)
return !(num & (num - 1));
}
-/* Returns the smallest power of 2 which is greater than or equal to num */
-static UINT make_pow2(UINT num)
-{
- UINT result = 1;
-
- /* In the unlikely event somebody passes a large value, make sure we don't enter
an infinite loop */
- if (num >= 0x80000000)
- return 0x80000000;
-
- while (result < num)
- result <<= 1;
-
- return result;
-}
-
static HRESULT get_surface(D3DRESOURCETYPE type, struct IDirect3DBaseTexture9 *tex,
int face, UINT level, struct IDirect3DSurface9 **surf)
{
diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg
index ab6b158b684..86c62751e83 100644
--- a/sdk/tools/winesync/d3dx9.cfg
+++ b/sdk/tools/winesync/d3dx9.cfg
@@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h:
sdk/inc
include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h:
sdk/include/dxsdk/d3dx9of.h,
include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h:
sdk/include/dxsdk/d3dx9shape.h,
include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h:
sdk/include/dxsdk/d3dx9xof.h}
-tags: {wine: e0ce80561bf046c9dc7837e1c7f3c999f18b0361}
+tags: {wine: 1b0ad92db1c21d5052c45be2291759d60553476c}