- Fixed issue with support 8+ textures in D3D9.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5295 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
c279615ab8
commit
3c57e01700
|
@ -35,7 +35,7 @@ CD3D9Driver::CD3D9Driver(const SIrrlichtCreationParameters& params, io::IFileSys
|
|||
D3DLibrary(0), pID3D(0), pID3DDevice(0), BackBufferSurface(0),
|
||||
DepthStencilSurface(0), WindowId(0), SceneSourceRect(0),
|
||||
LastVertexType((video::E_VERTEX_TYPE)-1), VendorID(0),
|
||||
MaxTextureUnits(0), MaxUserClipPlanes(0),
|
||||
MaxTextureUnits(0), MaxFixedPipelineTextureUnits(0), MaxUserClipPlanes(0),
|
||||
MaxLightDistance(0.f), LastSetLight(-1),
|
||||
ColorFormat(ECF_A8R8G8B8), DeviceLost(false),
|
||||
DriverWasReset(true), OcclusionQuerySupport(false),
|
||||
|
@ -426,7 +426,14 @@ bool CD3D9Driver::initDriver(HWND hwnd, bool pureSoftware)
|
|||
// create materials
|
||||
createMaterialRenderers();
|
||||
|
||||
MaxTextureUnits = core::min_((u32)Caps.MaxSimultaneousTextures, MATERIAL_MAX_TEXTURES);
|
||||
MaxFixedPipelineTextureUnits = (u32)Caps.MaxSimultaneousTextures;
|
||||
|
||||
u32 maxTextureSamplers = (Caps.PixelShaderVersion >= D3DPS_VERSION(2, 0)) ? 16 : (Caps.PixelShaderVersion >= D3DPS_VERSION(1, 4)) ?
|
||||
6 : (Caps.PixelShaderVersion >= D3DPS_VERSION(1, 0)) ? 4 : 0;
|
||||
|
||||
MaxTextureUnits = core::max_(MaxFixedPipelineTextureUnits, maxTextureSamplers);
|
||||
MaxTextureUnits = core::min_(MaxTextureUnits, MATERIAL_MAX_TEXTURES);
|
||||
|
||||
MaxUserClipPlanes = (u32)Caps.MaxUserClipPlanes;
|
||||
OcclusionQuerySupport=(pID3DDevice->CreateQuery(D3DQUERYTYPE_OCCLUSION, NULL) == S_OK);
|
||||
|
||||
|
@ -443,7 +450,7 @@ bool CD3D9Driver::initDriver(HWND hwnd, bool pureSoftware)
|
|||
#endif
|
||||
|
||||
DriverAttributes->setAttribute("MaxTextures", (s32)MaxTextureUnits);
|
||||
DriverAttributes->setAttribute("MaxSupportedTextures", (s32)Caps.MaxSimultaneousTextures);
|
||||
DriverAttributes->setAttribute("MaxSupportedTextures", (s32)MaxTextureUnits);
|
||||
DriverAttributes->setAttribute("MaxLights", (s32)Caps.MaxActiveLights);
|
||||
DriverAttributes->setAttribute("MaxAnisotropy", (s32)Caps.MaxAnisotropy);
|
||||
DriverAttributes->setAttribute("MaxUserClipPlanes", (s32)Caps.MaxUserClipPlanes);
|
||||
|
@ -659,8 +666,7 @@ bool CD3D9Driver::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const
|
|||
|
||||
|
||||
//! sets transformation
|
||||
void CD3D9Driver::setTransform(E_TRANSFORMATION_STATE state,
|
||||
const core::matrix4& mat)
|
||||
void CD3D9Driver::setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat)
|
||||
{
|
||||
Transformation3DChanged = true;
|
||||
|
||||
|
@ -678,15 +684,18 @@ void CD3D9Driver::setTransform(E_TRANSFORMATION_STATE state,
|
|||
case ETS_COUNT:
|
||||
return;
|
||||
default:
|
||||
if (state-ETS_TEXTURE_0 < MATERIAL_MAX_TEXTURES)
|
||||
{
|
||||
if (mat.isIdentity())
|
||||
pID3DDevice->SetTextureStageState( state - ETS_TEXTURE_0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE );
|
||||
else
|
||||
const s32 stage = state - ETS_TEXTURE_0;
|
||||
|
||||
if (stage < MATERIAL_MAX_TEXTURES && stage < static_cast<s32>(MaxFixedPipelineTextureUnits))
|
||||
{
|
||||
pID3DDevice->SetTextureStageState( state - ETS_TEXTURE_0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2 );
|
||||
pID3DDevice->SetTransform((D3DTRANSFORMSTATETYPE)(D3DTS_TEXTURE0+ ( state - ETS_TEXTURE_0 )),
|
||||
(D3DMATRIX*)((void*)mat.pointer()));
|
||||
if (mat.isIdentity())
|
||||
pID3DDevice->SetTextureStageState(stage, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE);
|
||||
else
|
||||
{
|
||||
pID3DDevice->SetTextureStageState(stage, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2);
|
||||
pID3DDevice->SetTransform((D3DTRANSFORMSTATETYPE)(D3DTS_TEXTURE0 + stage), (D3DMATRIX*)((void*)mat.pointer()));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -429,6 +429,7 @@ namespace video
|
|||
u16 VendorID;
|
||||
|
||||
u32 MaxTextureUnits;
|
||||
u32 MaxFixedPipelineTextureUnits;
|
||||
u32 MaxUserClipPlanes;
|
||||
f32 MaxLightDistance;
|
||||
s32 LastSetLight;
|
||||
|
|
Loading…
Reference in New Issue