Make the fixed function pipeline support multiple streams for created
vertex shaders with no function supplied. Also split down draw primitive along the lines of the d3dcore requirements and put in some diagnostic aids.
This commit is contained in:
parent
3f5b518dfc
commit
3cf874bb04
|
@ -16,6 +16,7 @@ C_SRCS = \
|
|||
d3d8_main.c \
|
||||
device.c \
|
||||
directx.c \
|
||||
drawprim.c \
|
||||
indexbuffer.c \
|
||||
resource.c \
|
||||
shader.c \
|
||||
|
|
|
@ -67,6 +67,15 @@ extern void (*wine_tsx11_unlock_ptr)(void);
|
|||
#define HIGHEST_TRANSFORMSTATE 512
|
||||
#define D3DSBT_RECORDED 0xfffffffe
|
||||
|
||||
/* CreateVertexShader can return > 0xFFFF */
|
||||
#define VS_HIGHESTFIXEDFXF 0xF0000000
|
||||
#define VERTEX_SHADER(Handle) \
|
||||
((Handle <= VS_HIGHESTFIXEDFXF) ? ((Handle >= sizeof(VertexShaders) / sizeof(IDirect3DVertexShaderImpl*)) ? NULL : VertexShaders[Handle]) : VertexShaders[Handle - VS_HIGHESTFIXEDFXF])
|
||||
#define VERTEX_SHADER_DECL(Handle) \
|
||||
((Handle <= VS_HIGHESTFIXEDFXF) ? ((Handle >= sizeof(VertexShaderDeclarations) / sizeof(IDirect3DVertexShaderDeclarationImpl*)) ? NULL : VertexShaderDeclarations[Handle]) : VertexShaderDeclarations[Handle - VS_HIGHESTFIXEDFXF])
|
||||
#define PIXEL_SHADER(Handle) \
|
||||
((Handle <= VS_HIGHESTFIXEDFXF) ? ((Handle >= sizeof(PixelShaders) / sizeof(IDirect3DPixelShaderImpl*)) ? NULL : PixelShaders[Handle]) : PixelShaders[Handle - VS_HIGHESTFIXEDFXF])
|
||||
|
||||
/* Direct3D8 Interfaces: */
|
||||
typedef struct IDirect3DBaseTexture8Impl IDirect3DBaseTexture8Impl;
|
||||
typedef struct IDirect3DVolumeTexture8Impl IDirect3DVolumeTexture8Impl;
|
||||
|
@ -112,14 +121,14 @@ typedef struct VSHADERDATA8 {
|
|||
|
||||
/** temporary here waiting for buffer code */
|
||||
typedef struct VSHADERINPUTDATA8 {
|
||||
D3DSHADERVECTOR V[16];
|
||||
D3DSHADERVECTOR V[17];
|
||||
} VSHADERINPUTDATA8;
|
||||
|
||||
/** temporary here waiting for buffer code */
|
||||
typedef struct VSHADEROUTPUTDATA8 {
|
||||
D3DSHADERVECTOR oPos;
|
||||
D3DSHADERVECTOR oD[2];
|
||||
D3DSHADERVECTOR oT[4];
|
||||
D3DSHADERVECTOR oT[8];
|
||||
D3DSHADERVECTOR oFog;
|
||||
D3DSHADERVECTOR oPts;
|
||||
} VSHADEROUTPUTDATA8;
|
||||
|
@ -1064,6 +1073,7 @@ struct IDirect3DStateBlockImpl {
|
|||
/* Stream Source */
|
||||
UINT stream_stride[MAX_STREAMS];
|
||||
IDirect3DVertexBuffer8 *stream_source[MAX_STREAMS];
|
||||
BOOL streamIsUP;
|
||||
|
||||
/* Indices */
|
||||
IDirect3DIndexBuffer8* pIndexData;
|
||||
|
@ -1141,7 +1151,9 @@ struct IDirect3DVertexShaderDeclarationImpl {
|
|||
IDirect3DDevice8Impl* device;
|
||||
|
||||
/** precomputed fvf if simple declaration */
|
||||
DWORD fvf;
|
||||
DWORD fvf[MAX_STREAMS];
|
||||
DWORD allFVF;
|
||||
|
||||
/** dx8 compatible Declaration fields */
|
||||
DWORD* pDeclaration8;
|
||||
DWORD declaration8Length;
|
||||
|
@ -1197,7 +1209,7 @@ extern DWORD WINAPI IDirect3DVertexShaderImpl_GetVersion(IDirect3DVertexShaderIm
|
|||
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_FillVertexShaderInput(IDirect3DDevice8Impl* This, IDirect3DVertexShaderImpl* vshader, const void* vertexFirstStream, DWORD StartVertexIndex, DWORD idxDecal);
|
||||
extern HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInput(IDirect3DDevice8Impl* This, IDirect3DVertexShaderImpl* vshader, DWORD SkipnStrides);
|
||||
|
||||
/* ------------------------ */
|
||||
/* IDirect3DPixelShaderImpl */
|
||||
|
@ -1272,4 +1284,37 @@ const char* debug_d3dressourcetype(D3DRESOURCETYPE res);
|
|||
const char* debug_d3dprimitivetype(D3DPRIMITIVETYPE PrimitiveType);
|
||||
const char* debug_d3dpool(D3DPOOL Pool);
|
||||
|
||||
/* Some #defines for additional diagnostics */
|
||||
#if 0 /* NOTE: Must be 0 in cvs */
|
||||
/* To avoid having to get gigabytes of trace, the following can be compiled in, and at the start
|
||||
of each frame, a check is made for the existance of C:\D3DTRACE, and if if exists d3d trace
|
||||
is enabled, and if it doesnt 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
|
||||
# define SINGLE_FRAME_DEBUGGING
|
||||
# endif
|
||||
/* The following, when enabled, lets you see the makeup of the frame, by drawprimitive calls.
|
||||
A check is made for the existence of C:\D3DSHOWFRAME, and if it exists will write the
|
||||
contents of the back buffer into /tmp/backbuffer_* after each primitive array is drawn
|
||||
for a single frame. At the end of the frame, the file is deleted. */
|
||||
# if 1
|
||||
# define SHOW_FRAME_MAKEUP 1
|
||||
# endif
|
||||
extern BOOL isOn;
|
||||
extern BOOL isDumpingFrames;
|
||||
extern LONG primCounter;
|
||||
#endif
|
||||
|
||||
/* Per-vertex trace: */
|
||||
#if 0 /* NOTE: Must be 0 in cvs */
|
||||
# define VTRACE(A) TRACE A
|
||||
#else
|
||||
# define VTRACE(A)
|
||||
#endif
|
||||
|
||||
#define TRACE_VECTOR(name) TRACE( #name "=(%f, %f, %f, %f)\n", name.x, name.y, name.z, name.w);
|
||||
#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);
|
||||
|
||||
#endif /* __WINE_D3DX8_PRIVATE_H */
|
||||
|
|
|
@ -268,4 +268,44 @@ typedef enum _GL_PSVersion {
|
|||
#define WINAPI __stdcall
|
||||
#define APIENTRY WINAPI
|
||||
|
||||
/* Routine common to the draw primitive and draw indexed primitive routines */
|
||||
void drawPrimitive(LPDIRECT3DDEVICE8 iface,
|
||||
int PrimitiveType,
|
||||
long NumPrimitives,
|
||||
|
||||
/* for Indexed: */
|
||||
long StartVertexIndex,
|
||||
long StartIdx,
|
||||
short idxBytes,
|
||||
const void *idxData,
|
||||
int minIndex);
|
||||
|
||||
/* Structures required to draw primitives */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct Direct3DStridedData {
|
||||
BYTE *lpData; /* Pointer to start of data */
|
||||
DWORD dwStride; /* Stride between occurances of this data */
|
||||
DWORD dwType; /* Type (as in D3DVSDT_TYPE) */
|
||||
} Direct3DStridedData;
|
||||
|
||||
typedef struct Direct3DVertexStridedData {
|
||||
union {
|
||||
struct {
|
||||
Direct3DStridedData position;
|
||||
Direct3DStridedData blendWeights;
|
||||
Direct3DStridedData blendMatrixIndices;
|
||||
Direct3DStridedData normal;
|
||||
Direct3DStridedData pSize;
|
||||
Direct3DStridedData diffuse;
|
||||
Direct3DStridedData specular;
|
||||
Direct3DStridedData texCoords[8];
|
||||
} DUMMYSTRUCTNAME;
|
||||
Direct3DStridedData input[16]; /* Indexed by constants in D3DVSDE_REGISTER */
|
||||
} DUMMYUNIONNAME;
|
||||
} Direct3DVertexStridedData;
|
||||
|
||||
#endif /* __WINE_D3DCORE_GL_H */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -34,12 +34,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
|
|||
|
||||
/* Shader debugging - Change the following line to enable debugging of software
|
||||
vertex shaders */
|
||||
#if 0
|
||||
#if 0 /* Must not be 1 in cvs version */
|
||||
# define VSTRACE(A) TRACE A
|
||||
# define TRACE_VECTOR(name) TRACE( #name "=(%f, %f, %f, %f)\n", name.x, name.y, name.z, name.w)
|
||||
# define TRACE_VSVECTOR(name) TRACE( #name "=(%f, %f, %f, %f)\n", name.x, name.y, name.z, name.w)
|
||||
#else
|
||||
# define VSTRACE(A)
|
||||
# define TRACE_VECTOR(name)
|
||||
# define TRACE_VSVECTOR(name)
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -584,30 +584,30 @@ HRESULT WINAPI IDirect3DVertexShaderImpl_ExecuteSW(IDirect3DVertexShaderImpl* vs
|
|||
memset(R, 0, 12 * sizeof(D3DSHADERVECTOR));
|
||||
|
||||
/* vshader_program_parse(vshader); */
|
||||
#if 0
|
||||
#if 0 /* Must not be 1 in cvs */
|
||||
TRACE("Input:\n");
|
||||
TRACE_VECTOR(vshader->data->C[0]);
|
||||
TRACE_VECTOR(vshader->data->C[1]);
|
||||
TRACE_VECTOR(vshader->data->C[2]);
|
||||
TRACE_VECTOR(vshader->data->C[3]);
|
||||
TRACE_VECTOR(vshader->data->C[4]);
|
||||
TRACE_VECTOR(vshader->data->C[5]);
|
||||
TRACE_VECTOR(vshader->data->C[6]);
|
||||
TRACE_VECTOR(vshader->data->C[7]);
|
||||
TRACE_VECTOR(vshader->data->C[8]);
|
||||
TRACE_VECTOR(vshader->data->C[64]);
|
||||
TRACE_VECTOR(input->V[D3DVSDE_POSITION]);
|
||||
TRACE_VECTOR(input->V[D3DVSDE_BLENDWEIGHT]);
|
||||
TRACE_VECTOR(input->V[D3DVSDE_BLENDINDICES]);
|
||||
TRACE_VECTOR(input->V[D3DVSDE_NORMAL]);
|
||||
TRACE_VECTOR(input->V[D3DVSDE_PSIZE]);
|
||||
TRACE_VECTOR(input->V[D3DVSDE_DIFFUSE]);
|
||||
TRACE_VECTOR(input->V[D3DVSDE_SPECULAR]);
|
||||
TRACE_VECTOR(input->V[D3DVSDE_TEXCOORD0]);
|
||||
TRACE_VECTOR(input->V[D3DVSDE_TEXCOORD1]);
|
||||
TRACE_VSVECTOR(vshader->data->C[0]);
|
||||
TRACE_VSVECTOR(vshader->data->C[1]);
|
||||
TRACE_VSVECTOR(vshader->data->C[2]);
|
||||
TRACE_VSVECTOR(vshader->data->C[3]);
|
||||
TRACE_VSVECTOR(vshader->data->C[4]);
|
||||
TRACE_VSVECTOR(vshader->data->C[5]);
|
||||
TRACE_VSVECTOR(vshader->data->C[6]);
|
||||
TRACE_VSVECTOR(vshader->data->C[7]);
|
||||
TRACE_VSVECTOR(vshader->data->C[8]);
|
||||
TRACE_VSVECTOR(vshader->data->C[64]);
|
||||
TRACE_VSVECTOR(input->V[D3DVSDE_POSITION]);
|
||||
TRACE_VSVECTOR(input->V[D3DVSDE_BLENDWEIGHT]);
|
||||
TRACE_VSVECTOR(input->V[D3DVSDE_BLENDINDICES]);
|
||||
TRACE_VSVECTOR(input->V[D3DVSDE_NORMAL]);
|
||||
TRACE_VSVECTOR(input->V[D3DVSDE_PSIZE]);
|
||||
TRACE_VSVECTOR(input->V[D3DVSDE_DIFFUSE]);
|
||||
TRACE_VSVECTOR(input->V[D3DVSDE_SPECULAR]);
|
||||
TRACE_VSVECTOR(input->V[D3DVSDE_TEXCOORD0]);
|
||||
TRACE_VSVECTOR(input->V[D3DVSDE_TEXCOORD1]);
|
||||
#endif
|
||||
|
||||
TRACE_VECTOR(vshader->data->C[64]);
|
||||
TRACE_VSVECTOR(vshader->data->C[64]);
|
||||
|
||||
/* the first dword is the version tag */
|
||||
/* TODO: parse it */
|
||||
|
@ -756,17 +756,17 @@ HRESULT WINAPI IDirect3DVertexShaderImpl_ExecuteSW(IDirect3DVertexShaderImpl* vs
|
|||
}
|
||||
|
||||
#if 0
|
||||
TRACE_VECTOR(output->oPos);
|
||||
TRACE_VECTOR(output->oD[0]);
|
||||
TRACE_VECTOR(output->oD[1]);
|
||||
TRACE_VECTOR(output->oT[0]);
|
||||
TRACE_VECTOR(output->oT[1]);
|
||||
TRACE_VECTOR(R[0]);
|
||||
TRACE_VECTOR(R[1]);
|
||||
TRACE_VECTOR(R[2]);
|
||||
TRACE_VECTOR(R[3]);
|
||||
TRACE_VECTOR(R[4]);
|
||||
TRACE_VECTOR(R[5]);
|
||||
TRACE_VSVECTOR(output->oPos);
|
||||
TRACE_VSVECTOR(output->oD[0]);
|
||||
TRACE_VSVECTOR(output->oD[1]);
|
||||
TRACE_VSVECTOR(output->oT[0]);
|
||||
TRACE_VSVECTOR(output->oT[1]);
|
||||
TRACE_VSVECTOR(R[0]);
|
||||
TRACE_VSVECTOR(R[1]);
|
||||
TRACE_VSVECTOR(R[2]);
|
||||
TRACE_VSVECTOR(R[3]);
|
||||
TRACE_VSVECTOR(R[4]);
|
||||
TRACE_VSVECTOR(R[5]);
|
||||
#endif
|
||||
|
||||
/* to next opcode token */
|
||||
|
@ -774,26 +774,26 @@ HRESULT WINAPI IDirect3DVertexShaderImpl_ExecuteSW(IDirect3DVertexShaderImpl* vs
|
|||
}
|
||||
#if 0
|
||||
TRACE("End of current instruction:\n");
|
||||
TRACE_VECTOR(output->oPos);
|
||||
TRACE_VECTOR(output->oD[0]);
|
||||
TRACE_VECTOR(output->oD[1]);
|
||||
TRACE_VECTOR(output->oT[0]);
|
||||
TRACE_VECTOR(output->oT[1]);
|
||||
TRACE_VECTOR(R[0]);
|
||||
TRACE_VECTOR(R[1]);
|
||||
TRACE_VECTOR(R[2]);
|
||||
TRACE_VECTOR(R[3]);
|
||||
TRACE_VECTOR(R[4]);
|
||||
TRACE_VECTOR(R[5]);
|
||||
TRACE_VSVECTOR(output->oPos);
|
||||
TRACE_VSVECTOR(output->oD[0]);
|
||||
TRACE_VSVECTOR(output->oD[1]);
|
||||
TRACE_VSVECTOR(output->oT[0]);
|
||||
TRACE_VSVECTOR(output->oT[1]);
|
||||
TRACE_VSVECTOR(R[0]);
|
||||
TRACE_VSVECTOR(R[1]);
|
||||
TRACE_VSVECTOR(R[2]);
|
||||
TRACE_VSVECTOR(R[3]);
|
||||
TRACE_VSVECTOR(R[4]);
|
||||
TRACE_VSVECTOR(R[5]);
|
||||
#endif
|
||||
}
|
||||
#if 0
|
||||
#if 0 /* Must not be 1 in cvs */
|
||||
TRACE("Output:\n");
|
||||
TRACE_VECTOR(output->oPos);
|
||||
TRACE_VECTOR(output->oD[0]);
|
||||
TRACE_VECTOR(output->oD[1]);
|
||||
TRACE_VECTOR(output->oT[0]);
|
||||
TRACE_VECTOR(output->oT[1]);
|
||||
TRACE_VSVECTOR(output->oPos);
|
||||
TRACE_VSVECTOR(output->oD[0]);
|
||||
TRACE_VSVECTOR(output->oD[1]);
|
||||
TRACE_VSVECTOR(output->oT[0]);
|
||||
TRACE_VSVECTOR(output->oT[1]);
|
||||
#endif
|
||||
return D3D_OK;
|
||||
}
|
||||
|
|
|
@ -31,14 +31,6 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
|
||||
|
||||
/* trace: */
|
||||
#if 0
|
||||
# define VTRACE(A) TRACE A
|
||||
#else
|
||||
# define VTRACE(A)
|
||||
#endif
|
||||
|
||||
|
||||
/* IDirect3DVolume IUnknown parts follow: */
|
||||
HRESULT WINAPI IDirect3DSurface8Impl_QueryInterface(LPDIRECT3DSURFACE8 iface,REFIID riid,LPVOID *ppobj)
|
||||
{
|
||||
|
|
|
@ -35,13 +35,6 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
||||
|
||||
|
||||
#if 0
|
||||
# define VTRACE(A) TRACE A
|
||||
#else
|
||||
# define VTRACE(A)
|
||||
#endif
|
||||
|
||||
const char* debug_d3ddevicetype(D3DDEVTYPE devtype) {
|
||||
switch (devtype) {
|
||||
#define DEVTYPE_TO_STR(dev) case dev: return #dev
|
||||
|
|
|
@ -203,6 +203,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_CreateVertexShaderDeclaration8(IDirect3DDevic
|
|||
/*object->lpVtbl = &Direct3DVextexShaderDeclaration8_Vtbl;*/
|
||||
object->device = This; /* FIXME: AddRef(This) */
|
||||
object->ref = 1;
|
||||
object->allFVF = 0;
|
||||
|
||||
while (D3DVSD_END() != *pToken) {
|
||||
token = *pToken;
|
||||
|
@ -215,16 +216,27 @@ HRESULT WINAPI IDirect3DDeviceImpl_CreateVertexShaderDeclaration8(IDirect3DDevic
|
|||
* how really works streams,
|
||||
* in DolphinVS dx8 dsk sample they seems to decal reg numbers !!!
|
||||
*/
|
||||
DWORD oldStream = stream;
|
||||
stream = ((token & D3DVSD_STREAMNUMBERMASK) >> D3DVSD_STREAMNUMBERSHIFT);
|
||||
|
||||
if (stream > 0) {
|
||||
/** fvf cannot map mutliple streams, so invalid fvf computing */
|
||||
invalid_fvf = TRUE;
|
||||
/* 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) - stream;
|
||||
DWORD reg = ((token & D3DVSD_VERTEXREGMASK) >> D3DVSD_VERTEXREGSHIFT);
|
||||
|
||||
switch (reg) {
|
||||
case D3DVSDE_POSITION:
|
||||
|
@ -305,40 +317,54 @@ HRESULT WINAPI IDirect3DDeviceImpl_CreateVertexShaderDeclaration8(IDirect3DDevic
|
|||
}
|
||||
break;
|
||||
|
||||
/**
|
||||
* TODO: for TEX* only FLOAT2 supported
|
||||
* by default using texture type info
|
||||
*/
|
||||
case D3DVSDE_TEXCOORD0: tex = max(tex, D3DFVF_TEX1); break;
|
||||
case D3DVSDE_TEXCOORD1: tex = max(tex, D3DFVF_TEX2); break;
|
||||
case D3DVSDE_TEXCOORD2: tex = max(tex, D3DFVF_TEX3); break;
|
||||
case D3DVSDE_TEXCOORD3: tex = max(tex, D3DFVF_TEX4); break;
|
||||
case D3DVSDE_TEXCOORD4: tex = max(tex, D3DFVF_TEX5); break;
|
||||
case D3DVSDE_TEXCOORD5: tex = max(tex, D3DFVF_TEX6); break;
|
||||
case D3DVSDE_TEXCOORD6: tex = max(tex, D3DFVF_TEX7); break;
|
||||
case D3DVSDE_TEXCOORD7: tex = max(tex, D3DFVF_TEX8); 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:
|
||||
/** errooooorr mismatched use of a register, invalid fvf computing */
|
||||
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);
|
||||
TRACE("[%lu] registers in VertexShader declaration not supported yet (token:0x%08lx)\n", reg, token);
|
||||
break;
|
||||
}
|
||||
/*TRACE("VertexShader declaration define %x as current FVF\n", fvf);*/
|
||||
TRACE("VertexShader declaration define %lx as current FVF\n", fvf);
|
||||
}
|
||||
len += tokenlen;
|
||||
pToken += tokenlen;
|
||||
}
|
||||
if (tex > 0) {
|
||||
/*TRACE("VertexShader declaration define %x as texture level\n", tex);*/
|
||||
fvf |= tex;
|
||||
}
|
||||
/* here D3DVSD_END() */
|
||||
len += Direct3DVextexShaderDeclarationImpl_ParseToken(pToken);
|
||||
|
||||
/* copy fvf if valid */
|
||||
if (FALSE == invalid_fvf)
|
||||
object->fvf = fvf;
|
||||
else
|
||||
object->fvf = 0;
|
||||
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 */
|
||||
|
@ -352,9 +378,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_CreateVertexShaderDeclaration8(IDirect3DDevic
|
|||
|
||||
HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInput(IDirect3DDevice8Impl* This,
|
||||
IDirect3DVertexShaderImpl* vshader,
|
||||
const void* vertexFirstStream,
|
||||
DWORD StartVertexIndex,
|
||||
DWORD idxDecal) {
|
||||
DWORD SkipnStrides) {
|
||||
/** parser data */
|
||||
const DWORD* pToken = This->UpdateStateBlock->vertexShaderDecl->pDeclaration8;
|
||||
DWORD stream = 0;
|
||||
|
@ -367,7 +391,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInput(IDirect3DDevice8Impl* T
|
|||
SHORT u, v, r, t;
|
||||
DWORD dw;
|
||||
|
||||
TRACE("(%p) - This:%p - stream:%p, startIdx=%lu, idxDecal=%lu\n", vshader, This, vertexFirstStream, StartVertexIndex, idxDecal);
|
||||
TRACE("(%p) - This:%p, skipstrides=%lu\n", vshader, This, SkipnStrides);
|
||||
|
||||
while (D3DVSD_END() != *pToken) {
|
||||
token = *pToken;
|
||||
|
@ -376,7 +400,6 @@ HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInput(IDirect3DDevice8Impl* T
|
|||
/** FVF generation block */
|
||||
if (D3DVSD_TOKEN_STREAM == tokentype && 0 == (D3DVSD_STREAMTESSMASK & token)) {
|
||||
IDirect3DVertexBuffer8* pVB;
|
||||
const char* startVtx = NULL;
|
||||
int skip = 0;
|
||||
|
||||
++pToken;
|
||||
|
@ -385,25 +408,21 @@ HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInput(IDirect3DDevice8Impl* T
|
|||
* 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 (0 == stream) {
|
||||
skip = This->StateBlock->stream_stride[0];
|
||||
startVtx = (const char*) vertexFirstStream + (StartVertexIndex * skip);
|
||||
curPos = startVtx + idxDecal;
|
||||
/*TRACE(" using stream[%lu] with %lu decal => curPos %p\n", stream, idxDecal, curPos);*/
|
||||
} else {
|
||||
skip = This->StateBlock->stream_stride[stream];
|
||||
pVB = This->StateBlock->stream_source[stream];
|
||||
|
||||
if (NULL == pVB) {
|
||||
if (NULL == pVB) {
|
||||
ERR("using unitialised stream[%lu]\n", stream);
|
||||
return D3DERR_INVALIDCALL;
|
||||
} else {
|
||||
startVtx = ((IDirect3DVertexBuffer8Impl*) pVB)->allocatedMemory + (StartVertexIndex * skip);
|
||||
/** do we need to decal if we use idxBuffer */
|
||||
curPos = startVtx + idxDecal;
|
||||
/*TRACE(" using stream[%lu] with %lu decal\n", stream, idxDecal);*/
|
||||
}
|
||||
} else {
|
||||
if (This->StateBlock->streamIsUP == TRUE) {
|
||||
curPos = ((char *) 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 */
|
||||
|
|
Loading…
Reference in New Issue