Commit 5f395061 authored by Raphael Junqueira's avatar Raphael Junqueira Committed by Alexandre Julliard

- the hardware GL vendors (NVidia and ATI) can support more than 95

constants (the Mesa bug) and VRally use the 0..95 indexes so fix it - fix normalize for some HW VertexShader inputs - trying to fix the combination of NV_texture_combine_4 with texture_combine_EXT (impl of D3DTOP_DISABLE, D3DTOP_MODULATE for NV_texture_combine_4) - if shaders disabled declare to support 0 for MaxVertexShaderConst.
parent 0a5ad9eb
......@@ -2,4 +2,4 @@
@ stdcall DebugSetMute()
@ stdcall Direct3DCreate8(long)
@ stdcall ValidatePixelShader(ptr ptr)
@ stdcall ValidateVertexShader(ptr ptr)
@ stdcall ValidateVertexShader(ptr)
......@@ -696,6 +696,7 @@ typedef enum _GL_SupportedExt {
typedef enum _GL_Vendors {
VENDOR_WINE = 0x0,
VENDOR_MESA = 0x1,
VENDOR_ATI = 0x1002,
VENDOR_NVIDIA = 0x10de
} GL_Vendors;
......
......@@ -501,8 +501,10 @@ HRESULT WINAPI IDirect3D8Impl_CheckDeviceFormat (LPDIRECT3D8 iface,
case D3DFMT_A4L4:
/* Bump */
/*case D3DFMT_V8U8:*/
/*case D3DFMT_V16U16:*/
#if 0
case D3DFMT_V8U8:
case D3DFMT_V16U16:
#endif
case D3DFMT_L6V5U5:
case D3DFMT_X8L8V8U8:
case D3DFMT_Q8W8V8U8:
......@@ -784,10 +786,13 @@ HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Adapter, D
D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA |
D3DTEXOPCAPS_BLENDTEXTUREALPHAPM;
}
#if 0
pCaps->TextureOpCaps |= D3DTEXOPCAPS_BUMPENVMAP;
/* FIXME: Add
D3DTEXOPCAPS_BUMPENVMAPLUMINANCE
D3DTEXOPCAPS_PREMODULATE */
#endif
if (gotContext) {
GLint gl_max;
......@@ -843,11 +848,19 @@ HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Adapter, D
pCaps->MaxStreams = MAX_STREAMS;
pCaps->MaxStreamStride = 1024;
if (((vs_mode == VS_HW) && GL_SUPPORT(ARB_VERTEX_PROGRAM)) || (vs_mode == VS_SW) || (DeviceType == D3DDEVTYPE_REF))
pCaps->VertexShaderVersion = D3DVS_VERSION(1,1);
else
pCaps->VertexShaderVersion = 0;
pCaps->MaxVertexShaderConst = D3D8_VSHADER_MAX_CONSTANTS;
if (((vs_mode == VS_HW) && GL_SUPPORT(ARB_VERTEX_PROGRAM)) || (vs_mode == VS_SW) || (DeviceType == D3DDEVTYPE_REF)) {
pCaps->VertexShaderVersion = D3DVS_VERSION(1,1);
if (This->gl_info.gl_vendor == VENDOR_MESA ||
This->gl_info.gl_vendor == VENDOR_WINE) {
pCaps->MaxVertexShaderConst = 95;
} else {
pCaps->MaxVertexShaderConst = D3D8_VSHADER_MAX_CONSTANTS;
}
} else {
pCaps->VertexShaderVersion = 0;
pCaps->MaxVertexShaderConst = 0;
}
if ((ps_mode == PS_HW) && GL_SUPPORT(ARB_FRAGMENT_PROGRAM) && (DeviceType != D3DDEVTYPE_REF)) {
pCaps->PixelShaderVersion = D3DPS_VERSION(1,4);
......
......@@ -747,11 +747,15 @@ inline static VOID IDirect3DVertexShaderImpl_GenerateProgramArbHW(IDirect3DVerte
}
/* Due to the dynamic constants binding mechanism, we need to declare
* all the constants for relative addressing. */
/* Mesa supports only 95 constants for VS1.X although we should have at least 96.
* Let's declare max constants minus one for now. */
sprintf(tmpLine, "PARAM C[%d] = { program.env[0..%d] };\n", numConstants-1, numConstants-2);
TRACE("GL HW (%u) : %s", strlen(pgmStr), tmpLine); /* Don't add \n to this line as already in tmpLine */
/* Mesa supports nly 95 constants for VS1.X although we should have at least 96. */
if (This->direct3d8->gl_info.gl_vendor == VENDOR_MESA ||
This->direct3d8->gl_info.gl_vendor == VENDOR_WINE) {
numConstants = 95;
}
sprintf(tmpLine, "PARAM C[%d] = { program.env[0..%d] };\n", numConstants, numConstants-1);
TRACE_(d3d_hw_shader)("GL HW (%u,%u) : %s", lineNum, strlen(pgmStr), tmpLine); /* Don't add \n to this line as already in tmpLine */
strcat(pgmStr, tmpLine);
++lineNum;
++pToken;
continue;
......@@ -2361,9 +2365,9 @@ HRESULT WINAPI IDirect3DPixelShaderImpl_GetConstantF(IDirect3DPixelShaderImpl* T
/***********************************************************************
* ValidateVertexShader (D3D8.@)
*/
BOOL WINAPI ValidateVertexShader(LPVOID what, LPVOID toto) {
FIXME("(void): stub: %p %p\n", what, toto);
return TRUE;
BOOL WINAPI ValidateVertexShader(LPVOID what) {
FIXME("(void): stub: %p\n", what);
return 0;
}
/***********************************************************************
......
......@@ -673,7 +673,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInputArbHW(IDirect3DDevice8Im
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_FALSE, skip, curPos));
GL_EXTCALL(glVertexAttribPointerARB(reg, 4, GL_UNSIGNED_BYTE, GL_TRUE, skip, curPos));
GL_EXTCALL(glEnableVertexAttribArrayARB(reg));
curPos = curPos + 4*sizeof(BYTE);
break;
......@@ -694,7 +694,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInputArbHW(IDirect3DDevice8Im
case D3DVSDT_UBYTE4:
FIXME("D3DVSDT_UBYTE4 in hw shader - To confirm\n");
GL_EXTCALL(glVertexAttribPointerARB(reg, 4, GL_UNSIGNED_BYTE, GL_FALSE, skip, curPos));
GL_EXTCALL(glVertexAttribPointerARB(reg, 4, GL_UNSIGNED_BYTE, GL_TRUE, skip, curPos));
GL_EXTCALL(glEnableVertexAttribArrayARB(reg));
curPos = curPos + 4*sizeof(BYTE);
break;
......
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