Commit b050a3db authored by Raphael Junqueira's avatar Raphael Junqueira Committed by Alexandre Julliard

- pixel shader program dump code

- pixel shader code split into a new "COM object" (as done before for vertex shader) - some fixes on Validate* functions call types - add pixel shader (ie fragment_program) detection on caps code
parent 3d51c865
@ stdcall D3D8GetSWInfo() @ stdcall D3D8GetSWInfo()
@ stdcall DebugSetMute(long) @ stdcall DebugSetMute()
@ stdcall Direct3DCreate8(long) @ stdcall Direct3DCreate8(long)
@ stdcall ValidatePixelShader(ptr ptr) @ stdcall ValidatePixelShader(ptr ptr)
@ stdcall ValidateVertexShader(ptr ptr) @ stdcall ValidateVertexShader(ptr ptr)
...@@ -38,10 +38,9 @@ HRESULT WINAPI D3D8GetSWInfo(void) ...@@ -38,10 +38,9 @@ HRESULT WINAPI D3D8GetSWInfo(void)
return 0; return 0;
} }
HRESULT WINAPI DebugSetMute(void) void DebugSetMute(void)
{ {
FIXME("(void): stub\n"); /* nothing to do */
return 0;
} }
IDirect3D8* WINAPI Direct3DCreate8(UINT SDKVersion) IDirect3D8* WINAPI Direct3DCreate8(UINT SDKVersion)
......
...@@ -99,17 +99,16 @@ typedef struct D3DSHADERSCALAR { ...@@ -99,17 +99,16 @@ typedef struct D3DSHADERSCALAR {
} D3DSHADERSCALAR; } D3DSHADERSCALAR;
#define D3D8_VSHADER_MAX_CONSTANTS 96 #define D3D8_VSHADER_MAX_CONSTANTS 96
#define D3D8_PSHADER_MAX_CONSTANTS 96
typedef D3DSHADERVECTOR VSHADERCONSTANTS8[D3D8_VSHADER_MAX_CONSTANTS]; typedef D3DSHADERVECTOR VSHADERCONSTANTS8[D3D8_VSHADER_MAX_CONSTANTS];
typedef struct SHADERDATA8 { typedef struct VSHADERDATA8 {
/** Run Time Shader Function Constants */ /** Run Time Shader Function Constants */
/*D3DXBUFFER* constants;*/ /*D3DXBUFFER* constants;*/
VSHADERCONSTANTS8 C; VSHADERCONSTANTS8 C;
/** Shader Code as char ... */ /** Shader Code as char ... */
CONST DWORD* code; CONST DWORD* code;
UINT codeLength; UINT codeLength;
} SHADERDATA8; } VSHADERDATA8;
/** temporary here waiting for buffer code */ /** temporary here waiting for buffer code */
typedef struct VSHADERINPUTDATA8 { typedef struct VSHADERINPUTDATA8 {
...@@ -125,6 +124,34 @@ typedef struct VSHADEROUTPUTDATA8 { ...@@ -125,6 +124,34 @@ typedef struct VSHADEROUTPUTDATA8 {
D3DSHADERVECTOR oPts; D3DSHADERVECTOR oPts;
} VSHADEROUTPUTDATA8; } VSHADEROUTPUTDATA8;
#define D3D8_PSHADER_MAX_CONSTANTS 32
typedef D3DSHADERVECTOR PSHADERCONSTANTS8[D3D8_PSHADER_MAX_CONSTANTS];
typedef struct PSHADERDATA8 {
/** Run Time Shader Function Constants */
/*D3DXBUFFER* constants;*/
PSHADERCONSTANTS8 C;
/** Shader Code as char ... */
CONST DWORD* code;
UINT codeLength;
} PSHADERDATA8;
/** temporary here waiting for buffer code */
typedef struct PSHADERINPUTDATA8 {
D3DSHADERVECTOR V[2];
D3DSHADERVECTOR T[8];
D3DSHADERVECTOR S[16];
/*D3DSHADERVECTOR R[12];*/
} PSHADERINPUTDATA8;
/** temporary here waiting for buffer code */
typedef struct PSHADEROUTPUTDATA8 {
D3DSHADERVECTOR oC[4];
D3DSHADERVECTOR oDepth;
} PSHADEROUTPUTDATA8;
/* /*
* External prototypes * External prototypes
*/ */
...@@ -155,6 +182,7 @@ void CreateStateBlock(LPDIRECT3DDEVICE8 iface); ...@@ -155,6 +182,7 @@ void CreateStateBlock(LPDIRECT3DDEVICE8 iface);
typedef enum _GL_SupportedExt { typedef enum _GL_SupportedExt {
/* ARB */ /* ARB */
ARB_FRAGMENT_PROGRAM,
ARB_MULTISAMPLE, ARB_MULTISAMPLE,
ARB_MULTITEXTURE, ARB_MULTITEXTURE,
ARB_POINT_PARAMETERS, ARB_POINT_PARAMETERS,
...@@ -173,6 +201,7 @@ typedef enum _GL_SupportedExt { ...@@ -173,6 +201,7 @@ typedef enum _GL_SupportedExt {
EXT_TEXTURE_LOD_BIAS, EXT_TEXTURE_LOD_BIAS,
EXT_VERTEX_WEIGHTING, EXT_VERTEX_WEIGHTING,
/* NVIDIA */ /* NVIDIA */
NV_FRAGMENT_PROGRAM,
NV_VERTEX_PROGRAM, NV_VERTEX_PROGRAM,
/* ATI */ /* ATI */
EXT_VERTEX_SHADER, EXT_VERTEX_SHADER,
...@@ -190,6 +219,19 @@ typedef enum _GL_VSVersion { ...@@ -190,6 +219,19 @@ typedef enum _GL_VSVersion {
VS_VERSION_FORCE_DWORD = 0x7FFFFFFF VS_VERSION_FORCE_DWORD = 0x7FFFFFFF
} GL_VSVersion; } GL_VSVersion;
typedef enum _GL_PSVersion {
PS_VERSION_NOT_SUPPORTED = 0x0,
PS_VERSION_10 = 0x10,
PS_VERSION_11 = 0x11,
PS_VERSION_12 = 0x12,
PS_VERSION_13 = 0x13,
PS_VERSION_14 = 0x14,
PS_VERSION_20 = 0x20,
PS_VERSION_30 = 0x30,
/*Force 32-bits*/
PS_VERSION_FORCE_DWORD = 0x7FFFFFFF
} GL_PSVersion;
typedef struct _GL_Info { typedef struct _GL_Info {
/** /**
* CAPS Constants * CAPS Constants
...@@ -198,11 +240,14 @@ typedef struct _GL_Info { ...@@ -198,11 +240,14 @@ typedef struct _GL_Info {
UINT max_textures; UINT max_textures;
UINT max_clipplanes; UINT max_clipplanes;
GL_PSVersion ps_arb_version;
GL_PSVersion ps_nv_version;
GL_VSVersion vs_arb_version; GL_VSVersion vs_arb_version;
GL_VSVersion vs_nv_version; GL_VSVersion vs_nv_version;
GL_VSVersion vs_ati_version; GL_VSVersion vs_ati_version;
BOOL supported[25]; BOOL supported[30];
} GL_Info; } GL_Info;
#define GL_LIMITS(ExtName) (This->direct3d8->gl_info.max_##ExtName) #define GL_LIMITS(ExtName) (This->direct3d8->gl_info.max_##ExtName)
...@@ -1017,6 +1062,7 @@ typedef struct SAVEDSTATES { ...@@ -1017,6 +1062,7 @@ typedef struct SAVEDSTATES {
BOOL vertexShaderConstant; BOOL vertexShaderConstant;
BOOL vertexShaderDecl; BOOL vertexShaderDecl;
BOOL pixelShader; BOOL pixelShader;
BOOL pixelShaderConstant;
BOOL renderstate[HIGHEST_RENDER_STATE]; BOOL renderstate[HIGHEST_RENDER_STATE];
BOOL texture_state[8][HIGHEST_TEXTURE_STATE]; BOOL texture_state[8][HIGHEST_TEXTURE_STATE];
BOOL clipplane[MAX_CLIPPLANES]; BOOL clipplane[MAX_CLIPPLANES];
...@@ -1091,7 +1137,6 @@ struct IDirect3DStateBlockImpl { ...@@ -1091,7 +1137,6 @@ struct IDirect3DStateBlockImpl {
/* Pixel Shader */ /* Pixel Shader */
DWORD PixelShader; DWORD PixelShader;
/* TODO: Pixel Shader Constant */
/* Indexed Vertex Blending */ /* Indexed Vertex Blending */
D3DVERTEXBLENDFLAGS vertex_blend; D3DVERTEXBLENDFLAGS vertex_blend;
...@@ -1099,6 +1144,8 @@ struct IDirect3DStateBlockImpl { ...@@ -1099,6 +1144,8 @@ struct IDirect3DStateBlockImpl {
/* Vertex Shader Constant */ /* Vertex Shader Constant */
D3DSHADERVECTOR vertexShaderConstant[D3D8_VSHADER_MAX_CONSTANTS]; D3DSHADERVECTOR vertexShaderConstant[D3D8_VSHADER_MAX_CONSTANTS];
/* Pixel Shader Constant */
D3DSHADERVECTOR pixelShaderConstant[D3D8_PSHADER_MAX_CONSTANTS];
}; };
/* exported Interfaces */ /* exported Interfaces */
...@@ -1171,7 +1218,7 @@ struct IDirect3DVertexShaderImpl { ...@@ -1171,7 +1218,7 @@ struct IDirect3DVertexShaderImpl {
DWORD usage; /* 0 || D3DUSAGE_SOFTWAREPROCESSING */ DWORD usage; /* 0 || D3DUSAGE_SOFTWAREPROCESSING */
DWORD version; DWORD version;
/* run time datas */ /* run time datas */
SHADERDATA8* data; VSHADERDATA8* data;
VSHADERINPUTDATA8 input; VSHADERINPUTDATA8 input;
VSHADEROUTPUTDATA8 output; VSHADEROUTPUTDATA8 output;
}; };
...@@ -1210,18 +1257,21 @@ struct IDirect3DPixelShaderImpl { ...@@ -1210,18 +1257,21 @@ struct IDirect3DPixelShaderImpl {
/* The device, to be replaced by a IDirect3DDeviceImpl */ /* The device, to be replaced by a IDirect3DDeviceImpl */
IDirect3DDevice8Impl* device; IDirect3DDevice8Impl* device;
/* TODO: Pixel Shader */ DWORD* function;
CONST DWORD* function;
UINT functionLength; UINT functionLength;
DWORD version; DWORD version;
/* run time datas */ /* run time datas */
SHADERDATA8* data; PSHADERDATA8* data;
PSHADERINPUTDATA8 input;
PSHADEROUTPUTDATA8 output;
}; };
/* exported Interfaces */ /* exported Interfaces */
extern HRESULT WINAPI IDirect3DPixelShaderImpl_GetFunction(IDirect3DPixelShaderImpl* This, VOID* pData, UINT* pSizeOfData); extern HRESULT WINAPI IDirect3DPixelShaderImpl_GetFunction(IDirect3DPixelShaderImpl* This, VOID* pData, UINT* pSizeOfData);
/* internal Interfaces */ /* internal Interfaces */
extern DWORD WINAPI IDirect3DPixelShaderImpl_GetVersion(IDirect3DPixelShaderImpl* This); extern DWORD WINAPI IDirect3DPixelShaderImpl_GetVersion(IDirect3DPixelShaderImpl* This);
/* temporary internal Interfaces */
extern HRESULT WINAPI IDirect3DDeviceImpl_CreatePixelShader(IDirect3DDevice8Impl* This, CONST DWORD* pFunction, IDirect3DPixelShaderImpl** ppPixelShader);
/** /**
...@@ -1229,7 +1279,10 @@ extern DWORD WINAPI IDirect3DPixelShaderImpl_GetVersion(IDirect3DPixelShaderImpl ...@@ -1229,7 +1279,10 @@ extern DWORD WINAPI IDirect3DPixelShaderImpl_GetVersion(IDirect3DPixelShaderImpl
* *
* to see how not defined it here * to see how not defined it here
*/ */
void GetSrcAndOpFromValue(DWORD iValue, BOOL isAlphaArg, GLenum* source, GLenum* operand);
void setupTextureStates(LPDIRECT3DDEVICE8 iface, DWORD Stage); void setupTextureStates(LPDIRECT3DDEVICE8 iface, DWORD Stage);
void set_tex_op(LPDIRECT3DDEVICE8 iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3);
SHORT D3DFmtGetBpp(IDirect3DDevice8Impl* This, D3DFORMAT fmt); SHORT D3DFmtGetBpp(IDirect3DDevice8Impl* This, D3DFORMAT fmt);
GLint D3DFmt2GLIntFmt(IDirect3DDevice8Impl* This, D3DFORMAT fmt); GLint D3DFmt2GLIntFmt(IDirect3DDevice8Impl* This, D3DFORMAT fmt);
......
...@@ -681,12 +681,6 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface, ...@@ -681,12 +681,6 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
int dblBuf[] = {GLX_RGBA, int dblBuf[] = {GLX_RGBA,
GLX_STENCIL_SIZE, 8, /* 2 */ GLX_STENCIL_SIZE, 8, /* 2 */
GLX_DEPTH_SIZE, 16, /* 4 */ GLX_DEPTH_SIZE, 16, /* 4 */
#if 0
GLX_RED_SIZE, 8, /* 6 */
GLX_GREEN_SIZE, 8, /* 8 */
GLX_BLUE_SIZE, 8, /* 10 */
GLX_ALPHA_SIZE, 8, /* 12 */
#endif
GLX_DOUBLEBUFFER, None}; GLX_DOUBLEBUFFER, None};
/* FIXME: Handle stencil appropriately via EnableAutoDepthStencil / AutoDepthStencilFormat */ /* FIXME: Handle stencil appropriately via EnableAutoDepthStencil / AutoDepthStencilFormat */
...@@ -889,8 +883,10 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface, ...@@ -889,8 +883,10 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
*/ */
memset(&This->gl_info.supported, 0, sizeof(This->gl_info.supported)); memset(&This->gl_info.supported, 0, sizeof(This->gl_info.supported));
This->gl_info.max_textures = 1; This->gl_info.max_textures = 1;
This->gl_info.ps_arb_version = PS_VERSION_NOT_SUPPORTED;
This->gl_info.vs_arb_version = VS_VERSION_NOT_SUPPORTED; This->gl_info.vs_arb_version = VS_VERSION_NOT_SUPPORTED;
This->gl_info.vs_nv_version = VS_VERSION_NOT_SUPPORTED; This->gl_info.vs_nv_version = VS_VERSION_NOT_SUPPORTED;
This->gl_info.vs_ati_version = VS_VERSION_NOT_SUPPORTED;
/* Retrieve opengl defaults */ /* Retrieve opengl defaults */
glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max); glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max);
...@@ -922,7 +918,11 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface, ...@@ -922,7 +918,11 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
/** /**
* ARB * ARB
*/ */
if (strcmp(ThisExtn, "GL_ARB_multisample") == 0) { if (strcmp(ThisExtn, "GL_ARB_fragment_program") == 0) {
This->gl_info.ps_arb_version = PS_VERSION_11;
FIXME(" FOUND: ARB Pixel Shader support - version=%02x\n", This->gl_info.ps_arb_version);
This->gl_info.supported[ARB_FRAGMENT_PROGRAM] = TRUE;
} else if (strcmp(ThisExtn, "GL_ARB_multisample") == 0) {
FIXME(" FOUND: ARB Multisample support\n"); FIXME(" FOUND: ARB Multisample support\n");
This->gl_info.supported[ARB_MULTISAMPLE] = TRUE; This->gl_info.supported[ARB_MULTISAMPLE] = TRUE;
} else if (strcmp(ThisExtn, "GL_ARB_multitexture") == 0) { } else if (strcmp(ThisExtn, "GL_ARB_multitexture") == 0) {
...@@ -976,6 +976,10 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface, ...@@ -976,6 +976,10 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
/** /**
* NVIDIA * NVIDIA
*/ */
} else if (strstr(ThisExtn, "GL_NV_fragment_program")) {
This->gl_info.ps_nv_version = PS_VERSION_11;
FIXME(" FOUND: NVIDIA (NV) Pixel Shader support - version=%02x\n", This->gl_info.ps_nv_version);
This->gl_info.supported[NV_FRAGMENT_PROGRAM] = TRUE;
} else if (strstr(ThisExtn, "GL_NV_vertex_program")) { } else if (strstr(ThisExtn, "GL_NV_vertex_program")) {
This->gl_info.vs_nv_version = max(This->gl_info.vs_nv_version, (0 == strcmp(ThisExtn, "GL_NV_vertex_program1_1")) ? VS_VERSION_11 : VS_VERSION_10); This->gl_info.vs_nv_version = max(This->gl_info.vs_nv_version, (0 == strcmp(ThisExtn, "GL_NV_vertex_program1_1")) ? VS_VERSION_11 : VS_VERSION_10);
This->gl_info.vs_nv_version = max(This->gl_info.vs_nv_version, (0 == strcmp(ThisExtn, "GL_NV_vertex_program2")) ? VS_VERSION_20 : VS_VERSION_10); This->gl_info.vs_nv_version = max(This->gl_info.vs_nv_version, (0 == strcmp(ThisExtn, "GL_NV_vertex_program2")) ? VS_VERSION_20 : VS_VERSION_10);
......
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