Commit 376c58fe authored by hybrid's avatar hybrid

The d3d drivers also suffered from the shader compilation failure problem, now fixed.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1343 dfc29bdd-3216-0410-991c-e03cc46cb475
parent a5286dbb
......@@ -156,8 +156,12 @@ namespace video
// compile shaders on our own
init(outMaterialTypeNr, D3D8_NORMAL_MAP_VSH, D3D8_NORMAL_MAP_PSH, EVT_TANGENTS);
}
// something failed, use base material
if (-1==outMaterialTypeNr)
driver->addMaterialRenderer(this);
}
CD3D8NormalMapRenderer::~CD3D8NormalMapRenderer()
{
if (CallBack == this)
......@@ -171,6 +175,7 @@ namespace video
}
}
bool CD3D8NormalMapRenderer::OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype)
{
if (vtxtype != video::EVT_TANGENTS)
......
......@@ -190,8 +190,12 @@ namespace video
// compile shaders on our own
init(outMaterialTypeNr, D3D8_PARALLAX_MAP_VSH, D3D8_PARALLAX_MAP_PSH, EVT_TANGENTS);
}
// something failed, use base material
if (-1==outMaterialTypeNr)
driver->addMaterialRenderer(this);
}
CD3D8ParallaxMapRenderer::~CD3D8ParallaxMapRenderer()
{
if (CallBack == this)
......@@ -205,6 +209,7 @@ namespace video
}
}
bool CD3D8ParallaxMapRenderer::OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype)
{
if (vtxtype != video::EVT_TANGENTS)
......@@ -216,6 +221,7 @@ namespace video
return CD3D8ShaderMaterialRenderer::OnRender(service, vtxtype);
}
void CD3D8ParallaxMapRenderer::OnSetMaterial(const video::SMaterial& material,
const video::SMaterial& lastMaterial,
bool resetAllRenderstates, video::IMaterialRendererServices* services)
......@@ -226,6 +232,7 @@ namespace video
CurrentScale = material.MaterialTypeParam;
}
//! Returns the render capability of the material.
s32 CD3D8ParallaxMapRenderer::getRenderCapability() const
{
......@@ -237,8 +244,8 @@ namespace video
}
//! Called by the engine when the vertex and/or pixel shader constants for an
//! material renderer should be set.
//! Called by the engine when the vertex and/or pixel shader constants
//! for an material renderer should be set.
void CD3D8ParallaxMapRenderer::OnSetConstants(IMaterialRendererServices* services, s32 userData)
{
video::IVideoDriver* driver = services->getVideoDriver();
......@@ -268,7 +275,7 @@ namespace video
// here we've got to fetch the fixed function lights from the driver
// and set them as constants
u32 cnt = driver->getDynamicLightCount();
const u32 cnt = driver->getDynamicLightCount();
for (u32 i=0; i<2; ++i)
{
......
......@@ -168,7 +168,6 @@ namespace video
s32& outMaterialTypeNr, IMaterialRenderer* baseMaterial)
: CD3D9ShaderMaterialRenderer(d3ddev, driver, 0, baseMaterial)
{
#ifdef _DEBUG
setDebugName("CD3D9NormalMapRenderer");
#endif
......@@ -178,8 +177,9 @@ namespace video
CallBack = this;
// basicly, this thing simply compiles these hardcoded shaders if the
// hardware is able to do them, otherwise it maps to the base material
// basically, this thing simply compiles the hardcoded shaders
// if the hardware is able to do them, otherwise it maps to the
// base material
if (!driver->queryFeature(video::EVDF_PIXEL_SHADER_1_1) ||
!driver->queryFeature(video::EVDF_VERTEX_SHADER_1_1))
......@@ -219,14 +219,19 @@ namespace video
init(outMaterialTypeNr, D3D9_NORMAL_MAP_VSH, D3D9_NORMAL_MAP_PSH_1_1);
}
}
// something failed, use base material
if (-1==outMaterialTypeNr)
driver->addMaterialRenderer(this);
}
CD3D9NormalMapRenderer::~CD3D9NormalMapRenderer()
{
if (CallBack == this)
CallBack = 0;
}
bool CD3D9NormalMapRenderer::OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype)
{
if (vtxtype != video::EVT_TANGENTS)
......@@ -250,8 +255,8 @@ namespace video
}
//! Called by the engine when the vertex and/or pixel shader constants for an
//! material renderer should be set.
//! Called by the engine when the vertex and/or pixel shader constants
//! for an material renderer should be set.
void CD3D9NormalMapRenderer::OnSetConstants(IMaterialRendererServices* services, s32 userData)
{
video::IVideoDriver* driver = services->getVideoDriver();
......@@ -265,8 +270,8 @@ namespace video
worldViewProj *= driver->getTransform(video::ETS_WORLD);
services->setVertexShaderConstant(worldViewProj.getTransposed().pointer(), 8, 4);
// here we've got to fetch the fixed function lights from the driver
// and set them as constants
// here we've got to fetch the fixed function lights from the
// driver and set them as constants
u32 cnt = driver->getDynamicLightCount();
......
......@@ -289,8 +289,12 @@ namespace video
#endif // SHADER_EXTERNAL_DEBUG
}
// something failed, use base material
if (-1==outMaterialTypeNr)
driver->addMaterialRenderer(this);
}
CD3D9ParallaxMapRenderer::~CD3D9ParallaxMapRenderer()
{
if (CallBack == this)
......@@ -308,6 +312,7 @@ namespace video
return CD3D9ShaderMaterialRenderer::OnRender(service, vtxtype);
}
void CD3D9ParallaxMapRenderer::OnSetMaterial(const video::SMaterial& material,
const video::SMaterial& lastMaterial,
bool resetAllRenderstates, video::IMaterialRendererServices* services)
......@@ -318,6 +323,7 @@ namespace video
CurrentScale = material.MaterialTypeParam;
}
//! Returns the render capability of the material.
s32 CD3D9ParallaxMapRenderer::getRenderCapability() const
{
......@@ -329,8 +335,8 @@ namespace video
}
//! Called by the engine when the vertex and/or pixel shader constants for an
//! material renderer should be set.
//! Called by the engine when the vertex and/or pixel shader constants
//! for an material renderer should be set.
void CD3D9ParallaxMapRenderer::OnSetConstants(IMaterialRendererServices* services, s32 userData)
{
video::IVideoDriver* driver = services->getVideoDriver();
......@@ -358,12 +364,12 @@ namespace video
worldViewProj *= driver->getTransform(video::ETS_WORLD);
services->setVertexShaderConstant(worldViewProj.getTransposed().pointer(), 8, 4);
// here we've got to fetch the fixed function lights from the driver
// and set them as constants
// here we've got to fetch the fixed function lights from the
// driver and set them as constants
int cnt = driver->getDynamicLightCount();
const u32 cnt = driver->getDynamicLightCount();
for (int i=0; i<2; ++i)
for (u32 i=0; i<2; ++i)
{
SLight light;
......
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