Commit 559b1069 authored by Raphael Junqueira's avatar Raphael Junqueira Committed by Alexandre Julliard

- integration with DrawPrimitive

- remove non-esthetic c++ comments into c comments block ;) - more more debug - indent, cleanups - trying to use DIFFUSE and SPECULAR for vertex shader - many fixes - integration with Jason's texture patch
parent 1d97f52f
@ stdcall D3D8GetSWInfo() D3D8GetSWInfo
@ stdcall DebugSetMute() DebugSetMute
@ stdcall DebugSetMute(long) DebugSetMute
@ stdcall Direct3DCreate8(long) Direct3DCreate8
@ stdcall ValidatePixelShader() ValidatePixelShader
@ stdcall ValidateVertexShader() ValidateVertexShader
@ stdcall ValidatePixelShader(ptr ptr) ValidatePixelShader
@ stdcall ValidateVertexShader(ptr ptr) ValidateVertexShader
......@@ -63,7 +63,7 @@ extern void (*wine_tsx11_unlock_ptr)(void);
#define HIGHEST_TRANSFORMSTATE 512
#define D3DSBT_RECORDED 0xfffffffe
/* Direct38 Interfaces: */
/* Direct3D8 Interfaces: */
typedef struct IDirect3DBaseTexture8Impl IDirect3DBaseTexture8Impl;
typedef struct IDirect3DVolumeTexture8Impl IDirect3DVolumeTexture8Impl;
typedef struct IDirect3D8Impl IDirect3D8Impl;
......@@ -152,52 +152,64 @@ typedef struct STATEBLOCK {
} STATEBLOCK;
typedef struct SHADER8Vector {
typedef struct D3DSHADERVECTOR {
float x;
float y;
float z;
float w;
} SHADER8Vector;
} D3DSHADERVECTOR;
typedef struct SHADER8Scalar {
typedef struct D3DSHADERSCALAR {
float x;
} SHADER8Scalar;
} D3DSHADERSCALAR;
#define SHADER_MAX_CONSTANTS 96
#define VSHADER_MAX_CONSTANTS 96
#define PSHADER_MAX_CONSTANTS 96
typedef SHADER8Vector SHADER8Constants[SHADER_MAX_CONSTANTS];
#define D3D8_VSHADER_MAX_CONSTANTS 96
#define D3D8_PSHADER_MAX_CONSTANTS 96
typedef D3DSHADERVECTOR VSHADERCONSTANTS8[D3D8_VSHADER_MAX_CONSTANTS];
typedef struct SHADER8Data {
typedef struct SHADERDATA8 {
/** Run Time Shader Function Constants */
/*D3DXBUFFER* constants;*/
SHADER8Constants C;
VSHADERCONSTANTS8 C;
/** Shader Code as char ... */
CONST DWORD* code;
UINT codeLength;
} SHADER8Data;
} SHADERDATA8;
typedef struct VERTEXSHADER8 { /* TODO: Vertex Shader */
CONST DWORD* decl;
CONST DWORD* function;
DWORD* decl;
DWORD* function;
DWORD usage; /* 0 || D3DUSAGE_SOFTWAREPROCESSING */
UINT declLength;
UINT functionLength;
DWORD fvf;
DWORD version;
/* run time datas */
SHADER8Data* data;
SHADERDATA8* data;
} VERTEXSHADER8;
typedef struct PIXELSHADER8 { /* TODO: Pixel Shader */
CONST DWORD* function;
UINT functionLength;
DWORD version;
/* run time datas */
SHADER8Data* data;
SHADERDATA8* data;
} PIXELSHADER8;
/** temporary here waiting for buffer code */
typedef struct VSHADERINPUTDATA8 {
D3DSHADERVECTOR V[16];
} VSHADERINPUTDATA8;
/** temporary here waiting for buffer code */
typedef struct VSHADEROUTPUTDATA8 {
D3DSHADERVECTOR oPos;
D3DSHADERVECTOR oD[2];
D3DSHADERVECTOR oT[4];
D3DSHADERVECTOR oFog;
D3DSHADERVECTOR oPts;
} VSHADEROUTPUTDATA8;
/*
* External prototypes
*/
......@@ -916,6 +928,6 @@ extern HRESULT WINAPI IDirect3DVolumeTexture8Impl_AddDirtyBox(LPDIRECT3D
*/
DWORD vshader_decl_parse(VERTEXSHADER8* vshader);
DWORD vshader_program_parse(VERTEXSHADER8* vshader);
BOOL vshader_program_execute_SW(VERTEXSHADER8* vshader, VSHADERINPUTDATA8* input, VSHADEROUTPUTDATA8* output);
#endif /* __WINE_D3DX8_PRIVATE_H */
......@@ -159,7 +159,7 @@ UINT WINAPI IDirect3D8Impl_GetAdapterModeCount (LPDIRECT3D8 iface,
FIXME("Adapter not primary display\n");
}
return D3D_OK;
return 0;
}
HRESULT WINAPI IDirect3D8Impl_EnumAdapterModes (LPDIRECT3D8 iface,
......@@ -195,7 +195,8 @@ HRESULT WINAPI IDirect3D8Impl_EnumAdapterModes (LPDIRECT3D8 iface,
switch (bpp) {
case 8: pMode->Format = D3DFMT_R3G3B2; break;
case 16: pMode->Format = D3DFMT_A4R4G4B4; break;
/*case 16: pMode->Format = D3DFMT_A4R4G4B4; break;*/
case 16: pMode->Format = D3DFMT_R5G6B5; break;
case 24: pMode->Format = D3DFMT_R8G8B8; break;
case 32: pMode->Format = D3DFMT_A8R8G8B8; break;
default: pMode->Format = D3DFMT_UNKNOWN;
......@@ -232,7 +233,8 @@ HRESULT WINAPI IDirect3D8Impl_GetAdapterDisplayMode (LPDIRECT3D8 iface,
switch (bpp) {
case 8: pMode->Format = D3DFMT_R3G3B2; break;
case 16: pMode->Format = D3DFMT_A4R4G4B4; break;
case 16: pMode->Format = D3DFMT_R5G6B5; break;
/*case 16: pMode->Format = D3DFMT_A4R4G4B4; break;*/
case 24: pMode->Format = D3DFMT_R8G8B8; break;
case 32: pMode->Format = D3DFMT_A8R8G8B8; break;
default: pMode->Format = D3DFMT_UNKNOWN;
......@@ -242,7 +244,7 @@ HRESULT WINAPI IDirect3D8Impl_GetAdapterDisplayMode (LPDIRECT3D8 iface,
FIXME("Adapter not primary display\n");
}
TRACE("returning w:%d, h:%d, ref:%d, fmt:%d\n", pMode->Width,
TRACE("returning w:%d, h:%d, ref:%d, fmt:%x\n", pMode->Width,
pMode->Height, pMode->RefreshRate, pMode->Format);
return D3D_OK;
}
......@@ -290,7 +292,7 @@ HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps (LPDIRECT3D8 iface,
/* NOTE: Most of the values here are complete garbage for now */
pCaps->DeviceType = D3DDEVTYPE_HAL; /* Not quite true, but use h/w supported by opengl I suppose */
pCaps->DeviceType = (DeviceType == D3DDEVTYPE_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF; /* Not quite true, but use h/w supported by opengl I suppose */
pCaps->AdapterOrdinal = Adapter;
pCaps->Caps = 0;
......@@ -367,7 +369,7 @@ HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps (LPDIRECT3D8 iface,
pCaps->MaxStreamStride = 1024;
pCaps->VertexShaderVersion = 01;
pCaps->MaxVertexShaderConst = 1;
pCaps->MaxVertexShaderConst = D3D8_VSHADER_MAX_CONSTANTS;
pCaps->PixelShaderVersion = 01;
pCaps->MaxPixelShaderValue = 1.0;
......@@ -466,9 +468,8 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
return D3DERR_NOTAVAILABLE;
}
}
object->glCtx = glXCreateContext(object->display, object->visInfo, NULL, GL_TRUE);
if (NULL == object->visInfo) {
if (NULL == object->glCtx) {
ERR("cannot create glxContext\n");
LEAVE_GL();
return D3DERR_NOTAVAILABLE;
......@@ -524,6 +525,8 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
*/
ENTER_GL();
/*TRACE("hereeee. %x %x %x\n", object->display, object->win, object->glCtx);*/
if (glXMakeCurrent(object->display, object->win, object->glCtx) == False) {
ERR("Error in setting current context (context %p drawable %ld)!\n", object->glCtx, object->win);
}
......@@ -555,26 +558,26 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
if (NULL == GL_Extensions) {
ERR(" GL_Extensions returns NULL\n");
} else {
while (*GL_Extensions!=0x00) {
while (*GL_Extensions != 0x00) {
const char *Start = GL_Extensions;
char ThisExtn[256];
memset(ThisExtn, 0x00, sizeof(ThisExtn));
while (*GL_Extensions!=' ' && *GL_Extensions!=0x00) {
GL_Extensions++;
while (*GL_Extensions != ' ' && *GL_Extensions != 0x00) {
GL_Extensions++;
}
memcpy(ThisExtn, Start, (GL_Extensions-Start));
memcpy(ThisExtn, Start, (GL_Extensions - Start));
TRACE (" %s\n", ThisExtn);
if (strcmp(ThisExtn, "GL_ARB_multitexture")==0) {
GLint gl_max_texture_units_arb;
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &gl_max_texture_units_arb);
object->isMultiTexture = TRUE;
object->TextureUnits = min(8, gl_max_texture_units_arb);
TRACE("FOUND: Multitexture support - GL_MAX_TEXTURE_UNITS_ARB=%d\n", gl_max_texture_units_arb);
if (strcmp(ThisExtn, "GL_ARB_multitexture") == 0) {
GLint gl_max_texture_units_arb;
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &gl_max_texture_units_arb);
object->isMultiTexture = TRUE;
object->TextureUnits = min(8, gl_max_texture_units_arb);
TRACE("FOUND: Multitexture support - GL_MAX_TEXTURE_UNITS_ARB=%d\n", gl_max_texture_units_arb);
}
if (*GL_Extensions==' ') GL_Extensions++;
if (*GL_Extensions == ' ') GL_Extensions++;
}
}
......@@ -584,17 +587,17 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
if (NULL == GLX_Extensions) {
ERR(" GLX_Extensions returns NULL\n");
} else {
while (*GLX_Extensions!=0x00) {
while (*GLX_Extensions != 0x00) {
const char *Start = GLX_Extensions;
char ThisExtn[256];
memset(ThisExtn, 0x00, sizeof(ThisExtn));
while (*GLX_Extensions!=' ' && *GLX_Extensions!=0x00) {
GLX_Extensions++;
while (*GLX_Extensions != ' ' && *GLX_Extensions != 0x00) {
GLX_Extensions++;
}
memcpy(ThisExtn, Start, (GLX_Extensions-Start));
memcpy(ThisExtn, Start, (GLX_Extensions - Start));
TRACE (" %s\n", ThisExtn);
if (*GLX_Extensions==' ') GLX_Extensions++;
if (*GLX_Extensions == ' ') GLX_Extensions++;
}
}
......
......@@ -63,41 +63,41 @@
/*****************************************************************************
* Predeclare the interfaces
*/
DEFINE_GUID(IID_IDirect3D8, 0x1DD9E8DA,0x1C77,0x4D40,0xB0,0xCF,0x98,0xFE,0xFD,0xFF,0x95,0x12);
typedef struct IDirect3D8 IDirect3D8, *LPDIRECT3D8;
DEFINE_GUID(IID_IDirect3D8, 0x1DD9E8DA,0x1C77,0x4D40,0xB0,0xCF,0x98,0xFE,0xFD,0xFF,0x95,0x12);
typedef struct IDirect3D8 IDirect3D8, *LPDIRECT3D8;
DEFINE_GUID(IID_IDirect3DDevice8, 0X7385E5DF,0X8FE8,0X41D5,0X86,0XB6,0XD7,0XB4,0X85,0X47,0XB6,0XCF);
typedef struct IDirect3DDevice8 IDirect3DDevice8, *LPDIRECT3DDEVICE8;
DEFINE_GUID(IID_IDirect3DDevice8, 0x7385E5DF,0x8FE8,0x41D5,0x86,0xB6,0xD7,0xB4,0x85,0x47,0xB6,0xCF);
typedef struct IDirect3DDevice8 IDirect3DDevice8, *LPDIRECT3DDEVICE8;
DEFINE_GUID(IID_IDirect3DResource8, 0X1B36BB7B,0X09B7,0X410A,0XB4,0X45,0X7D,0X14,0X30,0XD7,0XB3,0X3F);
typedef struct IDirect3DResource8 IDirect3DResource8, *LPDIRECT3DRESOURCE8, *PDIRECT3DRESOURCE8;
DEFINE_GUID(IID_IDirect3DResource8, 0x1B36BB7B,0x09B7,0x410A,0xB4,0x45,0x7D,0x14,0x30,0xD7,0xB3,0x3F);
typedef struct IDirect3DResource8 IDirect3DResource8, *LPDIRECT3DRESOURCE8, *PDIRECT3DRESOURCE8;
DEFINE_GUID(IID_IDirect3DVertexBuffer8, 0X8AEEEAC7,0X05F9,0X44D4,0XB5,0X91,0X00,0X0B,0X0D,0XF1,0XCB,0X95);
typedef struct IDirect3DVertexBuffer8 IDirect3DVertexBuffer8, *LPDIRECT3DVERTEXBUFFER8, *PDIRECT3DVERTEXBUFFER8;
DEFINE_GUID(IID_IDirect3DVertexBuffer8, 0x8AEEEAC7,0x05F9,0x44D4,0xB5,0x91,0x00,0x0B,0x0D,0xF1,0xCB,0x95);
typedef struct IDirect3DVertexBuffer8 IDirect3DVertexBuffer8, *LPDIRECT3DVERTEXBUFFER8, *PDIRECT3DVERTEXBUFFER8;
DEFINE_GUID(IID_IDirect3DVolume8, 0XBD7349F5,0X14F1,0X42E4,0X9C,0X79,0X97,0X23,0X80,0XDB,0X40,0XC0);
typedef struct IDirect3DVolume8 IDirect3DVolume8, *LPDIRECT3DVOLUME8, *PDIRECT3DVOLUME8;
DEFINE_GUID(IID_IDirect3DVolume8, 0xBD7349F5,0x14F1,0x42E4,0x9C,0x79,0x97,0x23,0x80,0xDB,0x40,0xC0);
typedef struct IDirect3DVolume8 IDirect3DVolume8, *LPDIRECT3DVOLUME8, *PDIRECT3DVOLUME8;
DEFINE_GUID(IID_IDirect3DSwapChain8, 0X928C088B,0X76B9,0X4C6B,0XA5,0X36,0XA5,0X90,0X85,0X38,0X76,0XCD);
typedef struct IDirect3DSwapChain8 IDirect3DSwapChain8, *LPDIRECT3DSWAPCHAIN8, *PDIRECT3DSWAPCHAIN8;
DEFINE_GUID(IID_IDirect3DSwapChain8, 0x928C088B,0x76B9,0x4C6B,0xA5,0x36,0xA5,0x90,0x85,0x38,0x76,0xCD);
typedef struct IDirect3DSwapChain8 IDirect3DSwapChain8, *LPDIRECT3DSWAPCHAIN8, *PDIRECT3DSWAPCHAIN8;
DEFINE_GUID(IID_IDirect3DSurface8, 0XB96EEBCA,0XB326,0X4EA5,0X88,0X2F,0X2F,0XF5,0XBA,0XE0,0X21,0XDD);
typedef struct IDirect3DSurface8 IDirect3DSurface8, *LPDIRECT3DSURFACE8, *PDIRECT3DSURFACE8;
DEFINE_GUID(IID_IDirect3DSurface8, 0xB96EEBCA,0xB326,0x4EA5,0x88,0x2F,0x2F,0xF5,0xBA,0xE0,0x21,0xDD);
typedef struct IDirect3DSurface8 IDirect3DSurface8, *LPDIRECT3DSURFACE8, *PDIRECT3DSURFACE8;
DEFINE_GUID(IID_IDirect3DIndexBuffer8, 0X0E689C9A,0X053D,0X44A0,0X9D,0X92,0XDB,0X0E,0X3D,0X75,0X0F,0X86);
typedef struct IDirect3DIndexBuffer8 IDirect3DIndexBuffer8, *LPDIRECT3DINDEXBUFFER8, *PDIRECT3DINDEXBUFFER8;
DEFINE_GUID(IID_IDirect3DIndexBuffer8, 0x0E689C9A,0x053D,0x44A0,0x9D,0x92,0xDB,0x0E,0x3D,0x75,0x0F,0x86);
typedef struct IDirect3DIndexBuffer8 IDirect3DIndexBuffer8, *LPDIRECT3DINDEXBUFFER8, *PDIRECT3DINDEXBUFFER8;
DEFINE_GUID(IID_IDirect3DBaseTexture8, 0XB4211CFA,0X51B9,0X4A9F,0XAB,0X78,0XDB,0X99,0XB2,0XBB,0X67,0X8E);
typedef struct IDirect3DBaseTexture8 IDirect3DBaseTexture8, *LPDIRECT3DBASETEXTURE8, *PDIRECT3DBASETEXTURE8;
DEFINE_GUID(IID_IDirect3DBaseTexture8, 0xB4211CFA,0x51B9,0x4A9F,0xAB,0x78,0xDB,0x99,0xB2,0xBB,0x67,0x8E);
typedef struct IDirect3DBaseTexture8 IDirect3DBaseTexture8, *LPDIRECT3DBASETEXTURE8, *PDIRECT3DBASETEXTURE8;
DEFINE_GUID(IID_IDirect3DTexture8, 0XE4CDD575,0X2866,0X4F01,0XB1,0X2E,0X7E,0XEC,0XE1,0XEC,0X93,0X58);
typedef struct IDirect3DTexture8 IDirect3DTexture8, *LPDIRECT3DTEXTURE8, *PDIRECT3DTEXTURE8;
DEFINE_GUID(IID_IDirect3DTexture8, 0xE4CDD575,0x2866,0x4F01,0xB1,0x2E,0x7E,0xEC,0xE1,0xEC,0x93,0x58);
typedef struct IDirect3DTexture8 IDirect3DTexture8, *LPDIRECT3DTEXTURE8, *PDIRECT3DTEXTURE8;
DEFINE_GUID(IID_IDirect3DCubeTexture8, 0X3EE5B968,0X2ACA,0X4C34,0X8B,0XB5,0X7E,0X0C,0X3D,0X19,0XB7,0X50);
typedef struct IDirect3DCubeTexture8 IDirect3DCubeTexture8, *LPDIRECT3DCUBETEXTURE8, *PDIRECT3DCUBETEXTURE8;
DEFINE_GUID(IID_IDirect3DCubeTexture8, 0x3EE5B968,0x2ACA,0x4C34,0x8B,0xB5,0x7E,0x0C,0x3D,0x19,0xB7,0x50);
typedef struct IDirect3DCubeTexture8 IDirect3DCubeTexture8, *LPDIRECT3DCUBETEXTURE8, *PDIRECT3DCUBETEXTURE8;
DEFINE_GUID(IID_IDirect3DVolumeTexture8,0X4B8AAAFA,0X140F,0X42BA,0X91,0X31,0X59,0X7E,0XAF,0XAA,0X2E,0XAD);
typedef struct IDirect3DVolumeTexture8 IDirect3DVolumeTexture8, *LPDIRECT3DVOLUMETEXTURE8, *PDIRECT3DVOLUMETEXTURE8;
DEFINE_GUID(IID_IDirect3DVolumeTexture8, 0x4B8AAAFA,0x140F,0x42BA,0x91,0x31,0x59,0x7E,0xAF,0xAA,0x2E,0xAD);
typedef struct IDirect3DVolumeTexture8 IDirect3DVolumeTexture8, *LPDIRECT3DVOLUMETEXTURE8, *PDIRECT3DVOLUMETEXTURE8;
/*****************************************************************************
* IDirect3D8 interface
......@@ -728,7 +728,15 @@ ICOM_DEFINE(IDirect3DVolumeTexture8,IDirect3DBaseTexture8)
#define IDirect3DVolumeTexture8_UnlockBox(p,a) ICOM_CALL1(UnlockBox,p,a)
#define IDirect3DVolumeTexture8_AddDirtyBox(p,a) ICOM_CALL1(AddDirtyBox,p,a)
#ifdef __cplusplus
extern "C" {
#endif /* defined(__cplusplus) */
/* Define the main entrypoint as well */
IDirect3D8* WINAPI Direct3DCreate8(UINT SDKVersion);
#ifdef __cplusplus
} /* extern "C" */
#endif /* defined(__cplusplus) */
#endif /* __WINE_D3D8_H */
......@@ -250,7 +250,7 @@ typedef enum _D3DVSDT_TYPE {
#define D3DVSD_EXTINFOMASK (0xFFFFFF << D3DVSD_EXTINFOSHIFT)
#define D3DVSD_STREAMNUMBERMASK (0xF << D3DVSD_STREAMNUMBERSHIFT)
#define D3DVSD_VERTEXREGMASK (0x1F << D3DVSD_VERTEXREGSHIFT)
#define D3DVSD_CONSTRSMASK (0x1FFF << D3DVSD_CONSTREGSHIFT)
#define D3DVSD_CONSTRSMASK (0x1FFF << D3DVSD_CONSTRSSHIFT)
#define D3DVSD_DATATYPEMASK (0xF << D3DVSD_DATATYPESHIFT)
#define D3DVSD_SKIPCOUNTMASK (0xF << D3DVSD_SKIPCOUNTSHIFT)
#define D3DVSD_EXTCOUNTMASK (0x1F << D3DVSD_EXTCOUNTSHIFT)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment