d3d8: Moved the remaining code over to WineD3D (based on patches by
Oliver Stieber).
This commit is contained in:
parent
4a8961ce3d
commit
d13469c1d8
|
@ -14,19 +14,17 @@ C_SRCS = \
|
||||||
d3d8_main.c \
|
d3d8_main.c \
|
||||||
device.c \
|
device.c \
|
||||||
directx.c \
|
directx.c \
|
||||||
drawprim.c \
|
|
||||||
indexbuffer.c \
|
indexbuffer.c \
|
||||||
|
pixelshader.c \
|
||||||
resource.c \
|
resource.c \
|
||||||
shader.c \
|
|
||||||
stateblock.c \
|
stateblock.c \
|
||||||
surface.c \
|
surface.c \
|
||||||
swapchain.c \
|
swapchain.c \
|
||||||
texture.c \
|
texture.c \
|
||||||
utils.c \
|
|
||||||
vertexbuffer.c \
|
vertexbuffer.c \
|
||||||
|
vertexshader.c \
|
||||||
volume.c \
|
volume.c \
|
||||||
volumetexture.c \
|
volumetexture.c
|
||||||
vshaderdeclaration.c
|
|
||||||
|
|
||||||
RC_SRCS = version.rc
|
RC_SRCS = version.rc
|
||||||
|
|
||||||
|
|
|
@ -161,17 +161,3 @@ const IDirect3DBaseTexture8Vtbl Direct3DBaseTexture8_Vtbl =
|
||||||
IDirect3DBaseTexture8Impl_GetLOD,
|
IDirect3DBaseTexture8Impl_GetLOD,
|
||||||
IDirect3DBaseTexture8Impl_GetLevelCount
|
IDirect3DBaseTexture8Impl_GetLevelCount
|
||||||
};
|
};
|
||||||
|
|
||||||
BOOL WINAPI IDirect3DBaseTexture8Impl_IsDirty(LPDIRECT3DBASETEXTURE8 iface) {
|
|
||||||
IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
|
|
||||||
return ((IWineD3DBaseTextureImpl*)This->wineD3DBaseTexture)->baseTexture.dirty;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL WINAPI IDirect3DBaseTexture8Impl_SetDirty(LPDIRECT3DBASETEXTURE8 iface, BOOL dirty) {
|
|
||||||
BOOL old;
|
|
||||||
IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
|
|
||||||
|
|
||||||
old = ((IWineD3DBaseTextureImpl*)This->wineD3DBaseTexture)->baseTexture.dirty;
|
|
||||||
((IWineD3DBaseTextureImpl*)This->wineD3DBaseTexture)->baseTexture.dirty = dirty;
|
|
||||||
return old;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
/* Direct3D 8
|
/*
|
||||||
|
* Direct3D 8
|
||||||
|
*
|
||||||
|
* Copyright 2005 Oliver Stieber
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -18,100 +21,74 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "initguid.h"
|
#include "initguid.h"
|
||||||
|
#include "d3d8_private.h"
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
#include "windef.h"
|
|
||||||
#include "winbase.h"
|
|
||||||
#include "winreg.h"
|
|
||||||
#include "wingdi.h"
|
|
||||||
#include "winuser.h"
|
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
|
||||||
#include "d3d8.h"
|
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
|
||||||
#include "d3d8_private.h"
|
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
|
||||||
|
|
||||||
int num_lock = 0;
|
|
||||||
void (*wine_tsx11_lock_ptr)(void) = NULL;
|
void (*wine_tsx11_lock_ptr)(void) = NULL;
|
||||||
void (*wine_tsx11_unlock_ptr)(void) = NULL;
|
void (*wine_tsx11_unlock_ptr)(void) = NULL;
|
||||||
int vs_mode = VS_HW; /* Hardware by default */
|
|
||||||
int ps_mode = PS_NONE; /* Disabled by default */
|
|
||||||
|
|
||||||
HRESULT WINAPI D3D8GetSWInfo(void)
|
|
||||||
{
|
HRESULT WINAPI D3D8GetSWInfo(void) {
|
||||||
FIXME("(void): stub\n");
|
FIXME("(void): stub\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WINAPI DebugSetMute(void)
|
void WINAPI DebugSetMute(void) {
|
||||||
{
|
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
}
|
}
|
||||||
|
|
||||||
IDirect3D8* WINAPI Direct3DCreate8(UINT SDKVersion)
|
IDirect3D8* WINAPI Direct3DCreate8(UINT SDKVersion) {
|
||||||
{
|
IDirect3D8Impl* object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D8Impl));
|
||||||
IDirect3D8Impl *object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D8Impl));
|
|
||||||
|
|
||||||
object->lpVtbl = &Direct3D8_Vtbl;
|
object->lpVtbl = &Direct3D8_Vtbl;
|
||||||
object->direct3d8 = object;
|
|
||||||
object->ref = 1;
|
object->ref = 1;
|
||||||
object->WineD3D = WineDirect3DCreate(SDKVersion, 8, (IUnknown *)object);
|
object->WineD3D = WineDirect3DCreate(SDKVersion, 8, (IUnknown *)object);
|
||||||
|
|
||||||
TRACE("SDKVersion = %x, Created Direct3D object @ %p, WineObj @ %p\n", SDKVersion, object, object->WineD3D);
|
TRACE("SDKVersion = %x, Created Direct3D object @ %p, WineObj @ %p\n", SDKVersion, object, object->WineD3D);
|
||||||
|
|
||||||
return (IDirect3D8 *)object;
|
return (IDirect3D8*) object;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* At process attach */
|
/* At process attach */
|
||||||
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
|
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) {
|
||||||
{
|
TRACE("fdwReason=%ld\n", fdwReason);
|
||||||
TRACE("D3D8 DLLMain Reason=%ld\n", fdwReason);
|
if (fdwReason == DLL_PROCESS_ATTACH) {
|
||||||
if (fdwReason == DLL_PROCESS_ATTACH)
|
|
||||||
{
|
|
||||||
HMODULE mod;
|
HMODULE mod;
|
||||||
char buffer[32];
|
|
||||||
DWORD size = sizeof(buffer);
|
|
||||||
HKEY hkey = 0;
|
|
||||||
|
|
||||||
DisableThreadLibraryCalls(hInstDLL);
|
DisableThreadLibraryCalls(hInstDLL);
|
||||||
|
|
||||||
mod = GetModuleHandleA( "winex11.drv" );
|
mod = GetModuleHandleA( "winex11.drv" );
|
||||||
if (mod)
|
if (mod)
|
||||||
{
|
{
|
||||||
wine_tsx11_lock_ptr = (void *)GetProcAddress( mod, "wine_tsx11_lock" );
|
wine_tsx11_lock_ptr = (void*) GetProcAddress(mod, "wine_tsx11_lock");
|
||||||
wine_tsx11_unlock_ptr = (void *)GetProcAddress( mod, "wine_tsx11_unlock" );
|
wine_tsx11_unlock_ptr = (void*) GetProcAddress(mod, "wine_tsx11_unlock");
|
||||||
}
|
}
|
||||||
/* @@ Wine registry key: HKCU\Software\Wine\Direct3D */
|
|
||||||
if ( !RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Direct3D", &hkey) )
|
|
||||||
{
|
|
||||||
if ( !RegQueryValueExA( hkey, "VertexShaderMode", 0, NULL, (LPBYTE) buffer, &size) )
|
|
||||||
{
|
|
||||||
if (!strcmp(buffer,"none"))
|
|
||||||
{
|
|
||||||
TRACE("Disable vertex shaders\n");
|
|
||||||
vs_mode = VS_NONE;
|
|
||||||
}
|
|
||||||
else if (!strcmp(buffer,"emulation"))
|
|
||||||
{
|
|
||||||
TRACE("Force SW vertex shaders\n");
|
|
||||||
vs_mode = VS_SW;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( !RegQueryValueExA( hkey, "PixelShaderMode", 0, NULL, (LPBYTE) buffer, &size) )
|
|
||||||
{
|
|
||||||
if (!strcmp(buffer,"enabled"))
|
|
||||||
{
|
|
||||||
TRACE("Allow pixel shaders\n");
|
|
||||||
ps_mode = PS_HW;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (vs_mode == VS_HW)
|
|
||||||
TRACE("Allow HW vertex shaders\n");
|
|
||||||
if (ps_mode == PS_NONE)
|
|
||||||
TRACE("Disable pixel shaders\n");
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* ValidateVertexShader (D3D8.@)
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* toto result?
|
||||||
|
*/
|
||||||
|
BOOL WINAPI ValidateVertexShader(LPVOID pFunction, int foo, int bar, void *fee, int rab)
|
||||||
|
{
|
||||||
|
FIXME("(void): stub: %p %d %d %p %d\n", pFunction, foo, bar, fee, rab);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* ValidatePixelShader (D3D8.@)
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* toto result?
|
||||||
|
*/
|
||||||
|
BOOL WINAPI ValidatePixelShader(LPVOID pFunction, int foo, int bar, void *fee, int rab)
|
||||||
|
{
|
||||||
|
FIXME("(void): stub: %p %d %d %p %d\n", pFunction, foo, bar, fee, rab);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
|
@ -88,6 +88,7 @@ extern int ps_mode;
|
||||||
#define MAX_STREAMS 16
|
#define MAX_STREAMS 16
|
||||||
#define MAX_CLIPPLANES D3DMAXUSERCLIPPLANES
|
#define MAX_CLIPPLANES D3DMAXUSERCLIPPLANES
|
||||||
#define MAX_LEVELS 256
|
#define MAX_LEVELS 256
|
||||||
|
#define MAX_SHADERS 64
|
||||||
|
|
||||||
/* Other useful values */
|
/* Other useful values */
|
||||||
#define HIGHEST_RENDER_STATE 174
|
#define HIGHEST_RENDER_STATE 174
|
||||||
|
@ -189,6 +190,7 @@ typedef struct IDirect3DVertexShaderDeclarationImpl IDirect3DVertexShaderDeclara
|
||||||
|
|
||||||
/* Advance declaration of structures to satisfy compiler */
|
/* Advance declaration of structures to satisfy compiler */
|
||||||
typedef struct IWineD3DStateBlockImpl IWineD3DStateBlockImpl;
|
typedef struct IWineD3DStateBlockImpl IWineD3DStateBlockImpl;
|
||||||
|
typedef struct IDirect3DVertexShader8Impl IDirect3DVertexShader8Impl;
|
||||||
|
|
||||||
typedef struct D3DSHADERVECTOR {
|
typedef struct D3DSHADERVECTOR {
|
||||||
float x;
|
float x;
|
||||||
|
@ -541,76 +543,11 @@ struct IDirect3DDevice8Impl
|
||||||
/* IUnknown fields */
|
/* IUnknown fields */
|
||||||
const IDirect3DDevice8Vtbl *lpVtbl;
|
const IDirect3DDevice8Vtbl *lpVtbl;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
/* But what about baseVertexIndex in state blocks? hmm... it may be a better idea to pass this to wined3d */
|
||||||
/* IDirect3DDevice8 fields */
|
|
||||||
IDirect3D8Impl *direct3d8;
|
|
||||||
IWineD3DDevice *WineD3DDevice;
|
IWineD3DDevice *WineD3DDevice;
|
||||||
|
IDirect3DVertexShader8Impl *vShaders[MAX_SHADERS];
|
||||||
IDirect3DSurface8Impl *frontBuffer;
|
/* FIXME: Move *baseVertexIndex somewhere sensible like wined3d */
|
||||||
IDirect3DSurface8Impl *backBuffer;
|
UINT baseVertexIndex;
|
||||||
IDirect3DSurface8Impl *depthStencilBuffer;
|
|
||||||
|
|
||||||
IDirect3DSurface8Impl *renderTarget;
|
|
||||||
IDirect3DSurface8Impl *stencilBufferTarget;
|
|
||||||
|
|
||||||
D3DPRESENT_PARAMETERS PresentParms;
|
|
||||||
D3DDEVICE_CREATION_PARAMETERS CreateParms;
|
|
||||||
|
|
||||||
UINT adapterNo;
|
|
||||||
D3DDEVTYPE devType;
|
|
||||||
|
|
||||||
UINT srcBlend;
|
|
||||||
UINT dstBlend;
|
|
||||||
UINT alphafunc;
|
|
||||||
UINT stencilfunc;
|
|
||||||
|
|
||||||
/* State block related */
|
|
||||||
BOOL isRecordingState;
|
|
||||||
IDirect3DStateBlockImpl *StateBlock;
|
|
||||||
IDirect3DStateBlockImpl *UpdateStateBlock;
|
|
||||||
|
|
||||||
/* palettes texture management */
|
|
||||||
PALETTEENTRY palettes[MAX_PALETTES][256];
|
|
||||||
UINT currentPalette;
|
|
||||||
|
|
||||||
BOOL texture_shader_active;
|
|
||||||
|
|
||||||
/* Optimization */
|
|
||||||
BOOL modelview_valid;
|
|
||||||
BOOL proj_valid;
|
|
||||||
BOOL view_ident; /* true iff view matrix is identity */
|
|
||||||
BOOL last_was_rhw; /* true iff last draw_primitive was in xyzrhw mode */
|
|
||||||
GLenum tracking_parm; /* Which source is tracking current colour */
|
|
||||||
LONG tracking_color; /* used iff GL_COLOR_MATERIAL was enabled */
|
|
||||||
#define DISABLED_TRACKING 0 /* Disabled */
|
|
||||||
#define IS_TRACKING 1 /* tracking_parm is tracking diffuse color */
|
|
||||||
#define NEEDS_TRACKING 2 /* Tracking needs to be enabled when needed */
|
|
||||||
#define NEEDS_DISABLE 3 /* Tracking needs to be disabled when needed*/
|
|
||||||
|
|
||||||
/* OpenGL related */
|
|
||||||
GLXContext glCtx;
|
|
||||||
XVisualInfo *visInfo;
|
|
||||||
Display *display;
|
|
||||||
HWND win_handle;
|
|
||||||
Window win;
|
|
||||||
GLXContext render_ctx;
|
|
||||||
Drawable drawable;
|
|
||||||
GLint maxConcurrentLights;
|
|
||||||
|
|
||||||
/* OpenGL Extension related */
|
|
||||||
|
|
||||||
/* Cursor management */
|
|
||||||
BOOL bCursorVisible;
|
|
||||||
UINT xHotSpot;
|
|
||||||
UINT yHotSpot;
|
|
||||||
UINT xScreenSpace;
|
|
||||||
UINT yScreenSpace;
|
|
||||||
GLint cursor;
|
|
||||||
|
|
||||||
UINT dummyTextureName[8];
|
|
||||||
|
|
||||||
/* For rendering to a texture using glCopyTexImage */
|
|
||||||
BOOL renderUpsideDown;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* IUnknown: */
|
/* IUnknown: */
|
||||||
|
@ -951,8 +888,7 @@ struct IDirect3DResource8Impl
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
/* IDirect3DResource8 fields */
|
/* IDirect3DResource8 fields */
|
||||||
IDirect3DDevice8Impl *Device;
|
IWineD3DResource *wineD3DResource;
|
||||||
D3DRESOURCETYPE ResourceType;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* IUnknown: */
|
/* IUnknown: */
|
||||||
|
@ -988,15 +924,9 @@ struct IDirect3DVertexBuffer8Impl
|
||||||
/* IUnknown fields */
|
/* IUnknown fields */
|
||||||
const IDirect3DVertexBuffer8Vtbl *lpVtbl;
|
const IDirect3DVertexBuffer8Vtbl *lpVtbl;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
LONG refInt;
|
|
||||||
|
|
||||||
/* IDirect3DResource8 fields */
|
/* IDirect3DResource8 fields */
|
||||||
IDirect3DDevice8Impl *Device;
|
IWineD3DVertexBuffer *wineD3DVertexBuffer;
|
||||||
D3DRESOURCETYPE ResourceType;
|
|
||||||
|
|
||||||
/* IDirect3DVertexBuffer8 fields */
|
|
||||||
BYTE *allocatedMemory;
|
|
||||||
D3DVERTEXBUFFER_DESC currentDesc;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* IUnknown: */
|
/* IUnknown: */
|
||||||
|
@ -1041,15 +971,9 @@ struct IDirect3DIndexBuffer8Impl
|
||||||
/* IUnknown fields */
|
/* IUnknown fields */
|
||||||
const IDirect3DIndexBuffer8Vtbl *lpVtbl;
|
const IDirect3DIndexBuffer8Vtbl *lpVtbl;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
LONG refInt;
|
|
||||||
|
|
||||||
/* IDirect3DResource8 fields */
|
/* IDirect3DResource8 fields */
|
||||||
IDirect3DDevice8Impl *Device;
|
IWineD3DIndexBuffer *wineD3DIndexBuffer;
|
||||||
D3DRESOURCETYPE ResourceType;
|
|
||||||
|
|
||||||
/* IDirect3DIndexBuffer8 fields */
|
|
||||||
void *allocatedMemory;
|
|
||||||
D3DINDEXBUFFER_DESC currentDesc;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* IUnknown: */
|
/* IUnknown: */
|
||||||
|
@ -1427,221 +1351,159 @@ struct IWineD3DStateBlockImpl
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* ==============================================================================
|
||||||
|
Private interfaces: beginning of cleaning/splitting for HAL and d3d9 support
|
||||||
|
============================================================================== */
|
||||||
|
|
||||||
/* ----------------------- */
|
/* ----------------------- */
|
||||||
/* IDirect3DStateBlockImpl */
|
/* IDirect3DStateBlockImpl */
|
||||||
/* ----------------------- */
|
/* ----------------------- */
|
||||||
|
|
||||||
|
/* TODO: Generate a valid GUIDs */
|
||||||
|
/* {83B073CE-6F30-11d9-C687-00046142C14F} */
|
||||||
|
DEFINE_GUID(IID_IDirect3DStateBlock8,
|
||||||
|
0x83b073ce, 0x6f30, 0x11d9, 0xc6, 0x87, 0x0, 0x4, 0x61, 0x42, 0xc1, 0x4f);
|
||||||
|
|
||||||
|
DEFINE_GUID(IID_IDirect3DVertexShader8,
|
||||||
|
0xefc5557e, 0x6265, 0x4613, 0x8a, 0x94, 0x43, 0x85, 0x78, 0x89, 0xeb, 0x36);
|
||||||
|
|
||||||
|
DEFINE_GUID(IID_IDirect3DPixelShader8,
|
||||||
|
0x6d3bdbdc, 0x5b02, 0x4415, 0xb8, 0x52, 0xce, 0x5e, 0x8b, 0xcc, 0xb2, 0x89);
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* IDirect3DStateBlock8 interface
|
||||||
|
*/
|
||||||
|
#define INTERFACE IDirect3DStateBlock8
|
||||||
|
DECLARE_INTERFACE_(IDirect3DStateBlock8, IUnknown)
|
||||||
|
{
|
||||||
|
/*** IUnknown methods ***/
|
||||||
|
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
|
||||||
|
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
||||||
|
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
||||||
|
/*** IDirect3DStateBlock9 methods ***/
|
||||||
|
STDMETHOD(GetDevice)(THIS_ struct IDirect3DDevice8** ppDevice) PURE;
|
||||||
|
STDMETHOD(Capture)(THIS) PURE;
|
||||||
|
STDMETHOD(Apply)(THIS) PURE;
|
||||||
|
};
|
||||||
|
#undef INTERFACE
|
||||||
|
|
||||||
|
/*** IUnknown methods ***/
|
||||||
|
#define IDirect3DStateBlock8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
||||||
|
#define IDirect3DStateBlock8_AddRef(p) (p)->lpVtbl->AddRef(p)
|
||||||
|
#define IDirect3DStateBlock8_Release(p) (p)->lpVtbl->Release(p)
|
||||||
|
/*** IDirect3DStateBlock9 methods ***/
|
||||||
|
#define IDirect3DStateBlock8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a)
|
||||||
|
#define IDirect3DStateBlock8_Capture(p) (p)->lpVtbl->Capture(p)
|
||||||
|
#define IDirect3DStateBlock8_Apply(p) (p)->lpVtbl->Apply(p)
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Predeclare the interface implementation structures
|
* Predeclare the interface implementation structures
|
||||||
*/
|
*/
|
||||||
/*extern const IDirect3DStateBlock9Vtbl Direct3DStateBlock9_Vtbl;*/
|
extern const IDirect3DStateBlock8Vtbl Direct3DStateBlock8_Vtbl;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* IDirect3DStateBlock implementation structure
|
* IDirect3DStateBlock implementation structure
|
||||||
*/
|
*/
|
||||||
struct IDirect3DStateBlockImpl {
|
typedef struct IDirect3DStateBlock8Impl {
|
||||||
/* IUnknown fields */
|
/* IUnknown fields */
|
||||||
/*const IDirect3DStateBlock9Vtbl *lpVtbl;*/
|
const IDirect3DStateBlock8Vtbl *lpVtbl;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
/* The device, to be replaced by an IDirect3DDeviceImpl */
|
/* IDirect3DResource8 fields */
|
||||||
IDirect3DDevice8Impl* device;
|
IWineD3DStateBlock *wineD3DStateBlock;
|
||||||
|
} IDirect3DStateBlock8Impl;
|
||||||
|
|
||||||
D3DSTATEBLOCKTYPE blockType;
|
/*****************************************************************************
|
||||||
|
* IDirect3DVertexShader9 interface
|
||||||
SAVEDSTATES Changed;
|
*/
|
||||||
SAVEDSTATES Set;
|
#define INTERFACE IDirect3DVertexShader8
|
||||||
|
DECLARE_INTERFACE_(IDirect3DVertexShader8, IUnknown)
|
||||||
/* Clipping */
|
{
|
||||||
double clipplane[MAX_CLIPPLANES][4];
|
/*** IUnknown methods ***/
|
||||||
D3DCLIPSTATUS8 clip_status;
|
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
|
||||||
|
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
||||||
/* Stream Source */
|
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
||||||
UINT stream_stride[MAX_STREAMS];
|
/*** IDirect3DVertexShader9 methods ***/
|
||||||
IDirect3DVertexBuffer8 *stream_source[MAX_STREAMS];
|
STDMETHOD(GetDevice)(THIS_ struct IDirect3DDevice8** ppDevice) PURE;
|
||||||
BOOL streamIsUP;
|
STDMETHOD(GetFunction)(THIS_ void*, UINT* pSizeOfData) PURE;
|
||||||
|
|
||||||
/* Indices */
|
|
||||||
IDirect3DIndexBuffer8* pIndexData;
|
|
||||||
UINT baseVertexIndex;
|
|
||||||
|
|
||||||
/* Texture */
|
|
||||||
IDirect3DBaseTexture8 *textures[8];
|
|
||||||
int textureDimensions[8];
|
|
||||||
/* Texture State Stage */
|
|
||||||
DWORD texture_state[8][HIGHEST_TEXTURE_STATE];
|
|
||||||
|
|
||||||
/* Lights */
|
|
||||||
PLIGHTINFOEL *lights; /* NOTE: active GL lights must be front of the chain */
|
|
||||||
|
|
||||||
/* Material */
|
|
||||||
D3DMATERIAL8 material;
|
|
||||||
|
|
||||||
/* RenderState */
|
|
||||||
DWORD renderstate[HIGHEST_RENDER_STATE];
|
|
||||||
|
|
||||||
/* Transform */
|
|
||||||
D3DMATRIX transforms[HIGHEST_TRANSFORMSTATE];
|
|
||||||
|
|
||||||
/* ViewPort */
|
|
||||||
D3DVIEWPORT8 viewport;
|
|
||||||
|
|
||||||
/* Vertex Shader */
|
|
||||||
DWORD VertexShader;
|
|
||||||
|
|
||||||
/* Vertex Shader Declaration */
|
|
||||||
IDirect3DVertexShaderDeclarationImpl* vertexShaderDecl;
|
|
||||||
|
|
||||||
/* Pixel Shader */
|
|
||||||
DWORD PixelShader;
|
|
||||||
|
|
||||||
/* Indexed Vertex Blending */
|
|
||||||
D3DVERTEXBLENDFLAGS vertex_blend;
|
|
||||||
FLOAT tween_factor;
|
|
||||||
|
|
||||||
/* Vertex Shader Constant */
|
|
||||||
D3DSHADERVECTOR vertexShaderConstant[D3D8_VSHADER_MAX_CONSTANTS];
|
|
||||||
/* Pixel Shader Constant */
|
|
||||||
D3DSHADERVECTOR pixelShaderConstant[D3D8_PSHADER_MAX_CONSTANTS];
|
|
||||||
};
|
};
|
||||||
|
#undef INTERFACE
|
||||||
|
|
||||||
/* exported Interfaces */
|
/*** IUnknown methods ***/
|
||||||
/* internal Interfaces */
|
#define IDirect3DVertexShader8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
||||||
/* temporary internal Interfaces */
|
#define IDirect3DVertexShader8_AddRef(p) (p)->lpVtbl->AddRef(p)
|
||||||
extern HRESULT WINAPI IDirect3DDeviceImpl_InitStartupStateBlock(IDirect3DDevice8Impl* This);
|
#define IDirect3DVertexShader8_Release(p) (p)->lpVtbl->Release(p)
|
||||||
extern HRESULT WINAPI IDirect3DDeviceImpl_CreateStateBlock(IDirect3DDevice8Impl* This, D3DSTATEBLOCKTYPE Type, IDirect3DStateBlockImpl** ppStateBlock);
|
/*** IDirect3DVertexShader8 methods ***/
|
||||||
extern HRESULT WINAPI IDirect3DDeviceImpl_DeleteStateBlock(IDirect3DDevice8Impl* This, IDirect3DStateBlockImpl* pSB);
|
#define IDirect3DVertexShader8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a)
|
||||||
extern HRESULT WINAPI IDirect3DDeviceImpl_BeginStateBlock(IDirect3DDevice8Impl* This);
|
#define IDirect3DVertexShader8_GetFunction(p,a,b) (p)->lpVtbl->GetFunction(p,a,b)
|
||||||
extern HRESULT WINAPI IDirect3DDeviceImpl_EndStateBlock(IDirect3DDevice8Impl* This, IDirect3DStateBlockImpl** ppStateBlock);
|
|
||||||
extern HRESULT WINAPI IDirect3DDeviceImpl_ApplyStateBlock(IDirect3DDevice8Impl* iface, IDirect3DStateBlockImpl* pSB);
|
/* ------------------------- */
|
||||||
extern HRESULT WINAPI IDirect3DDeviceImpl_CaptureStateBlock(IDirect3DDevice8Impl* This, IDirect3DStateBlockImpl* pSB);
|
/* IDirect3DVertexShader8Impl */
|
||||||
|
/* ------------------------- */
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* IDirect3DPixelShader9 interface
|
||||||
|
*/
|
||||||
|
#define INTERFACE IDirect3DPixelShader8
|
||||||
|
DECLARE_INTERFACE_(IDirect3DPixelShader8,IUnknown)
|
||||||
|
{
|
||||||
|
/*** IUnknown methods ***/
|
||||||
|
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
|
||||||
|
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
||||||
|
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
||||||
|
/*** IDirect3DPixelShader8 methods ***/
|
||||||
|
STDMETHOD(GetDevice)(THIS_ struct IDirect3DDevice8** ppDevice) PURE;
|
||||||
|
STDMETHOD(GetFunction)(THIS_ void*, UINT* pSizeOfData) PURE;
|
||||||
|
};
|
||||||
|
#undef INTERFACE
|
||||||
|
|
||||||
|
/*** IUnknown methods ***/
|
||||||
|
#define IDirect3DPixelShader8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
||||||
|
#define IDirect3DPixelShader8_AddRef(p) (p)->lpVtbl->AddRef(p)
|
||||||
|
#define IDirect3DPixelShader8_Release(p) (p)->lpVtbl->Release(p)
|
||||||
|
/*** IDirect3DPixelShader8 methods ***/
|
||||||
|
#define IDirect3DPixelShader8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a)
|
||||||
|
#define IDirect3DPixelShader8_GetFunction(p,a,b) (p)->lpVtbl->GetFunction(p,a,b)
|
||||||
|
|
||||||
/* ------------------------------------ */
|
|
||||||
/* IDirect3DVertexShaderDeclarationImpl */
|
|
||||||
/* ------------------------------------ */
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Predeclare the interface implementation structures
|
* Predeclare the interface implementation structures
|
||||||
*/
|
*/
|
||||||
/*extern const IDirect3DVertexShaderDeclaration9Vtbl Direct3DVertexShaderDeclaration9_Vtbl;*/
|
extern const IDirect3DVertexShader8Vtbl Direct3DVertexShader8_Vtbl;
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* IDirect3DVertexShaderDeclaration implementation structure
|
|
||||||
*/
|
|
||||||
struct IDirect3DVertexShaderDeclarationImpl {
|
|
||||||
/* IUnknown fields */
|
|
||||||
/*const IDirect3DVertexShaderDeclaration9Vtbl *lpVtbl;*/
|
|
||||||
LONG ref;
|
|
||||||
|
|
||||||
/* The device, to be replaced by an IDirect3DDeviceImpl */
|
|
||||||
IDirect3DDevice8Impl* device;
|
|
||||||
|
|
||||||
/** precomputed fvf if simple declaration */
|
|
||||||
DWORD fvf[MAX_STREAMS];
|
|
||||||
DWORD allFVF;
|
|
||||||
|
|
||||||
/** dx8 compatible Declaration fields */
|
|
||||||
DWORD* pDeclaration8;
|
|
||||||
DWORD declaration8Length;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* exported Interfaces */
|
|
||||||
extern HRESULT WINAPI IDirect3DVertexShaderDeclarationImpl_GetDeclaration8(IDirect3DVertexShaderDeclarationImpl* This, DWORD* pData, UINT* pSizeOfData);
|
|
||||||
/*extern HRESULT IDirect3DVertexShaderDeclarationImpl_GetDeclaration9(IDirect3DVertexShaderDeclarationImpl* This, D3DVERTEXELEMENT9* pData, UINT* pNumElements);*/
|
|
||||||
/* internal Interfaces */
|
|
||||||
/* temporary internal Interfaces */
|
|
||||||
extern HRESULT WINAPI IDirect3DDeviceImpl_CreateVertexShaderDeclaration8(IDirect3DDevice8Impl* This, CONST DWORD* pDeclaration8, IDirect3DVertexShaderDeclarationImpl** ppVertexShaderDecl);
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------- */
|
|
||||||
/* IDirect3DVertexShaderImpl */
|
|
||||||
/* ------------------------- */
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* Predeclare the interface implementation structures
|
|
||||||
*/
|
|
||||||
/*extern const IDirect3DVertexShader9Vtbl Direct3DVertexShader9_Vtbl;*/
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* IDirect3DVertexShader implementation structure
|
* IDirect3DVertexShader implementation structure
|
||||||
*/
|
*/
|
||||||
struct IDirect3DVertexShaderImpl {
|
|
||||||
/*const IDirect3DVertexShader9Vtbl *lpVtbl;*/
|
struct IDirect3DVertexShader8Impl {
|
||||||
|
const IDirect3DVertexShader8Vtbl *lpVtbl;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
/* The device, to be replaced by an IDirect3DDeviceImpl */
|
IWineD3DVertexShader *wineD3DVertexShader;
|
||||||
IDirect3DDevice8Impl* device;
|
|
||||||
|
|
||||||
DWORD* function;
|
|
||||||
UINT functionLength;
|
|
||||||
DWORD usage; /* 0 || D3DUSAGE_SOFTWAREPROCESSING */
|
|
||||||
DWORD version;
|
|
||||||
|
|
||||||
/** fields for hw vertex shader use */
|
|
||||||
GLuint prgId;
|
|
||||||
|
|
||||||
/* run time datas */
|
|
||||||
VSHADERDATA8* data;
|
|
||||||
VSHADERINPUTDATA8 input;
|
|
||||||
VSHADEROUTPUTDATA8 output;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* exported Interfaces */
|
|
||||||
extern HRESULT WINAPI IDirect3DVertexShaderImpl_GetFunction(IDirect3DVertexShaderImpl* This, VOID* pData, UINT* pSizeOfData);
|
|
||||||
/*extern HRESULT WINAPI IDirect3DVertexShaderImpl_SetConstantB(IDirect3DVertexShaderImpl* This, UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount);*/
|
|
||||||
/*extern HRESULT WINAPI IDirect3DVertexShaderImpl_SetConstantI(IDirect3DVertexShaderImpl* This, UINT StartRegister, CONST INT* pConstantData, UINT Vector4iCount);*/
|
|
||||||
extern HRESULT WINAPI IDirect3DVertexShaderImpl_SetConstantF(IDirect3DVertexShaderImpl* This, UINT StartRegister, CONST FLOAT* pConstantData, UINT Vector4fCount);
|
|
||||||
/*extern HRESULT WINAPI IDirect3DVertexShaderImpl_GetConstantB(IDirect3DVertexShaderImpl* This, UINT StartRegister, BOOL* pConstantData, UINT BoolCount);*/
|
|
||||||
/*extern HRESULT WINAPI IDirect3DVertexShaderImpl_GetConstantI(IDirect3DVertexShaderImpl* This, UINT StartRegister, INT* pConstantData, UINT Vector4iCount);*/
|
|
||||||
extern HRESULT WINAPI IDirect3DVertexShaderImpl_GetConstantF(IDirect3DVertexShaderImpl* This, UINT StartRegister, FLOAT* pConstantData, UINT Vector4fCount);
|
|
||||||
/* internal Interfaces */
|
|
||||||
extern DWORD WINAPI IDirect3DVertexShaderImpl_GetVersion(IDirect3DVertexShaderImpl* This);
|
|
||||||
extern HRESULT WINAPI IDirect3DVertexShaderImpl_ExecuteSW(IDirect3DVertexShaderImpl* This, VSHADERINPUTDATA8* input, VSHADEROUTPUTDATA8* output);
|
|
||||||
/* temporary internal Interfaces */
|
|
||||||
extern HRESULT WINAPI IDirect3DDeviceImpl_CreateVertexShader(IDirect3DDevice8Impl* This, CONST DWORD* pFunction, DWORD Usage, IDirect3DVertexShaderImpl** ppVertexShader);
|
|
||||||
extern HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInputSW(IDirect3DDevice8Impl* This, IDirect3DVertexShaderImpl* vshader, DWORD SkipnStrides);
|
|
||||||
extern HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInputArbHW(IDirect3DDevice8Impl* This, IDirect3DVertexShaderImpl* vshader, DWORD SkipnStrides);
|
|
||||||
|
|
||||||
/* ------------------------ */
|
/* ------------------------ */
|
||||||
/* IDirect3DPixelShaderImpl */
|
/* IDirect3DPixelShaderImpl */
|
||||||
/* ------------------------ */
|
/* ------------------------ */
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Predeclare the interface implementation structures
|
* Predeclare the interface implementation structures
|
||||||
*/
|
*/
|
||||||
/*extern const IDirect3DPixelShader9Vtbl Direct3DPixelShader9_Vtbl;*/
|
extern const IDirect3DPixelShader8Vtbl Direct3DPixelShader8_Vtbl;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* IDirect3DPixelShader implementation structure
|
* IDirect3DPixelShader implementation structure
|
||||||
*/
|
*/
|
||||||
struct IDirect3DPixelShaderImpl {
|
typedef struct IDirect3DPixelShader8Impl {
|
||||||
/*const IDirect3DPixelShader9Vtbl *lpVtbl;*/
|
const IDirect3DPixelShader8Vtbl *lpVtbl;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
/* The device, to be replaced by an IDirect3DDeviceImpl */
|
/* The device, to be replaced by an IDirect3DDeviceImpl */
|
||||||
IDirect3DDevice8Impl* device;
|
IWineD3DPixelShader *wineD3DPixelShader;
|
||||||
|
} IDirect3DPixelShader8Impl;
|
||||||
DWORD* function;
|
|
||||||
UINT functionLength;
|
|
||||||
DWORD version;
|
|
||||||
|
|
||||||
/** fields for hw pixel shader use */
|
|
||||||
GLuint prgId;
|
|
||||||
|
|
||||||
/* run time datas */
|
|
||||||
PSHADERDATA8* data;
|
|
||||||
PSHADERINPUTDATA8 input;
|
|
||||||
PSHADEROUTPUTDATA8 output;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* exported Interfaces */
|
|
||||||
extern HRESULT WINAPI IDirect3DPixelShaderImpl_GetFunction(IDirect3DPixelShaderImpl* This, VOID* pData, UINT* pSizeOfData);
|
|
||||||
extern HRESULT WINAPI IDirect3DPixelShaderImpl_SetConstantF(IDirect3DPixelShaderImpl* This, UINT StartRegister, CONST FLOAT* pConstantData, UINT Vector4fCount);
|
|
||||||
/* internal Interfaces */
|
|
||||||
extern DWORD WINAPI IDirect3DPixelShaderImpl_GetVersion(IDirect3DPixelShaderImpl* This);
|
|
||||||
/* temporary internal Interfaces */
|
|
||||||
extern HRESULT WINAPI IDirect3DDeviceImpl_CreatePixelShader(IDirect3DDevice8Impl* This, CONST DWORD* pFunction, IDirect3DPixelShaderImpl** ppPixelShader);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internals functions
|
* Internals functions
|
||||||
|
@ -1680,65 +1542,24 @@ int SOURCEx_ALPHA_EXT(DWORD arg);
|
||||||
int OPERANDx_ALPHA_EXT(DWORD arg);
|
int OPERANDx_ALPHA_EXT(DWORD arg);
|
||||||
GLenum StencilOp(DWORD op);
|
GLenum StencilOp(DWORD op);
|
||||||
|
|
||||||
/**
|
/* Callbacks */
|
||||||
* Internals debug functions
|
extern HRESULT WINAPI D3D8CB_CreateSurface(IUnknown *device, UINT Width, UINT Height,
|
||||||
*/
|
WINED3DFORMAT Format, DWORD Usage, D3DPOOL Pool, UINT Level,
|
||||||
const char* debug_d3ddevicetype(D3DDEVTYPE devtype);
|
IWineD3DSurface** ppSurface, HANDLE* pSharedHandle);
|
||||||
const char* debug_d3dusage(DWORD usage);
|
|
||||||
const char* debug_d3dformat(D3DFORMAT fmt);
|
|
||||||
const char* debug_d3dressourcetype(D3DRESOURCETYPE res);
|
|
||||||
const char* debug_d3dprimitivetype(D3DPRIMITIVETYPE PrimitiveType);
|
|
||||||
const char* debug_d3dpool(D3DPOOL Pool);
|
|
||||||
const char *debug_d3drenderstate(DWORD State);
|
|
||||||
const char *debug_d3dtexturestate(DWORD State);
|
|
||||||
|
|
||||||
/* Some #defines for additional diagnostics */
|
extern HRESULT WINAPI D3D8CB_CreateVolume(IUnknown *pDevice, UINT Width, UINT Height, UINT Depth,
|
||||||
#if 0 /* NOTE: Must be 0 in cvs */
|
WINED3DFORMAT Format, D3DPOOL Pool, DWORD Usage,
|
||||||
/* To avoid having to get gigabytes of trace, the following can be compiled in, and at the start
|
IWineD3DVolume **ppVolume,
|
||||||
of each frame, a check is made for the existence of C:\D3DTRACE, and if if exists d3d trace
|
HANDLE * pSharedHandle);
|
||||||
is enabled, and if it doesn't exists it is disabled. */
|
|
||||||
# define FRAME_DEBUGGING
|
|
||||||
/* Adding in the SINGLE_FRAME_DEBUGGING gives a trace of just what makes up a single frame, before
|
|
||||||
the file is deleted */
|
|
||||||
# if 1 /* NOTE: Must be 1 in cvs, as this is mostly more useful than a trace from program start */
|
|
||||||
# define SINGLE_FRAME_DEBUGGING
|
|
||||||
# endif
|
|
||||||
/* The following, when enabled, lets you see the makeup of the frame, by drawprimitive calls.
|
|
||||||
It can only be enabled when FRAME_DEBUGGING is also enabled
|
|
||||||
The contents of the back buffer are written into /tmp/backbuffer_* after each primitive
|
|
||||||
array is drawn. */
|
|
||||||
# if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */
|
|
||||||
# define SHOW_FRAME_MAKEUP 1
|
|
||||||
# endif
|
|
||||||
/* The following, when enabled, lets you see the makeup of the all the textures used during each
|
|
||||||
of the drawprimitive calls. It can only be enabled when SHOW_FRAME_MAKEUP is also enabled.
|
|
||||||
The contents of the textures assigned to each stage are written into
|
|
||||||
/tmp/texture_*_<Stage>.ppm after each primitive array is drawn. */
|
|
||||||
# if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */
|
|
||||||
# define SHOW_TEXTURE_MAKEUP 0
|
|
||||||
# endif
|
|
||||||
extern BOOL isOn;
|
|
||||||
extern BOOL isDumpingFrames;
|
|
||||||
extern LONG primCounter;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Per-vertex trace: */
|
extern HRESULT WINAPI D3D8CB_CreateDepthStencilSurface(IUnknown *device, UINT Width, UINT Height,
|
||||||
#if 0 /* NOTE: Must be 0 in cvs */
|
WINED3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample,
|
||||||
# define VTRACE(A) TRACE A
|
DWORD MultisampleQuality, BOOL Discard,
|
||||||
#else
|
IWineD3DSurface** ppSurface, HANDLE* pSharedHandle);
|
||||||
# define VTRACE(A)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TRACE_VECTOR(name) TRACE( #name "=(%f, %f, %f, %f)\n", name.x, name.y, name.z, name.w);
|
extern HRESULT WINAPI D3D8CB_CreateRenderTarget(IUnknown *device, UINT Width, UINT Height,
|
||||||
#define TRACE_STRIDED(sd,name) TRACE( #name "=(data:%p, stride:%ld, type:%ld)\n", sd->u.s.name.lpData, sd->u.s.name.dwStride, sd->u.s.name.dwType);
|
WINED3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample,
|
||||||
|
DWORD MultisampleQuality, BOOL Lockable,
|
||||||
#define DUMP_LIGHT_CHAIN() \
|
IWineD3DSurface** ppSurface, HANDLE* pSharedHandle);
|
||||||
{ \
|
|
||||||
PLIGHTINFOEL *el = This->StateBlock->lights;\
|
|
||||||
while (el) { \
|
|
||||||
TRACE("Light %p (glIndex %ld, d3dIndex %ld, enabled %d)\n", el, el->glIndex, el->OriginalIndex, el->lightEnabled);\
|
|
||||||
el = el->next; \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* __WINE_D3DX8_PRIVATE_H */
|
#endif /* __WINE_D3DX8_PRIVATE_H */
|
||||||
|
|
4479
dlls/d3d8/device.c
4479
dlls/d3d8/device.c
File diff suppressed because it is too large
Load Diff
|
@ -35,52 +35,21 @@
|
||||||
|
|
||||||
#include "d3d8_private.h"
|
#include "d3d8_private.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
|
||||||
|
|
||||||
/* x11drv GDI escapes */
|
|
||||||
#define X11DRV_ESCAPE 6789
|
|
||||||
enum x11drv_escape_codes
|
|
||||||
{
|
|
||||||
X11DRV_GET_DISPLAY, /* get X11 display for a DC */
|
|
||||||
X11DRV_GET_DRAWABLE, /* get current drawable for a DC */
|
|
||||||
X11DRV_GET_FONT, /* get current X font for a DC */
|
|
||||||
};
|
|
||||||
|
|
||||||
#define NUM_FORMATS 7
|
|
||||||
static const D3DFORMAT device_formats[NUM_FORMATS] = {
|
|
||||||
D3DFMT_P8,
|
|
||||||
D3DFMT_R3G3B2,
|
|
||||||
D3DFMT_R5G6B5,
|
|
||||||
D3DFMT_X1R5G5B5,
|
|
||||||
D3DFMT_X4R4G4B4,
|
|
||||||
D3DFMT_R8G8B8,
|
|
||||||
D3DFMT_X8R8G8B8
|
|
||||||
};
|
|
||||||
|
|
||||||
/* retrieve the X display to use on a given DC */
|
|
||||||
inline static Display *get_display( HDC hdc )
|
|
||||||
{
|
|
||||||
Display *display;
|
|
||||||
enum x11drv_escape_codes escape = X11DRV_GET_DISPLAY;
|
|
||||||
|
|
||||||
if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape,
|
|
||||||
sizeof(display), (LPSTR)&display )) display = NULL;
|
|
||||||
return display;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* IDirect3D IUnknown parts follow: */
|
/* IDirect3D IUnknown parts follow: */
|
||||||
HRESULT WINAPI IDirect3D8Impl_QueryInterface(LPDIRECT3D8 iface,REFIID riid,LPVOID *ppobj)
|
HRESULT WINAPI IDirect3D8Impl_QueryInterface(LPDIRECT3D8 iface, REFIID riid,LPVOID *ppobj)
|
||||||
{
|
{
|
||||||
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
||||||
|
|
||||||
if (IsEqualGUID(riid, &IID_IUnknown)
|
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||||
|| IsEqualGUID(riid, &IID_IDirect3D8)) {
|
|| IsEqualGUID(riid, &IID_IDirect3D8)) {
|
||||||
IDirect3D8Impl_AddRef(iface);
|
IUnknown_AddRef(iface);
|
||||||
*ppobj = This;
|
*ppobj = This;
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
|
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid),ppobj);
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,13 +69,15 @@ ULONG WINAPI IDirect3D8Impl_Release(LPDIRECT3D8 iface) {
|
||||||
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
|
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
|
||||||
|
|
||||||
if (ref == 0) {
|
if (ref == 0) {
|
||||||
|
TRACE("Releasing wined3d %p\n", This->WineD3D);
|
||||||
IWineD3D_Release(This->WineD3D);
|
IWineD3D_Release(This->WineD3D);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IDirect3D Interface follow: */
|
/* IDirect3D8 Interface follow: */
|
||||||
HRESULT WINAPI IDirect3D8Impl_RegisterSoftwareDevice (LPDIRECT3D8 iface, void* pInitializeFunction) {
|
HRESULT WINAPI IDirect3D8Impl_RegisterSoftwareDevice (LPDIRECT3D8 iface, void* pInitializeFunction) {
|
||||||
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
||||||
return IWineD3D_RegisterSoftwareDevice(This->WineD3D, pInitializeFunction);
|
return IWineD3D_RegisterSoftwareDevice(This->WineD3D, pInitializeFunction);
|
||||||
|
@ -127,7 +98,7 @@ HRESULT WINAPI IDirect3D8Impl_GetAdapterIdentifier (LPDIRECT3D8 iface,
|
||||||
structure */
|
structure */
|
||||||
adapter_id.Driver = pIdentifier->Driver;
|
adapter_id.Driver = pIdentifier->Driver;
|
||||||
adapter_id.Description = pIdentifier->Description;
|
adapter_id.Description = pIdentifier->Description;
|
||||||
adapter_id.DeviceName = NULL;
|
adapter_id.DeviceName = NULL; /* d3d9 only */
|
||||||
adapter_id.DriverVersion = &pIdentifier->DriverVersion;
|
adapter_id.DriverVersion = &pIdentifier->DriverVersion;
|
||||||
adapter_id.VendorId = &pIdentifier->VendorId;
|
adapter_id.VendorId = &pIdentifier->VendorId;
|
||||||
adapter_id.DeviceId = &pIdentifier->DeviceId;
|
adapter_id.DeviceId = &pIdentifier->DeviceId;
|
||||||
|
@ -141,12 +112,13 @@ HRESULT WINAPI IDirect3D8Impl_GetAdapterIdentifier (LPDIRECT3D8 iface,
|
||||||
|
|
||||||
UINT WINAPI IDirect3D8Impl_GetAdapterModeCount (LPDIRECT3D8 iface,UINT Adapter) {
|
UINT WINAPI IDirect3D8Impl_GetAdapterModeCount (LPDIRECT3D8 iface,UINT Adapter) {
|
||||||
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
||||||
return IWineD3D_GetAdapterModeCount(This->WineD3D, Adapter, D3DFMT_UNKNOWN);
|
return IWineD3D_GetAdapterModeCount(This->WineD3D, Adapter, 0 /* format */);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3D8Impl_EnumAdapterModes (LPDIRECT3D8 iface, UINT Adapter, UINT Mode, D3DDISPLAYMODE* pMode) {
|
HRESULT WINAPI IDirect3D8Impl_EnumAdapterModes (LPDIRECT3D8 iface, UINT Adapter, UINT Mode, D3DDISPLAYMODE* pMode) {
|
||||||
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
||||||
return IWineD3D_EnumAdapterModes(This->WineD3D, Adapter, D3DFMT_UNKNOWN, Mode, pMode);
|
/* FIXME: USe a constant WINED3DFOTMAT_ANY, or something similar */
|
||||||
|
return IWineD3D_EnumAdapterModes(This->WineD3D, Adapter, 0 /* format */, Mode, pMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3D8Impl_GetAdapterDisplayMode (LPDIRECT3D8 iface, UINT Adapter, D3DDISPLAYMODE* pMode) {
|
HRESULT WINAPI IDirect3D8Impl_GetAdapterDisplayMode (LPDIRECT3D8 iface, UINT Adapter, D3DDISPLAYMODE* pMode) {
|
||||||
|
@ -220,12 +192,15 @@ HRESULT WINAPI D3D8CB_CreateRenderTarget(IUnknown *device, UINT Width, UINT Heig
|
||||||
HRESULT res = D3D_OK;
|
HRESULT res = D3D_OK;
|
||||||
IDirect3DSurface8Impl *d3dSurface = NULL;
|
IDirect3DSurface8Impl *d3dSurface = NULL;
|
||||||
|
|
||||||
/* Note - Throw away MultisampleQuality and SharedHandle - only relevant for d3d9 */
|
TRACE("(%p) call back\n", device);
|
||||||
res = IDirect3DDevice8_CreateRenderTarget((IDirect3DDevice8 *)device, Width, Height,
|
res = IDirect3DDevice8_CreateRenderTarget((IDirect3DDevice8 *)device, Width, Height,
|
||||||
(D3DFORMAT)Format, MultiSample, Lockable,
|
(D3DFORMAT)Format, MultiSample, Lockable,
|
||||||
(IDirect3DSurface8 **)&d3dSurface);
|
(IDirect3DSurface8 **)&d3dSurface);
|
||||||
if (res == D3D_OK) {
|
|
||||||
|
if (SUCCEEDED(res)) {
|
||||||
*ppSurface = d3dSurface->wineD3DSurface;
|
*ppSurface = d3dSurface->wineD3DSurface;
|
||||||
|
} else {
|
||||||
|
*ppSurface = NULL;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -236,8 +211,9 @@ HRESULT WINAPI D3D8CB_CreateAdditionalSwapChain(IUnknown *device,
|
||||||
IWineD3DSwapChain ** ppSwapChain){
|
IWineD3DSwapChain ** ppSwapChain){
|
||||||
HRESULT res = D3D_OK;
|
HRESULT res = D3D_OK;
|
||||||
IDirect3DSwapChain8Impl *d3dSwapChain = NULL;
|
IDirect3DSwapChain8Impl *d3dSwapChain = NULL;
|
||||||
/* We have to pass the presentation parameters back and forth */
|
|
||||||
D3DPRESENT_PARAMETERS localParameters;
|
D3DPRESENT_PARAMETERS localParameters;
|
||||||
|
TRACE("(%p) call back\n", device);
|
||||||
|
|
||||||
localParameters.BackBufferWidth = *(pPresentationParameters->BackBufferWidth);
|
localParameters.BackBufferWidth = *(pPresentationParameters->BackBufferWidth);
|
||||||
localParameters.BackBufferHeight = *(pPresentationParameters->BackBufferHeight);
|
localParameters.BackBufferHeight = *(pPresentationParameters->BackBufferHeight);
|
||||||
localParameters.BackBufferFormat = *(pPresentationParameters->BackBufferFormat);
|
localParameters.BackBufferFormat = *(pPresentationParameters->BackBufferFormat);
|
||||||
|
@ -252,27 +228,26 @@ HRESULT WINAPI D3D8CB_CreateAdditionalSwapChain(IUnknown *device,
|
||||||
localParameters.AutoDepthStencilFormat = *(pPresentationParameters->AutoDepthStencilFormat);
|
localParameters.AutoDepthStencilFormat = *(pPresentationParameters->AutoDepthStencilFormat);
|
||||||
localParameters.Flags = *(pPresentationParameters->Flags);
|
localParameters.Flags = *(pPresentationParameters->Flags);
|
||||||
localParameters.FullScreen_RefreshRateInHz = *(pPresentationParameters->FullScreen_RefreshRateInHz);
|
localParameters.FullScreen_RefreshRateInHz = *(pPresentationParameters->FullScreen_RefreshRateInHz);
|
||||||
/* not in d3d8 */
|
/* d3d9 only */
|
||||||
/* localParameters.PresentationInterval = *(pPresentationParameters->PresentationInterval); */
|
/* localParameters.PresentationInterval = *(pPresentationParameters->PresentationInterval); */
|
||||||
|
|
||||||
TRACE("(%p) rellaying\n", device);
|
|
||||||
/*copy the presentation parameters*/
|
/*copy the presentation parameters*/
|
||||||
res = IDirect3DDevice8_CreateAdditionalSwapChain((IDirect3DDevice8 *)device, &localParameters, (IDirect3DSwapChain8 **)&d3dSwapChain);
|
res = IDirect3DDevice8_CreateAdditionalSwapChain((IDirect3DDevice8 *)device, &localParameters, (IDirect3DSwapChain8 **)&d3dSwapChain);
|
||||||
|
|
||||||
if (res == D3D_OK){
|
if (res == D3D_OK && d3dSwapChain != NULL){
|
||||||
*ppSwapChain = d3dSwapChain->wineD3DSwapChain;
|
*ppSwapChain = d3dSwapChain->wineD3DSwapChain;
|
||||||
} else {
|
} else {
|
||||||
FIXME("failed to create additional swap chain\n");
|
|
||||||
*ppSwapChain = NULL;
|
*ppSwapChain = NULL;
|
||||||
}
|
}
|
||||||
/* Copy back the presentation parameters */
|
|
||||||
TRACE("(%p) setting up return parameters\n", device);
|
/*Copy back the presentation parameters*/
|
||||||
*pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
|
*pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
|
||||||
*pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight;
|
*pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight;
|
||||||
*pPresentationParameters->BackBufferFormat = localParameters.BackBufferFormat;
|
*pPresentationParameters->BackBufferFormat = localParameters.BackBufferFormat;
|
||||||
*pPresentationParameters->BackBufferCount = localParameters.BackBufferCount;
|
*pPresentationParameters->BackBufferCount = localParameters.BackBufferCount;
|
||||||
*pPresentationParameters->MultiSampleType = localParameters.MultiSampleType;
|
*pPresentationParameters->MultiSampleType = localParameters.MultiSampleType;
|
||||||
/* *pPresentationParameters->MultiSampleQuality leave alone in case wined3d set something internally */
|
/* d3d9 only */
|
||||||
|
/* *pPresentationParameters->MultiSampleQuality = localParameters.MultiSampleQuality; */
|
||||||
*pPresentationParameters->SwapEffect = localParameters.SwapEffect;
|
*pPresentationParameters->SwapEffect = localParameters.SwapEffect;
|
||||||
*pPresentationParameters->hDeviceWindow = localParameters.hDeviceWindow;
|
*pPresentationParameters->hDeviceWindow = localParameters.hDeviceWindow;
|
||||||
*pPresentationParameters->Windowed = localParameters.Windowed;
|
*pPresentationParameters->Windowed = localParameters.Windowed;
|
||||||
|
@ -280,40 +255,56 @@ HRESULT WINAPI D3D8CB_CreateAdditionalSwapChain(IUnknown *device,
|
||||||
*pPresentationParameters->AutoDepthStencilFormat = localParameters.AutoDepthStencilFormat;
|
*pPresentationParameters->AutoDepthStencilFormat = localParameters.AutoDepthStencilFormat;
|
||||||
*pPresentationParameters->Flags = localParameters.Flags;
|
*pPresentationParameters->Flags = localParameters.Flags;
|
||||||
*pPresentationParameters->FullScreen_RefreshRateInHz = localParameters.FullScreen_RefreshRateInHz;
|
*pPresentationParameters->FullScreen_RefreshRateInHz = localParameters.FullScreen_RefreshRateInHz;
|
||||||
/* *pPresentationParameters->PresentationInterval leave alone in case wined3d set something internally */
|
/* d3d9 only */
|
||||||
|
/* *pPresentationParameters->PresentationInterval = localParameters.PresentationInterval; */
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
|
/* Internal function called back during the CreateDevice to create a render target */
|
||||||
UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow,
|
HRESULT WINAPI D3D8CB_CreateDepthStencilSurface(IUnknown *device, UINT Width, UINT Height,
|
||||||
|
WINED3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample,
|
||||||
|
DWORD MultisampleQuality, BOOL Discard,
|
||||||
|
IWineD3DSurface** ppSurface, HANDLE* pSharedHandle) {
|
||||||
|
HRESULT res = D3D_OK;
|
||||||
|
IDirect3DSurface8Impl *d3dSurface = NULL;
|
||||||
|
TRACE("(%p) call back\n", device);
|
||||||
|
|
||||||
|
res = IDirect3DDevice8_CreateDepthStencilSurface((IDirect3DDevice8 *)device, Width, Height,
|
||||||
|
(D3DFORMAT)Format, MultiSample, (IDirect3DSurface8 **)&d3dSurface);
|
||||||
|
if (res == D3D_OK) {
|
||||||
|
*ppSurface = d3dSurface->wineD3DSurface;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT WINAPI IDirect3D8Impl_CreateDevice(LPDIRECT3D8 iface, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow,
|
||||||
DWORD BehaviourFlags, D3DPRESENT_PARAMETERS* pPresentationParameters,
|
DWORD BehaviourFlags, D3DPRESENT_PARAMETERS* pPresentationParameters,
|
||||||
IDirect3DDevice8** ppReturnedDeviceInterface) {
|
IDirect3DDevice8** ppReturnedDeviceInterface) {
|
||||||
IDirect3DDevice8Impl *object;
|
|
||||||
HWND whichHWND;
|
|
||||||
int num;
|
|
||||||
XVisualInfo template;
|
|
||||||
HDC hDc;
|
|
||||||
WINED3DPRESENT_PARAMETERS localParameters;
|
|
||||||
|
|
||||||
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
IDirect3D8Impl *This = (IDirect3D8Impl *)iface;
|
||||||
TRACE("(%p)->(Adptr:%d, DevType: %x, FocusHwnd: %p, BehFlags: %lx, PresParms: %p, RetDevInt: %p)\n", This, Adapter, DeviceType,
|
IDirect3DDevice8Impl *object = NULL;
|
||||||
hFocusWindow, BehaviourFlags, pPresentationParameters, ppReturnedDeviceInterface);
|
WINED3DPRESENT_PARAMETERS localParameters;
|
||||||
|
HRESULT hr;
|
||||||
|
TRACE("(%p) Relay \n", This);
|
||||||
|
|
||||||
|
/* Check the validity range of the adapter parameter */
|
||||||
if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
|
if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
|
||||||
|
*ppReturnedDeviceInterface = NULL;
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate the storage for the device */
|
/* Allocate the storage for the device object */
|
||||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DDevice8Impl));
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DDevice8Impl));
|
||||||
if (NULL == object) {
|
if (NULL == object) {
|
||||||
|
FIXME("Allocation of memory failed\n");
|
||||||
|
*ppReturnedDeviceInterface = NULL;
|
||||||
return D3DERR_OUTOFVIDEOMEMORY;
|
return D3DERR_OUTOFVIDEOMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
object->lpVtbl = &Direct3DDevice8_Vtbl;
|
object->lpVtbl = &Direct3DDevice8_Vtbl;
|
||||||
object->ref = 1;
|
object->ref = 1;
|
||||||
object->direct3d8 = This;
|
*ppReturnedDeviceInterface = (IDirect3DDevice8 *)object;
|
||||||
/** The device AddRef the direct3d8 Interface else crash in propers clients codes */
|
|
||||||
IDirect3D8_AddRef((LPDIRECT3D8) object->direct3d8);
|
|
||||||
|
|
||||||
/* Allocate an associated WineD3DDevice object */
|
/* Allocate an associated WineD3DDevice object */
|
||||||
localParameters.BackBufferWidth = &pPresentationParameters->BackBufferWidth;
|
localParameters.BackBufferWidth = &pPresentationParameters->BackBufferWidth;
|
||||||
|
@ -321,7 +312,8 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
|
||||||
localParameters.BackBufferFormat = (WINED3DFORMAT *)&pPresentationParameters->BackBufferFormat;
|
localParameters.BackBufferFormat = (WINED3DFORMAT *)&pPresentationParameters->BackBufferFormat;
|
||||||
localParameters.BackBufferCount = &pPresentationParameters->BackBufferCount;
|
localParameters.BackBufferCount = &pPresentationParameters->BackBufferCount;
|
||||||
localParameters.MultiSampleType = &pPresentationParameters->MultiSampleType;
|
localParameters.MultiSampleType = &pPresentationParameters->MultiSampleType;
|
||||||
localParameters.MultiSampleQuality = NULL; /* New at dx9 */
|
/* d3d9 only */
|
||||||
|
localParameters.MultiSampleQuality = NULL;
|
||||||
localParameters.SwapEffect = &pPresentationParameters->SwapEffect;
|
localParameters.SwapEffect = &pPresentationParameters->SwapEffect;
|
||||||
localParameters.hDeviceWindow = &pPresentationParameters->hDeviceWindow;
|
localParameters.hDeviceWindow = &pPresentationParameters->hDeviceWindow;
|
||||||
localParameters.Windowed = &pPresentationParameters->Windowed;
|
localParameters.Windowed = &pPresentationParameters->Windowed;
|
||||||
|
@ -329,230 +321,27 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
|
||||||
localParameters.AutoDepthStencilFormat = (WINED3DFORMAT *)&pPresentationParameters->AutoDepthStencilFormat;
|
localParameters.AutoDepthStencilFormat = (WINED3DFORMAT *)&pPresentationParameters->AutoDepthStencilFormat;
|
||||||
localParameters.Flags = &pPresentationParameters->Flags;
|
localParameters.Flags = &pPresentationParameters->Flags;
|
||||||
localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz;
|
localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz;
|
||||||
localParameters.PresentationInterval = &pPresentationParameters->FullScreen_PresentationInterval; /* Renamed in dx9 */
|
localParameters.PresentationInterval = &pPresentationParameters->FullScreen_PresentationInterval;/* Renamed in dx9 */
|
||||||
IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &localParameters, &object->WineD3DDevice, (IUnknown *)object, D3D8CB_CreateAdditionalSwapChain);
|
|
||||||
|
|
||||||
/** use StateBlock Factory here, for creating the startup stateBlock */
|
hr =IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &localParameters, &object->WineD3DDevice, (IUnknown *)object, D3D8CB_CreateAdditionalSwapChain);
|
||||||
object->StateBlock = NULL;
|
|
||||||
IDirect3DDeviceImpl_CreateStateBlock(object, D3DSBT_ALL, NULL);
|
|
||||||
object->UpdateStateBlock = object->StateBlock;
|
|
||||||
|
|
||||||
/* Save the creation parameters */
|
if (hr == D3D_OK) {
|
||||||
object->CreateParms.AdapterOrdinal = Adapter;
|
TRACE("(%p) : Created Device %p\n", This, object);
|
||||||
object->CreateParms.DeviceType = DeviceType;
|
|
||||||
object->CreateParms.hFocusWindow = hFocusWindow;
|
|
||||||
object->CreateParms.BehaviorFlags = BehaviourFlags;
|
|
||||||
|
|
||||||
*ppReturnedDeviceInterface = (LPDIRECT3DDEVICE8) object;
|
|
||||||
|
|
||||||
/* Initialize settings */
|
|
||||||
object->PresentParms.BackBufferCount = 1; /* Opengl only supports one? */
|
|
||||||
object->adapterNo = Adapter;
|
|
||||||
object->devType = DeviceType;
|
|
||||||
|
|
||||||
/* Initialize openGl - Note the visual is chosen as the window is created and the glcontext cannot
|
|
||||||
use different properties after that point in time. FIXME: How to handle when requested format
|
|
||||||
doesn't match actual visual? Cannot choose one here - code removed as it ONLY works if the one
|
|
||||||
it chooses is identical to the one already being used! */
|
|
||||||
/* FIXME: Handle stencil appropriately via EnableAutoDepthStencil / AutoDepthStencilFormat */
|
|
||||||
|
|
||||||
/* Which hwnd are we using? */
|
|
||||||
whichHWND = pPresentationParameters->hDeviceWindow;
|
|
||||||
if (!whichHWND) {
|
|
||||||
whichHWND = hFocusWindow;
|
|
||||||
}
|
|
||||||
whichHWND = GetAncestor(whichHWND, GA_ROOT);
|
|
||||||
if ( !( object->win = (Window)GetPropA(whichHWND, "__wine_x11_whole_window") ) ) {
|
|
||||||
ERR("Can't get drawable (window), HWND:%p doesn't have the property __wine_x11_whole_window\n", whichHWND);
|
|
||||||
return D3DERR_NOTAVAILABLE;
|
|
||||||
}
|
|
||||||
object->win_handle = whichHWND;
|
|
||||||
|
|
||||||
hDc = GetDC(whichHWND);
|
|
||||||
object->display = get_display(hDc);
|
|
||||||
|
|
||||||
TRACE("(%p)->(DepthStencil:(%u,%s), BackBufferFormat:(%u,%s))\n", This,
|
|
||||||
pPresentationParameters->AutoDepthStencilFormat, debug_d3dformat(pPresentationParameters->AutoDepthStencilFormat),
|
|
||||||
pPresentationParameters->BackBufferFormat, debug_d3dformat(pPresentationParameters->BackBufferFormat));
|
|
||||||
|
|
||||||
ENTER_GL();
|
|
||||||
|
|
||||||
/* Create a context based off the properties of the existing visual */
|
|
||||||
template.visualid = (VisualID)GetPropA(GetDesktopWindow(), "__wine_x11_visual_id");
|
|
||||||
object->visInfo = XGetVisualInfo(object->display, VisualIDMask, &template, &num);
|
|
||||||
if (NULL == object->visInfo) {
|
|
||||||
ERR("cannot really get XVisual\n");
|
|
||||||
LEAVE_GL();
|
|
||||||
return D3DERR_NOTAVAILABLE;
|
|
||||||
}
|
|
||||||
object->glCtx = glXCreateContext(object->display, object->visInfo, NULL, GL_TRUE);
|
|
||||||
if (NULL == object->glCtx) {
|
|
||||||
ERR("cannot create glxContext\n");
|
|
||||||
LEAVE_GL();
|
|
||||||
return D3DERR_NOTAVAILABLE;
|
|
||||||
}
|
|
||||||
LEAVE_GL();
|
|
||||||
|
|
||||||
ReleaseDC(whichHWND, hDc);
|
|
||||||
|
|
||||||
if (object->glCtx == NULL) {
|
|
||||||
ERR("Error in context creation !\n");
|
|
||||||
return D3DERR_INVALIDCALL;
|
|
||||||
} else {
|
} else {
|
||||||
TRACE("Context created (HWND=%p, glContext=%p, Window=%ld, VisInfo=%p)\n",
|
HeapFree(GetProcessHeap(), 0, object);
|
||||||
whichHWND, object->glCtx, object->win, object->visInfo);
|
*ppReturnedDeviceInterface = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If not windowed, need to go fullscreen, and resize the HWND to the appropriate */
|
return hr;
|
||||||
/* dimensions */
|
|
||||||
if (!pPresentationParameters->Windowed) {
|
|
||||||
#if 1
|
|
||||||
DEVMODEW devmode;
|
|
||||||
HDC hdc;
|
|
||||||
int bpp = 0;
|
|
||||||
memset(&devmode, 0, sizeof(DEVMODEW));
|
|
||||||
devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
|
|
||||||
MultiByteToWideChar(CP_ACP, 0, "Gamers CG", -1, devmode.dmDeviceName, CCHDEVICENAME);
|
|
||||||
hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
|
|
||||||
bpp = GetDeviceCaps(hdc, BITSPIXEL);
|
|
||||||
DeleteDC(hdc);
|
|
||||||
devmode.dmBitsPerPel = (bpp >= 24) ? 32 : bpp;/*Stupid XVidMode cannot change bpp D3DFmtGetBpp(object, pPresentationParameters->BackBufferFormat);*/
|
|
||||||
devmode.dmPelsWidth = pPresentationParameters->BackBufferWidth;
|
|
||||||
devmode.dmPelsHeight = pPresentationParameters->BackBufferHeight;
|
|
||||||
ChangeDisplaySettingsExW(devmode.dmDeviceName, &devmode, object->win_handle, CDS_FULLSCREEN, NULL);
|
|
||||||
#else
|
|
||||||
FIXME("Requested full screen support not implemented, expect windowed operation\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Make popup window */
|
|
||||||
SetWindowLongA(whichHWND, GWL_STYLE, WS_POPUP);
|
|
||||||
SetWindowPos(object->win_handle, HWND_TOP, 0, 0,
|
|
||||||
pPresentationParameters->BackBufferWidth,
|
|
||||||
pPresentationParameters->BackBufferHeight, SWP_SHOWWINDOW | SWP_FRAMECHANGED);
|
|
||||||
}
|
|
||||||
|
|
||||||
TRACE("Creating back buffer\n");
|
|
||||||
/* MSDN: If Windowed is TRUE and either of the BackBufferWidth/Height values is zero,
|
|
||||||
then the corresponding dimension of the client area of the hDeviceWindow
|
|
||||||
(or the focus window, if hDeviceWindow is NULL) is taken. */
|
|
||||||
if (pPresentationParameters->Windowed && ((pPresentationParameters->BackBufferWidth == 0) ||
|
|
||||||
(pPresentationParameters->BackBufferHeight == 0))) {
|
|
||||||
RECT Rect;
|
|
||||||
|
|
||||||
GetClientRect(whichHWND, &Rect);
|
|
||||||
|
|
||||||
if (pPresentationParameters->BackBufferWidth == 0) {
|
|
||||||
pPresentationParameters->BackBufferWidth = Rect.right;
|
|
||||||
TRACE("Updating width to %d\n", pPresentationParameters->BackBufferWidth);
|
|
||||||
}
|
|
||||||
if (pPresentationParameters->BackBufferHeight == 0) {
|
|
||||||
pPresentationParameters->BackBufferHeight = Rect.bottom;
|
|
||||||
TRACE("Updating height to %d\n", pPresentationParameters->BackBufferHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Save the presentation parms now filled in correctly */
|
|
||||||
memcpy(&object->PresentParms, pPresentationParameters, sizeof(D3DPRESENT_PARAMETERS));
|
|
||||||
|
|
||||||
|
|
||||||
IDirect3DDevice8Impl_CreateRenderTarget((LPDIRECT3DDEVICE8) object,
|
|
||||||
pPresentationParameters->BackBufferWidth,
|
|
||||||
pPresentationParameters->BackBufferHeight,
|
|
||||||
pPresentationParameters->BackBufferFormat,
|
|
||||||
pPresentationParameters->MultiSampleType,
|
|
||||||
TRUE,
|
|
||||||
(LPDIRECT3DSURFACE8*) &object->frontBuffer);
|
|
||||||
|
|
||||||
IDirect3DDevice8Impl_CreateRenderTarget((LPDIRECT3DDEVICE8) object,
|
|
||||||
pPresentationParameters->BackBufferWidth,
|
|
||||||
pPresentationParameters->BackBufferHeight,
|
|
||||||
pPresentationParameters->BackBufferFormat,
|
|
||||||
pPresentationParameters->MultiSampleType,
|
|
||||||
TRUE,
|
|
||||||
(LPDIRECT3DSURFACE8*) &object->backBuffer);
|
|
||||||
|
|
||||||
if (pPresentationParameters->EnableAutoDepthStencil) {
|
|
||||||
IDirect3DDevice8Impl_CreateDepthStencilSurface((LPDIRECT3DDEVICE8) object,
|
|
||||||
pPresentationParameters->BackBufferWidth,
|
|
||||||
pPresentationParameters->BackBufferHeight,
|
|
||||||
pPresentationParameters->AutoDepthStencilFormat,
|
|
||||||
D3DMULTISAMPLE_NONE,
|
|
||||||
(LPDIRECT3DSURFACE8*) &object->depthStencilBuffer);
|
|
||||||
} else {
|
|
||||||
object->depthStencilBuffer = NULL;
|
|
||||||
}
|
|
||||||
TRACE("FrontBuf @ %p, BackBuf @ %p, DepthStencil @ %p\n",object->frontBuffer, object->backBuffer, object->depthStencilBuffer);
|
|
||||||
|
|
||||||
/* init the default renderTarget management */
|
|
||||||
object->drawable = object->win;
|
|
||||||
object->render_ctx = object->glCtx;
|
|
||||||
object->renderTarget = object->backBuffer;
|
|
||||||
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) object->renderTarget);
|
|
||||||
object->stencilBufferTarget = object->depthStencilBuffer;
|
|
||||||
if (NULL != object->stencilBufferTarget) {
|
|
||||||
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) object->stencilBufferTarget);
|
|
||||||
}
|
|
||||||
|
|
||||||
ENTER_GL();
|
|
||||||
|
|
||||||
if (glXMakeCurrent(object->display, object->win, object->glCtx) == False) {
|
|
||||||
ERR("Error in setting current context (context %p drawable %ld)!\n", object->glCtx, object->win);
|
|
||||||
}
|
|
||||||
checkGLcall("glXMakeCurrent");
|
|
||||||
|
|
||||||
/* Clear the screen */
|
|
||||||
glClearColor(1.0, 0.0, 0.0, 0.0);
|
|
||||||
checkGLcall("glClearColor");
|
|
||||||
glColor3f(1.0, 1.0, 1.0);
|
|
||||||
checkGLcall("glColor3f");
|
|
||||||
|
|
||||||
glEnable(GL_LIGHTING);
|
|
||||||
checkGLcall("glEnable");
|
|
||||||
|
|
||||||
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
|
|
||||||
checkGLcall("glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);");
|
|
||||||
|
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
|
|
||||||
checkGLcall("glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);");
|
|
||||||
|
|
||||||
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
|
|
||||||
checkGLcall("glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);");
|
|
||||||
|
|
||||||
/* Setup all the devices defaults */
|
|
||||||
IDirect3DDeviceImpl_InitStartupStateBlock(object);
|
|
||||||
|
|
||||||
LEAVE_GL();
|
|
||||||
|
|
||||||
{ /* Set a default viewport */
|
|
||||||
D3DVIEWPORT8 vp;
|
|
||||||
vp.X = 0;
|
|
||||||
vp.Y = 0;
|
|
||||||
vp.Width = pPresentationParameters->BackBufferWidth;
|
|
||||||
vp.Height = pPresentationParameters->BackBufferHeight;
|
|
||||||
vp.MinZ = 0.0f;
|
|
||||||
vp.MaxZ = 1.0f;
|
|
||||||
IDirect3DDevice8Impl_SetViewport((LPDIRECT3DDEVICE8) object, &vp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize the current view state */
|
|
||||||
object->modelview_valid = 1;
|
|
||||||
object->proj_valid = 0;
|
|
||||||
object->view_ident = 1;
|
|
||||||
object->last_was_rhw = 0;
|
|
||||||
glGetIntegerv(GL_MAX_LIGHTS, &object->maxConcurrentLights);
|
|
||||||
TRACE("(%p,%d) All defaults now set up, leaving CreateDevice with %p\n", This, Adapter, object);
|
|
||||||
|
|
||||||
/* Clear the screen */
|
|
||||||
IDirect3DDevice8Impl_Clear((LPDIRECT3DDEVICE8) object, 0, NULL, D3DCLEAR_STENCIL|D3DCLEAR_ZBUFFER|D3DCLEAR_TARGET, 0x00, 1.0, 0);
|
|
||||||
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const IDirect3D8Vtbl Direct3D8_Vtbl =
|
const IDirect3D8Vtbl Direct3D8_Vtbl =
|
||||||
{
|
{
|
||||||
|
/* IUnknown */
|
||||||
IDirect3D8Impl_QueryInterface,
|
IDirect3D8Impl_QueryInterface,
|
||||||
IDirect3D8Impl_AddRef,
|
IDirect3D8Impl_AddRef,
|
||||||
IDirect3D8Impl_Release,
|
IDirect3D8Impl_Release,
|
||||||
|
/* IDirect3D8 */
|
||||||
IDirect3D8Impl_RegisterSoftwareDevice,
|
IDirect3D8Impl_RegisterSoftwareDevice,
|
||||||
IDirect3D8Impl_GetAdapterCount,
|
IDirect3D8Impl_GetAdapterCount,
|
||||||
IDirect3D8Impl_GetAdapterIdentifier,
|
IDirect3D8Impl_GetAdapterIdentifier,
|
||||||
|
|
1663
dlls/d3d8/drawprim.c
1663
dlls/d3d8/drawprim.c
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* IDirect3DIndexBuffer8 implementation
|
* IDirect3DIndexBuffer8 implementation
|
||||||
*
|
*
|
||||||
* Copyright 2002 Jason Edmeades
|
* Copyright 2005 Oliver Stieber
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -19,33 +19,23 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
#include "windef.h"
|
|
||||||
#include "winbase.h"
|
|
||||||
#include "winuser.h"
|
|
||||||
#include "wingdi.h"
|
|
||||||
#include "wine/debug.h"
|
|
||||||
|
|
||||||
#include "d3d8_private.h"
|
#include "d3d8_private.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
|
||||||
|
|
||||||
/* IDirect3DIndexBuffer8 IUnknown parts follow: */
|
/* IDirect3DIndexBuffer8 IUnknown parts follow: */
|
||||||
HRESULT WINAPI IDirect3DIndexBuffer8Impl_QueryInterface(LPDIRECT3DINDEXBUFFER8 iface,REFIID riid,LPVOID *ppobj)
|
HRESULT WINAPI IDirect3DIndexBuffer8Impl_QueryInterface(LPDIRECT3DINDEXBUFFER8 iface, REFIID riid, LPVOID *ppobj) {
|
||||||
{
|
|
||||||
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
||||||
|
|
||||||
if (IsEqualGUID(riid, &IID_IUnknown)
|
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||||
|| IsEqualGUID(riid, &IID_IDirect3DResource8)
|
|| IsEqualGUID(riid, &IID_IDirect3DResource8)
|
||||||
|| IsEqualGUID(riid, &IID_IDirect3DIndexBuffer8)) {
|
|| IsEqualGUID(riid, &IID_IDirect3DIndexBuffer8)) {
|
||||||
IDirect3DIndexBuffer8Impl_AddRef(iface);
|
IUnknown_AddRef(iface);
|
||||||
*ppobj = This;
|
*ppobj = This;
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
|
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,106 +54,89 @@ ULONG WINAPI IDirect3DIndexBuffer8Impl_Release(LPDIRECT3DINDEXBUFFER8 iface) {
|
||||||
|
|
||||||
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
|
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
|
||||||
|
|
||||||
if (ref == 0 && 0 == This->refInt) {
|
if (ref == 0) {
|
||||||
HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
|
IWineD3DIndexBuffer_Release(This->wineD3DIndexBuffer);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
} else if (0 == ref) {
|
|
||||||
WARN("(%p) : The application failed to set indicies NULL before releasing the index buffer, leak\n", This);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* IDirect3DIndexBuffer8 IDirect3DResource8 Interface follow: */
|
||||||
ULONG WINAPI IDirect3DIndexBuffer8Impl_AddRefInt(LPDIRECT3DINDEXBUFFER8 iface) {
|
HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetDevice(LPDIRECT3DINDEXBUFFER8 iface, IDirect3DDevice8 **ppDevice) {
|
||||||
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
||||||
ULONG refInt = InterlockedIncrement(&This->refInt);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
return IDirect3DResource8Impl_GetDevice((LPDIRECT3DRESOURCE8) This, ppDevice);
|
||||||
TRACE("(%p) : AddRefInt from %ld\n", This, refInt - 1);
|
|
||||||
|
|
||||||
return refInt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG WINAPI IDirect3DIndexBuffer8Impl_ReleaseInt(LPDIRECT3DINDEXBUFFER8 iface) {
|
|
||||||
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
|
||||||
ULONG refInt = InterlockedDecrement(&This->refInt);
|
|
||||||
|
|
||||||
TRACE("(%p) : ReleaseRefInt to %ld\n", This, refInt);
|
|
||||||
|
|
||||||
if (0 == This->ref && 0 == refInt) {
|
|
||||||
WARN("(%p) : Cleaning up after the calling application failed to release the indicies properly\n", This);
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
|
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
|
||||||
}
|
|
||||||
|
|
||||||
return refInt;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* IDirect3DResource Interface follow: */
|
|
||||||
HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetDevice(LPDIRECT3DINDEXBUFFER8 iface, IDirect3DDevice8** ppDevice) {
|
|
||||||
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
|
||||||
TRACE("(%p) : returning %p\n", This, This->Device);
|
|
||||||
*ppDevice = (LPDIRECT3DDEVICE8) This->Device;
|
|
||||||
IDirect3DDevice8Impl_AddRef(*ppDevice);
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
|
||||||
HRESULT WINAPI IDirect3DIndexBuffer8Impl_SetPrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
|
HRESULT WINAPI IDirect3DIndexBuffer8Impl_SetPrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
|
||||||
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
||||||
FIXME("(%p) : stub\n", This); return D3D_OK;
|
TRACE("(%p) Relay\n", This);
|
||||||
}
|
return IWineD3DIndexBuffer_SetPrivateData(This->wineD3DIndexBuffer, refguid, pData, SizeOfData, Flags);
|
||||||
HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetPrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
|
|
||||||
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
|
||||||
FIXME("(%p) : stub\n", This); return D3D_OK;
|
|
||||||
}
|
|
||||||
HRESULT WINAPI IDirect3DIndexBuffer8Impl_FreePrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid) {
|
|
||||||
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
|
||||||
FIXME("(%p) : stub\n", This); return D3D_OK;
|
|
||||||
}
|
|
||||||
DWORD WINAPI IDirect3DIndexBuffer8Impl_SetPriority(LPDIRECT3DINDEXBUFFER8 iface, DWORD PriorityNew) {
|
|
||||||
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
|
||||||
FIXME("(%p) : stub\n", This); return D3D_OK;
|
|
||||||
}
|
|
||||||
DWORD WINAPI IDirect3DIndexBuffer8Impl_GetPriority(LPDIRECT3DINDEXBUFFER8 iface) {
|
|
||||||
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
|
||||||
FIXME("(%p) : stub\n", This); return D3D_OK;
|
|
||||||
}
|
|
||||||
void WINAPI IDirect3DIndexBuffer8Impl_PreLoad(LPDIRECT3DINDEXBUFFER8 iface) {
|
|
||||||
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
|
||||||
FIXME("(%p) : stub\n", This);
|
|
||||||
}
|
|
||||||
D3DRESOURCETYPE WINAPI IDirect3DIndexBuffer8Impl_GetType(LPDIRECT3DINDEXBUFFER8 iface) {
|
|
||||||
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
|
||||||
TRACE("(%p) : returning %d\n", This, This->ResourceType);
|
|
||||||
return This->ResourceType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IDirect3DIndexBuffer8 */
|
HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetPrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid, void *pData, DWORD *pSizeOfData) {
|
||||||
HRESULT WINAPI IDirect3DIndexBuffer8Impl_Lock(LPDIRECT3DINDEXBUFFER8 iface, UINT OffsetToLock, UINT SizeToLock, BYTE** ppbData, DWORD Flags) {
|
|
||||||
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
||||||
TRACE("(%p) : no locking yet, offset %d, size %d, Flags=%lx\n", This, OffsetToLock, SizeToLock, Flags);
|
TRACE("(%p) Relay\n", This);
|
||||||
*ppbData = (BYTE *)This->allocatedMemory + OffsetToLock;
|
return IWineD3DIndexBuffer_GetPrivateData(This->wineD3DIndexBuffer, refguid, pData, pSizeOfData);
|
||||||
return D3D_OK;
|
}
|
||||||
|
|
||||||
|
HRESULT WINAPI IDirect3DIndexBuffer8Impl_FreePrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid) {
|
||||||
|
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
||||||
|
TRACE("(%p) Relay\n", This);
|
||||||
|
return IWineD3DIndexBuffer_FreePrivateData(This->wineD3DIndexBuffer, refguid);
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD WINAPI IDirect3DIndexBuffer8Impl_SetPriority(LPDIRECT3DINDEXBUFFER8 iface, DWORD PriorityNew) {
|
||||||
|
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
||||||
|
TRACE("(%p) Relay\n", This);
|
||||||
|
return IWineD3DIndexBuffer_SetPriority(This->wineD3DIndexBuffer, PriorityNew);
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD WINAPI IDirect3DIndexBuffer8Impl_GetPriority(LPDIRECT3DINDEXBUFFER8 iface) {
|
||||||
|
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
||||||
|
TRACE("(%p) Relay\n", This);
|
||||||
|
return IWineD3DIndexBuffer_GetPriority(This->wineD3DIndexBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WINAPI IDirect3DIndexBuffer8Impl_PreLoad(LPDIRECT3DINDEXBUFFER8 iface) {
|
||||||
|
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
||||||
|
TRACE("(%p) Relay\n", This);
|
||||||
|
return IWineD3DIndexBuffer_PreLoad(This->wineD3DIndexBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
D3DRESOURCETYPE WINAPI IDirect3DIndexBuffer8Impl_GetType(LPDIRECT3DINDEXBUFFER8 iface) {
|
||||||
|
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
||||||
|
TRACE("(%p) Relay\n", This);
|
||||||
|
return IWineD3DIndexBuffer_GetType(This->wineD3DIndexBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* IDirect3DIndexBuffer8 Interface follow: */
|
||||||
|
HRESULT WINAPI IDirect3DIndexBuffer8Impl_Lock(LPDIRECT3DINDEXBUFFER8 iface, UINT OffsetToLock, UINT SizeToLock, BYTE **ppbData, DWORD Flags) {
|
||||||
|
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
||||||
|
TRACE("(%p) Relay\n", This);
|
||||||
|
return IWineD3DIndexBuffer_Lock(This->wineD3DIndexBuffer, OffsetToLock, SizeToLock, ppbData, Flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3DIndexBuffer8Impl_Unlock(LPDIRECT3DINDEXBUFFER8 iface) {
|
HRESULT WINAPI IDirect3DIndexBuffer8Impl_Unlock(LPDIRECT3DINDEXBUFFER8 iface) {
|
||||||
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
||||||
TRACE("(%p) : stub\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
return D3D_OK;
|
return IWineD3DIndexBuffer_Unlock(This->wineD3DIndexBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetDesc(LPDIRECT3DINDEXBUFFER8 iface, D3DINDEXBUFFER_DESC *pDesc) {
|
HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetDesc(LPDIRECT3DINDEXBUFFER8 iface, D3DINDEXBUFFER_DESC *pDesc) {
|
||||||
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
|
||||||
|
TRACE("(%p) Relay\n", This);
|
||||||
TRACE("(%p) : copying into %p\n", This, pDesc);
|
return IWineD3DIndexBuffer_GetDesc(This->wineD3DIndexBuffer, pDesc);
|
||||||
memcpy(pDesc, &This->currentDesc, sizeof(D3DINDEXBUFFER_DESC));
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const IDirect3DIndexBuffer8Vtbl Direct3DIndexBuffer8_Vtbl =
|
const IDirect3DIndexBuffer8Vtbl Direct3DIndexBuffer8_Vtbl =
|
||||||
{
|
{
|
||||||
|
/* IUnknown */
|
||||||
IDirect3DIndexBuffer8Impl_QueryInterface,
|
IDirect3DIndexBuffer8Impl_QueryInterface,
|
||||||
IDirect3DIndexBuffer8Impl_AddRef,
|
IDirect3DIndexBuffer8Impl_AddRef,
|
||||||
IDirect3DIndexBuffer8Impl_Release,
|
IDirect3DIndexBuffer8Impl_Release,
|
||||||
|
/* IDirect3DResource8 */
|
||||||
IDirect3DIndexBuffer8Impl_GetDevice,
|
IDirect3DIndexBuffer8Impl_GetDevice,
|
||||||
IDirect3DIndexBuffer8Impl_SetPrivateData,
|
IDirect3DIndexBuffer8Impl_SetPrivateData,
|
||||||
IDirect3DIndexBuffer8Impl_GetPrivateData,
|
IDirect3DIndexBuffer8Impl_GetPrivateData,
|
||||||
|
@ -172,6 +145,7 @@ const IDirect3DIndexBuffer8Vtbl Direct3DIndexBuffer8_Vtbl =
|
||||||
IDirect3DIndexBuffer8Impl_GetPriority,
|
IDirect3DIndexBuffer8Impl_GetPriority,
|
||||||
IDirect3DIndexBuffer8Impl_PreLoad,
|
IDirect3DIndexBuffer8Impl_PreLoad,
|
||||||
IDirect3DIndexBuffer8Impl_GetType,
|
IDirect3DIndexBuffer8Impl_GetType,
|
||||||
|
/* IDirect3DIndexBuffer8 */
|
||||||
IDirect3DIndexBuffer8Impl_Lock,
|
IDirect3DIndexBuffer8Impl_Lock,
|
||||||
IDirect3DIndexBuffer8Impl_Unlock,
|
IDirect3DIndexBuffer8Impl_Unlock,
|
||||||
IDirect3DIndexBuffer8Impl_GetDesc
|
IDirect3DIndexBuffer8Impl_GetDesc
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
/*
|
||||||
|
* IDirect3DPixelShader8 implementation
|
||||||
|
*
|
||||||
|
* Copyright 2002-2003 Jason Edmeades
|
||||||
|
* Raphael Junqueira
|
||||||
|
*
|
||||||
|
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "d3d8_private.h"
|
||||||
|
|
||||||
|
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
|
||||||
|
|
||||||
|
/* IDirect3DPixelShader8 IUnknown parts follow: */
|
||||||
|
HRESULT WINAPI IDirect3DPixelShader8Impl_QueryInterface(IDirect3DPixelShader8 *iface, REFIID riid, LPVOID *ppobj) {
|
||||||
|
IDirect3DPixelShader8Impl *This = (IDirect3DPixelShader8Impl *)iface;
|
||||||
|
|
||||||
|
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||||
|
|| IsEqualGUID(riid, &IID_IDirect3DPixelShader8)) {
|
||||||
|
IUnknown_AddRef(iface);
|
||||||
|
*ppobj = This;
|
||||||
|
return D3D_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG WINAPI IDirect3DPixelShader8Impl_AddRef(IDirect3DPixelShader8 *iface) {
|
||||||
|
IDirect3DPixelShader8Impl *This = (IDirect3DPixelShader8Impl *)iface;
|
||||||
|
ULONG ref = InterlockedIncrement(&This->ref);
|
||||||
|
|
||||||
|
TRACE("(%p) : AddRef from %ld\n", This, ref - 1);
|
||||||
|
|
||||||
|
return ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG WINAPI IDirect3DPixelShader8Impl_Release(IDirect3DPixelShader8 * iface) {
|
||||||
|
IDirect3DPixelShader8Impl *This = (IDirect3DPixelShader8Impl *)iface;
|
||||||
|
ULONG ref = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
|
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
|
||||||
|
|
||||||
|
if (ref == 0) {
|
||||||
|
IWineD3DPixelShader_Release(This->wineD3DPixelShader);
|
||||||
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
|
}
|
||||||
|
return ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* IDirect3DPixelShader8 Interface follow: */
|
||||||
|
HRESULT WINAPI IDirect3DPixelShader8Impl_GetDevice(IDirect3DPixelShader8 *iface, IDirect3DDevice8 **ppDevice) {
|
||||||
|
IDirect3DPixelShader8Impl *This = (IDirect3DPixelShader8Impl *)iface;
|
||||||
|
IWineD3DDevice *myDevice = NULL;
|
||||||
|
|
||||||
|
TRACE("(%p) : Relay\n", This);
|
||||||
|
|
||||||
|
IWineD3DPixelShader_GetDevice(This->wineD3DPixelShader, &myDevice);
|
||||||
|
IWineD3DDevice_GetParent(myDevice, (IUnknown **)ppDevice);
|
||||||
|
IWineD3DDevice_Release(myDevice);
|
||||||
|
TRACE("(%p) returing (%p)", This, *ppDevice);
|
||||||
|
return D3D_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT WINAPI IDirect3DPixelShader8Impl_GetFunction(IDirect3DPixelShader8 *iface, VOID *pData, UINT *pSizeOfData) {
|
||||||
|
IDirect3DPixelShader8Impl *This = (IDirect3DPixelShader8Impl *)iface;
|
||||||
|
TRACE("(%p) Relay\n", This);
|
||||||
|
return IWineD3DPixelShader_GetFunction(This->wineD3DPixelShader, pData, pSizeOfData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const IDirect3DPixelShader8Vtbl Direct3DPixelShader8_Vtbl =
|
||||||
|
{
|
||||||
|
/* IUnknown */
|
||||||
|
IDirect3DPixelShader8Impl_QueryInterface,
|
||||||
|
IDirect3DPixelShader8Impl_AddRef,
|
||||||
|
IDirect3DPixelShader8Impl_Release,
|
||||||
|
/* IDirect3DPixelShader8 */
|
||||||
|
IDirect3DPixelShader8Impl_GetDevice,
|
||||||
|
IDirect3DPixelShader8Impl_GetFunction
|
||||||
|
};
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* IDirect3DResource8 implementation
|
* IDirect3DResource8 implementation
|
||||||
*
|
*
|
||||||
* Copyright 2002 Jason Edmeades
|
* Copyright 2005 Oliver Stieber
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -19,32 +19,22 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
#include "windef.h"
|
|
||||||
#include "winbase.h"
|
|
||||||
#include "winuser.h"
|
|
||||||
#include "wingdi.h"
|
|
||||||
#include "wine/debug.h"
|
|
||||||
|
|
||||||
#include "d3d8_private.h"
|
#include "d3d8_private.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
|
||||||
|
|
||||||
/* IDirect3DResource IUnknown parts follow: */
|
/* IDirect3DResource8 IUnknown parts follow: */
|
||||||
HRESULT WINAPI IDirect3DResource8Impl_QueryInterface(LPDIRECT3DRESOURCE8 iface,REFIID riid,LPVOID *ppobj)
|
HRESULT WINAPI IDirect3DResource8Impl_QueryInterface(LPDIRECT3DRESOURCE8 iface, REFIID riid, LPVOID* ppobj) {
|
||||||
{
|
|
||||||
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
|
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
|
||||||
|
|
||||||
if (IsEqualGUID(riid, &IID_IUnknown)
|
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||||
|| IsEqualGUID(riid, &IID_IDirect3DResource8)) {
|
|| IsEqualGUID(riid, &IID_IDirect3DResource8)) {
|
||||||
IDirect3DResource8Impl_AddRef(iface);
|
IUnknown_AddRef(iface);
|
||||||
*ppobj = This;
|
*ppobj = This;
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
|
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,49 +53,67 @@ ULONG WINAPI IDirect3DResource8Impl_Release(LPDIRECT3DRESOURCE8 iface) {
|
||||||
|
|
||||||
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
|
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
|
||||||
|
|
||||||
if (ref == 0)
|
if (ref == 0) {
|
||||||
|
IWineD3DResource_Release(This->wineD3DResource);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
|
}
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IDirect3DResource Interface follow: */
|
/* IDirect3DResource8 Interface follow: */
|
||||||
HRESULT WINAPI IDirect3DResource8Impl_GetDevice(LPDIRECT3DRESOURCE8 iface, IDirect3DDevice8** ppDevice) {
|
HRESULT WINAPI IDirect3DResource8Impl_GetDevice(LPDIRECT3DRESOURCE8 iface, IDirect3DDevice8** ppDevice) {
|
||||||
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
|
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
|
||||||
TRACE("(%p) : returning %p\n", This, This->Device);
|
IWineD3DDevice *myDevice = NULL;
|
||||||
*ppDevice = (LPDIRECT3DDEVICE8) This->Device;
|
|
||||||
IDirect3DDevice8Impl_AddRef(*ppDevice);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
|
IWineD3DResource_GetDevice(This->wineD3DResource, &myDevice);
|
||||||
|
IWineD3DDevice_GetParent(myDevice, (IUnknown **)ppDevice);
|
||||||
|
IWineD3DDevice_Release(myDevice);
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3DResource8Impl_SetPrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
|
HRESULT WINAPI IDirect3DResource8Impl_SetPrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
|
||||||
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
|
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
|
||||||
FIXME("(%p) : stub\n", This); return D3D_OK;
|
TRACE("(%p) Relay\n", This);
|
||||||
|
return IWineD3DResource_SetPrivateData(This->wineD3DResource, refguid, pData, SizeOfData, Flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3DResource8Impl_GetPrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
|
HRESULT WINAPI IDirect3DResource8Impl_GetPrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
|
||||||
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
|
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
|
||||||
FIXME("(%p) : stub\n", This); return D3D_OK;
|
TRACE("(%p) Relay\n", This);
|
||||||
|
return IWineD3DResource_GetPrivateData(This->wineD3DResource, refguid, pData, pSizeOfData);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3DResource8Impl_FreePrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid) {
|
HRESULT WINAPI IDirect3DResource8Impl_FreePrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid) {
|
||||||
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
|
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
|
||||||
FIXME("(%p) : stub\n", This); return D3D_OK;
|
TRACE("(%p) Relay\n", This);
|
||||||
|
return IWineD3DResource_FreePrivateData(This->wineD3DResource, refguid);
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD WINAPI IDirect3DResource8Impl_SetPriority(LPDIRECT3DRESOURCE8 iface, DWORD PriorityNew) {
|
DWORD WINAPI IDirect3DResource8Impl_SetPriority(LPDIRECT3DRESOURCE8 iface, DWORD PriorityNew) {
|
||||||
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
|
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
|
||||||
FIXME("(%p) : stub\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
return 0;
|
return IWineD3DResource_SetPriority(This->wineD3DResource, PriorityNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD WINAPI IDirect3DResource8Impl_GetPriority(LPDIRECT3DRESOURCE8 iface) {
|
DWORD WINAPI IDirect3DResource8Impl_GetPriority(LPDIRECT3DRESOURCE8 iface) {
|
||||||
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
|
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
|
||||||
FIXME("(%p) : stub\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
return 0;
|
return IWineD3DResource_GetPriority(This->wineD3DResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WINAPI IDirect3DResource8Impl_PreLoad(LPDIRECT3DRESOURCE8 iface) {
|
void WINAPI IDirect3DResource8Impl_PreLoad(LPDIRECT3DRESOURCE8 iface) {
|
||||||
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
|
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
|
||||||
FIXME("(%p) : stub\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
IWineD3DResource_PreLoad(This->wineD3DResource);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
D3DRESOURCETYPE WINAPI IDirect3DResource8Impl_GetType(LPDIRECT3DRESOURCE8 iface) {
|
D3DRESOURCETYPE WINAPI IDirect3DResource8Impl_GetType(LPDIRECT3DRESOURCE8 iface) {
|
||||||
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
|
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
|
||||||
TRACE("(%p) : returning %d\n", This, This->ResourceType);
|
TRACE("(%p) Relay\n", This);
|
||||||
return This->ResourceType;
|
return IWineD3DResource_GetType(This->wineD3DResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
const IDirect3DResource8Vtbl Direct3DResource8_Vtbl =
|
const IDirect3DResource8Vtbl Direct3DResource8_Vtbl =
|
||||||
|
|
2386
dlls/d3d8/shader.c
2386
dlls/d3d8/shader.c
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,9 @@
|
||||||
/*
|
/*
|
||||||
* state block implementation
|
* IDirect3DStateBlock8 implementation
|
||||||
*
|
*
|
||||||
* Copyright 2002 Raphael Junqueira
|
* Copyright 2002-2003 Raphael Junqueira
|
||||||
|
* Copyright 2002-2003 Jason Edmeades
|
||||||
|
* Copyright 2005 Oliver Stieber
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -19,821 +21,75 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
#include "windef.h"
|
|
||||||
#include "winbase.h"
|
|
||||||
#include "winuser.h"
|
|
||||||
#include "wingdi.h"
|
|
||||||
#include "wine/debug.h"
|
|
||||||
|
|
||||||
#include "d3d8_private.h"
|
#include "d3d8_private.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
|
||||||
|
|
||||||
/* Used for CreateStateBlock */
|
/* NOTE: DirectX8 doesn't export a IDirect3DStateBlock8, the interface is used internally to keep d3d8 and d3d9 as simila as possible */
|
||||||
#define NUM_SAVEDPIXELSTATES_R 38
|
/* IDirect3DStateBlock8 IUnknown parts follow: */
|
||||||
#define NUM_SAVEDPIXELSTATES_T 27
|
HRESULT WINAPI IDirect3DStateBlock8Impl_QueryInterface(IDirect3DStateBlock8 *iface, REFIID riid, LPVOID *ppobj) {
|
||||||
#define NUM_SAVEDVERTEXSTATES_R 33
|
IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
|
||||||
#define NUM_SAVEDVERTEXSTATES_T 2
|
|
||||||
|
|
||||||
/*
|
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||||
* Globals
|
|| IsEqualGUID(riid, &IID_IDirect3DStateBlock8)) {
|
||||||
*/
|
IUnknown_AddRef(iface);
|
||||||
extern DWORD SavedPixelStates_R[NUM_SAVEDPIXELSTATES_R];
|
*ppobj = This;
|
||||||
extern DWORD SavedPixelStates_T[NUM_SAVEDPIXELSTATES_T];
|
return D3D_OK;
|
||||||
extern DWORD SavedVertexStates_R[NUM_SAVEDVERTEXSTATES_R];
|
}
|
||||||
extern DWORD SavedVertexStates_T[NUM_SAVEDVERTEXSTATES_T];
|
|
||||||
static const float idmatrix[16] = {
|
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
|
||||||
1.0, 0.0, 0.0, 0.0,
|
return E_NOINTERFACE;
|
||||||
0.0, 1.0, 0.0, 0.0,
|
}
|
||||||
0.0, 0.0, 1.0, 0.0,
|
|
||||||
0.0, 0.0, 0.0, 1.0
|
ULONG WINAPI IDirect3DStateBlock8Impl_AddRef(IDirect3DStateBlock8 *iface) {
|
||||||
};
|
IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
|
||||||
|
ULONG ref = InterlockedIncrement(&This->ref);
|
||||||
HRESULT WINAPI IDirect3DDeviceImpl_InitStartupStateBlock(IDirect3DDevice8Impl* This) {
|
|
||||||
union {
|
TRACE("(%p) : AddRef from %ld\n", This, ref - 1);
|
||||||
D3DLINEPATTERN lp;
|
|
||||||
DWORD d;
|
return ref;
|
||||||
} lp;
|
}
|
||||||
union {
|
|
||||||
float f;
|
ULONG WINAPI IDirect3DStateBlock8Impl_Release(IDirect3DStateBlock8 *iface) {
|
||||||
DWORD d;
|
IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
|
||||||
} tmpfloat;
|
ULONG ref = InterlockedDecrement(&This->ref);
|
||||||
unsigned int i;
|
|
||||||
int j;
|
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
|
||||||
LPDIRECT3DDEVICE8 iface = (LPDIRECT3DDEVICE8) This;
|
|
||||||
|
if (ref == 0) {
|
||||||
/* Note this may have a large overhead but it should only be executed
|
IWineD3DStateBlock_Release(This->wineD3DStateBlock);
|
||||||
once, in order to initialize the complete state of the device and
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
all opengl equivalents */
|
}
|
||||||
TRACE("-----------------------> Setting up device defaults...\n");
|
return ref;
|
||||||
This->StateBlock->blockType = D3DSBT_ALL;
|
}
|
||||||
|
|
||||||
/* FIXME: Set some of the defaults for lights, transforms etc */
|
/* IDirect3DStateBlock8 Interface follow: */
|
||||||
memcpy(&This->StateBlock->transforms[D3DTS_PROJECTION], &idmatrix, sizeof(idmatrix));
|
HRESULT WINAPI IDirect3DStateBlock8Impl_GetDevice(IDirect3DStateBlock8 *iface, IDirect3DDevice8 **ppDevice) {
|
||||||
memcpy(&This->StateBlock->transforms[D3DTS_VIEW], &idmatrix, sizeof(idmatrix));
|
IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
|
||||||
for (i = 0; i < 256; ++i) {
|
TRACE("(%p) Relay\n", This);
|
||||||
memcpy(&This->StateBlock->transforms[D3DTS_WORLDMATRIX(i)], &idmatrix, sizeof(idmatrix));
|
return IDirect3DResource8Impl_GetDevice((LPDIRECT3DRESOURCE8) This, ppDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Render states: */
|
HRESULT WINAPI IDirect3DStateBlock8Impl_Capture(IDirect3DStateBlock8 *iface) {
|
||||||
if (This->PresentParms.EnableAutoDepthStencil) {
|
IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_ZENABLE, D3DZB_TRUE);
|
TRACE("(%p) Relay\n", This);
|
||||||
} else {
|
return IWineD3DStateBlock_Capture(This->wineD3DStateBlock);
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_ZENABLE, D3DZB_FALSE);
|
}
|
||||||
}
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_FILLMODE, D3DFILL_SOLID);
|
HRESULT WINAPI IDirect3DStateBlock8Impl_Apply(IDirect3DStateBlock8 *iface) {
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_SHADEMODE, D3DSHADE_GOURAUD);
|
IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
|
||||||
|
TRACE("(%p) Relay\n", This);
|
||||||
lp.lp.wRepeatFactor = 0; lp.lp.wLinePattern = 0;
|
return IWineD3DStateBlock_Apply(This->wineD3DStateBlock);
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_LINEPATTERN, lp.d);
|
}
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_ZWRITEENABLE, TRUE);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_ALPHATESTENABLE, FALSE);
|
const IDirect3DStateBlock8Vtbl Direct3DStateBlock8_Vtbl =
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_LASTPIXEL, TRUE);
|
{
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_SRCBLEND, D3DBLEND_ONE);
|
/* IUnknown */
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_DESTBLEND, D3DBLEND_ZERO);
|
IDirect3DStateBlock8Impl_QueryInterface,
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_CULLMODE, D3DCULL_CCW);
|
IDirect3DStateBlock8Impl_AddRef,
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_ZFUNC, D3DCMP_LESSEQUAL);
|
IDirect3DStateBlock8Impl_Release,
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_ALPHAFUNC, D3DCMP_ALWAYS);
|
/* IDirect3DStateBlock8 */
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_ALPHAREF, 0xff); /*??*/
|
IDirect3DStateBlock8Impl_GetDevice,
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_DITHERENABLE, FALSE);
|
IDirect3DStateBlock8Impl_Capture,
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_ALPHABLENDENABLE, FALSE);
|
IDirect3DStateBlock8Impl_Apply
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_FOGENABLE, FALSE);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_SPECULARENABLE, FALSE);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_ZVISIBLE, 0);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_FOGCOLOR, 0);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_FOGTABLEMODE, D3DFOG_NONE);
|
|
||||||
tmpfloat.f = 0.0f;
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_FOGSTART, tmpfloat.d);
|
|
||||||
tmpfloat.f = 1.0f;
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_FOGEND, tmpfloat.d);
|
|
||||||
tmpfloat.f = 1.0f;
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_FOGDENSITY, tmpfloat.d);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_EDGEANTIALIAS, FALSE);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_ZBIAS, 0);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_RANGEFOGENABLE, FALSE);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_STENCILENABLE, FALSE);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_STENCILFAIL, D3DSTENCILOP_KEEP);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_STENCILZFAIL, D3DSTENCILOP_KEEP);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_STENCILPASS, D3DSTENCILOP_KEEP);
|
|
||||||
|
|
||||||
/* Setting stencil func also uses values for stencil ref/mask, so manually set defaults
|
|
||||||
* so only a single call performed (and ensure defaults initialized before making that call)
|
|
||||||
*
|
|
||||||
* IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_STENCILREF, 0);
|
|
||||||
* IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_STENCILMASK, 0xFFFFFFFF);
|
|
||||||
*/
|
|
||||||
This->StateBlock->renderstate[D3DRS_STENCILREF] = 0;
|
|
||||||
This->StateBlock->renderstate[D3DRS_STENCILMASK] = 0xFFFFFFFF;
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_STENCILFUNC, D3DCMP_ALWAYS);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_STENCILWRITEMASK, 0xFFFFFFFF);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_TEXTUREFACTOR, 0xFFFFFFFF);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_WRAP0, 0);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_WRAP1, 0);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_WRAP2, 0);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_WRAP3, 0);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_WRAP4, 0);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_WRAP5, 0);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_WRAP6, 0);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_WRAP7, 0);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_CLIPPING, TRUE);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_LIGHTING, TRUE);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_AMBIENT, 0);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_FOGVERTEXMODE, D3DFOG_NONE);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_COLORVERTEX, TRUE);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_LOCALVIEWER, TRUE);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_NORMALIZENORMALS, FALSE);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_COLOR1);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_SPECULARMATERIALSOURCE, D3DMCS_COLOR2);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_AMBIENTMATERIALSOURCE, D3DMCS_COLOR2);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_EMISSIVEMATERIALSOURCE, D3DMCS_MATERIAL);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_VERTEXBLEND, D3DVBF_DISABLE);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_CLIPPLANEENABLE, 0);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_SOFTWAREVERTEXPROCESSING, FALSE);
|
|
||||||
tmpfloat.f = 1.0f;
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_POINTSIZE, tmpfloat.d);
|
|
||||||
tmpfloat.f = 0.0f;
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_POINTSIZE_MIN, tmpfloat.d);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_POINTSPRITEENABLE, FALSE);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_POINTSCALEENABLE, FALSE);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_POINTSCALE_A, TRUE);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_POINTSCALE_B, TRUE);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_POINTSCALE_C, TRUE);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_MULTISAMPLEANTIALIAS, TRUE);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_MULTISAMPLEMASK, 0xFFFFFFFF);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_PATCHEDGESTYLE, D3DPATCHEDGE_DISCRETE);
|
|
||||||
tmpfloat.f = 1.0f;
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_PATCHSEGMENTS, tmpfloat.d);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_DEBUGMONITORTOKEN, D3DDMT_DISABLE);
|
|
||||||
tmpfloat.f = 64.0f;
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_POINTSIZE_MAX, tmpfloat.d);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_INDEXEDVERTEXBLENDENABLE, FALSE);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_COLORWRITEENABLE, 0x0000000F);
|
|
||||||
tmpfloat.f = 0.0f;
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_TWEENFACTOR, tmpfloat.d);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_BLENDOP, D3DBLENDOP_ADD);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_POSITIONORDER, D3DORDER_CUBIC);
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_NORMALORDER, D3DORDER_LINEAR);
|
|
||||||
|
|
||||||
/** clipping status */
|
|
||||||
This->StateBlock->clip_status.ClipUnion = 0;
|
|
||||||
This->StateBlock->clip_status.ClipIntersection = 0xFFFFFFFF;
|
|
||||||
|
|
||||||
/* Texture Stage States - Put directly into state block, we will call function below */
|
|
||||||
for (i = 0; i < GL_LIMITS(textures); i++) {
|
|
||||||
memcpy(&This->StateBlock->transforms[D3DTS_TEXTURE0 + i], &idmatrix, sizeof(idmatrix));
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_COLOROP ] = (i==0)? D3DTOP_MODULATE : D3DTOP_DISABLE;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_COLORARG1 ] = D3DTA_TEXTURE;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_COLORARG2 ] = D3DTA_CURRENT;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_ALPHAOP ] = (i==0)? D3DTOP_SELECTARG1 : D3DTOP_DISABLE;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_ALPHAARG1 ] = D3DTA_TEXTURE;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_ALPHAARG2 ] = D3DTA_CURRENT;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_BUMPENVMAT00 ] = (DWORD) 0.0;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_BUMPENVMAT01 ] = (DWORD) 0.0;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_BUMPENVMAT10 ] = (DWORD) 0.0;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_BUMPENVMAT11 ] = (DWORD) 0.0;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_TEXCOORDINDEX ] = i;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_ADDRESSU ] = D3DTADDRESS_WRAP;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_ADDRESSV ] = D3DTADDRESS_WRAP;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_BORDERCOLOR ] = 0x00;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_MAGFILTER ] = D3DTEXF_POINT;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_MINFILTER ] = D3DTEXF_POINT;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_MIPFILTER ] = D3DTEXF_NONE;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_MIPMAPLODBIAS ] = 0;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_MAXMIPLEVEL ] = 0;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_MAXANISOTROPY ] = 1;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_BUMPENVLSCALE ] = (DWORD) 0.0;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_BUMPENVLOFFSET ] = (DWORD) 0.0;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_TEXTURETRANSFORMFLAGS ] = D3DTTFF_DISABLE;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_ADDRESSW ] = D3DTADDRESS_WRAP;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_COLORARG0 ] = D3DTA_CURRENT;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_ALPHAARG0 ] = D3DTA_CURRENT;
|
|
||||||
This->StateBlock->texture_state[i][D3DTSS_RESULTARG ] = D3DTA_CURRENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Under DirectX you can have texture stage operations even if no texture is
|
|
||||||
bound, whereas opengl will only do texture operations when a valid texture is
|
|
||||||
bound. We emulate this by creating dummy textures and binding them to each
|
|
||||||
texture stage, but disable all stages by default. Hence if a stage is enabled
|
|
||||||
then the default texture will kick in until replaced by a SetTexture call */
|
|
||||||
|
|
||||||
ENTER_GL();
|
|
||||||
|
|
||||||
for (i = 0; i < GL_LIMITS(textures); i++) {
|
|
||||||
GLubyte white = 255;
|
|
||||||
|
|
||||||
/* Note this avoids calling settexture, so pretend it has been called */
|
|
||||||
This->StateBlock->Set.textures[i] = TRUE;
|
|
||||||
This->StateBlock->Changed.textures[i] = TRUE;
|
|
||||||
This->StateBlock->textures[i] = NULL;
|
|
||||||
|
|
||||||
/* Make appropriate texture active */
|
|
||||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
|
||||||
#if defined(GL_VERSION_1_3)
|
|
||||||
glActiveTexture(GL_TEXTURE0 + i);
|
|
||||||
#else
|
|
||||||
glActiveTextureARB(GL_TEXTURE0_ARB + i);
|
|
||||||
#endif
|
|
||||||
checkGLcall("glActiveTextureARB");
|
|
||||||
} else if (i > 0) {
|
|
||||||
FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Generate an opengl texture name */
|
|
||||||
glGenTextures(1, &This->dummyTextureName[i]);
|
|
||||||
checkGLcall("glGenTextures");
|
|
||||||
TRACE("Dummy Texture %d given name %d\n", i, This->dummyTextureName[i]);
|
|
||||||
|
|
||||||
/* Generate a dummy 1d texture */
|
|
||||||
This->StateBlock->textureDimensions[i] = GL_TEXTURE_1D;
|
|
||||||
glBindTexture(GL_TEXTURE_1D, This->dummyTextureName[i]);
|
|
||||||
checkGLcall("glBindTexture");
|
|
||||||
|
|
||||||
glTexImage1D(GL_TEXTURE_1D, 0, GL_LUMINANCE, 1, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, &white);
|
|
||||||
checkGLcall("glTexImage1D");
|
|
||||||
|
|
||||||
/* Reapply all the texture state information to this texture */
|
|
||||||
setupTextureStates(iface, i, REAPPLY_ALL);
|
|
||||||
}
|
|
||||||
|
|
||||||
LEAVE_GL();
|
|
||||||
|
|
||||||
/* defaulting palettes */
|
|
||||||
for (i = 0; i < MAX_PALETTES; ++i) {
|
|
||||||
for (j = 0; j < 256; ++j) {
|
|
||||||
This->palettes[i][j].peRed = 0xFF;
|
|
||||||
This->palettes[i][j].peGreen = 0xFF;
|
|
||||||
This->palettes[i][j].peBlue = 0xFF;
|
|
||||||
This->palettes[i][j].peFlags = 0xFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
This->currentPalette = 0;
|
|
||||||
|
|
||||||
TRACE("-----------------------> Device defaults now set up...\n");
|
|
||||||
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3DDeviceImpl_CreateStateBlock(IDirect3DDevice8Impl* This, D3DSTATEBLOCKTYPE Type, IDirect3DStateBlockImpl** ppStateBlock) {
|
|
||||||
IDirect3DStateBlockImpl* object;
|
|
||||||
UINT i, j;
|
|
||||||
|
|
||||||
TRACE("(%p) : Type(%d)\n", This, Type);
|
|
||||||
|
|
||||||
/* Allocate Storage */
|
|
||||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DStateBlockImpl));
|
|
||||||
if (object) {
|
|
||||||
if (NULL == This->StateBlock) { /** if it the main stateblock only do init and returns */
|
|
||||||
/*object->lpVtbl = &Direct3DStateBlock9_Vtbl;*/
|
|
||||||
object->device = This;
|
|
||||||
object->ref = 1;
|
|
||||||
object->blockType = Type;
|
|
||||||
This->StateBlock = object;
|
|
||||||
/* don't forget to init it calling InitStartupStateBlock */
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
|
||||||
memcpy(object, This->StateBlock, sizeof(IDirect3DStateBlockImpl));
|
|
||||||
} else {
|
|
||||||
*ppStateBlock = (IDirect3DStateBlockImpl*) 0xFFFFFFFF;
|
|
||||||
return E_OUTOFMEMORY;
|
|
||||||
}
|
|
||||||
/*object->lpVtbl = &Direct3DStateBlock9_Vtbl;*/
|
|
||||||
object->device = This;
|
|
||||||
object->ref = 1;
|
|
||||||
object->blockType = Type;
|
|
||||||
|
|
||||||
TRACE("Updating changed flags appropriate for type %d\n", Type);
|
|
||||||
|
|
||||||
if (Type == D3DSBT_ALL) {
|
|
||||||
TRACE("ALL => Pretend everything has changed\n");
|
|
||||||
memset(&object->Changed, TRUE, sizeof(This->StateBlock->Changed));
|
|
||||||
|
|
||||||
} else if (Type == D3DSBT_PIXELSTATE) {
|
|
||||||
|
|
||||||
memset(&object->Changed, FALSE, sizeof(This->StateBlock->Changed));
|
|
||||||
|
|
||||||
/* TODO: Pixel Shader Constants */
|
|
||||||
object->Changed.pixelShader = TRUE;
|
|
||||||
for (i = 0; i < NUM_SAVEDPIXELSTATES_R; i++) {
|
|
||||||
object->Changed.renderstate[SavedPixelStates_R[i]] = TRUE;
|
|
||||||
}
|
|
||||||
for (j = 0; j < GL_LIMITS(textures); i++) {
|
|
||||||
for (i = 0; i < NUM_SAVEDPIXELSTATES_T; i++) {
|
|
||||||
object->Changed.texture_state[j][SavedPixelStates_T[i]] = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (Type == D3DSBT_VERTEXSTATE) {
|
|
||||||
|
|
||||||
memset(&object->Changed, FALSE, sizeof(This->StateBlock->Changed));
|
|
||||||
|
|
||||||
/* TODO: Vertex Shader Constants */
|
|
||||||
object->Changed.vertexShader = TRUE;
|
|
||||||
for (i = 0; i < NUM_SAVEDVERTEXSTATES_R; i++) {
|
|
||||||
object->Changed.renderstate[SavedVertexStates_R[i]] = TRUE;
|
|
||||||
}
|
|
||||||
for (j = 0; j < GL_LIMITS(textures); i++) {
|
|
||||||
for (i = 0; i < NUM_SAVEDVERTEXSTATES_T; i++) {
|
|
||||||
object->Changed.texture_state[j][SavedVertexStates_T[i]] = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Duplicate light chain */
|
|
||||||
{
|
|
||||||
PLIGHTINFOEL *src = NULL;
|
|
||||||
PLIGHTINFOEL *dst = NULL;
|
|
||||||
PLIGHTINFOEL *newEl = NULL;
|
|
||||||
|
|
||||||
src = This->StateBlock->lights;
|
|
||||||
object->lights = NULL;
|
|
||||||
|
|
||||||
while (src) {
|
|
||||||
newEl = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PLIGHTINFOEL));
|
|
||||||
if (newEl == NULL) return D3DERR_OUTOFVIDEOMEMORY;
|
|
||||||
memcpy(newEl, src, sizeof(PLIGHTINFOEL));
|
|
||||||
newEl->prev = dst;
|
|
||||||
newEl->changed = TRUE;
|
|
||||||
newEl->enabledChanged = TRUE;
|
|
||||||
if (dst == NULL) {
|
|
||||||
object->lights = newEl;
|
|
||||||
} else {
|
|
||||||
dst->next = newEl;
|
|
||||||
}
|
|
||||||
dst = newEl;
|
|
||||||
src = src->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
FIXME("Unrecognized state block type %d\n", Type);
|
|
||||||
}
|
|
||||||
TRACE("(%p) returning token (ptr to stateblock) of %p\n", This, object);
|
|
||||||
|
|
||||||
*ppStateBlock = object;
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** yakkk temporary waiting for Release */
|
|
||||||
HRESULT WINAPI IDirect3DDeviceImpl_DeleteStateBlock(IDirect3DDevice8Impl* This, IDirect3DStateBlockImpl* pSB) {
|
|
||||||
PLIGHTINFOEL *tmp;
|
|
||||||
|
|
||||||
TRACE("(%p) : freeing StateBlock %p\n", This, pSB);
|
|
||||||
tmp = pSB->lights;
|
|
||||||
if (tmp) tmp = tmp->next;
|
|
||||||
while (tmp != NULL) {
|
|
||||||
HeapFree(GetProcessHeap(), 0, (void *)(tmp->prev));
|
|
||||||
tmp = tmp->next;
|
|
||||||
}
|
|
||||||
HeapFree(GetProcessHeap(), 0, (void *)tmp);
|
|
||||||
HeapFree(GetProcessHeap(), 0, (void *)pSB);
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3DDeviceImpl_BeginStateBlock(IDirect3DDevice8Impl* This) {
|
|
||||||
IDirect3DStateBlockImpl* object;
|
|
||||||
|
|
||||||
TRACE("(%p)\n", This);
|
|
||||||
|
|
||||||
if (This->isRecordingState) {
|
|
||||||
TRACE("(%p) already recording! returning error\n", This);
|
|
||||||
return D3DERR_INVALIDCALL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate Storage */
|
|
||||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DStateBlockImpl));
|
|
||||||
if (object) {
|
|
||||||
} else {
|
|
||||||
return E_OUTOFMEMORY;
|
|
||||||
}
|
|
||||||
/*object->lpVtbl = &Direct3DVextexShaderDeclaration8_Vtbl;*/
|
|
||||||
object->device = This;
|
|
||||||
object->ref = 1;
|
|
||||||
|
|
||||||
This->isRecordingState = TRUE;
|
|
||||||
This->UpdateStateBlock = object;
|
|
||||||
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3DDeviceImpl_EndStateBlock(IDirect3DDevice8Impl* This, IDirect3DStateBlockImpl** ppStateBlock) {
|
|
||||||
TRACE("(%p)\n", This);
|
|
||||||
|
|
||||||
if (!This->isRecordingState) {
|
|
||||||
TRACE("(%p) not recording! returning error\n", This);
|
|
||||||
*ppStateBlock = NULL;
|
|
||||||
return D3DERR_INVALIDCALL;
|
|
||||||
}
|
|
||||||
|
|
||||||
This->UpdateStateBlock->blockType = D3DSBT_RECORDED;
|
|
||||||
*ppStateBlock = This->UpdateStateBlock; /* FIXME: AddRef() */
|
|
||||||
This->isRecordingState = FALSE;
|
|
||||||
This->UpdateStateBlock = This->StateBlock;
|
|
||||||
|
|
||||||
TRACE("(%p) returning token (ptr to stateblock) of %p\n", This, *ppStateBlock);
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3DDeviceImpl_ApplyStateBlock(IDirect3DDevice8Impl* This, IDirect3DStateBlockImpl* pSB) {
|
|
||||||
UINT i;
|
|
||||||
UINT j;
|
|
||||||
LPDIRECT3DDEVICE8 iface = (LPDIRECT3DDEVICE8) This;
|
|
||||||
|
|
||||||
TRACE("(%p) : Applying state block %p ------------------v\n", This, pSB);
|
|
||||||
|
|
||||||
/* FIXME: Only apply applicable states not all states */
|
|
||||||
|
|
||||||
if (pSB->blockType == D3DSBT_RECORDED || pSB->blockType == D3DSBT_ALL || pSB->blockType == D3DSBT_VERTEXSTATE) {
|
|
||||||
|
|
||||||
PLIGHTINFOEL *toDo = pSB->lights;
|
|
||||||
while (toDo != NULL) {
|
|
||||||
if (toDo->changed)
|
|
||||||
IDirect3DDevice8Impl_SetLight(iface, toDo->OriginalIndex, &toDo->OriginalParms);
|
|
||||||
if (toDo->enabledChanged)
|
|
||||||
IDirect3DDevice8Impl_LightEnable(iface, toDo->OriginalIndex, toDo->lightEnabled);
|
|
||||||
toDo = toDo->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pSB->Set.vertexShader && pSB->Changed.vertexShader)
|
|
||||||
IDirect3DDevice8Impl_SetVertexShader(iface, pSB->VertexShader);
|
|
||||||
|
|
||||||
/* TODO: Vertex Shader Constants */
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pSB->blockType == D3DSBT_RECORDED || pSB->blockType == D3DSBT_ALL || pSB->blockType == D3DSBT_PIXELSTATE) {
|
|
||||||
|
|
||||||
if (pSB->Set.pixelShader && pSB->Changed.pixelShader)
|
|
||||||
IDirect3DDevice8Impl_SetPixelShader(iface, pSB->PixelShader);
|
|
||||||
|
|
||||||
/* TODO: Pixel Shader Constants */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Others + Render & Texture */
|
|
||||||
if (pSB->blockType == D3DSBT_RECORDED || pSB->blockType == D3DSBT_ALL) {
|
|
||||||
for (i = 0; i < HIGHEST_TRANSFORMSTATE; i++) {
|
|
||||||
if (pSB->Set.transform[i] && pSB->Changed.transform[i])
|
|
||||||
IDirect3DDevice8Impl_SetTransform(iface, i, &pSB->transforms[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pSB->Set.Indices && pSB->Changed.Indices)
|
|
||||||
IDirect3DDevice8Impl_SetIndices(iface, pSB->pIndexData, pSB->baseVertexIndex);
|
|
||||||
|
|
||||||
if (pSB->Set.material && pSB->Changed.material)
|
|
||||||
IDirect3DDevice8Impl_SetMaterial(iface, &pSB->material);
|
|
||||||
|
|
||||||
if (pSB->Set.viewport && pSB->Changed.viewport)
|
|
||||||
IDirect3DDevice8Impl_SetViewport(iface, &pSB->viewport);
|
|
||||||
|
|
||||||
for (i=0; i<MAX_STREAMS; i++) {
|
|
||||||
if (pSB->Set.stream_source[i] && pSB->Changed.stream_source[i])
|
|
||||||
IDirect3DDevice8Impl_SetStreamSource(iface, i, pSB->stream_source[i], pSB->stream_stride[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < GL_LIMITS(clipplanes); i++) {
|
|
||||||
if (pSB->Set.clipplane[i] && pSB->Changed.clipplane[i]) {
|
|
||||||
float clip[4];
|
|
||||||
|
|
||||||
clip[0] = pSB->clipplane[i][0];
|
|
||||||
clip[1] = pSB->clipplane[i][1];
|
|
||||||
clip[2] = pSB->clipplane[i][2];
|
|
||||||
clip[3] = pSB->clipplane[i][3];
|
|
||||||
IDirect3DDevice8Impl_SetClipPlane(iface, i, clip);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Render */
|
|
||||||
for (i = 0; i < HIGHEST_RENDER_STATE; i++) {
|
|
||||||
if (pSB->Set.renderstate[i] && pSB->Changed.renderstate[i])
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, i, pSB->renderstate[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Texture */
|
|
||||||
for (j = 0; j < GL_LIMITS(textures); j++) {
|
|
||||||
for (i = 0; i < HIGHEST_TEXTURE_STATE; i++) {
|
|
||||||
if (pSB->Set.texture_state[j][i] && pSB->Changed.texture_state[j][i]) {
|
|
||||||
IDirect3DDevice8Impl_SetTextureStageState(iface, j, i, pSB->texture_state[j][i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (pSB->Set.textures[j] && pSB->Changed.textures[j]) {
|
|
||||||
IDirect3DDevice8Impl_SetTexture(iface, j, pSB->textures[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else if (pSB->blockType == D3DSBT_PIXELSTATE) {
|
|
||||||
|
|
||||||
for (i = 0; i < NUM_SAVEDPIXELSTATES_R; i++) {
|
|
||||||
if (pSB->Set.renderstate[SavedPixelStates_R[i]] && pSB->Changed.renderstate[SavedPixelStates_R[i]])
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, SavedPixelStates_R[i], pSB->renderstate[SavedPixelStates_R[i]]);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
for (j = 0; j < GL_LIMITS(textures); i++) {
|
|
||||||
for (i = 0; i < NUM_SAVEDPIXELSTATES_T; i++) {
|
|
||||||
if (pSB->Set.texture_state[j][SavedPixelStates_T[i]] &&
|
|
||||||
pSB->Changed.texture_state[j][SavedPixelStates_T[i]])
|
|
||||||
IDirect3DDevice8Impl_SetTextureStageState(iface, j, SavedPixelStates_T[i], pSB->texture_state[j][SavedPixelStates_T[i]]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (pSB->blockType == D3DSBT_VERTEXSTATE) {
|
|
||||||
|
|
||||||
for (i = 0; i < NUM_SAVEDVERTEXSTATES_R; i++) {
|
|
||||||
if (pSB->Set.renderstate[SavedVertexStates_R[i]] && pSB->Changed.renderstate[SavedVertexStates_R[i]])
|
|
||||||
IDirect3DDevice8Impl_SetRenderState(iface, SavedVertexStates_R[i], pSB->renderstate[SavedVertexStates_R[i]]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (j = 0; j < GL_LIMITS(textures); i++) {
|
|
||||||
for (i = 0; i < NUM_SAVEDVERTEXSTATES_T; i++) {
|
|
||||||
if (pSB->Set.texture_state[j][SavedVertexStates_T[i]] &&
|
|
||||||
pSB->Changed.texture_state[j][SavedVertexStates_T[i]])
|
|
||||||
IDirect3DDevice8Impl_SetTextureStageState(iface, j, SavedVertexStates_T[i], pSB->texture_state[j][SavedVertexStates_T[i]]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
FIXME("Unrecognized state block type %d\n", pSB->blockType);
|
|
||||||
}
|
|
||||||
memcpy(&This->StateBlock->Changed, &pSB->Changed, sizeof(This->StateBlock->Changed));
|
|
||||||
TRACE("(%p) : Applied state block %p ------------------^\n", This, pSB);
|
|
||||||
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3DDeviceImpl_CaptureStateBlock(IDirect3DDevice8Impl* This, IDirect3DStateBlockImpl* updateBlock) {
|
|
||||||
LPDIRECT3DDEVICE8 iface = (LPDIRECT3DDEVICE8) This;
|
|
||||||
PLIGHTINFOEL *tmp;
|
|
||||||
|
|
||||||
TRACE("(%p) : Updating state block %p ------------------v\n", This, updateBlock);
|
|
||||||
|
|
||||||
/* If not recorded, then update can just recapture */
|
|
||||||
if (updateBlock->blockType != D3DSBT_RECORDED) {
|
|
||||||
IDirect3DStateBlockImpl* tmpBlock;
|
|
||||||
IDirect3DDeviceImpl_CreateStateBlock(This, updateBlock->blockType, &tmpBlock);
|
|
||||||
|
|
||||||
/* Note just swap the light chains over so when deleting, the old one goes */
|
|
||||||
tmp = updateBlock->lights;
|
|
||||||
memcpy(updateBlock, tmpBlock, sizeof(IDirect3DStateBlockImpl));
|
|
||||||
tmpBlock->lights = tmp;
|
|
||||||
|
|
||||||
/* Delete the temporary one (which points to the old light chain though */
|
|
||||||
IDirect3DDeviceImpl_DeleteStateBlock(This, tmpBlock);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
unsigned int i, j;
|
|
||||||
PLIGHTINFOEL *src;
|
|
||||||
|
|
||||||
/* Recorded => Only update 'changed' values */
|
|
||||||
if (updateBlock->Set.vertexShader && updateBlock->VertexShader != This->StateBlock->VertexShader) {
|
|
||||||
updateBlock->VertexShader = This->StateBlock->VertexShader;
|
|
||||||
TRACE("Updating vertex shader to %ld\n", This->StateBlock->VertexShader);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO: Vertex Shader Constants */
|
|
||||||
|
|
||||||
/* Lights... For a recorded state block, we just had a chain of actions to perform,
|
|
||||||
so we need to walk that chain and update any actions which differ */
|
|
||||||
src = updateBlock->lights;
|
|
||||||
while (src != NULL) {
|
|
||||||
PLIGHTINFOEL *realLight = NULL;
|
|
||||||
|
|
||||||
/* Locate the light in the live lights */
|
|
||||||
realLight = This->StateBlock->lights;
|
|
||||||
while (realLight != NULL && realLight->OriginalIndex != src->OriginalIndex) realLight = realLight->next;
|
|
||||||
|
|
||||||
if (realLight == NULL) {
|
|
||||||
FIXME("A captured light no longer exists...?\n");
|
|
||||||
} else {
|
|
||||||
|
|
||||||
/* If 'changed' then its a SetLight command. Rather than comparing to see
|
|
||||||
if the OriginalParms have changed and then copy them (twice through
|
|
||||||
memory) just do the copy */
|
|
||||||
if (src->changed) {
|
|
||||||
TRACE("Updating lights for light %ld\n", src->OriginalIndex);
|
|
||||||
memcpy(&src->OriginalParms, &realLight->OriginalParms, sizeof(PLIGHTINFOEL));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If 'enabledChanged' then its a LightEnable command */
|
|
||||||
if (src->enabledChanged) {
|
|
||||||
TRACE("Updating lightEnabled for light %ld\n", src->OriginalIndex);
|
|
||||||
src->lightEnabled = realLight->lightEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
src = src->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (updateBlock->Set.pixelShader && updateBlock->PixelShader != This->StateBlock->PixelShader) {
|
|
||||||
TRACE("Updating pixel shader to %ld\n", This->StateBlock->PixelShader);
|
|
||||||
IDirect3DDevice8Impl_SetVertexShader(iface, updateBlock->PixelShader);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO: Pixel Shader Constants */
|
|
||||||
|
|
||||||
/* Others + Render & Texture */
|
|
||||||
for (i = 0; i < HIGHEST_TRANSFORMSTATE; i++) {
|
|
||||||
if (updateBlock->Set.transform[i] && memcmp(&This->StateBlock->transforms[i],
|
|
||||||
&updateBlock->transforms[i],
|
|
||||||
sizeof(D3DMATRIX)) != 0) {
|
|
||||||
TRACE("Updating transform %d\n", i);
|
|
||||||
memcpy(&updateBlock->transforms[i], &This->StateBlock->transforms[i], sizeof(D3DMATRIX));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (updateBlock->Set.Indices && ((updateBlock->pIndexData != This->StateBlock->pIndexData)
|
|
||||||
|| (updateBlock->baseVertexIndex != This->StateBlock->baseVertexIndex))) {
|
|
||||||
TRACE("Updating pindexData to %p, baseVertexIndex to %d\n",
|
|
||||||
This->StateBlock->pIndexData, This->StateBlock->baseVertexIndex);
|
|
||||||
updateBlock->pIndexData = This->StateBlock->pIndexData;
|
|
||||||
updateBlock->baseVertexIndex = This->StateBlock->baseVertexIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (updateBlock->Set.material && memcmp(&This->StateBlock->material,
|
|
||||||
&updateBlock->material,
|
|
||||||
sizeof(D3DMATERIAL8)) != 0) {
|
|
||||||
TRACE("Updating material\n");
|
|
||||||
memcpy(&updateBlock->material, &This->StateBlock->material, sizeof(D3DMATERIAL8));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (updateBlock->Set.viewport && memcmp(&This->StateBlock->viewport,
|
|
||||||
&updateBlock->viewport,
|
|
||||||
sizeof(D3DVIEWPORT8)) != 0) {
|
|
||||||
TRACE("Updating viewport\n");
|
|
||||||
memcpy(&updateBlock->viewport, &This->StateBlock->viewport, sizeof(D3DVIEWPORT8));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_STREAMS; i++) {
|
|
||||||
if (updateBlock->Set.stream_source[i] &&
|
|
||||||
((updateBlock->stream_stride[i] != This->StateBlock->stream_stride[i]) ||
|
|
||||||
(updateBlock->stream_source[i] != This->StateBlock->stream_source[i]))) {
|
|
||||||
TRACE("Updating stream source %d to %p, stride to %d\n", i, This->StateBlock->stream_source[i],
|
|
||||||
This->StateBlock->stream_stride[i]);
|
|
||||||
updateBlock->stream_stride[i] = This->StateBlock->stream_stride[i];
|
|
||||||
updateBlock->stream_source[i] = This->StateBlock->stream_source[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < GL_LIMITS(clipplanes); i++) {
|
|
||||||
if (updateBlock->Set.clipplane[i] && memcmp(&This->StateBlock->clipplane[i],
|
|
||||||
&updateBlock->clipplane[i],
|
|
||||||
sizeof(updateBlock->clipplane)) != 0) {
|
|
||||||
|
|
||||||
TRACE("Updating clipplane %d\n", i);
|
|
||||||
memcpy(&updateBlock->clipplane[i], &This->StateBlock->clipplane[i],
|
|
||||||
sizeof(updateBlock->clipplane));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Render */
|
|
||||||
for (i = 0; i < HIGHEST_RENDER_STATE; i++) {
|
|
||||||
|
|
||||||
if (updateBlock->Set.renderstate[i] && (updateBlock->renderstate[i] !=
|
|
||||||
This->StateBlock->renderstate[i])) {
|
|
||||||
TRACE("Updating renderstate %d to %ld\n", i, This->StateBlock->renderstate[i]);
|
|
||||||
updateBlock->renderstate[i] = This->StateBlock->renderstate[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Texture */
|
|
||||||
for (j = 0; j < GL_LIMITS(textures); j++) {
|
|
||||||
for (i = 0; i < HIGHEST_TEXTURE_STATE; i++) {
|
|
||||||
|
|
||||||
if (updateBlock->Set.texture_state[j][i] && (updateBlock->texture_state[j][i] !=
|
|
||||||
This->StateBlock->texture_state[j][i])) {
|
|
||||||
TRACE("Updating texturestagestate %d,%d to %ld (was %ld)\n", j,i, This->StateBlock->texture_state[j][i],
|
|
||||||
updateBlock->texture_state[j][i]);
|
|
||||||
updateBlock->texture_state[j][i] = This->StateBlock->texture_state[j][i];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (updateBlock->Set.textures[j] && (updateBlock->textures[j] != This->StateBlock->textures[j])) {
|
|
||||||
TRACE("Updating texture %d to %p (was %p)\n", j, This->StateBlock->textures[j], updateBlock->textures[j]);
|
|
||||||
updateBlock->textures[j] = This->StateBlock->textures[j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TRACE("(%p) : Updated state block %p ------------------^\n", This, updateBlock);
|
|
||||||
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD SavedPixelStates_R[NUM_SAVEDPIXELSTATES_R] = {
|
|
||||||
D3DRS_ALPHABLENDENABLE ,
|
|
||||||
D3DRS_ALPHAFUNC ,
|
|
||||||
D3DRS_ALPHAREF ,
|
|
||||||
D3DRS_ALPHATESTENABLE ,
|
|
||||||
D3DRS_BLENDOP ,
|
|
||||||
D3DRS_COLORWRITEENABLE ,
|
|
||||||
D3DRS_DESTBLEND ,
|
|
||||||
D3DRS_DITHERENABLE ,
|
|
||||||
D3DRS_EDGEANTIALIAS ,
|
|
||||||
D3DRS_FILLMODE ,
|
|
||||||
D3DRS_FOGDENSITY ,
|
|
||||||
D3DRS_FOGEND ,
|
|
||||||
D3DRS_FOGSTART ,
|
|
||||||
D3DRS_LASTPIXEL ,
|
|
||||||
D3DRS_LINEPATTERN ,
|
|
||||||
D3DRS_SHADEMODE ,
|
|
||||||
D3DRS_SRCBLEND ,
|
|
||||||
D3DRS_STENCILENABLE ,
|
|
||||||
D3DRS_STENCILFAIL ,
|
|
||||||
D3DRS_STENCILFUNC ,
|
|
||||||
D3DRS_STENCILMASK ,
|
|
||||||
D3DRS_STENCILPASS ,
|
|
||||||
D3DRS_STENCILREF ,
|
|
||||||
D3DRS_STENCILWRITEMASK ,
|
|
||||||
D3DRS_STENCILZFAIL ,
|
|
||||||
D3DRS_TEXTUREFACTOR ,
|
|
||||||
D3DRS_WRAP0 ,
|
|
||||||
D3DRS_WRAP1 ,
|
|
||||||
D3DRS_WRAP2 ,
|
|
||||||
D3DRS_WRAP3 ,
|
|
||||||
D3DRS_WRAP4 ,
|
|
||||||
D3DRS_WRAP5 ,
|
|
||||||
D3DRS_WRAP6 ,
|
|
||||||
D3DRS_WRAP7 ,
|
|
||||||
D3DRS_ZBIAS ,
|
|
||||||
D3DRS_ZENABLE ,
|
|
||||||
D3DRS_ZFUNC ,
|
|
||||||
D3DRS_ZWRITEENABLE
|
|
||||||
};
|
|
||||||
|
|
||||||
DWORD SavedPixelStates_T[NUM_SAVEDPIXELSTATES_T] = {
|
|
||||||
D3DTSS_ADDRESSU ,
|
|
||||||
D3DTSS_ADDRESSV ,
|
|
||||||
D3DTSS_ADDRESSW ,
|
|
||||||
D3DTSS_ALPHAARG0 ,
|
|
||||||
D3DTSS_ALPHAARG1 ,
|
|
||||||
D3DTSS_ALPHAARG2 ,
|
|
||||||
D3DTSS_ALPHAOP ,
|
|
||||||
D3DTSS_BORDERCOLOR ,
|
|
||||||
D3DTSS_BUMPENVLOFFSET ,
|
|
||||||
D3DTSS_BUMPENVLSCALE ,
|
|
||||||
D3DTSS_BUMPENVMAT00 ,
|
|
||||||
D3DTSS_BUMPENVMAT01 ,
|
|
||||||
D3DTSS_BUMPENVMAT10 ,
|
|
||||||
D3DTSS_BUMPENVMAT11 ,
|
|
||||||
D3DTSS_COLORARG0 ,
|
|
||||||
D3DTSS_COLORARG1 ,
|
|
||||||
D3DTSS_COLORARG2 ,
|
|
||||||
D3DTSS_COLOROP ,
|
|
||||||
D3DTSS_MAGFILTER ,
|
|
||||||
D3DTSS_MAXANISOTROPY ,
|
|
||||||
D3DTSS_MAXMIPLEVEL ,
|
|
||||||
D3DTSS_MINFILTER ,
|
|
||||||
D3DTSS_MIPFILTER ,
|
|
||||||
D3DTSS_MIPMAPLODBIAS ,
|
|
||||||
D3DTSS_RESULTARG ,
|
|
||||||
D3DTSS_TEXCOORDINDEX ,
|
|
||||||
D3DTSS_TEXTURETRANSFORMFLAGS
|
|
||||||
};
|
|
||||||
|
|
||||||
DWORD SavedVertexStates_R[NUM_SAVEDVERTEXSTATES_R] = {
|
|
||||||
D3DRS_AMBIENT ,
|
|
||||||
D3DRS_AMBIENTMATERIALSOURCE ,
|
|
||||||
D3DRS_CLIPPING ,
|
|
||||||
D3DRS_CLIPPLANEENABLE ,
|
|
||||||
D3DRS_COLORVERTEX ,
|
|
||||||
D3DRS_DIFFUSEMATERIALSOURCE ,
|
|
||||||
D3DRS_EMISSIVEMATERIALSOURCE ,
|
|
||||||
D3DRS_FOGDENSITY ,
|
|
||||||
D3DRS_FOGEND ,
|
|
||||||
D3DRS_FOGSTART ,
|
|
||||||
D3DRS_FOGTABLEMODE ,
|
|
||||||
D3DRS_FOGVERTEXMODE ,
|
|
||||||
D3DRS_INDEXEDVERTEXBLENDENABLE ,
|
|
||||||
D3DRS_LIGHTING ,
|
|
||||||
D3DRS_LOCALVIEWER ,
|
|
||||||
D3DRS_MULTISAMPLEANTIALIAS ,
|
|
||||||
D3DRS_MULTISAMPLEMASK ,
|
|
||||||
D3DRS_NORMALIZENORMALS ,
|
|
||||||
D3DRS_PATCHEDGESTYLE ,
|
|
||||||
D3DRS_PATCHSEGMENTS ,
|
|
||||||
D3DRS_POINTSCALE_A ,
|
|
||||||
D3DRS_POINTSCALE_B ,
|
|
||||||
D3DRS_POINTSCALE_C ,
|
|
||||||
D3DRS_POINTSCALEENABLE ,
|
|
||||||
D3DRS_POINTSIZE ,
|
|
||||||
D3DRS_POINTSIZE_MAX ,
|
|
||||||
D3DRS_POINTSIZE_MIN ,
|
|
||||||
D3DRS_POINTSPRITEENABLE ,
|
|
||||||
D3DRS_RANGEFOGENABLE ,
|
|
||||||
D3DRS_SOFTWAREVERTEXPROCESSING ,
|
|
||||||
D3DRS_SPECULARMATERIALSOURCE ,
|
|
||||||
D3DRS_TWEENFACTOR ,
|
|
||||||
D3DRS_VERTEXBLEND
|
|
||||||
};
|
|
||||||
|
|
||||||
DWORD SavedVertexStates_T[NUM_SAVEDVERTEXSTATES_T] = {
|
|
||||||
D3DTSS_TEXCOORDINDEX ,
|
|
||||||
D3DTSS_TEXTURETRANSFORMFLAGS
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* IDirect3DSwapChain8 implementation
|
* IDirect3DSwapChain8 implementation
|
||||||
*
|
*
|
||||||
* Copyright 2002 Jason Edmeades
|
* Copyright 2005 Oliver Stieber
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -19,32 +19,23 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
#include "windef.h"
|
|
||||||
#include "winbase.h"
|
|
||||||
#include "winuser.h"
|
|
||||||
#include "wingdi.h"
|
|
||||||
#include "wine/debug.h"
|
|
||||||
|
|
||||||
#include "d3d8_private.h"
|
#include "d3d8_private.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
|
||||||
|
|
||||||
/* IDirect3DSwapChain IUnknown parts follow: */
|
/* IDirect3DSwapChain IUnknown parts follow: */
|
||||||
HRESULT WINAPI IDirect3DSwapChain8Impl_QueryInterface(LPDIRECT3DSWAPCHAIN8 iface,REFIID riid,LPVOID *ppobj)
|
HRESULT WINAPI IDirect3DSwapChain8Impl_QueryInterface(LPDIRECT3DSWAPCHAIN8 iface, REFIID riid, LPVOID* ppobj)
|
||||||
{
|
{
|
||||||
IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface;
|
IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface;
|
||||||
|
|
||||||
if (IsEqualGUID(riid, &IID_IUnknown)
|
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||||
|| IsEqualGUID(riid, &IID_IDirect3DSwapChain8)) {
|
|| IsEqualGUID(riid, &IID_IDirect3DSwapChain8)) {
|
||||||
IDirect3DSwapChain8Impl_AddRef(iface);
|
IUnknown_AddRef(iface);
|
||||||
*ppobj = This;
|
*ppobj = This;
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
|
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,31 +55,32 @@ ULONG WINAPI IDirect3DSwapChain8Impl_Release(LPDIRECT3DSWAPCHAIN8 iface) {
|
||||||
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
|
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
|
||||||
|
|
||||||
if (ref == 0) {
|
if (ref == 0) {
|
||||||
|
IWineD3DSwapChain_Release(This->wineD3DSwapChain);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
}
|
}
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IDirect3DSwapChain parts follow: */
|
/* IDirect3DSwapChain8 parts follow: */
|
||||||
HRESULT WINAPI IDirect3DSwapChain8Impl_Present(LPDIRECT3DSWAPCHAIN8 iface, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) {
|
HRESULT WINAPI IDirect3DSwapChain8Impl_Present(LPDIRECT3DSWAPCHAIN8 iface, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion) {
|
||||||
IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface;
|
IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface;
|
||||||
FIXME("(%p) : stub\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
return D3D_OK;
|
return IWineD3DSwapChain_Present(This->wineD3DSwapChain, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3DSwapChain8Impl_GetBackBuffer(LPDIRECT3DSWAPCHAIN8 iface, UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8** ppBackBuffer) {
|
HRESULT WINAPI IDirect3DSwapChain8Impl_GetBackBuffer(LPDIRECT3DSWAPCHAIN8 iface, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8** ppBackBuffer) {
|
||||||
IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface;
|
IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface;
|
||||||
*ppBackBuffer = (LPDIRECT3DSURFACE8) This->backBuffer;
|
HRESULT hrc = D3D_OK;
|
||||||
TRACE("(%p) : BackBuf %d Type %d returning %p\n", This, BackBuffer, Type, *ppBackBuffer);
|
IWineD3DSurface *mySurface = NULL;
|
||||||
|
|
||||||
if (BackBuffer > This->PresentParms.BackBufferCount - 1) {
|
TRACE("(%p) Relay\n", This);
|
||||||
FIXME("Only one backBuffer currently supported\n");
|
|
||||||
return D3DERR_INVALIDCALL;
|
hrc = IWineD3DSwapChain_GetBackBuffer(This->wineD3DSwapChain, iBackBuffer, Type, &mySurface);
|
||||||
|
if (hrc == D3D_OK && NULL != mySurface) {
|
||||||
|
IWineD3DSurface_GetParent(mySurface, (IUnknown **)ppBackBuffer);
|
||||||
|
IWineD3DSurface_Release(mySurface);
|
||||||
}
|
}
|
||||||
|
return hrc;
|
||||||
/* Note inc ref on returned surface */
|
|
||||||
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) *ppBackBuffer);
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const IDirect3DSwapChain8Vtbl Direct3DSwapChain8_Vtbl =
|
const IDirect3DSwapChain8Vtbl Direct3DSwapChain8_Vtbl =
|
||||||
|
|
|
@ -23,10 +23,6 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
|
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
|
||||||
|
|
||||||
#define D3D8_TEXTURE(a) ((IWineD3DTextureImpl*)(a->wineD3DTexture))
|
|
||||||
#define D3D8_TEXTURE_GET_SURFACE(a) ((IWineD3DSurfaceImpl*)(D3D8_TEXTURE(a)->surfaces[i]))
|
|
||||||
#define D3D8_BASETEXTURE(a) (((IWineD3DTextureImpl*)(a->wineD3DTexture))->baseTexture)
|
|
||||||
|
|
||||||
/* IDirect3DTexture8 IUnknown parts follow: */
|
/* IDirect3DTexture8 IUnknown parts follow: */
|
||||||
HRESULT WINAPI IDirect3DTexture8Impl_QueryInterface(LPDIRECT3DTEXTURE8 iface, REFIID riid, LPVOID *ppobj) {
|
HRESULT WINAPI IDirect3DTexture8Impl_QueryInterface(LPDIRECT3DTEXTURE8 iface, REFIID riid, LPVOID *ppobj) {
|
||||||
IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface;
|
IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface;
|
||||||
|
@ -104,49 +100,9 @@ DWORD WINAPI IDirect3DTexture8Impl_GetPriority(LPDIRECT3DTEXTURE8 iface) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WINAPI IDirect3DTexture8Impl_PreLoad(LPDIRECT3DTEXTURE8 iface) {
|
void WINAPI IDirect3DTexture8Impl_PreLoad(LPDIRECT3DTEXTURE8 iface) {
|
||||||
unsigned int i;
|
|
||||||
IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface;
|
IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface;
|
||||||
TRACE("(%p) : About to load texture\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
return IWineD3DTexture_PreLoad(This->wineD3DTexture);
|
||||||
ENTER_GL();
|
|
||||||
|
|
||||||
for (i = 0; i < D3D8_BASETEXTURE(This).levels; i++) {
|
|
||||||
if (i == 0 && D3D8_TEXTURE_GET_SURFACE(This)->textureName != 0 && D3D8_BASETEXTURE(This).dirty == FALSE) {
|
|
||||||
glBindTexture(GL_TEXTURE_2D, D3D8_TEXTURE_GET_SURFACE(This)->textureName);
|
|
||||||
checkGLcall("glBindTexture");
|
|
||||||
TRACE("Texture %p (level %d) given name %d\n", D3D8_TEXTURE_GET_SURFACE(This), i, D3D8_TEXTURE_GET_SURFACE(This)->textureName);
|
|
||||||
/* No need to walk through all mip-map levels, since already all assigned */
|
|
||||||
i = D3D8_BASETEXTURE(This).levels;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if (i == 0) {
|
|
||||||
if (D3D8_TEXTURE_GET_SURFACE(This)->textureName == 0) {
|
|
||||||
glGenTextures(1, &(D3D8_TEXTURE_GET_SURFACE(This)->textureName));
|
|
||||||
checkGLcall("glGenTextures");
|
|
||||||
TRACE("Texture %p (level %d) given name %d\n", D3D8_TEXTURE_GET_SURFACE(This), i, D3D8_TEXTURE_GET_SURFACE(This)->textureName);
|
|
||||||
}
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, D3D8_TEXTURE_GET_SURFACE(This)->textureName);
|
|
||||||
checkGLcall("glBindTexture");
|
|
||||||
}
|
|
||||||
IWineD3DSurface_LoadTexture((IWineD3DSurface*)D3D8_TEXTURE_GET_SURFACE(This));
|
|
||||||
/* IDirect3DSurface8Impl_LoadTexture((LPDIRECT3DSURFACE8) D3D8_TEXTURE_GET_SURFACE(This), GL_TEXTURE_2D, i); */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* No longer dirty */
|
|
||||||
D3D8_BASETEXTURE(This).dirty = FALSE;
|
|
||||||
|
|
||||||
/* Always need to reset the number of mipmap levels when rebinding as it is
|
|
||||||
a property of the active texture unit, and another texture may have set it
|
|
||||||
to a different value */
|
|
||||||
TRACE("Setting GL_TEXTURE_MAX_LEVEL to %d\n", D3D8_BASETEXTURE(This).levels - 1);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, D3D8_BASETEXTURE(This).levels - 1);
|
|
||||||
checkGLcall("glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, This->levels)");
|
|
||||||
|
|
||||||
LEAVE_GL();
|
|
||||||
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
D3DRESOURCETYPE WINAPI IDirect3DTexture8Impl_GetType(LPDIRECT3DTEXTURE8 iface) {
|
D3DRESOURCETYPE WINAPI IDirect3DTexture8Impl_GetType(LPDIRECT3DTEXTURE8 iface) {
|
||||||
|
|
1845
dlls/d3d8/utils.c
1845
dlls/d3d8/utils.c
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* IDirect3DResource8 implementation
|
* IDirect3DVertexBuffer8 implementation
|
||||||
*
|
*
|
||||||
* Copyright 2002 Jason Edmeades
|
* Copyright 2005 Oliver Stieber
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -19,33 +19,24 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
#include "windef.h"
|
|
||||||
#include "winbase.h"
|
|
||||||
#include "winuser.h"
|
|
||||||
#include "wingdi.h"
|
|
||||||
#include "wine/debug.h"
|
|
||||||
|
|
||||||
#include "d3d8_private.h"
|
#include "d3d8_private.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
|
||||||
|
|
||||||
/* IDirect3DResource IUnknown parts follow: */
|
/* IDirect3DVertexBuffer8 IUnknown parts follow: */
|
||||||
HRESULT WINAPI IDirect3DVertexBuffer8Impl_QueryInterface(LPDIRECT3DVERTEXBUFFER8 iface, REFIID riid, LPVOID *ppobj)
|
HRESULT WINAPI IDirect3DVertexBuffer8Impl_QueryInterface(LPDIRECT3DVERTEXBUFFER8 iface, REFIID riid, LPVOID *ppobj) {
|
||||||
{
|
|
||||||
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
||||||
|
|
||||||
if (IsEqualGUID(riid, &IID_IUnknown)
|
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||||
|| IsEqualGUID(riid, &IID_IDirect3DResource8)
|
|| IsEqualGUID(riid, &IID_IDirect3DResource8)
|
||||||
|| IsEqualGUID(riid, &IID_IDirect3DVertexBuffer8)) {
|
|| IsEqualGUID(riid, &IID_IDirect3DVertexBuffer8)) {
|
||||||
IDirect3DVertexBuffer8Impl_AddRef(iface);
|
IUnknown_AddRef(iface);
|
||||||
*ppobj = This;
|
*ppobj = This;
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
|
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
|
||||||
|
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,109 +55,101 @@ ULONG WINAPI IDirect3DVertexBuffer8Impl_Release(LPDIRECT3DVERTEXBUFFER8 iface) {
|
||||||
|
|
||||||
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
|
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
|
||||||
|
|
||||||
if (ref == 0 && 0 == This->refInt) {
|
if (ref == 0) {
|
||||||
HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
|
IWineD3DVertexBuffer_Release(This->wineD3DVertexBuffer);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
} else if (0 == ref) {
|
|
||||||
WARN("(%p) : The application failed to set Stream source to NULL before releasing the vertex shader, leak\n", This);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG WINAPI IDirect3DVertexBuffer8Impl_AddRefInt(LPDIRECT3DVERTEXBUFFER8 iface) {
|
/* IDirect3DVertexBuffer8 IDirect3DResource8 Interface follow: */
|
||||||
|
HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetDevice(LPDIRECT3DVERTEXBUFFER8 iface, IDirect3DDevice8 **ppDevice) {
|
||||||
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
||||||
ULONG refInt = InterlockedIncrement(&This->refInt);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
TRACE("(%p) : AddRefInt from %ld\n", This, refInt - 1);
|
return IDirect3DResource8Impl_GetDevice((LPDIRECT3DRESOURCE8) This, ppDevice);
|
||||||
|
|
||||||
return refInt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG WINAPI IDirect3DVertexBuffer8Impl_ReleaseInt(LPDIRECT3DVERTEXBUFFER8 iface) {
|
HRESULT WINAPI IDirect3DVertexBuffer8Impl_SetPrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid, CONST void *pData, DWORD SizeOfData, DWORD Flags) {
|
||||||
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
||||||
ULONG refInt = InterlockedDecrement(&This->refInt);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
TRACE("(%p) : ReleaseRefInt to %ld\n", This, refInt);
|
return IWineD3DVertexBuffer_SetPrivateData(This->wineD3DVertexBuffer, refguid, pData, SizeOfData, Flags);
|
||||||
|
|
||||||
if (0 == This->ref && 0 == refInt) {
|
|
||||||
WARN("(%p) : Cleaning up after the calling application failed to release the stream source properly\n", This);
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
|
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
|
||||||
}
|
|
||||||
|
|
||||||
return refInt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IDirect3DResource Interface follow: */
|
HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetPrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid, void *pData, DWORD *pSizeOfData) {
|
||||||
HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetDevice(LPDIRECT3DVERTEXBUFFER8 iface, IDirect3DDevice8** ppDevice) {
|
|
||||||
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
||||||
TRACE("(%p) : returning %p\n", This, This->Device);
|
TRACE("(%p) Relay\n", This);
|
||||||
*ppDevice = (LPDIRECT3DDEVICE8) This->Device;
|
|
||||||
IDirect3DDevice8Impl_AddRef(*ppDevice);
|
return IWineD3DVertexBuffer_GetPrivateData(This->wineD3DVertexBuffer, refguid, pData, pSizeOfData);
|
||||||
return D3D_OK;
|
|
||||||
}
|
|
||||||
HRESULT WINAPI IDirect3DVertexBuffer8Impl_SetPrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
|
|
||||||
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
|
||||||
FIXME("(%p) : stub\n", This); return D3D_OK;
|
|
||||||
}
|
|
||||||
HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetPrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
|
|
||||||
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
|
||||||
FIXME("(%p) : stub\n", This); return D3D_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3DVertexBuffer8Impl_FreePrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid) {
|
HRESULT WINAPI IDirect3DVertexBuffer8Impl_FreePrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid) {
|
||||||
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
||||||
FIXME("(%p) : stub\n", This); return D3D_OK;
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
|
return IWineD3DVertexBuffer_FreePrivateData(This->wineD3DVertexBuffer, refguid);
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD WINAPI IDirect3DVertexBuffer8Impl_SetPriority(LPDIRECT3DVERTEXBUFFER8 iface, DWORD PriorityNew) {
|
DWORD WINAPI IDirect3DVertexBuffer8Impl_SetPriority(LPDIRECT3DVERTEXBUFFER8 iface, DWORD PriorityNew) {
|
||||||
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
||||||
FIXME("(%p) : stub\n", This); return D3D_OK;
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
|
return IWineD3DVertexBuffer_SetPriority(This->wineD3DVertexBuffer, PriorityNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD WINAPI IDirect3DVertexBuffer8Impl_GetPriority(LPDIRECT3DVERTEXBUFFER8 iface) {
|
DWORD WINAPI IDirect3DVertexBuffer8Impl_GetPriority(LPDIRECT3DVERTEXBUFFER8 iface) {
|
||||||
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
||||||
FIXME("(%p) : stub\n", This); return D3D_OK;
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
|
return IWineD3DVertexBuffer_GetPriority(This->wineD3DVertexBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WINAPI IDirect3DVertexBuffer8Impl_PreLoad(LPDIRECT3DVERTEXBUFFER8 iface) {
|
void WINAPI IDirect3DVertexBuffer8Impl_PreLoad(LPDIRECT3DVERTEXBUFFER8 iface) {
|
||||||
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
||||||
FIXME("(%p) : stub\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
IWineD3DVertexBuffer_PreLoad(This->wineD3DVertexBuffer);
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
D3DRESOURCETYPE WINAPI IDirect3DVertexBuffer8Impl_GetType(LPDIRECT3DVERTEXBUFFER8 iface) {
|
D3DRESOURCETYPE WINAPI IDirect3DVertexBuffer8Impl_GetType(LPDIRECT3DVERTEXBUFFER8 iface) {
|
||||||
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
||||||
TRACE("(%p) : returning %d\n", This, This->ResourceType);
|
TRACE("(%p) Relay\n", This);
|
||||||
return This->ResourceType;
|
|
||||||
|
return IWineD3DVertexBuffer_GetType(This->wineD3DVertexBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IDirect3DVertexBuffer8 */
|
/* IDirect3DVertexBuffer8 Interface follow: */
|
||||||
HRESULT WINAPI IDirect3DVertexBuffer8Impl_Lock(LPDIRECT3DVERTEXBUFFER8 iface, UINT OffsetToLock, UINT SizeToLock, BYTE** ppbData, DWORD Flags) {
|
HRESULT WINAPI IDirect3DVertexBuffer8Impl_Lock(LPDIRECT3DVERTEXBUFFER8 iface, UINT OffsetToLock, UINT SizeToLock, BYTE **ppbData, DWORD Flags) {
|
||||||
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
||||||
TRACE("(%p) : returning memory of %p (base:%p,offset:%u)\n", This, This->allocatedMemory + OffsetToLock, This->allocatedMemory, OffsetToLock);
|
TRACE("(%p) Relay\n", This);
|
||||||
/* TODO: check Flags compatibility with This->currentDesc.Usage (see MSDN) */
|
|
||||||
*ppbData = This->allocatedMemory + OffsetToLock;
|
return IWineD3DVertexBuffer_Lock(This->wineD3DVertexBuffer, OffsetToLock, SizeToLock, ppbData, Flags);
|
||||||
return D3D_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3DVertexBuffer8Impl_Unlock(LPDIRECT3DVERTEXBUFFER8 iface) {
|
HRESULT WINAPI IDirect3DVertexBuffer8Impl_Unlock(LPDIRECT3DVERTEXBUFFER8 iface) {
|
||||||
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
||||||
TRACE("(%p) : stub\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
return D3D_OK;
|
|
||||||
|
return IWineD3DVertexBuffer_Unlock(This->wineD3DVertexBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetDesc(LPDIRECT3DVERTEXBUFFER8 iface, D3DVERTEXBUFFER_DESC *pDesc) {
|
HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetDesc(LPDIRECT3DVERTEXBUFFER8 iface, D3DVERTEXBUFFER_DESC *pDesc) {
|
||||||
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
|
||||||
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
TRACE("(%p)\n", This);
|
return IWineD3DVertexBuffer_GetDesc(This->wineD3DVertexBuffer, pDesc);
|
||||||
pDesc->Format = This->currentDesc.Format;
|
|
||||||
pDesc->Type = This->currentDesc.Type;
|
|
||||||
pDesc->Usage = This->currentDesc.Usage;
|
|
||||||
pDesc->Pool = This->currentDesc.Pool;
|
|
||||||
pDesc->Size = This->currentDesc.Size;
|
|
||||||
pDesc->FVF = This->currentDesc.FVF;
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const IDirect3DVertexBuffer8Vtbl Direct3DVertexBuffer8_Vtbl =
|
const IDirect3DVertexBuffer8Vtbl Direct3DVertexBuffer8_Vtbl =
|
||||||
{
|
{
|
||||||
|
/* IUnknown */
|
||||||
IDirect3DVertexBuffer8Impl_QueryInterface,
|
IDirect3DVertexBuffer8Impl_QueryInterface,
|
||||||
IDirect3DVertexBuffer8Impl_AddRef,
|
IDirect3DVertexBuffer8Impl_AddRef,
|
||||||
IDirect3DVertexBuffer8Impl_Release,
|
IDirect3DVertexBuffer8Impl_Release,
|
||||||
|
/* IDirect3DResource8 */
|
||||||
IDirect3DVertexBuffer8Impl_GetDevice,
|
IDirect3DVertexBuffer8Impl_GetDevice,
|
||||||
IDirect3DVertexBuffer8Impl_SetPrivateData,
|
IDirect3DVertexBuffer8Impl_SetPrivateData,
|
||||||
IDirect3DVertexBuffer8Impl_GetPrivateData,
|
IDirect3DVertexBuffer8Impl_GetPrivateData,
|
||||||
|
@ -175,6 +158,7 @@ const IDirect3DVertexBuffer8Vtbl Direct3DVertexBuffer8_Vtbl =
|
||||||
IDirect3DVertexBuffer8Impl_GetPriority,
|
IDirect3DVertexBuffer8Impl_GetPriority,
|
||||||
IDirect3DVertexBuffer8Impl_PreLoad,
|
IDirect3DVertexBuffer8Impl_PreLoad,
|
||||||
IDirect3DVertexBuffer8Impl_GetType,
|
IDirect3DVertexBuffer8Impl_GetType,
|
||||||
|
/* IDirect3DVertexBuffer8 */
|
||||||
IDirect3DVertexBuffer8Impl_Lock,
|
IDirect3DVertexBuffer8Impl_Lock,
|
||||||
IDirect3DVertexBuffer8Impl_Unlock,
|
IDirect3DVertexBuffer8Impl_Unlock,
|
||||||
IDirect3DVertexBuffer8Impl_GetDesc
|
IDirect3DVertexBuffer8Impl_GetDesc
|
||||||
|
|
|
@ -0,0 +1,98 @@
|
||||||
|
/*
|
||||||
|
* IDirect3DVertexShader8 implementation
|
||||||
|
*
|
||||||
|
* Copyright 2002-2003 Jason Edmeades
|
||||||
|
* Raphael Junqueira
|
||||||
|
*
|
||||||
|
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "d3d8_private.h"
|
||||||
|
|
||||||
|
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
|
||||||
|
|
||||||
|
/* IDirect3DVertexShader8 IUnknown parts follow: */
|
||||||
|
HRESULT WINAPI IDirect3DVertexShader8Impl_QueryInterface(IDirect3DVertexShader8 *iface, REFIID riid, LPVOID* ppobj) {
|
||||||
|
IDirect3DVertexShader8Impl *This = (IDirect3DVertexShader8Impl *)iface;
|
||||||
|
|
||||||
|
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||||
|
|| IsEqualGUID(riid, &IID_IDirect3DVertexShader8)) {
|
||||||
|
IUnknown_AddRef(iface);
|
||||||
|
*ppobj = This;
|
||||||
|
return D3D_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG WINAPI IDirect3DVertexShader8Impl_AddRef(IDirect3DVertexShader8 *iface) {
|
||||||
|
IDirect3DVertexShader8Impl *This = (IDirect3DVertexShader8Impl *)iface;
|
||||||
|
ULONG ref = InterlockedIncrement(&This->ref);
|
||||||
|
|
||||||
|
TRACE("(%p) : AddRef from %ld\n", This, ref - 1);
|
||||||
|
|
||||||
|
return ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG WINAPI IDirect3DVertexShader8Impl_Release(IDirect3DVertexShader8 *iface) {
|
||||||
|
IDirect3DVertexShader8Impl *This = (IDirect3DVertexShader8Impl *)iface;
|
||||||
|
ULONG ref = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
|
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
|
||||||
|
|
||||||
|
if (ref == 0) {
|
||||||
|
IWineD3DVertexShader_Release(This->wineD3DVertexShader);
|
||||||
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
|
}
|
||||||
|
return ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* IDirect3DVertexShader8 Interface follow: */
|
||||||
|
HRESULT WINAPI IDirect3DVertexShader8Impl_GetDevice(IDirect3DVertexShader8 *iface, IDirect3DDevice8** ppDevice) {
|
||||||
|
IDirect3DVertexShader8Impl *This = (IDirect3DVertexShader8Impl *)iface;
|
||||||
|
IWineD3DDevice *myDevice = NULL;
|
||||||
|
HRESULT hr = D3D_OK;
|
||||||
|
TRACE("(%p) : Relay\n", This);
|
||||||
|
|
||||||
|
if (D3D_OK == (hr = IWineD3DVertexShader_GetDevice(This->wineD3DVertexShader, &myDevice) && myDevice != NULL)) {
|
||||||
|
hr = IWineD3DDevice_GetParent(myDevice, (IUnknown **)ppDevice);
|
||||||
|
IWineD3DDevice_Release(myDevice);
|
||||||
|
} else {
|
||||||
|
*ppDevice = NULL;
|
||||||
|
}
|
||||||
|
TRACE("(%p) returing (%p)", This, *ppDevice);
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT WINAPI IDirect3DVertexShader8Impl_GetFunction(IDirect3DVertexShader8 *iface, VOID* pData, UINT* pSizeOfData) {
|
||||||
|
IDirect3DVertexShader8Impl *This = (IDirect3DVertexShader8Impl *)iface;
|
||||||
|
|
||||||
|
TRACE("(%p) : Relay\n", This);
|
||||||
|
return IWineD3DVertexShader_GetFunction(This->wineD3DVertexShader, pData, pSizeOfData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const IDirect3DVertexShader8Vtbl Direct3DVertexShader8_Vtbl =
|
||||||
|
{
|
||||||
|
/* IUnknown */
|
||||||
|
IDirect3DVertexShader8Impl_QueryInterface,
|
||||||
|
IDirect3DVertexShader8Impl_AddRef,
|
||||||
|
IDirect3DVertexShader8Impl_Release,
|
||||||
|
/* IDirect3DVertexShader8 */
|
||||||
|
IDirect3DVertexShader8Impl_GetDevice,
|
||||||
|
IDirect3DVertexShader8Impl_GetFunction
|
||||||
|
};
|
|
@ -1,723 +0,0 @@
|
||||||
/*
|
|
||||||
* vertex shaders declaration implementation
|
|
||||||
*
|
|
||||||
* Copyright 2002 Raphael Junqueira
|
|
||||||
* Copyright 2004 Jason Edmeades
|
|
||||||
* Copyright 2004 Christian Costa
|
|
||||||
*
|
|
||||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
#include "windef.h"
|
|
||||||
#include "winbase.h"
|
|
||||||
#include "winuser.h"
|
|
||||||
#include "wingdi.h"
|
|
||||||
#include "wine/debug.h"
|
|
||||||
|
|
||||||
#include "d3d8_private.h"
|
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DirectX9 SDK download
|
|
||||||
* http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp
|
|
||||||
*
|
|
||||||
* Exploring D3DX
|
|
||||||
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndrive/html/directx07162002.asp
|
|
||||||
*
|
|
||||||
* Using Vertex Shaders
|
|
||||||
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndrive/html/directx02192001.asp
|
|
||||||
*
|
|
||||||
* Dx9 New
|
|
||||||
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/whatsnew.asp
|
|
||||||
*
|
|
||||||
* Dx9 Shaders
|
|
||||||
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/Shaders/VertexShader2_0/VertexShader2_0.asp
|
|
||||||
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/Shaders/VertexShader2_0/Instructions/Instructions.asp
|
|
||||||
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/programmingguide/GettingStarted/VertexDeclaration/VertexDeclaration.asp
|
|
||||||
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/Shaders/VertexShader3_0/VertexShader3_0.asp
|
|
||||||
*
|
|
||||||
* Dx9 D3DX
|
|
||||||
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/programmingguide/advancedtopics/VertexPipe/matrixstack/matrixstack.asp
|
|
||||||
*
|
|
||||||
* FVF
|
|
||||||
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/programmingguide/GettingStarted/VertexFormats/vformats.asp
|
|
||||||
*
|
|
||||||
* NVIDIA: DX8 Vertex Shader to NV Vertex Program
|
|
||||||
* http://developer.nvidia.com/view.asp?IO=vstovp
|
|
||||||
*
|
|
||||||
* NVIDIA: Memory Management with VAR
|
|
||||||
* http://developer.nvidia.com/view.asp?IO=var_memory_management
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Vertex Shader Declaration data types tokens */
|
|
||||||
#define MAX_VSHADER_DECL_TYPES 8
|
|
||||||
static CONST char* VertexShaderDeclDataTypes[] = {
|
|
||||||
"D3DVSDT_FLOAT1",
|
|
||||||
"D3DVSDT_FLOAT2",
|
|
||||||
"D3DVSDT_FLOAT3",
|
|
||||||
"D3DVSDT_FLOAT4",
|
|
||||||
"D3DVSDT_D3DCOLOR",
|
|
||||||
"D3DVSDT_UBYTE4",
|
|
||||||
"D3DVSDT_SHORT2",
|
|
||||||
"D3DVSDT_SHORT4",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static CONST char* VertexShaderDeclRegister[] = {
|
|
||||||
"D3DVSDE_POSITION",
|
|
||||||
"D3DVSDE_BLENDWEIGHT",
|
|
||||||
"D3DVSDE_BLENDINDICES",
|
|
||||||
"D3DVSDE_NORMAL",
|
|
||||||
"D3DVSDE_PSIZE",
|
|
||||||
"D3DVSDE_DIFFUSE",
|
|
||||||
"D3DVSDE_SPECULAR",
|
|
||||||
"D3DVSDE_TEXCOORD0",
|
|
||||||
"D3DVSDE_TEXCOORD1",
|
|
||||||
"D3DVSDE_TEXCOORD2",
|
|
||||||
"D3DVSDE_TEXCOORD3",
|
|
||||||
"D3DVSDE_TEXCOORD4",
|
|
||||||
"D3DVSDE_TEXCOORD5",
|
|
||||||
"D3DVSDE_TEXCOORD6",
|
|
||||||
"D3DVSDE_TEXCOORD7",
|
|
||||||
"D3DVSDE_POSITION2",
|
|
||||||
"D3DVSDE_NORMAL2",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
/** todo check decl validity */
|
|
||||||
/*inline static*/ DWORD Direct3DVextexShaderDeclarationImpl_ParseToken(const DWORD* pToken) {
|
|
||||||
const DWORD token = *pToken;
|
|
||||||
DWORD tokenlen = 1;
|
|
||||||
|
|
||||||
switch ((token & D3DVSD_TOKENTYPEMASK) >> D3DVSD_TOKENTYPESHIFT) { /* maybe a macro to inverse ... */
|
|
||||||
case D3DVSD_TOKEN_NOP:
|
|
||||||
TRACE(" 0x%08lx NOP()\n", token);
|
|
||||||
break;
|
|
||||||
case D3DVSD_TOKEN_STREAM:
|
|
||||||
if (token & D3DVSD_STREAMTESSMASK) {
|
|
||||||
TRACE(" 0x%08lx STREAM_TESS()\n", token);
|
|
||||||
} else {
|
|
||||||
TRACE(" 0x%08lx STREAM(%lu)\n", token, ((token & D3DVSD_STREAMNUMBERMASK) >> D3DVSD_STREAMNUMBERSHIFT));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case D3DVSD_TOKEN_STREAMDATA:
|
|
||||||
if (token & 0x10000000) {
|
|
||||||
TRACE(" 0x%08lx SKIP(%lu)\n", token, ((token & D3DVSD_SKIPCOUNTMASK) >> D3DVSD_SKIPCOUNTSHIFT));
|
|
||||||
} else {
|
|
||||||
DWORD type = ((token & D3DVSD_DATATYPEMASK) >> D3DVSD_DATATYPESHIFT);
|
|
||||||
DWORD reg = ((token & D3DVSD_VERTEXREGMASK) >> D3DVSD_VERTEXREGSHIFT);
|
|
||||||
TRACE(" 0x%08lx REG(%s, %s)\n", token, VertexShaderDeclRegister[reg], VertexShaderDeclDataTypes[type]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case D3DVSD_TOKEN_TESSELLATOR:
|
|
||||||
if (token & 0x10000000) {
|
|
||||||
DWORD type = ((token & D3DVSD_DATATYPEMASK) >> D3DVSD_DATATYPESHIFT);
|
|
||||||
DWORD reg = ((token & D3DVSD_VERTEXREGMASK) >> D3DVSD_VERTEXREGSHIFT);
|
|
||||||
TRACE(" 0x%08lx TESSUV(%s) as %s\n", token, VertexShaderDeclRegister[reg], VertexShaderDeclDataTypes[type]);
|
|
||||||
} else {
|
|
||||||
DWORD type = ((token & D3DVSD_DATATYPEMASK) >> D3DVSD_DATATYPESHIFT);
|
|
||||||
DWORD regout = ((token & D3DVSD_VERTEXREGMASK) >> D3DVSD_VERTEXREGSHIFT);
|
|
||||||
DWORD regin = ((token & D3DVSD_VERTEXREGINMASK) >> D3DVSD_VERTEXREGINSHIFT);
|
|
||||||
TRACE(" 0x%08lx TESSNORMAL(%s, %s) as %s\n", token, VertexShaderDeclRegister[regin], VertexShaderDeclRegister[regout], VertexShaderDeclDataTypes[type]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case D3DVSD_TOKEN_CONSTMEM:
|
|
||||||
{
|
|
||||||
DWORD i;
|
|
||||||
DWORD count = ((token & D3DVSD_CONSTCOUNTMASK) >> D3DVSD_CONSTCOUNTSHIFT);
|
|
||||||
DWORD constaddress = ((token & D3DVSD_CONSTADDRESSMASK) >> D3DVSD_CONSTADDRESSSHIFT);
|
|
||||||
TRACE(" 0x%08lx CONST(%lu, %lu)\n", token, constaddress, count);
|
|
||||||
++pToken;
|
|
||||||
for (i = 0; i < count; ++i) {
|
|
||||||
#if 0
|
|
||||||
TRACE(" c[%lu] = (0x%08lx, 0x%08lx, 0x%08lx, 0x%08lx)\n",
|
|
||||||
constaddress,
|
|
||||||
*pToken,
|
|
||||||
*(pToken + 1),
|
|
||||||
*(pToken + 2),
|
|
||||||
*(pToken + 3));
|
|
||||||
#endif
|
|
||||||
TRACE(" c[%lu] = (%8f, %8f, %8f, %8f)\n",
|
|
||||||
constaddress,
|
|
||||||
*(const float*) pToken,
|
|
||||||
*(const float*) (pToken + 1),
|
|
||||||
*(const float*) (pToken + 2),
|
|
||||||
*(const float*) (pToken + 3));
|
|
||||||
pToken += 4;
|
|
||||||
++constaddress;
|
|
||||||
}
|
|
||||||
tokenlen = (4 * count) + 1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case D3DVSD_TOKEN_EXT:
|
|
||||||
{
|
|
||||||
DWORD count = ((token & D3DVSD_CONSTCOUNTMASK) >> D3DVSD_CONSTCOUNTSHIFT);
|
|
||||||
DWORD extinfo = ((token & D3DVSD_EXTINFOMASK) >> D3DVSD_EXTINFOSHIFT);
|
|
||||||
TRACE(" 0x%08lx EXT(%lu, %lu)\n", token, count, extinfo);
|
|
||||||
/* todo ... print extension */
|
|
||||||
tokenlen = count + 1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case D3DVSD_TOKEN_END:
|
|
||||||
TRACE(" 0x%08lx END()\n", token);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
TRACE(" 0x%08lx UNKNOWN\n", token);
|
|
||||||
/* argg error */
|
|
||||||
}
|
|
||||||
return tokenlen;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3DDeviceImpl_CreateVertexShaderDeclaration8(IDirect3DDevice8Impl* This, CONST DWORD* pDeclaration8, IDirect3DVertexShaderDeclarationImpl** ppVertexShaderDecl) {
|
|
||||||
/** parser data */
|
|
||||||
const DWORD* pToken = pDeclaration8;
|
|
||||||
DWORD fvf = 0;
|
|
||||||
DWORD len = 0;
|
|
||||||
DWORD stream = 0;
|
|
||||||
DWORD token;
|
|
||||||
DWORD tokenlen;
|
|
||||||
DWORD tokentype;
|
|
||||||
DWORD tex = D3DFVF_TEX0;
|
|
||||||
/** TRUE if declaration can be matched by a fvf */
|
|
||||||
IDirect3DVertexShaderDeclarationImpl* object;
|
|
||||||
BOOL invalid_fvf = FALSE;
|
|
||||||
|
|
||||||
TRACE("(%p) : pDeclaration8(%p)\n", This, pDeclaration8);
|
|
||||||
|
|
||||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVertexShaderDeclarationImpl));
|
|
||||||
|
|
||||||
/*object->lpVtbl = &Direct3DVextexShaderDeclaration8_Vtbl;*/
|
|
||||||
object->device = This; /* FIXME: AddRef(This) */
|
|
||||||
object->ref = 1;
|
|
||||||
object->allFVF = 0;
|
|
||||||
|
|
||||||
while (D3DVSD_END() != *pToken) {
|
|
||||||
token = *pToken;
|
|
||||||
tokenlen = Direct3DVextexShaderDeclarationImpl_ParseToken(pToken);
|
|
||||||
tokentype = ((token & D3DVSD_TOKENTYPEMASK) >> D3DVSD_TOKENTYPESHIFT);
|
|
||||||
|
|
||||||
/** FVF generation block */
|
|
||||||
if (D3DVSD_TOKEN_STREAM == tokentype && 0 == (D3DVSD_STREAMTESSMASK & token)) {
|
|
||||||
/**
|
|
||||||
* how really works streams,
|
|
||||||
* in DolphinVS dx8 dsk sample they seems to decal reg numbers !!!
|
|
||||||
*/
|
|
||||||
DWORD oldStream = stream;
|
|
||||||
stream = ((token & D3DVSD_STREAMNUMBERMASK) >> D3DVSD_STREAMNUMBERSHIFT);
|
|
||||||
|
|
||||||
/* copy fvf if valid */
|
|
||||||
if (FALSE == invalid_fvf) {
|
|
||||||
fvf |= tex << D3DFVF_TEXCOUNT_SHIFT;
|
|
||||||
tex = 0;
|
|
||||||
object->fvf[oldStream] = fvf;
|
|
||||||
object->allFVF |= fvf;
|
|
||||||
} else {
|
|
||||||
object->fvf[oldStream] = 0;
|
|
||||||
tex = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* reset valid/invalid fvf */
|
|
||||||
fvf = 0;
|
|
||||||
invalid_fvf = FALSE;
|
|
||||||
|
|
||||||
} else if (D3DVSD_TOKEN_STREAMDATA == tokentype && 0 == (0x10000000 & tokentype)) {
|
|
||||||
DWORD type = ((token & D3DVSD_DATATYPEMASK) >> D3DVSD_DATATYPESHIFT);
|
|
||||||
DWORD reg = ((token & D3DVSD_VERTEXREGMASK) >> D3DVSD_VERTEXREGSHIFT);
|
|
||||||
|
|
||||||
switch (reg) {
|
|
||||||
case D3DVSDE_POSITION:
|
|
||||||
switch (type) {
|
|
||||||
case D3DVSDT_FLOAT3: fvf |= D3DFVF_XYZ; break;
|
|
||||||
case D3DVSDT_FLOAT4: fvf |= D3DFVF_XYZRHW; break;
|
|
||||||
default:
|
|
||||||
/** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */
|
|
||||||
invalid_fvf = TRUE;
|
|
||||||
if (type >= MAX_VSHADER_DECL_TYPES) {
|
|
||||||
TRACE("Mismatched use in VertexShader declaration of D3DVSDE_POSITION register: unsupported and unrecognized type %08lx\n", type);
|
|
||||||
} else {
|
|
||||||
TRACE("Mismatched use in VertexShader declaration of D3DVSDE_POSITION register: unsupported type %s\n", VertexShaderDeclDataTypes[type]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDE_BLENDWEIGHT:
|
|
||||||
switch (type) {
|
|
||||||
case D3DVSDT_FLOAT1: fvf |= D3DFVF_XYZB1; break;
|
|
||||||
case D3DVSDT_FLOAT2: fvf |= D3DFVF_XYZB2; break;
|
|
||||||
case D3DVSDT_FLOAT3: fvf |= D3DFVF_XYZB3; break;
|
|
||||||
case D3DVSDT_FLOAT4: fvf |= D3DFVF_XYZB4; break;
|
|
||||||
default:
|
|
||||||
/** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */
|
|
||||||
invalid_fvf = TRUE;
|
|
||||||
TRACE("Mismatched use in VertexShader declaration of D3DVSDE_BLENDWEIGHT register: unsupported type %s\n", VertexShaderDeclDataTypes[type]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDE_BLENDINDICES: /* seem to be B5 as said in MSDN Dx9SDK ?? */
|
|
||||||
switch (type) {
|
|
||||||
case D3DVSDT_UBYTE4: fvf |= D3DFVF_LASTBETA_UBYTE4; break;
|
|
||||||
default:
|
|
||||||
/** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */
|
|
||||||
invalid_fvf = TRUE;
|
|
||||||
TRACE("Mismatched use in VertexShader declaration of D3DVSDE_BLENDINDINCES register: unsupported type %s\n", VertexShaderDeclDataTypes[type]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDE_NORMAL: /* TODO: only FLOAT3 supported ... another choice possible ? */
|
|
||||||
switch (type) {
|
|
||||||
case D3DVSDT_FLOAT3: fvf |= D3DFVF_NORMAL; break;
|
|
||||||
default:
|
|
||||||
/** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */
|
|
||||||
invalid_fvf = TRUE;
|
|
||||||
TRACE("Mismatched use in VertexShader declaration of D3DVSDE_NORMAL register: unsupported type %s\n", VertexShaderDeclDataTypes[type]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDE_PSIZE: /* TODO: only FLOAT1 supported ... another choice possible ? */
|
|
||||||
switch (type) {
|
|
||||||
case D3DVSDT_FLOAT1: fvf |= D3DFVF_PSIZE; break;
|
|
||||||
default:
|
|
||||||
/** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */
|
|
||||||
invalid_fvf = TRUE;
|
|
||||||
TRACE("Mismatched use in VertexShader declaration of D3DVSDE_PSIZE register: unsupported type %s\n", VertexShaderDeclDataTypes[type]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDE_DIFFUSE: /* TODO: only D3DCOLOR supported */
|
|
||||||
switch (type) {
|
|
||||||
case D3DVSDT_D3DCOLOR: fvf |= D3DFVF_DIFFUSE; break;
|
|
||||||
default:
|
|
||||||
/** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */
|
|
||||||
invalid_fvf = TRUE;
|
|
||||||
TRACE("Mismatched use in VertexShader declaration of D3DVSDE_DIFFUSE register: unsupported type %s\n", VertexShaderDeclDataTypes[type]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDE_SPECULAR: /* TODO: only D3DCOLOR supported */
|
|
||||||
switch (type) {
|
|
||||||
case D3DVSDT_D3DCOLOR: fvf |= D3DFVF_SPECULAR; break;
|
|
||||||
default:
|
|
||||||
/** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */
|
|
||||||
invalid_fvf = TRUE;
|
|
||||||
TRACE("Mismatched use in VertexShader declaration of D3DVSDE_SPECULAR register: unsupported type %s\n", VertexShaderDeclDataTypes[type]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDE_TEXCOORD0:
|
|
||||||
case D3DVSDE_TEXCOORD1:
|
|
||||||
case D3DVSDE_TEXCOORD2:
|
|
||||||
case D3DVSDE_TEXCOORD3:
|
|
||||||
case D3DVSDE_TEXCOORD4:
|
|
||||||
case D3DVSDE_TEXCOORD5:
|
|
||||||
case D3DVSDE_TEXCOORD6:
|
|
||||||
case D3DVSDE_TEXCOORD7:
|
|
||||||
/* Fixme? - assume all tex coords in same stream */
|
|
||||||
{
|
|
||||||
int texNo = 1 + (reg - D3DVSDE_TEXCOORD0);
|
|
||||||
tex = max(tex, texNo);
|
|
||||||
switch (type) {
|
|
||||||
case D3DVSDT_FLOAT1: fvf |= D3DFVF_TEXCOORDSIZE1(texNo); break;
|
|
||||||
case D3DVSDT_FLOAT2: fvf |= D3DFVF_TEXCOORDSIZE2(texNo); break;
|
|
||||||
case D3DVSDT_FLOAT3: fvf |= D3DFVF_TEXCOORDSIZE3(texNo); break;
|
|
||||||
case D3DVSDT_FLOAT4: fvf |= D3DFVF_TEXCOORDSIZE4(texNo); break;
|
|
||||||
default:
|
|
||||||
/** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */
|
|
||||||
invalid_fvf = TRUE;
|
|
||||||
TRACE("Mismatched use in VertexShader declaration of D3DVSDE_TEXCOORD? register: unsupported type %s\n", VertexShaderDeclDataTypes[type]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDE_POSITION2: /* maybe D3DFVF_XYZRHW instead D3DFVF_XYZ (of D3DVDE_POSITION) ... to see */
|
|
||||||
case D3DVSDE_NORMAL2: /* FIXME i don't know what to do here ;( */
|
|
||||||
FIXME("[%lu] registers in VertexShader declaration not supported yet (token:0x%08lx)\n", reg, token);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
TRACE("VertexShader declaration define %lx as current FVF\n", fvf);
|
|
||||||
}
|
|
||||||
len += tokenlen;
|
|
||||||
pToken += tokenlen;
|
|
||||||
}
|
|
||||||
/* here D3DVSD_END() */
|
|
||||||
len += Direct3DVextexShaderDeclarationImpl_ParseToken(pToken);
|
|
||||||
|
|
||||||
/* copy fvf if valid */
|
|
||||||
if (FALSE == invalid_fvf) {
|
|
||||||
fvf |= tex << D3DFVF_TEXCOUNT_SHIFT;
|
|
||||||
object->fvf[stream] = fvf;
|
|
||||||
object->allFVF |= fvf;
|
|
||||||
} else {
|
|
||||||
object->fvf[stream] = 0;
|
|
||||||
}
|
|
||||||
TRACE("Completed, allFVF = %lx\n", object->allFVF);
|
|
||||||
|
|
||||||
/* compute size */
|
|
||||||
object->declaration8Length = len * sizeof(DWORD);
|
|
||||||
/* copy the declaration */
|
|
||||||
object->pDeclaration8 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, object->declaration8Length);
|
|
||||||
memcpy(object->pDeclaration8, pDeclaration8, object->declaration8Length);
|
|
||||||
/* returns */
|
|
||||||
*ppVertexShaderDecl = object;
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInputSW(IDirect3DDevice8Impl* This,
|
|
||||||
IDirect3DVertexShaderImpl* vshader,
|
|
||||||
DWORD SkipnStrides) {
|
|
||||||
/** parser data */
|
|
||||||
const DWORD* pToken = This->UpdateStateBlock->vertexShaderDecl->pDeclaration8;
|
|
||||||
DWORD stream = 0;
|
|
||||||
DWORD token;
|
|
||||||
/*DWORD tokenlen;*/
|
|
||||||
DWORD tokentype;
|
|
||||||
/** for input readers */
|
|
||||||
const BYTE* curPos = NULL;
|
|
||||||
FLOAT x, y, z, w;
|
|
||||||
SHORT u, v, r, t;
|
|
||||||
DWORD dw;
|
|
||||||
|
|
||||||
TRACE("(%p) - This:%p, skipstrides=%lu\n", vshader, This, SkipnStrides);
|
|
||||||
|
|
||||||
while (D3DVSD_END() != *pToken) {
|
|
||||||
token = *pToken;
|
|
||||||
tokentype = ((token & D3DVSD_TOKENTYPEMASK) >> D3DVSD_TOKENTYPESHIFT);
|
|
||||||
|
|
||||||
/** FVF generation block */
|
|
||||||
if (D3DVSD_TOKEN_STREAM == tokentype && 0 == (D3DVSD_STREAMTESSMASK & token)) {
|
|
||||||
IDirect3DVertexBuffer8* pVB;
|
|
||||||
int skip = 0;
|
|
||||||
|
|
||||||
++pToken;
|
|
||||||
/**
|
|
||||||
* how really works streams,
|
|
||||||
* in DolphinVS dx8 dsk sample use it !!!
|
|
||||||
*/
|
|
||||||
stream = ((token & D3DVSD_STREAMNUMBERMASK) >> D3DVSD_STREAMNUMBERSHIFT);
|
|
||||||
skip = This->StateBlock->stream_stride[stream];
|
|
||||||
pVB = This->StateBlock->stream_source[stream];
|
|
||||||
|
|
||||||
if (NULL == pVB) {
|
|
||||||
ERR("using unitialised stream[%lu]\n", stream);
|
|
||||||
return D3DERR_INVALIDCALL;
|
|
||||||
} else {
|
|
||||||
if (This->StateBlock->streamIsUP) {
|
|
||||||
curPos = (BYTE *)pVB + (SkipnStrides * skip); /* Not really a VB */
|
|
||||||
} else {
|
|
||||||
curPos = ((IDirect3DVertexBuffer8Impl*) pVB)->allocatedMemory + (SkipnStrides * skip);
|
|
||||||
}
|
|
||||||
|
|
||||||
TRACE(" using stream[%lu] with %p (%p + (Stride %d * skip %ld))\n", stream, curPos,
|
|
||||||
((IDirect3DVertexBuffer8Impl*) pVB)->allocatedMemory, skip, SkipnStrides);
|
|
||||||
}
|
|
||||||
} else if (D3DVSD_TOKEN_CONSTMEM == tokentype) {
|
|
||||||
/** Const decl */
|
|
||||||
DWORD i;
|
|
||||||
DWORD count = ((token & D3DVSD_CONSTCOUNTMASK) >> D3DVSD_CONSTCOUNTSHIFT);
|
|
||||||
DWORD constaddress = ((token & D3DVSD_CONSTADDRESSMASK) >> D3DVSD_CONSTADDRESSSHIFT);
|
|
||||||
++pToken;
|
|
||||||
for (i = 0; i < count; ++i) {
|
|
||||||
vshader->data->C[constaddress + i].x = *(const float*)pToken;
|
|
||||||
vshader->data->C[constaddress + i].y = *(const float*)(pToken + 1);
|
|
||||||
vshader->data->C[constaddress + i].z = *(const float*)(pToken + 2);
|
|
||||||
vshader->data->C[constaddress + i].w = *(const float*)(pToken + 3);
|
|
||||||
pToken += 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (D3DVSD_TOKEN_STREAMDATA == tokentype && 0 != (0x10000000 & tokentype)) {
|
|
||||||
/** skip datas */
|
|
||||||
DWORD skipCount = ((token & D3DVSD_SKIPCOUNTMASK) >> D3DVSD_SKIPCOUNTSHIFT);
|
|
||||||
TRACE(" skipping %ld dwords\n", skipCount);
|
|
||||||
curPos = curPos + skipCount * sizeof(DWORD);
|
|
||||||
++pToken;
|
|
||||||
|
|
||||||
} else if (D3DVSD_TOKEN_STREAMDATA == tokentype && 0 == (0x10000000 & tokentype)) {
|
|
||||||
DWORD type = ((token & D3DVSD_DATATYPEMASK) >> D3DVSD_DATATYPESHIFT);
|
|
||||||
DWORD reg = ((token & D3DVSD_VERTEXREGMASK) >> D3DVSD_VERTEXREGSHIFT);
|
|
||||||
++pToken;
|
|
||||||
|
|
||||||
TRACE(" type : %ld, reg = %ld\n", type, reg);
|
|
||||||
switch (type) {
|
|
||||||
case D3DVSDT_FLOAT1:
|
|
||||||
x = *(const float*) curPos;
|
|
||||||
curPos = curPos + sizeof(float);
|
|
||||||
/**/
|
|
||||||
vshader->input.V[reg].x = x;
|
|
||||||
vshader->input.V[reg].y = 0.0f;
|
|
||||||
vshader->input.V[reg].z = 0.0f;
|
|
||||||
vshader->input.V[reg].w = 1.0f;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDT_FLOAT2:
|
|
||||||
x = *(const float*) curPos;
|
|
||||||
curPos = curPos + sizeof(float);
|
|
||||||
y = *(const float*) curPos;
|
|
||||||
curPos = curPos + sizeof(float);
|
|
||||||
/**/
|
|
||||||
vshader->input.V[reg].x = x;
|
|
||||||
vshader->input.V[reg].y = y;
|
|
||||||
vshader->input.V[reg].z = 0.0f;
|
|
||||||
vshader->input.V[reg].w = 1.0f;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDT_FLOAT3:
|
|
||||||
x = *(const float*) curPos;
|
|
||||||
curPos = curPos + sizeof(float);
|
|
||||||
y = *(const float*) curPos;
|
|
||||||
curPos = curPos + sizeof(float);
|
|
||||||
z = *(const float*) curPos;
|
|
||||||
curPos = curPos + sizeof(float);
|
|
||||||
/**/
|
|
||||||
vshader->input.V[reg].x = x;
|
|
||||||
vshader->input.V[reg].y = y;
|
|
||||||
vshader->input.V[reg].z = z;
|
|
||||||
vshader->input.V[reg].w = 1.0f;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDT_FLOAT4:
|
|
||||||
x = *(const float*) curPos;
|
|
||||||
curPos = curPos + sizeof(float);
|
|
||||||
y = *(const float*) curPos;
|
|
||||||
curPos = curPos + sizeof(float);
|
|
||||||
z = *(const float*) curPos;
|
|
||||||
curPos = curPos + sizeof(float);
|
|
||||||
w = *(const float*) curPos;
|
|
||||||
curPos = curPos + sizeof(float);
|
|
||||||
/**/
|
|
||||||
vshader->input.V[reg].x = x;
|
|
||||||
vshader->input.V[reg].y = y;
|
|
||||||
vshader->input.V[reg].z = z;
|
|
||||||
vshader->input.V[reg].w = w;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDT_D3DCOLOR:
|
|
||||||
dw = *(const DWORD*) curPos;
|
|
||||||
curPos = curPos + sizeof(DWORD);
|
|
||||||
/**/
|
|
||||||
vshader->input.V[reg].x = D3DCOLOR_R(dw);
|
|
||||||
vshader->input.V[reg].y = D3DCOLOR_G(dw);
|
|
||||||
vshader->input.V[reg].z = D3DCOLOR_B(dw);
|
|
||||||
vshader->input.V[reg].w = D3DCOLOR_A(dw);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDT_SHORT2:
|
|
||||||
u = *(const SHORT*) curPos;
|
|
||||||
curPos = curPos + sizeof(SHORT);
|
|
||||||
v = *(const SHORT*) curPos;
|
|
||||||
curPos = curPos + sizeof(SHORT);
|
|
||||||
/**/
|
|
||||||
vshader->input.V[reg].x = (float) u;
|
|
||||||
vshader->input.V[reg].y = (float) v;
|
|
||||||
vshader->input.V[reg].z = 0.0f;
|
|
||||||
vshader->input.V[reg].w = 1.0f;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDT_SHORT4:
|
|
||||||
u = *(const SHORT*) curPos;
|
|
||||||
curPos = curPos + sizeof(SHORT);
|
|
||||||
v = *(const SHORT*) curPos;
|
|
||||||
curPos = curPos + sizeof(SHORT);
|
|
||||||
r = *(const SHORT*) curPos;
|
|
||||||
curPos = curPos + sizeof(SHORT);
|
|
||||||
t = *(const SHORT*) curPos;
|
|
||||||
curPos = curPos + sizeof(SHORT);
|
|
||||||
/**/
|
|
||||||
vshader->input.V[reg].x = (float) u;
|
|
||||||
vshader->input.V[reg].y = (float) v;
|
|
||||||
vshader->input.V[reg].z = (float) r;
|
|
||||||
vshader->input.V[reg].w = (float) t;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDT_UBYTE4:
|
|
||||||
dw = *(const DWORD*) curPos;
|
|
||||||
curPos = curPos + sizeof(DWORD);
|
|
||||||
/**/
|
|
||||||
vshader->input.V[reg].x = (float) ((dw & 0x000000FF) >> 0);
|
|
||||||
vshader->input.V[reg].y = (float) ((dw & 0x0000FF00) >> 8);
|
|
||||||
vshader->input.V[reg].z = (float) ((dw & 0x00FF0000) >> 16);
|
|
||||||
vshader->input.V[reg].w = (float) ((dw & 0xFF000000) >> 24);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: /** errooooorr what to do ? */
|
|
||||||
ERR("Error in VertexShader declaration of %s register: unsupported type %s\n", VertexShaderDeclRegister[reg], VertexShaderDeclDataTypes[type]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
/* here D3DVSD_END() */
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInputArbHW(IDirect3DDevice8Impl* This,
|
|
||||||
IDirect3DVertexShaderImpl* vshader,
|
|
||||||
DWORD SkipnStrides) {
|
|
||||||
/** parser data */
|
|
||||||
const DWORD* pToken = This->UpdateStateBlock->vertexShaderDecl->pDeclaration8;
|
|
||||||
DWORD stream = 0;
|
|
||||||
DWORD token;
|
|
||||||
/*DWORD tokenlen;*/
|
|
||||||
DWORD tokentype;
|
|
||||||
/** for input readers */
|
|
||||||
const BYTE* curPos = NULL;
|
|
||||||
int skip = 0;
|
|
||||||
|
|
||||||
TRACE("(%p) - This:%p, skipstrides=%lu\n", vshader, This, SkipnStrides);
|
|
||||||
|
|
||||||
while (D3DVSD_END() != *pToken) {
|
|
||||||
token = *pToken;
|
|
||||||
tokentype = ((token & D3DVSD_TOKENTYPEMASK) >> D3DVSD_TOKENTYPESHIFT);
|
|
||||||
|
|
||||||
/** FVF generation block */
|
|
||||||
if (D3DVSD_TOKEN_STREAM == tokentype && 0 == (D3DVSD_STREAMTESSMASK & token)) {
|
|
||||||
IDirect3DVertexBuffer8* pVB;
|
|
||||||
|
|
||||||
++pToken;
|
|
||||||
/**
|
|
||||||
* how really works streams,
|
|
||||||
* in DolphinVS dx8 dsk sample use it !!!
|
|
||||||
*/
|
|
||||||
stream = ((token & D3DVSD_STREAMNUMBERMASK) >> D3DVSD_STREAMNUMBERSHIFT);
|
|
||||||
skip = This->StateBlock->stream_stride[stream];
|
|
||||||
pVB = This->StateBlock->stream_source[stream];
|
|
||||||
|
|
||||||
if (NULL == pVB) {
|
|
||||||
ERR("using unitialised stream[%lu]\n", stream);
|
|
||||||
return D3DERR_INVALIDCALL;
|
|
||||||
} else {
|
|
||||||
if (This->StateBlock->streamIsUP) {
|
|
||||||
curPos = ((BYTE *) pVB) + (SkipnStrides * skip); /* Not really a VB */
|
|
||||||
} else {
|
|
||||||
curPos = ((IDirect3DVertexBuffer8Impl*) pVB)->allocatedMemory + (SkipnStrides * skip);
|
|
||||||
}
|
|
||||||
|
|
||||||
TRACE(" using stream[%lu] with %p (%p + (Stride %d * skip %ld))\n", stream, curPos,
|
|
||||||
((IDirect3DVertexBuffer8Impl*) pVB)->allocatedMemory, skip, SkipnStrides);
|
|
||||||
}
|
|
||||||
} else if (D3DVSD_TOKEN_CONSTMEM == tokentype) {
|
|
||||||
/** Const decl */
|
|
||||||
DWORD i;
|
|
||||||
DWORD count = ((token & D3DVSD_CONSTCOUNTMASK) >> D3DVSD_CONSTCOUNTSHIFT);
|
|
||||||
DWORD constaddress = ((token & D3DVSD_CONSTADDRESSMASK) >> D3DVSD_CONSTADDRESSSHIFT);
|
|
||||||
|
|
||||||
++pToken;
|
|
||||||
for (i = 0; i < count; ++i) {
|
|
||||||
FIXME("Confirm this is correct handling of consts inside the hw vertex shader\n");
|
|
||||||
GL_EXTCALL(glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, constaddress+i, (GLfloat *)pToken));
|
|
||||||
vshader->data->C[constaddress + i].x = *(const float*)pToken;
|
|
||||||
vshader->data->C[constaddress + i].y = *(const float*)(pToken + 1);
|
|
||||||
vshader->data->C[constaddress + i].z = *(const float*)(pToken + 2);
|
|
||||||
vshader->data->C[constaddress + i].w = *(const float*)(pToken + 3);
|
|
||||||
pToken += 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (D3DVSD_TOKEN_STREAMDATA == tokentype && 0 != (0x10000000 & tokentype)) {
|
|
||||||
/** skip datas */
|
|
||||||
DWORD skipCount = ((token & D3DVSD_SKIPCOUNTMASK) >> D3DVSD_SKIPCOUNTSHIFT);
|
|
||||||
TRACE(" skipping %ld dwords\n", skipCount);
|
|
||||||
curPos = curPos + skipCount * sizeof(DWORD);
|
|
||||||
++pToken;
|
|
||||||
|
|
||||||
} else if (D3DVSD_TOKEN_STREAMDATA == tokentype && 0 == (0x10000000 & tokentype)) {
|
|
||||||
DWORD type = ((token & D3DVSD_DATATYPEMASK) >> D3DVSD_DATATYPESHIFT);
|
|
||||||
DWORD reg = ((token & D3DVSD_VERTEXREGMASK) >> D3DVSD_VERTEXREGSHIFT);
|
|
||||||
++pToken;
|
|
||||||
|
|
||||||
TRACE(" type : %ld, reg = %ld\n", type, reg);
|
|
||||||
switch (type) {
|
|
||||||
case D3DVSDT_FLOAT1:
|
|
||||||
TRACE("HW VS glVertexAttribPointerARB(reg=%ld,num=%d,skip=%d,ptr=%p)\n", reg, 1, skip, curPos);
|
|
||||||
GL_EXTCALL(glVertexAttribPointerARB(reg, 1, GL_FLOAT, GL_FALSE, skip, curPos));
|
|
||||||
GL_EXTCALL(glEnableVertexAttribArrayARB(reg));
|
|
||||||
curPos = curPos + sizeof(float);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDT_FLOAT2:
|
|
||||||
TRACE("HW VS glVertexAttribPointerARB(reg=%ld,num=%d,skip=%d,ptr=%p)\n", reg, 2, skip, curPos);
|
|
||||||
GL_EXTCALL(glVertexAttribPointerARB(reg, 2, GL_FLOAT, GL_FALSE, skip, curPos));
|
|
||||||
GL_EXTCALL(glEnableVertexAttribArrayARB(reg));
|
|
||||||
curPos = curPos + 2*sizeof(float);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDT_FLOAT3:
|
|
||||||
TRACE("HW VS glVertexAttribPointerARB(reg=%ld,num=%d,skip=%d,ptr=%p)\n", reg, 3, skip, curPos);
|
|
||||||
GL_EXTCALL(glVertexAttribPointerARB(reg, 3, GL_FLOAT, GL_FALSE, skip, curPos));
|
|
||||||
GL_EXTCALL(glEnableVertexAttribArrayARB(reg));
|
|
||||||
curPos = curPos + 3*sizeof(float);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDT_FLOAT4:
|
|
||||||
TRACE("HW VS glVertexAttribPointerARB(reg=%ld,num=%d,skip=%d,ptr=%p)\n", reg, 4, skip, curPos);
|
|
||||||
GL_EXTCALL(glVertexAttribPointerARB(reg, 4, GL_FLOAT, GL_FALSE, skip, curPos));
|
|
||||||
GL_EXTCALL(glEnableVertexAttribArrayARB(reg));
|
|
||||||
curPos = curPos + 4*sizeof(float);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDT_D3DCOLOR:
|
|
||||||
TRACE("HW VS glVertexAttribPointerARB(reg=%ld,num=%d,skip=%d,ptr=%p)\n", reg, 4, skip, curPos);
|
|
||||||
FIXME("D3DVSDT_D3DCOLOR in hw shader - To confirm\n");
|
|
||||||
GL_EXTCALL(glVertexAttribPointerARB(reg, 4, GL_UNSIGNED_BYTE, GL_TRUE, skip, curPos));
|
|
||||||
GL_EXTCALL(glEnableVertexAttribArrayARB(reg));
|
|
||||||
curPos = curPos + 4*sizeof(BYTE);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDT_SHORT2:
|
|
||||||
TRACE("HW VS glVertexAttribPointerARB(reg=%ld,num=%d,skip=%d,ptr=%p)\n", reg, 2, skip, curPos);
|
|
||||||
GL_EXTCALL(glVertexAttribPointerARB(reg, 2, GL_UNSIGNED_SHORT, GL_FALSE, skip, curPos));
|
|
||||||
GL_EXTCALL(glEnableVertexAttribArrayARB(reg));
|
|
||||||
curPos = curPos + 2*sizeof(short int);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDT_SHORT4:
|
|
||||||
TRACE("HW VS glVertexAttribPointerARB(reg=%ld,num=%d,skip=%d,ptr=%p)\n", reg, 1, skip, curPos);
|
|
||||||
GL_EXTCALL(glVertexAttribPointerARB(reg, 4, GL_UNSIGNED_SHORT, GL_FALSE, skip, curPos));
|
|
||||||
GL_EXTCALL(glEnableVertexAttribArrayARB(reg));
|
|
||||||
curPos = curPos + 4*sizeof(short int);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case D3DVSDT_UBYTE4:
|
|
||||||
FIXME("D3DVSDT_UBYTE4 in hw shader - To confirm\n");
|
|
||||||
GL_EXTCALL(glVertexAttribPointerARB(reg, 4, GL_UNSIGNED_BYTE, GL_TRUE, skip, curPos));
|
|
||||||
GL_EXTCALL(glEnableVertexAttribArrayARB(reg));
|
|
||||||
curPos = curPos + 4*sizeof(BYTE);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: /** errooooorr what to do ? */
|
|
||||||
ERR("Error in VertexShader declaration of %s register: unsupported type %s\n", VertexShaderDeclRegister[reg], VertexShaderDeclDataTypes[type]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
/* here D3DVSD_END() */
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3DVertexShaderDeclarationImpl_GetDeclaration8(IDirect3DVertexShaderDeclarationImpl* This, DWORD* pData, UINT* pSizeOfData) {
|
|
||||||
if (NULL == pData) {
|
|
||||||
*pSizeOfData = This->declaration8Length;
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
|
||||||
if (*pSizeOfData < This->declaration8Length) {
|
|
||||||
*pSizeOfData = This->declaration8Length;
|
|
||||||
return D3DERR_MOREDATA;
|
|
||||||
}
|
|
||||||
TRACE("(%p) : GetVertexShaderDeclaration copying to %p\n", This, pData);
|
|
||||||
memcpy(pData, This->pDeclaration8, This->declaration8Length);
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
|
|
@ -362,7 +362,7 @@ ULONG WINAPI IWineD3DDeviceImpl_Release(IWineD3DDevice *iface) {
|
||||||
if (!refCount) {
|
if (!refCount) {
|
||||||
/* TODO: Clean up all the surfaces and textures! */
|
/* TODO: Clean up all the surfaces and textures! */
|
||||||
/* FIXME: Create targets and state blocks in d3d8 */
|
/* FIXME: Create targets and state blocks in d3d8 */
|
||||||
if (((IWineD3DImpl *)This->wineD3D)->dxVersion > 8) { /*We don't create a state block in d3d8 yet*/
|
if (((IWineD3DImpl *)This->wineD3D)->dxVersion >= 8) { /*We don't create state blocks for d3d7 yet*/
|
||||||
/* NOTE: You must release the parent if the object was created via a callback
|
/* NOTE: You must release the parent if the object was created via a callback
|
||||||
** ***************************/
|
** ***************************/
|
||||||
/* TODO: this is exactly the same as required by _Reset.., so at some point we need to move the code so that is can be called by reset add release... */
|
/* TODO: this is exactly the same as required by _Reset.., so at some point we need to move the code so that is can be called by reset add release... */
|
||||||
|
|
|
@ -1521,7 +1521,7 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVT
|
||||||
/* TODO: add support for NON-POW2 if avaialble
|
/* TODO: add support for NON-POW2 if avaialble
|
||||||
|
|
||||||
*/
|
*/
|
||||||
if (This->dxVersion > 8) {
|
if (This->dxVersion >= 8) {
|
||||||
*pCaps->TextureCaps |= D3DPTEXTURECAPS_NONPOW2CONDITIONAL;
|
*pCaps->TextureCaps |= D3DPTEXTURECAPS_NONPOW2CONDITIONAL;
|
||||||
|
|
||||||
} else { /* NONPOW2 isn't accessible by d3d8 yet */
|
} else { /* NONPOW2 isn't accessible by d3d8 yet */
|
||||||
|
@ -1782,19 +1782,9 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
|
||||||
object->adapterNo = Adapter;
|
object->adapterNo = Adapter;
|
||||||
object->devType = DeviceType;
|
object->devType = DeviceType;
|
||||||
|
|
||||||
/* Let D3D8 use WineD3D's capability detection code. We can't use the block of code after this call yet
|
/* FIXME: Use for dx7 code eventually too! */
|
||||||
/ as D3D8 doesn't use WineD3D stateblocks / swapchains.
|
|
||||||
*/
|
|
||||||
if(This->dxVersion == 8) {
|
|
||||||
/* Setup some defaults for creating the implicit swapchain */
|
|
||||||
ENTER_GL();
|
|
||||||
IWineD3DImpl_FillGLCaps(&This->gl_info, IWineD3DImpl_GetAdapterDisplay(iface, Adapter));
|
|
||||||
LEAVE_GL();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: Use for dx8 code eventually too! */
|
|
||||||
/* Deliberately no indentation here, as this if will be removed when dx8 support merged in */
|
/* Deliberately no indentation here, as this if will be removed when dx8 support merged in */
|
||||||
if (This->dxVersion > 8) {
|
if (This->dxVersion >= 8) {
|
||||||
TRACE("(%p) : Creating stateblock\n", This);
|
TRACE("(%p) : Creating stateblock\n", This);
|
||||||
/* Creating the startup stateBlock - Note Special Case: 0 => Don't fill in yet! */
|
/* Creating the startup stateBlock - Note Special Case: 0 => Don't fill in yet! */
|
||||||
if (D3D_OK != IWineD3DDevice_CreateStateBlock((IWineD3DDevice *)object,
|
if (D3D_OK != IWineD3DDevice_CreateStateBlock((IWineD3DDevice *)object,
|
||||||
|
|
Loading…
Reference in New Issue