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 DebugSetMute(long)
@ stdcall DebugSetMute()
@ stdcall Direct3DCreate8(long)
@ stdcall ValidatePixelShader(ptr ptr)
@ stdcall ValidateVertexShader(ptr ptr)
......@@ -38,10 +38,9 @@ HRESULT WINAPI D3D8GetSWInfo(void)
return 0;
}
HRESULT WINAPI DebugSetMute(void)
void DebugSetMute(void)
{
FIXME("(void): stub\n");
return 0;
/* nothing to do */
}
IDirect3D8* WINAPI Direct3DCreate8(UINT SDKVersion)
......
......@@ -99,17 +99,16 @@ typedef struct D3DSHADERSCALAR {
} D3DSHADERSCALAR;
#define D3D8_VSHADER_MAX_CONSTANTS 96
#define D3D8_PSHADER_MAX_CONSTANTS 96
typedef D3DSHADERVECTOR VSHADERCONSTANTS8[D3D8_VSHADER_MAX_CONSTANTS];
typedef struct SHADERDATA8 {
typedef struct VSHADERDATA8 {
/** Run Time Shader Function Constants */
/*D3DXBUFFER* constants;*/
VSHADERCONSTANTS8 C;
/** Shader Code as char ... */
CONST DWORD* code;
UINT codeLength;
} SHADERDATA8;
} VSHADERDATA8;
/** temporary here waiting for buffer code */
typedef struct VSHADERINPUTDATA8 {
......@@ -125,6 +124,34 @@ typedef struct VSHADEROUTPUTDATA8 {
D3DSHADERVECTOR oPts;
} 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
*/
......@@ -155,6 +182,7 @@ void CreateStateBlock(LPDIRECT3DDEVICE8 iface);
typedef enum _GL_SupportedExt {
/* ARB */
ARB_FRAGMENT_PROGRAM,
ARB_MULTISAMPLE,
ARB_MULTITEXTURE,
ARB_POINT_PARAMETERS,
......@@ -173,6 +201,7 @@ typedef enum _GL_SupportedExt {
EXT_TEXTURE_LOD_BIAS,
EXT_VERTEX_WEIGHTING,
/* NVIDIA */
NV_FRAGMENT_PROGRAM,
NV_VERTEX_PROGRAM,
/* ATI */
EXT_VERTEX_SHADER,
......@@ -190,6 +219,19 @@ typedef enum _GL_VSVersion {
VS_VERSION_FORCE_DWORD = 0x7FFFFFFF
} 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 {
/**
* CAPS Constants
......@@ -198,11 +240,14 @@ typedef struct _GL_Info {
UINT max_textures;
UINT max_clipplanes;
GL_PSVersion ps_arb_version;
GL_PSVersion ps_nv_version;
GL_VSVersion vs_arb_version;
GL_VSVersion vs_nv_version;
GL_VSVersion vs_ati_version;
BOOL supported[25];
BOOL supported[30];
} GL_Info;
#define GL_LIMITS(ExtName) (This->direct3d8->gl_info.max_##ExtName)
......@@ -1017,6 +1062,7 @@ typedef struct SAVEDSTATES {
BOOL vertexShaderConstant;
BOOL vertexShaderDecl;
BOOL pixelShader;
BOOL pixelShaderConstant;
BOOL renderstate[HIGHEST_RENDER_STATE];
BOOL texture_state[8][HIGHEST_TEXTURE_STATE];
BOOL clipplane[MAX_CLIPPLANES];
......@@ -1091,7 +1137,6 @@ struct IDirect3DStateBlockImpl {
/* Pixel Shader */
DWORD PixelShader;
/* TODO: Pixel Shader Constant */
/* Indexed Vertex Blending */
D3DVERTEXBLENDFLAGS vertex_blend;
......@@ -1099,6 +1144,8 @@ struct IDirect3DStateBlockImpl {
/* Vertex Shader Constant */
D3DSHADERVECTOR vertexShaderConstant[D3D8_VSHADER_MAX_CONSTANTS];
/* Pixel Shader Constant */
D3DSHADERVECTOR pixelShaderConstant[D3D8_PSHADER_MAX_CONSTANTS];
};
/* exported Interfaces */
......@@ -1171,7 +1218,7 @@ struct IDirect3DVertexShaderImpl {
DWORD usage; /* 0 || D3DUSAGE_SOFTWAREPROCESSING */
DWORD version;
/* run time datas */
SHADERDATA8* data;
VSHADERDATA8* data;
VSHADERINPUTDATA8 input;
VSHADEROUTPUTDATA8 output;
};
......@@ -1210,18 +1257,21 @@ struct IDirect3DPixelShaderImpl {
/* The device, to be replaced by a IDirect3DDeviceImpl */
IDirect3DDevice8Impl* device;
/* TODO: Pixel Shader */
CONST DWORD* function;
DWORD* function;
UINT functionLength;
DWORD version;
/* run time datas */
SHADERDATA8* data;
PSHADERDATA8* data;
PSHADERINPUTDATA8 input;
PSHADEROUTPUTDATA8 output;
};
/* exported Interfaces */
extern HRESULT WINAPI IDirect3DPixelShaderImpl_GetFunction(IDirect3DPixelShaderImpl* This, VOID* pData, UINT* pSizeOfData);
/* internal Interfaces */
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
*
* to see how not defined it here
*/
void GetSrcAndOpFromValue(DWORD iValue, BOOL isAlphaArg, GLenum* source, GLenum* operand);
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);
GLint D3DFmt2GLIntFmt(IDirect3DDevice8Impl* This, D3DFORMAT fmt);
......
......@@ -681,12 +681,6 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
int dblBuf[] = {GLX_RGBA,
GLX_STENCIL_SIZE, 8, /* 2 */
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};
/* FIXME: Handle stencil appropriately via EnableAutoDepthStencil / AutoDepthStencilFormat */
......@@ -889,8 +883,10 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
*/
memset(&This->gl_info.supported, 0, sizeof(This->gl_info.supported));
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_nv_version = VS_VERSION_NOT_SUPPORTED;
This->gl_info.vs_ati_version = VS_VERSION_NOT_SUPPORTED;
/* Retrieve opengl defaults */
glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max);
......@@ -922,7 +918,11 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
/**
* 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");
This->gl_info.supported[ARB_MULTISAMPLE] = TRUE;
} else if (strcmp(ThisExtn, "GL_ARB_multitexture") == 0) {
......@@ -976,6 +976,10 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
/**
* 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")) {
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);
......
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