- Added bool interface for a shaders constants.
- Fixed issue with an int array uniforms. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4229 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
7f01500fd1
commit
d432f415a2
|
@ -65,6 +65,9 @@ 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;
|
||||||
|
|
||||||
|
@ -86,6 +89,9 @@ 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;
|
||||||
|
|
||||||
|
|
|
@ -2186,6 +2186,14 @@ 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)
|
||||||
{
|
{
|
||||||
|
@ -2202,6 +2210,14 @@ 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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -182,12 +182,18 @@ 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);
|
||||||
|
|
||||||
|
|
|
@ -3090,6 +3090,19 @@ 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)
|
||||||
{
|
{
|
||||||
|
@ -3116,6 +3129,19 @@ 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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -268,12 +268,18 @@ 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);
|
||||||
|
|
||||||
|
|
|
@ -304,6 +304,45 @@ 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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,6 +51,9 @@ 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);
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,13 @@ 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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3876,15 +3876,27 @@ 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)
|
||||||
|
{
|
||||||
|
return setPixelShaderConstant(name, ints, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Sets a constant for the pixel shader based on a name.
|
||||||
|
bool COpenGLDriver::setPixelShaderConstant(const c8* name, const f32* floats, int count)
|
||||||
{
|
{
|
||||||
os::Printer::log("Error: Please call services->setPixelShaderConstant(), not VideoDriver->setPixelShaderConstant().");
|
os::Printer::log("Error: Please call services->setPixelShaderConstant(), not VideoDriver->setPixelShaderConstant().");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Sets a constant for the pixel shader based on a name.
|
//! Bool interface for the above.
|
||||||
bool COpenGLDriver::setPixelShaderConstant(const c8* name, const f32* floats, int count)
|
bool COpenGLDriver::setPixelShaderConstant(const c8* name, const bool* bools, int count)
|
||||||
{
|
{
|
||||||
os::Printer::log("Error: Please call services->setPixelShaderConstant(), not VideoDriver->setPixelShaderConstant().");
|
os::Printer::log("Error: Please call services->setPixelShaderConstant(), not VideoDriver->setPixelShaderConstant().");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -286,12 +286,18 @@ 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);
|
||||||
|
|
||||||
|
|
|
@ -1041,6 +1041,10 @@ class COpenGLExtensionHandler
|
||||||
void extGlUniform2fv(GLint loc, GLsizei count, const GLfloat *v);
|
void extGlUniform2fv(GLint loc, GLsizei count, const GLfloat *v);
|
||||||
void extGlUniform3fv(GLint loc, GLsizei count, const GLfloat *v);
|
void extGlUniform3fv(GLint loc, GLsizei count, const GLfloat *v);
|
||||||
void extGlUniform4fv(GLint loc, GLsizei count, const GLfloat *v);
|
void extGlUniform4fv(GLint loc, GLsizei count, const GLfloat *v);
|
||||||
|
void extGlUniform1bv(GLint loc, GLsizei count, const bool *v);
|
||||||
|
void extGlUniform2bv(GLint loc, GLsizei count, const bool *v);
|
||||||
|
void extGlUniform3bv(GLint loc, GLsizei count, const bool *v);
|
||||||
|
void extGlUniform4bv(GLint loc, GLsizei count, const bool *v);
|
||||||
void extGlUniform1iv(GLint loc, GLsizei count, const GLint *v);
|
void extGlUniform1iv(GLint loc, GLsizei count, const GLint *v);
|
||||||
void extGlUniform2iv(GLint loc, GLsizei count, const GLint *v);
|
void extGlUniform2iv(GLint loc, GLsizei count, const GLint *v);
|
||||||
void extGlUniform3iv(GLint loc, GLsizei count, const GLint *v);
|
void extGlUniform3iv(GLint loc, GLsizei count, const GLint *v);
|
||||||
|
|
|
@ -496,6 +496,11 @@ 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);
|
||||||
|
@ -527,27 +532,29 @@ bool COpenGLSLMaterialRenderer::setPixelShaderConstant(const c8* name, const f32
|
||||||
else
|
else
|
||||||
Location=Driver->extGlGetUniformLocationARB(Program,name);
|
Location=Driver->extGlGetUniformLocationARB(Program,name);
|
||||||
|
|
||||||
|
bool status = true;
|
||||||
|
|
||||||
switch (UniformInfo[i].type)
|
switch (UniformInfo[i].type)
|
||||||
{
|
{
|
||||||
case GL_FLOAT:
|
case GL_FLOAT:
|
||||||
Driver->extGlUniform1fv(Location, count, floats);
|
Driver->extGlUniform1fv(Location, count, floats);
|
||||||
break;
|
break;
|
||||||
case GL_FLOAT_VEC2_ARB:
|
case GL_FLOAT_VEC2:
|
||||||
Driver->extGlUniform2fv(Location, count/2, floats);
|
Driver->extGlUniform2fv(Location, count/2, floats);
|
||||||
break;
|
break;
|
||||||
case GL_FLOAT_VEC3_ARB:
|
case GL_FLOAT_VEC3:
|
||||||
Driver->extGlUniform3fv(Location, count/3, floats);
|
Driver->extGlUniform3fv(Location, count/3, floats);
|
||||||
break;
|
break;
|
||||||
case GL_FLOAT_VEC4_ARB:
|
case GL_FLOAT_VEC4:
|
||||||
Driver->extGlUniform4fv(Location, count/4, floats);
|
Driver->extGlUniform4fv(Location, count/4, floats);
|
||||||
break;
|
break;
|
||||||
case GL_FLOAT_MAT2_ARB:
|
case GL_FLOAT_MAT2:
|
||||||
Driver->extGlUniformMatrix2fv(Location, count/4, false, floats);
|
Driver->extGlUniformMatrix2fv(Location, count/4, false, floats);
|
||||||
break;
|
break;
|
||||||
case GL_FLOAT_MAT3_ARB:
|
case GL_FLOAT_MAT3:
|
||||||
Driver->extGlUniformMatrix3fv(Location, count/9, false, floats);
|
Driver->extGlUniformMatrix3fv(Location, count/9, false, floats);
|
||||||
break;
|
break;
|
||||||
case GL_FLOAT_MAT4_ARB:
|
case GL_FLOAT_MAT4:
|
||||||
Driver->extGlUniformMatrix4fv(Location, count/16, false, floats);
|
Driver->extGlUniformMatrix4fv(Location, count/16, false, floats);
|
||||||
break;
|
break;
|
||||||
case GL_SAMPLER_1D:
|
case GL_SAMPLER_1D:
|
||||||
|
@ -562,9 +569,57 @@ bool COpenGLSLMaterialRenderer::setPixelShaderConstant(const c8* name, const f32
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
status = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return status;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#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
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
@ -591,18 +646,22 @@ bool COpenGLSLMaterialRenderer::setPixelShaderConstant(const c8* name, const s32
|
||||||
else
|
else
|
||||||
Location=Driver->extGlGetUniformLocationARB(Program,name);
|
Location=Driver->extGlGetUniformLocationARB(Program,name);
|
||||||
|
|
||||||
|
bool status = true;
|
||||||
|
|
||||||
switch (UniformInfo[i].type)
|
switch (UniformInfo[i].type)
|
||||||
{
|
{
|
||||||
case GL_INT_VEC2_ARB:
|
case GL_INT:
|
||||||
|
Driver->extGlUniform1iv(Location, count, ints);
|
||||||
|
break;
|
||||||
|
case GL_INT_VEC2:
|
||||||
Driver->extGlUniform2iv(Location, count/2, ints);
|
Driver->extGlUniform2iv(Location, count/2, ints);
|
||||||
break;
|
break;
|
||||||
case GL_INT_VEC3_ARB:
|
case GL_INT_VEC3:
|
||||||
Driver->extGlUniform3iv(Location, count/3, ints);
|
Driver->extGlUniform3iv(Location, count/3, ints);
|
||||||
break;
|
break;
|
||||||
case GL_INT_VEC4_ARB:
|
case GL_INT_VEC4:
|
||||||
Driver->extGlUniform4iv(Location, count/4, ints);
|
Driver->extGlUniform4iv(Location, count/4, ints);
|
||||||
break;
|
break;
|
||||||
case GL_INT:
|
|
||||||
case GL_SAMPLER_1D:
|
case GL_SAMPLER_1D:
|
||||||
case GL_SAMPLER_2D:
|
case GL_SAMPLER_2D:
|
||||||
case GL_SAMPLER_3D:
|
case GL_SAMPLER_3D:
|
||||||
|
@ -612,9 +671,10 @@ bool COpenGLSLMaterialRenderer::setPixelShaderConstant(const c8* name, const s32
|
||||||
Driver->extGlUniform1iv(Location, 1, ints);
|
Driver->extGlUniform1iv(Location, 1, ints);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
status = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return status;
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -86,9 +86,11 @@ 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();
|
||||||
|
|
Loading…
Reference in New Issue