This commit is contained in:
Aaron Robinson 2004-03-28 11:28:17 +00:00
parent 6f17caa9ae
commit 3c746e0983
5 changed files with 40 additions and 11 deletions

BIN
Cxbx.opt

Binary file not shown.

View File

@ -2462,9 +2462,12 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetPixelShader
// simplest possible pixel shader (diffuse only)
static const char szDiffusePixelShader[] =
"ps.1.1 \n"
"tex t0 \n" // use texture 0
"tex t1 \n" // use texture 1
"mul r0, t0, t1 \n";// r0 = c0*t0
" \n"
"tex t0 \n"
"tex t1 \n"
" \n"
// "mov r0, v0 \n";
"mul r0, t0, t1 \n";
LPD3DXBUFFER pShader = 0;
LPD3DXBUFFER pErrors = 0;
@ -2476,13 +2479,14 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetPixelShader
hRet = g_pD3DDevice8->CreatePixelShader((DWORD*)pShader->GetBufferPointer(), &dwHandle);
if(FAILED(hRet))
EmuCleanup("Could not create pixel shader");
EmuWarning("Could not create pixel shader");
}
hRet = g_pD3DDevice8->SetPixelShader(dwHandle);
if(!FAILED(hRet))
hRet = g_pD3DDevice8->SetPixelShader(dwHandle);
if(FAILED(hRet))
EmuCleanup("Could not set pixel shader!");
EmuWarning("Could not set pixel shader!");
g_bFakePixelShaderLoaded = TRUE;
}

View File

@ -63,7 +63,7 @@ void XTL::EmuExecutePushBuffer
X_D3DPRIMITIVETYPE XBPrimitiveType = -1;
// TODO: This technically should be enabled
//XTL::EmuUpdateDeferredStates();
XTL::EmuUpdateDeferredStates();
// g_pD3DDevice8->Clear(0, NULL, D3DCLEAR_ZBUFFER, 0, 1.0, NULL);
// g_pD3DDevice8->SetRenderState(D3DRS_ZENABLE, FALSE);
@ -236,6 +236,29 @@ void XTL::EmuExecutePushBuffer
{
if(IsValidCurrentShader())
{
//g_pD3DDevice8->SetVertexShader(D3DFVF_XYZ | D3DFVF_TEX0);
/* these don't help the turok lighting problems :[
g_pD3DDevice8->SetRenderState(D3DRS_FOGENABLE, FALSE);
g_pD3DDevice8->SetRenderState(D3DRS_FOGTABLEMODE, D3DFOG_NONE);
g_pD3DDevice8->SetRenderState(D3DRS_SPECULARENABLE, FALSE);
g_pD3DDevice8->SetRenderState(D3DRS_ZVISIBLE, FALSE);
g_pD3DDevice8->SetRenderState(D3DRS_RANGEFOGENABLE, FALSE);
g_pD3DDevice8->SetRenderState(D3DRS_AMBIENT, RGB(255,125,125));
g_pD3DDevice8->SetRenderState(D3DRS_AMBIENTMATERIALSOURCE, D3DMCS_COLOR1);
D3DMATERIAL8 mtrl;
ZeroMemory( &mtrl, sizeof(D3DMATERIAL8) );
mtrl.Diffuse.r = mtrl.Ambient.r = mtrl.Specular.r = 1.0f;
mtrl.Diffuse.g = mtrl.Ambient.g = mtrl.Specular.r = 0.0f;
mtrl.Diffuse.b = mtrl.Ambient.b = mtrl.Specular.r = 0.0f;
mtrl.Diffuse.a = mtrl.Ambient.a = mtrl.Specular.r = 1.0f;
g_pD3DDevice8->SetMaterial(&mtrl);
//*/
g_pD3DDevice8->DrawIndexedPrimitive
(
PCPrimitiveType, 0, dwCount*2, 0, EmuD3DVertex2PrimitiveCount(XBPrimitiveType, dwCount*2)

View File

@ -299,10 +299,12 @@ void XTL::EmuUpdateDeferredStates()
if(g_bFakePixelShaderLoaded)
{
for(int r=0;r<4;r++)
for(int v=0;v<4;v++)
{
g_pD3DDevice8->SetTextureStageState(r, D3DTSS_COLOROP, D3DTOP_DISABLE);
g_pD3DDevice8->SetTextureStageState(r, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
g_pD3DDevice8->SetTextureStageState(v, D3DTSS_COLOROP, D3DTOP_DISABLE);
g_pD3DDevice8->SetTextureStageState(v, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
}
g_pD3DDevice8->SetRenderState(D3DRS_FOGENABLE, FALSE);
}
}

View File

@ -71,7 +71,7 @@ extern PVOID g_pfnThreadNotification = NULL;
// MmAllocateContiguousMemory[Ex] allocate unaligned data and then manually align the pointer,
// returning this to the Xbe. The original pointer must be retained in order to properly free.
#define ALIGN_CACHE_SIZE 256
#define ALIGN_CACHE_SIZE 1024
struct _AlignCache
{
PVOID pOrigPtr;