- Removed shader interface for bool variables (int interface will handle them).

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4398 dfc29bdd-3216-0410-991c-e03cc46cb475
master
nadro 2012-12-13 17:24:52 +00:00
parent 5fbcafdefd
commit fbedea08b6
14 changed files with 0 additions and 206 deletions

View File

@ -65,9 +65,6 @@ public:
*/ */
virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count) = 0; virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count) = 0;
//! Bool interface for the above.
virtual bool setVertexShaderConstant(const c8* name, const bool* bools, int count) = 0;
//! Int interface for the above. //! Int interface for the above.
virtual bool setVertexShaderConstant(const c8* name, const s32* ints, int count) = 0; virtual bool setVertexShaderConstant(const c8* name, const s32* ints, int count) = 0;
@ -89,9 +86,6 @@ public:
\return True if successful. */ \return True if successful. */
virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count) = 0; virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count) = 0;
//! Bool interface for the above.
virtual bool setPixelShaderConstant(const c8* name, const bool* bools, int count) = 0;
//! Int interface for the above. //! Int interface for the above.
virtual bool setPixelShaderConstant(const c8* name, const s32* ints, int count) = 0; virtual bool setPixelShaderConstant(const c8* name, const s32* ints, int count) = 0;

View File

@ -195,11 +195,6 @@ bool CCgMaterialRenderer::setVertexShaderConstant(const c8* name, const f32* flo
return setPixelShaderConstant(name, floats, count); return setPixelShaderConstant(name, floats, count);
} }
bool CCgMaterialRenderer::setVertexShaderConstant(const c8* name, const bool* bools, int count)
{
return setPixelShaderConstant(name, bools, count);
}
bool CCgMaterialRenderer::setVertexShaderConstant(const c8* name, const s32* ints, int count) bool CCgMaterialRenderer::setVertexShaderConstant(const c8* name, const s32* ints, int count)
{ {
return setPixelShaderConstant(name, ints, count); return setPixelShaderConstant(name, ints, count);
@ -244,23 +239,6 @@ bool CCgMaterialRenderer::setPixelShaderConstant(const c8* name, const s32* ints
return Status; return Status;
} }
bool CCgMaterialRenderer::setPixelShaderConstant(const c8* name, const bool* bools, int count)
{
bool Status = false;
for(unsigned int i = 0; i < UniformInfo.size(); ++i)
{
if(UniformInfo[i]->getName() == name)
{
UniformInfo[i]->update(bools, Material);
Status = true;
}
}
return Status;
}
void CCgMaterialRenderer::getUniformList() void CCgMaterialRenderer::getUniformList()
{ {
for(unsigned int i = 0; i < UniformInfo.size(); ++i) for(unsigned int i = 0; i < UniformInfo.size(); ++i)

View File

@ -140,11 +140,9 @@ public:
virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates) = 0; virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates) = 0;
virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count); virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count);
virtual bool setVertexShaderConstant(const c8* name, const bool* bools, int count);
virtual bool setVertexShaderConstant(const c8* name, const s32* ints, int count); virtual bool setVertexShaderConstant(const c8* name, const s32* ints, int count);
virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1); virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1);
virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count); virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count);
virtual bool setPixelShaderConstant(const c8* name, const bool* bools, int count);
virtual bool setPixelShaderConstant(const c8* name, const s32* ints, int count); virtual bool setPixelShaderConstant(const c8* name, const s32* ints, int count);
virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1); virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1);
virtual IVideoDriver* getVideoDriver() = 0; virtual IVideoDriver* getVideoDriver() = 0;

View File

@ -2186,14 +2186,6 @@ bool CD3D8Driver::setVertexShaderConstant(const c8* name, const f32* floats, int
} }
//! Bool interface for the above.
bool CD3D8Driver::setVertexShaderConstant(const c8* name, const bool* bools, int count)
{
os::Printer::log("Cannot set constant, no HLSL supported in D3D8");
return false;
}
//! Int interface for the above. //! Int interface for the above.
bool CD3D8Driver::setVertexShaderConstant(const c8* name, const s32* ints, int count) bool CD3D8Driver::setVertexShaderConstant(const c8* name, const s32* ints, int count)
{ {
@ -2210,14 +2202,6 @@ bool CD3D8Driver::setPixelShaderConstant(const c8* name, const f32* floats, int
} }
//! Bool interface for the above.
bool CD3D8Driver::setPixelShaderConstant(const c8* name, const bool* bools, int count)
{
os::Printer::log("Cannot set constant, no HLSL supported in D3D8");
return false;
}
//! Int interface for the above. //! Int interface for the above.
bool CD3D8Driver::setPixelShaderConstant(const c8* name, const s32* ints, int count) bool CD3D8Driver::setPixelShaderConstant(const c8* name, const s32* ints, int count)
{ {

View File

@ -182,18 +182,12 @@ namespace video
//! Sets a constant for the vertex shader based on a name. //! Sets a constant for the vertex shader based on a name.
virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count); virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count);
//! Bool interface for the above.
virtual bool setVertexShaderConstant(const c8* name, const bool* bools, int count);
//! Int interface for the above. //! Int interface for the above.
virtual bool setVertexShaderConstant(const c8* name, const s32* ints, int count); virtual bool setVertexShaderConstant(const c8* name, const s32* ints, int count);
//! Sets a constant for the pixel shader based on a name. //! Sets a constant for the pixel shader based on a name.
virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count); virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count);
//! Bool interface for the above.
virtual bool setPixelShaderConstant(const c8* name, const bool* bools, int count);
//! Int interface for the above. //! Int interface for the above.
virtual bool setPixelShaderConstant(const c8* name, const s32* ints, int count); virtual bool setPixelShaderConstant(const c8* name, const s32* ints, int count);

View File

@ -3100,19 +3100,6 @@ bool CD3D9Driver::setVertexShaderConstant(const c8* name, const f32* floats, int
} }
//! Bool interface for the above.
bool CD3D9Driver::setVertexShaderConstant(const c8* name, const bool* bools, int count)
{
if (Material.MaterialType >= 0 && Material.MaterialType < (s32)MaterialRenderers.size())
{
CD3D9MaterialRenderer* r = (CD3D9MaterialRenderer*)MaterialRenderers[Material.MaterialType].Renderer;
return r->setVariable(true, name, bools, count);
}
return false;
}
//! Int interface for the above. //! Int interface for the above.
bool CD3D9Driver::setVertexShaderConstant(const c8* name, const s32* ints, int count) bool CD3D9Driver::setVertexShaderConstant(const c8* name, const s32* ints, int count)
{ {
@ -3139,19 +3126,6 @@ bool CD3D9Driver::setPixelShaderConstant(const c8* name, const f32* floats, int
} }
//! Bool interface for the above.
bool CD3D9Driver::setPixelShaderConstant(const c8* name, const bool* bools, int count)
{
if (Material.MaterialType >= 0 && Material.MaterialType < (s32)MaterialRenderers.size())
{
CD3D9MaterialRenderer* r = (CD3D9MaterialRenderer*)MaterialRenderers[Material.MaterialType].Renderer;
return r->setVariable(false, name, bools, count);
}
return false;
}
//! Int interface for the above. //! Int interface for the above.
bool CD3D9Driver::setPixelShaderConstant(const c8* name, const s32* ints, int count) bool CD3D9Driver::setPixelShaderConstant(const c8* name, const s32* ints, int count)
{ {

View File

@ -268,18 +268,12 @@ namespace video
//! Sets a constant for the vertex shader based on a name. //! Sets a constant for the vertex shader based on a name.
virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count); virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count);
//! Bool interface for the above.
virtual bool setVertexShaderConstant(const c8* name, const bool* bools, int count);
//! Int interface for the above. //! Int interface for the above.
virtual bool setVertexShaderConstant(const c8* name, const s32* ints, int count); virtual bool setVertexShaderConstant(const c8* name, const s32* ints, int count);
//! Sets a constant for the pixel shader based on a name. //! Sets a constant for the pixel shader based on a name.
virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count); virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count);
//! Bool interface for the above.
virtual bool setPixelShaderConstant(const c8* name, const bool* bools, int count);
//! Int interface for the above. //! Int interface for the above.
virtual bool setPixelShaderConstant(const c8* name, const s32* ints, int count); virtual bool setPixelShaderConstant(const c8* name, const s32* ints, int count);

View File

@ -304,45 +304,6 @@ bool CD3D9HLSLMaterialRenderer::setVariable(bool vertexShader, const c8* name,
} }
bool CD3D9HLSLMaterialRenderer::setVariable(bool vertexShader, const c8* name,
const bool* bools, int count)
{
LPD3DXCONSTANTTABLE tbl = vertexShader ? VSConstantsTable : PSConstantsTable;
if (!tbl)
return false;
// currently we only support top level parameters.
// Should be enough for the beginning. (TODO)
D3DXHANDLE hndl = tbl->GetConstantByName(NULL, name);
if (!hndl)
{
core::stringc s = "HLSL Variable to set not found: '";
s += name;
s += "'. Available variables are:";
os::Printer::log(s.c_str(), ELL_WARNING);
printHLSLVariables(tbl);
return false;
}
D3DXCONSTANT_DESC Description;
UINT ucount = 1;
tbl->GetConstantDesc(hndl, &Description, &ucount);
if(Description.RegisterSet != D3DXRS_SAMPLER)
{
HRESULT hr = tbl->SetBoolArray(pID3DDevice, hndl, (BOOL*)bools, count);
if (FAILED(hr))
{
os::Printer::log("Error setting bool array for HLSL variable", ELL_WARNING);
return false;
}
}
return true;
}
bool CD3D9HLSLMaterialRenderer::setVariable(bool vertexShader, const c8* name, bool CD3D9HLSLMaterialRenderer::setVariable(bool vertexShader, const c8* name,
const s32* ints, int count) const s32* ints, int count)
{ {

View File

@ -51,9 +51,6 @@ public:
//! \param count: Amount of floats in array. //! \param count: Amount of floats in array.
virtual bool setVariable(bool vertexShader, const c8* name, const f32* floats, int count); virtual bool setVariable(bool vertexShader, const c8* name, const f32* floats, int count);
//! Bool interface for the above.
virtual bool setVariable(bool vertexShader, const c8* name, const bool* bools, int count);
//! Int interface for the above. //! Int interface for the above.
virtual bool setVariable(bool vertexShader, const c8* name, const s32* ints, int count); virtual bool setVariable(bool vertexShader, const c8* name, const s32* ints, int count);

View File

@ -75,13 +75,6 @@ public:
return false; return false;
} }
//! Bool interface for the above.
virtual bool setVariable(bool vertexShader, const c8* name, const bool* bools, int count)
{
os::Printer::log("Invalid material to set variable in.");
return false;
}
//! Int interface for the above. //! Int interface for the above.
virtual bool setVariable(bool vertexShader, const c8* name, const s32* ints, int count) virtual bool setVariable(bool vertexShader, const c8* name, const s32* ints, int count)
{ {

View File

@ -3893,12 +3893,6 @@ bool COpenGLDriver::setVertexShaderConstant(const c8* name, const f32* floats, i
return setPixelShaderConstant(name, floats, count); return setPixelShaderConstant(name, floats, count);
} }
//! Bool interface for the above.
bool COpenGLDriver::setVertexShaderConstant(const c8* name, const bool* bools, int count)
{
return setPixelShaderConstant(name, bools, count);
}
//! Int interface for the above. //! Int interface for the above.
bool COpenGLDriver::setVertexShaderConstant(const c8* name, const s32* ints, int count) bool COpenGLDriver::setVertexShaderConstant(const c8* name, const s32* ints, int count)
{ {
@ -3912,13 +3906,6 @@ bool COpenGLDriver::setPixelShaderConstant(const c8* name, const f32* floats, in
return false; return false;
} }
//! Bool interface for the above.
bool COpenGLDriver::setPixelShaderConstant(const c8* name, const bool* bools, int count)
{
os::Printer::log("Error: Please call services->setPixelShaderConstant(), not VideoDriver->setPixelShaderConstant().");
return false;
}
//! Int interface for the above. //! Int interface for the above.
bool COpenGLDriver::setPixelShaderConstant(const c8* name, const s32* ints, int count) bool COpenGLDriver::setPixelShaderConstant(const c8* name, const s32* ints, int count)
{ {

View File

@ -286,18 +286,12 @@ namespace video
//! Sets a constant for the vertex shader based on a name. //! Sets a constant for the vertex shader based on a name.
virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count); virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count);
//! Bool interface for the above.
virtual bool setVertexShaderConstant(const c8* name, const bool* bools, int count);
//! Int interface for the above. //! Int interface for the above.
virtual bool setVertexShaderConstant(const c8* name, const s32* ints, int count); virtual bool setVertexShaderConstant(const c8* name, const s32* ints, int count);
//! Sets a constant for the pixel shader based on a name. //! Sets a constant for the pixel shader based on a name.
virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count); virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count);
//! Bool interface for the above.
virtual bool setPixelShaderConstant(const c8* name, const bool* bools, int count);
//! Int interface for the above. //! Int interface for the above.
virtual bool setPixelShaderConstant(const c8* name, const s32* ints, int count); virtual bool setPixelShaderConstant(const c8* name, const s32* ints, int count);

View File

@ -500,11 +500,6 @@ bool COpenGLSLMaterialRenderer::setVertexShaderConstant(const c8* name, const f3
return setPixelShaderConstant(name, floats, count); return setPixelShaderConstant(name, floats, count);
} }
bool COpenGLSLMaterialRenderer::setVertexShaderConstant(const c8* name, const bool* bools, int count)
{
return setPixelShaderConstant(name, bools, count);
}
bool COpenGLSLMaterialRenderer::setVertexShaderConstant(const c8* name, const s32* ints, int count) bool COpenGLSLMaterialRenderer::setVertexShaderConstant(const c8* name, const s32* ints, int count)
{ {
return setPixelShaderConstant(name, ints, count); return setPixelShaderConstant(name, ints, count);
@ -582,53 +577,6 @@ bool COpenGLSLMaterialRenderer::setPixelShaderConstant(const c8* name, const f32
#endif #endif
} }
bool COpenGLSLMaterialRenderer::setPixelShaderConstant(const c8* name, const bool* bools, int count)
{
u32 i;
const u32 num = UniformInfo.size();
for (i=0; i < num; ++i)
{
if (UniformInfo[i].name == name)
break;
}
if (i == num)
return false;
#if defined(GL_VERSION_2_0)||defined(GL_ARB_shader_objects)
GLint Location=0;
if (Program2)
Location=Driver->extGlGetUniformLocation(Program2,name);
else
Location=Driver->extGlGetUniformLocationARB(Program,name);
bool status = true;
switch (UniformInfo[i].type)
{
case GL_BOOL:
Driver->extGlUniform1iv(Location, count, (GLint*)bools);
break;
case GL_BOOL_VEC2:
Driver->extGlUniform2iv(Location, count/2, (GLint*)bools);
break;
case GL_BOOL_VEC3:
Driver->extGlUniform3iv(Location, count/3, (GLint*)bools);
break;
case GL_BOOL_VEC4:
Driver->extGlUniform4iv(Location, count/4, (GLint*)bools);
break;
default:
status = false;
break;
}
return status;
#else
return false;
#endif
}
bool COpenGLSLMaterialRenderer::setPixelShaderConstant(const c8* name, const s32* ints, int count) bool COpenGLSLMaterialRenderer::setPixelShaderConstant(const c8* name, const s32* ints, int count)
{ {
u32 i; u32 i;

View File

@ -86,11 +86,9 @@ public:
// implementations for the render services // implementations for the render services
virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates); virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates);
virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count); virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count);
virtual bool setVertexShaderConstant(const c8* name, const bool* bools, int count);
virtual bool setVertexShaderConstant(const c8* name, const s32* ints, int count); virtual bool setVertexShaderConstant(const c8* name, const s32* ints, int count);
virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1); virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1);
virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count); virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count);
virtual bool setPixelShaderConstant(const c8* name, const bool* bools, int count);
virtual bool setPixelShaderConstant(const c8* name, const s32* ints, int count); virtual bool setPixelShaderConstant(const c8* name, const s32* ints, int count);
virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1); virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1);
virtual IVideoDriver* getVideoDriver(); virtual IVideoDriver* getVideoDriver();