#ifndef __WINE_D3D9_PRIVATE_H
#define __WINE_D3D9_PRIVATE_H
-#include <config.h>
-
#include <assert.h>
#include <stdarg.h>
-#define WIN32_NO_STATUS
-#define _INC_WINDOWS
-#define COM_NO_WINDOWS_H
-
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#define COBJMACROS
-#include <windef.h>
-#include <winbase.h>
-#include <wingdi.h>
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "wine/debug.h"
+#include "wine/heap.h"
+#include "wine/unicode.h"
-#include <wine/debug.h>
-WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
+#include "d3d9.h"
+#include "wine/wined3d.h"
-#include <d3d9.h>
-#include <wine/wined3d.h>
+#define D3D9_MAX_VERTEX_SHADER_CONSTANTF 256
+#define D3D9_MAX_TEXTURE_UNITS 20
#define D3DPRESENTFLAGS_MASK 0x00000fffu
+#define D3D9_TEXTURE_MIPMAP_DIRTY 0x1
+
+#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
+
extern const struct wined3d_parent_ops d3d9_null_wined3d_parent_ops DECLSPEC_HIDDEN;
HRESULT vdecl_convert_fvf(DWORD FVF, D3DVERTEXELEMENT9 **ppVertexElements) DECLSPEC_HIDDEN;
D3DFORMAT d3dformat_from_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN;
BOOL is_gdi_compat_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN;
enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format) DECLSPEC_HIDDEN;
+unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags) DECLSPEC_HIDDEN;
void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *present_parameters,
const struct wined3d_swapchain_desc *swapchain_desc) DECLSPEC_HIDDEN;
void d3dcaps_from_wined3dcaps(D3DCAPS9 *caps, const WINED3DCAPS *wined3d_caps) DECLSPEC_HIDDEN;
UINT index_buffer_size;
UINT index_buffer_pos;
+ struct d3d9_texture *textures[D3D9_MAX_TEXTURE_UNITS];
+ struct d3d9_surface *render_targets[D3D_MAX_SIMULTANEOUS_RENDERTARGETS];
+
LONG device_state;
BOOL in_destruction;
BOOL in_scene;
struct wined3d_texture *wined3d_texture;
IDirect3DDevice9Ex *parent_device;
struct list rtv_list;
+ DWORD usage;
+ BOOL flags;
+ struct wined3d_shader_resource_view *wined3d_srv;
+ D3DTEXTUREFILTERTYPE autogen_filter_type;
};
HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *device,
HRESULT volumetexture_init(struct d3d9_texture *texture, struct d3d9_device *device,
UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN;
struct d3d9_texture *unsafe_impl_from_IDirect3DBaseTexture9(IDirect3DBaseTexture9 *iface) DECLSPEC_HIDDEN;
+void d3d9_texture_flag_auto_gen_mipmap(struct d3d9_texture *texture) DECLSPEC_HIDDEN;
+void d3d9_texture_gen_auto_mipmap(struct d3d9_texture *texture) DECLSPEC_HIDDEN;
struct d3d9_stateblock
{
struct d3d9_device *device, const DWORD *byte_code) DECLSPEC_HIDDEN;
struct d3d9_vertexshader *unsafe_impl_from_IDirect3DVertexShader9(IDirect3DVertexShader9 *iface) DECLSPEC_HIDDEN;
-#define D3D9_MAX_VERTEX_SHADER_CONSTANTF 256
-#define D3D9_MAX_SIMULTANEOUS_RENDERTARGETS 4
-
struct d3d9_pixelshader
{
IDirect3DPixelShader9 IDirect3DPixelShader9_iface;
return CONTAINING_RECORD(iface, struct d3d9_device, IDirect3DDevice9Ex_iface);
}
+static inline DWORD d3dusage_from_wined3dusage(unsigned int usage)
+{
+ return usage & WINED3DUSAGE_MASK;
+}
+
+static inline D3DPOOL d3dpool_from_wined3daccess(unsigned int access, unsigned int usage)
+{
+ switch (access & (WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU))
+ {
+ default:
+ case WINED3D_RESOURCE_ACCESS_GPU:
+ return D3DPOOL_DEFAULT;
+ case WINED3D_RESOURCE_ACCESS_CPU:
+ if (usage & WINED3DUSAGE_SCRATCH)
+ return D3DPOOL_SCRATCH;
+ return D3DPOOL_SYSTEMMEM;
+ case WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU:
+ return D3DPOOL_MANAGED;
+ }
+}
+
+static inline unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int usage)
+{
+ switch (pool)
+ {
+ case D3DPOOL_DEFAULT:
+ if (usage & D3DUSAGE_DYNAMIC)
+ return WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
+ return WINED3D_RESOURCE_ACCESS_GPU;
+ case D3DPOOL_MANAGED:
+ return WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU
+ | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
+ case D3DPOOL_SYSTEMMEM:
+ case D3DPOOL_SCRATCH:
+ return WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
+ default:
+ return 0;
+ }
+}
+
+static inline DWORD wined3dusage_from_d3dusage(unsigned int usage)
+{
+ return usage & WINED3DUSAGE_MASK;
+}
+
#endif /* __WINE_D3D9_PRIVATE_H */