port: GrpDevice verbatim 40250 (Create over the recording device, declaration vertex shaders -> stream-0 FVF)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
b5d413afa6
commit
65c43a84cd
@@ -299,6 +299,7 @@ public:
|
||||
caps->DevCaps = D3DDEVCAPS_HWTRANSFORMANDLIGHT;
|
||||
caps->VertexShaderVersion = D3DVS_VERSION(1, 1);
|
||||
caps->PrimitiveMiscCaps = D3DPMISCCAPS_CLIPTLVERTS;
|
||||
caps->VertexProcessingCaps = D3DVTXPCAPS_TEXGEN | D3DVTXPCAPS_DIRECTIONALLIGHTS | D3DVTXPCAPS_POSITIONALLIGHTS;
|
||||
caps->MaxActiveLights = 8;
|
||||
caps->MaxTextureBlendStages = 4;
|
||||
caps->MaxSimultaneousTextures = 4;
|
||||
@@ -515,12 +516,38 @@ public:
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT SetPixelShader(DWORD) override { return S_OK; }
|
||||
// PORT: no programmable vertex shaders; 40250 falls back to its FVF when creation fails.
|
||||
HRESULT CreateVertexShader(const DWORD*, const DWORD*, DWORD* pHandle, DWORD) override
|
||||
// PORT: no programmable vertex shaders (a pFunction fails; 40250 falls back to its FVF). A declaration
|
||||
// alone describes fixed-function input, so its handle is the FVF of stream 0 (the vertices the device
|
||||
// records): CGraphicDevice's PT/PNT/PNT2 stream shaders.
|
||||
HRESULT CreateVertexShader(const DWORD* pDeclaration, const DWORD* pFunction, DWORD* pHandle, DWORD) override
|
||||
{
|
||||
if (pHandle)
|
||||
*pHandle = 0;
|
||||
return E_FAIL;
|
||||
if (pFunction || !pDeclaration || !pHandle)
|
||||
return E_FAIL;
|
||||
DWORD fvf = 0, texCount = 0, stream = 0;
|
||||
for (const DWORD* token = pDeclaration; *token != D3DVSD_END(); ++token)
|
||||
{
|
||||
const DWORD type = (*token & D3DVSD_TOKENTYPEMASK) >> D3DVSD_TOKENTYPESHIFT;
|
||||
if (type == D3DVSD_TOKEN_STREAM)
|
||||
stream = *token & 0xF;
|
||||
else if (type == D3DVSD_TOKEN_STREAMDATA && stream == 0)
|
||||
{
|
||||
const DWORD reg = *token & 0x1F;
|
||||
if (reg == D3DVSDE_POSITION)
|
||||
fvf |= D3DFVF_XYZ;
|
||||
else if (reg == D3DVSDE_NORMAL)
|
||||
fvf |= D3DFVF_NORMAL;
|
||||
else if (reg == D3DVSDE_DIFFUSE)
|
||||
fvf |= D3DFVF_DIFFUSE;
|
||||
else if (reg >= D3DVSDE_TEXCOORD0 && reg <= D3DVSDE_TEXCOORD3)
|
||||
texCount = std::max<DWORD>(texCount, reg - D3DVSDE_TEXCOORD0 + 1);
|
||||
else
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
*pHandle = fvf | (texCount << D3DFVF_TEXCOUNT_SHIFT);
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT DeleteVertexShader(DWORD) override { return S_OK; }
|
||||
HRESULT SetVertexShaderConstant(DWORD, const void*, DWORD) override { return S_OK; }
|
||||
|
||||
Reference in New Issue
Block a user