diff --git a/include/IMaterialRendererServices.h b/include/IMaterialRendererServices.h index 0c18535..f57e419 100644 --- a/include/IMaterialRendererServices.h +++ b/include/IMaterialRendererServices.h @@ -71,6 +71,12 @@ public: //! Int interface for the above. virtual bool setVertexShaderConstant(s32 index, const s32* ints, int count) = 0; + //! Uint interface for the above. + /* NOTE: UINT only works with GLSL, not supported for other shaders. + Also GLES drivers in Irrlicht do not support it as this needs at least GLES 3.0. + */ + virtual bool setVertexShaderConstant(s32 index, const u32* ints, int count) = 0; + //! Sets a vertex shader constant. /** Can be used if you created a shader using pixel/vertex shader assembler or ARB_fragment_program or ARB_vertex_program. @@ -95,6 +101,12 @@ public: //! Int interface for the above. virtual bool setPixelShaderConstant(s32 index, const s32* ints, int count) = 0; + //! Uint interface for the above. + /* NOTE: UINT only works with GLSL, not supported for other shaders. + Also GLES drivers in Irrlicht do not support it as this needs at least GLES 3.0. + */ + virtual bool setPixelShaderConstant(s32 index, const u32* ints, int count) = 0; + //! Sets a pixel shader constant. /** Can be used if you created a shader using pixel/vertex shader assembler or ARB_fragment_program or ARB_vertex_program. diff --git a/source/Irrlicht/CD3D9Driver.cpp b/source/Irrlicht/CD3D9Driver.cpp index a821322..629baa4 100644 --- a/source/Irrlicht/CD3D9Driver.cpp +++ b/source/Irrlicht/CD3D9Driver.cpp @@ -3177,6 +3177,19 @@ bool CD3D9Driver::setVertexShaderConstant(s32 index, const s32* ints, int count) } +//! Uint interface for the above. +bool CD3D9Driver::setVertexShaderConstant(s32 index, const u32* ints, int count) +{ + if (Material.MaterialType >= 0 && Material.MaterialType < (s32)MaterialRenderers.size()) + { + CD3D9MaterialRenderer* r = (CD3D9MaterialRenderer*)MaterialRenderers[Material.MaterialType].Renderer; + return r->setVariable(true, index, ints, count); + } + + return false; +} + + //! Sets a constant for the pixel shader based on an index. bool CD3D9Driver::setPixelShaderConstant(s32 index, const f32* floats, int count) { @@ -3203,6 +3216,20 @@ bool CD3D9Driver::setPixelShaderConstant(s32 index, const s32* ints, int count) } +//! Uint interface for the above. +bool CD3D9Driver::setPixelShaderConstant(s32 index, const u32* ints, int count) +{ + if (Material.MaterialType >= 0 && Material.MaterialType < (s32)MaterialRenderers.size()) + { + CD3D9MaterialRenderer* r = (CD3D9MaterialRenderer*)MaterialRenderers[Material.MaterialType].Renderer; + return r->setVariable(false, index, ints, count); + } + + return false; +} + + + //! Adds a new material renderer to the VideoDriver, using pixel and/or //! vertex shaders to render geometry. s32 CD3D9Driver::addShaderMaterial(const c8* vertexShaderProgram, diff --git a/source/Irrlicht/CD3D9Driver.h b/source/Irrlicht/CD3D9Driver.h index e4d7925..d28c0f4 100644 --- a/source/Irrlicht/CD3D9Driver.h +++ b/source/Irrlicht/CD3D9Driver.h @@ -252,12 +252,18 @@ namespace video //! Int interface for the above. virtual bool setVertexShaderConstant(s32 index, const s32* ints, int count) _IRR_OVERRIDE_; + //! Uint interface for the above. + virtual bool setVertexShaderConstant(s32 index, const u32* ints, int count) _IRR_OVERRIDE_; + //! Sets a constant for the pixel shader based on an index. virtual bool setPixelShaderConstant(s32 index, const f32* floats, int count) _IRR_OVERRIDE_; //! Int interface for the above. virtual bool setPixelShaderConstant(s32 index, const s32* ints, int count) _IRR_OVERRIDE_; + //! Uint interface for the above. + virtual bool setPixelShaderConstant(s32 index, const u32* ints, int count) _IRR_OVERRIDE_; + //! Returns a pointer to the IVideoDriver interface. (Implementation for //! IMaterialRendererServices) virtual IVideoDriver* getVideoDriver() _IRR_OVERRIDE_; diff --git a/source/Irrlicht/CD3D9HLSLMaterialRenderer.cpp b/source/Irrlicht/CD3D9HLSLMaterialRenderer.cpp index 3600333..b7007d6 100644 --- a/source/Irrlicht/CD3D9HLSLMaterialRenderer.cpp +++ b/source/Irrlicht/CD3D9HLSLMaterialRenderer.cpp @@ -370,6 +370,14 @@ bool CD3D9HLSLMaterialRenderer::setVariable(bool vertexShader, s32 index, } +bool CD3D9HLSLMaterialRenderer::setVariable(bool vertexShader, s32 index, + const u32* ints, int count) +{ + os::Printer::log("Error DirectX 9 does not support unsigned integer constants in shaders.", ELL_ERROR); + return false; +} + + bool CD3D9HLSLMaterialRenderer::OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype) { if (VSConstantsTable) diff --git a/source/Irrlicht/CD3D9HLSLMaterialRenderer.h b/source/Irrlicht/CD3D9HLSLMaterialRenderer.h index c485ee6..f02c803 100644 --- a/source/Irrlicht/CD3D9HLSLMaterialRenderer.h +++ b/source/Irrlicht/CD3D9HLSLMaterialRenderer.h @@ -56,6 +56,9 @@ public: //! Int interface for the above. virtual bool setVariable(bool vertexShader, s32 index, const s32* ints, int count); + //! Uint interface for the above. + virtual bool setVariable(bool vertexShader, s32 index, const u32* ints, int count); + bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype) _IRR_OVERRIDE_; protected: diff --git a/source/Irrlicht/CD3D9MaterialRenderer.h b/source/Irrlicht/CD3D9MaterialRenderer.h index fb81391..fca6bed 100644 --- a/source/Irrlicht/CD3D9MaterialRenderer.h +++ b/source/Irrlicht/CD3D9MaterialRenderer.h @@ -89,6 +89,13 @@ public: return false; } + //! Uint interface for the above. + virtual bool setVariable(bool vertexShader, s32 index, const u32* ints, int count) + { + os::Printer::log("Invalid material to set variable in."); + return false; + } + protected: IDirect3DDevice9* pID3DDevice; diff --git a/source/Irrlicht/COGLES2Driver.cpp b/source/Irrlicht/COGLES2Driver.cpp index 5f5c6b3..fe960f3 100644 --- a/source/Irrlicht/COGLES2Driver.cpp +++ b/source/Irrlicht/COGLES2Driver.cpp @@ -2299,14 +2299,21 @@ COGLES2Driver::~COGLES2Driver() //! Sets a constant for the vertex shader based on an index. bool COGLES2Driver::setVertexShaderConstant(s32 index, const f32* floats, int count) { - //pass this along, as in GLSL the same routine is used for both vertex and fragment shaders - return setPixelShaderConstant(index, floats, count); + os::Printer::log("Error: Please call services->setVertexShaderConstant(), not VideoDriver->setVertexShaderConstant()."); + return false; } //! Int interface for the above. bool COGLES2Driver::setVertexShaderConstant(s32 index, const s32* ints, int count) { - return setPixelShaderConstant(index, ints, count); + os::Printer::log("Error: Please call services->setVertexShaderConstant(), not VideoDriver->setVertexShaderConstant()."); + return false; + } + + bool COGLES2Driver::setVertexShaderConstant(s32 index, const u32* ints, int count) + { + os::Printer::log("Error: Please call services->setVertexShaderConstant(), not VideoDriver->setVertexShaderConstant()."); + return false; } //! Sets a constant for the pixel shader based on an index. @@ -2323,6 +2330,11 @@ COGLES2Driver::~COGLES2Driver() return false; } + bool COGLES2Driver::setPixelShaderConstant(s32 index, const u32* ints, int count) + { + os::Printer::log("Error: Please call services->setPixelShaderConstant(), not VideoDriver->setPixelShaderConstant()."); + return false; + } //! Adds a new material renderer to the VideoDriver, using pixel and/or //! vertex shaders to render geometry. diff --git a/source/Irrlicht/COGLES2Driver.h b/source/Irrlicht/COGLES2Driver.h index e7e2ac4..06e80a6 100644 --- a/source/Irrlicht/COGLES2Driver.h +++ b/source/Irrlicht/COGLES2Driver.h @@ -230,12 +230,18 @@ namespace video //! Int interface for the above. virtual bool setVertexShaderConstant(s32 index, const s32* ints, int count) _IRR_OVERRIDE_; + //! Uint interface for the above. + virtual bool setVertexShaderConstant(s32 index, const u32* ints, int count) _IRR_OVERRIDE_; + //! Sets a constant for the pixel shader based on an index. virtual bool setPixelShaderConstant(s32 index, const f32* floats, int count) _IRR_OVERRIDE_; //! Int interface for the above. virtual bool setPixelShaderConstant(s32 index, const s32* ints, int count) _IRR_OVERRIDE_; + //! Uint interface for the above. + virtual bool setPixelShaderConstant(s32 index, const u32* ints, int count) _IRR_OVERRIDE_; + //! Adds a new material renderer to the VideoDriver virtual s32 addShaderMaterial(const c8* vertexShaderProgram, const c8* pixelShaderProgram, IShaderConstantSetCallBack* callback, E_MATERIAL_TYPE baseMaterial, s32 userData) _IRR_OVERRIDE_; diff --git a/source/Irrlicht/COGLES2MaterialRenderer.cpp b/source/Irrlicht/COGLES2MaterialRenderer.cpp index e7cdfb5..628df02 100644 --- a/source/Irrlicht/COGLES2MaterialRenderer.cpp +++ b/source/Irrlicht/COGLES2MaterialRenderer.cpp @@ -384,6 +384,11 @@ bool COGLES2MaterialRenderer::setVertexShaderConstant(s32 index, const s32* ints return setPixelShaderConstant(index, ints, count); } +bool COGLES2MaterialRenderer::setVertexShaderConstant(s32 index, const u32* ints, int count) +{ + return setPixelShaderConstant(index, ints, count); +} + bool COGLES2MaterialRenderer::setPixelShaderConstant(s32 index, const f32* floats, int count) { if(index < 0 || UniformInfo[index].location < 0) @@ -471,6 +476,12 @@ bool COGLES2MaterialRenderer::setPixelShaderConstant(s32 index, const s32* ints, return status; } +bool COGLES2MaterialRenderer::setPixelShaderConstant(s32 index, const u32* ints, int count) +{ + os::Printer::log("Unsigned int support needs at least GLES 3.0", ELL_WARNING); + return false; +} + IVideoDriver* COGLES2MaterialRenderer::getVideoDriver() { return Driver; diff --git a/source/Irrlicht/COGLES2MaterialRenderer.h b/source/Irrlicht/COGLES2MaterialRenderer.h index 5a2bb5b..118cf5d 100644 --- a/source/Irrlicht/COGLES2MaterialRenderer.h +++ b/source/Irrlicht/COGLES2MaterialRenderer.h @@ -20,7 +20,7 @@ namespace irr { -namespace video +namespace video { class COGLES2Driver; @@ -30,8 +30,8 @@ class COGLES2MaterialRenderer : public IMaterialRenderer, public IMaterialRender public: COGLES2MaterialRenderer( - COGLES2Driver* driver, - s32& outMaterialTypeNr, + COGLES2Driver* driver, + s32& outMaterialTypeNr, const c8* vertexShaderProgram = 0, const c8* pixelShaderProgram = 0, IShaderConstantSetCallBack* callback = 0, @@ -53,18 +53,20 @@ public: virtual s32 getRenderCapability() const; - virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates); - - virtual s32 getVertexShaderConstantID(const c8* name); - virtual s32 getPixelShaderConstantID(const c8* name); - virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1); - virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1); - virtual bool setVertexShaderConstant(s32 index, const f32* floats, int count); - virtual bool setVertexShaderConstant(s32 index, const s32* ints, int count); - virtual bool setPixelShaderConstant(s32 index, const f32* floats, int count); - virtual bool setPixelShaderConstant(s32 index, const s32* ints, int count); + virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates) _IRR_OVERRIDE_; - virtual IVideoDriver* getVideoDriver(); + virtual s32 getVertexShaderConstantID(const c8* name) _IRR_OVERRIDE_; + virtual s32 getPixelShaderConstantID(const c8* name) _IRR_OVERRIDE_; + virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) _IRR_OVERRIDE_; + virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) _IRR_OVERRIDE_; + virtual bool setVertexShaderConstant(s32 index, const f32* floats, int count) _IRR_OVERRIDE_; + virtual bool setVertexShaderConstant(s32 index, const s32* ints, int count) _IRR_OVERRIDE_; + virtual bool setVertexShaderConstant(s32 index, const u32* ints, int count) _IRR_OVERRIDE_; + virtual bool setPixelShaderConstant(s32 index, const f32* floats, int count) _IRR_OVERRIDE_; + virtual bool setPixelShaderConstant(s32 index, const s32* ints, int count) _IRR_OVERRIDE_; + virtual bool setPixelShaderConstant(s32 index, const u32* ints, int count) _IRR_OVERRIDE_; + + virtual IVideoDriver* getVideoDriver() _IRR_OVERRIDE_; protected: @@ -77,7 +79,7 @@ protected: bool createShader(GLenum shaderType, const char* shader); bool linkProgram(); - + COGLES2Driver* Driver; IShaderConstantSetCallBack* CallBack; diff --git a/source/Irrlicht/COGLESDriver.cpp b/source/Irrlicht/COGLESDriver.cpp index 28c5687..cca937c 100644 --- a/source/Irrlicht/COGLESDriver.cpp +++ b/source/Irrlicht/COGLESDriver.cpp @@ -2602,6 +2602,11 @@ bool COGLES1Driver::setVertexShaderConstant(s32 index, const s32* ints, int coun return setPixelShaderConstant(index, ints, count); } +bool COGLES1Driver::setVertexShaderConstant(s32 index, const u32* ints, int count) +{ + return setPixelShaderConstant(index, ints, count); +} + //! Sets a constant for the pixel shader based on an index. bool COGLES1Driver::setPixelShaderConstant(s32 index, const f32* floats, int count) { @@ -2616,6 +2621,12 @@ bool COGLES1Driver::setPixelShaderConstant(s32 index, const s32* ints, int count return false; } +bool COGLES1Driver::setPixelShaderConstant(s32 index, const u32* ints, int count) +{ + os::Printer::log("Error: Please use IMaterialRendererServices from IShaderConstantSetCallBack::OnSetConstants not VideoDriver->setPixelShaderConstant()."); + return false; +} + //! Sets a vertex shader constant. void COGLES1Driver::setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount) { diff --git a/source/Irrlicht/COGLESDriver.h b/source/Irrlicht/COGLESDriver.h index 12017d6..6ffaaaf 100644 --- a/source/Irrlicht/COGLESDriver.h +++ b/source/Irrlicht/COGLESDriver.h @@ -218,12 +218,18 @@ namespace video //! Int interface for the above. virtual bool setVertexShaderConstant(s32 index, const s32* ints, int count) _IRR_OVERRIDE_; + //! Uint interface for the above. + virtual bool setVertexShaderConstant(s32 index, const u32* ints, int count) _IRR_OVERRIDE_; + //! Sets a constant for the pixel shader based on an index. virtual bool setPixelShaderConstant(s32 index, const f32* floats, int count) _IRR_OVERRIDE_; //! Int interface for the above. virtual bool setPixelShaderConstant(s32 index, const s32* ints, int count) _IRR_OVERRIDE_; + //! Uint interface for the above. + virtual bool setPixelShaderConstant(s32 index, const u32* ints, int count) _IRR_OVERRIDE_; + //! Sets a vertex shader constant. virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) _IRR_OVERRIDE_; diff --git a/source/Irrlicht/COpenGLDriver.cpp b/source/Irrlicht/COpenGLDriver.cpp index 3c5f00e..22d4abf 100644 --- a/source/Irrlicht/COpenGLDriver.cpp +++ b/source/Irrlicht/COpenGLDriver.cpp @@ -3667,19 +3667,15 @@ s32 COpenGLDriver::getPixelShaderConstantID(const c8* name) //! Sets a vertex shader constant. void COpenGLDriver::setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount) { -#ifdef GL_ARB_vertex_program for (s32 i=0; isetPixelShaderConstant(), not VideoDriver->setPixelShaderConstant()."); + return false; +} + //! Adds a new material renderer to the VideoDriver, using pixel and/or //! vertex shaders to render geometry. diff --git a/source/Irrlicht/COpenGLDriver.h b/source/Irrlicht/COpenGLDriver.h index 54660cb..7c9f869 100644 --- a/source/Irrlicht/COpenGLDriver.h +++ b/source/Irrlicht/COpenGLDriver.h @@ -293,12 +293,18 @@ namespace video //! Int interface for the above. virtual bool setVertexShaderConstant(s32 index, const s32* ints, int count) _IRR_OVERRIDE_; + //! Uint interface for the above. + virtual bool setVertexShaderConstant(s32 index, const u32* ints, int count) _IRR_OVERRIDE_; + //! Sets a constant for the pixel shader based on an index. virtual bool setPixelShaderConstant(s32 index, const f32* floats, int count) _IRR_OVERRIDE_; //! Int interface for the above. virtual bool setPixelShaderConstant(s32 index, const s32* ints, int count) _IRR_OVERRIDE_; + //! Uint interface for the above. + virtual bool setPixelShaderConstant(s32 index, const u32* ints, int count) _IRR_OVERRIDE_; + //! disables all textures beginning with the optional fromStage parameter. Otherwise all texture stages are disabled. //! Returns whether disabling was successful or not. bool disableTextures(u32 fromStage=0); diff --git a/source/Irrlicht/COpenGLExtensionHandler.cpp b/source/Irrlicht/COpenGLExtensionHandler.cpp index ee3bf84..9c215dd 100644 --- a/source/Irrlicht/COpenGLExtensionHandler.cpp +++ b/source/Irrlicht/COpenGLExtensionHandler.cpp @@ -44,6 +44,7 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() : pGlGetUniformLocationARB(0), pGlGetUniformLocation(0), pGlUniform1fvARB(0), pGlUniform2fvARB(0), pGlUniform3fvARB(0), pGlUniform4fvARB(0), pGlUniform1ivARB(0), pGlUniform2ivARB(0), pGlUniform3ivARB(0), pGlUniform4ivARB(0), + pGlUniform1uiv(0), pGlUniform2uiv(0), pGlUniform3uiv(0), pGlUniform4uiv(0), pGlUniformMatrix2fvARB(0), pGlUniformMatrix2x3fv(0), pGlUniformMatrix2x4fv(0), pGlUniformMatrix3x2fv(0), pGlUniformMatrix3fvARB(0), pGlUniformMatrix3x4fv(0), pGlUniformMatrix4x2fv(0), pGlUniformMatrix4x3fv(0), pGlUniformMatrix4fvARB(0), @@ -87,7 +88,8 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() : pGlBlendEquationIndexedAMD(0), pGlBlendEquationiARB(0), pGlBlendEquationSeparateIndexedAMD(0), pGlBlendEquationSeparateiARB(0), // DSA pGlTextureStorage2D(0), pGlTextureStorage3D(0), pGlTextureSubImage2D(0), pGlGetTextureImage(0), pGlNamedFramebufferTexture(0), - pGlTextureParameteri(0), pGlCreateTextures(0), pGlCreateFramebuffers(0), pGlBindTextures(0), pGlGenerateTextureMipmap(0), + pGlTextureParameteri(0), pGlTextureParameterf(0), pGlTextureParameteriv(0), pGlTextureParameterfv(0), + pGlCreateTextures(0), pGlCreateFramebuffers(0), pGlBindTextures(0), pGlGenerateTextureMipmap(0), // DSA with EXT or functions to simulate it pGlTextureStorage2DEXT(0), pGlTexStorage2D(0), pGlTextureStorage3DEXT(0), pGlTexStorage3D(0), pGlTextureSubImage2DEXT(0), pGlGetTextureImageEXT(0), pGlNamedFramebufferTextureEXT(0), pGlFramebufferTexture(0), pGlGenerateTextureMipmapEXT(0) @@ -466,6 +468,10 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) pGlUniform2ivARB = (PFNGLUNIFORM2IVARBPROC) IRR_OGL_LOAD_EXTENSION("glUniform2ivARB"); pGlUniform3ivARB = (PFNGLUNIFORM3IVARBPROC) IRR_OGL_LOAD_EXTENSION("glUniform3ivARB"); pGlUniform4ivARB = (PFNGLUNIFORM4IVARBPROC) IRR_OGL_LOAD_EXTENSION("glUniform4ivARB"); + pGlUniform1uiv = (PFNGLUNIFORM1UIVPROC) IRR_OGL_LOAD_EXTENSION("glUniform1uiv"); + pGlUniform2uiv = (PFNGLUNIFORM2UIVPROC) IRR_OGL_LOAD_EXTENSION("glUniform2uiv"); + pGlUniform3uiv = (PFNGLUNIFORM3UIVPROC) IRR_OGL_LOAD_EXTENSION("glUniform3uiv"); + pGlUniform4uiv = (PFNGLUNIFORM4UIVPROC) IRR_OGL_LOAD_EXTENSION("glUniform4uiv"); pGlUniformMatrix2fvARB = (PFNGLUNIFORMMATRIX2FVARBPROC) IRR_OGL_LOAD_EXTENSION("glUniformMatrix2fvARB"); pGlUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC) IRR_OGL_LOAD_EXTENSION("glUniformMatrix2x3fv"); pGlUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)IRR_OGL_LOAD_EXTENSION("glUniformMatrix2x4fv"); @@ -581,6 +587,10 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) pGlGetTextureImage = (PFNGLGETTEXTUREIMAGEPROC)IRR_OGL_LOAD_EXTENSION("glGetTextureImage"); pGlNamedFramebufferTexture = (PFNGLNAMEDFRAMEBUFFERTEXTUREPROC) IRR_OGL_LOAD_EXTENSION("glNamedFramebufferTexture"); pGlTextureParameteri = (PFNGLTEXTUREPARAMETERIPROC) IRR_OGL_LOAD_EXTENSION("glTextureParameteri"); + pGlTextureParameterf = (PFNGLTEXTUREPARAMETERFPROC)IRR_OGL_LOAD_EXTENSION("glTextureParameterf"); + pGlTextureParameteriv = (PFNGLTEXTUREPARAMETERIVPROC)IRR_OGL_LOAD_EXTENSION("glTextureParameteriv"); + pGlTextureParameterfv = (PFNGLTEXTUREPARAMETERFVPROC)IRR_OGL_LOAD_EXTENSION("glTextureParameterfv"); + pGlCreateTextures = (PFNGLCREATETEXTURESPROC) IRR_OGL_LOAD_EXTENSION("glCreateTextures"); pGlCreateFramebuffers = (PFNGLCREATEFRAMEBUFFERSPROC) IRR_OGL_LOAD_EXTENSION("glCreateFramebuffers"); pGlBindTextures = (PFNGLBINDTEXTURESPROC) IRR_OGL_LOAD_EXTENSION("glBindTextures"); diff --git a/source/Irrlicht/COpenGLExtensionHandler.h b/source/Irrlicht/COpenGLExtensionHandler.h index ff30e48..3ba22f7 100644 --- a/source/Irrlicht/COpenGLExtensionHandler.h +++ b/source/Irrlicht/COpenGLExtensionHandler.h @@ -1127,6 +1127,10 @@ class COpenGLExtensionHandler void extGlUniform2iv(GLint loc, GLsizei count, const GLint *v); void extGlUniform3iv(GLint loc, GLsizei count, const GLint *v); void extGlUniform4iv(GLint loc, GLsizei count, const GLint *v); + void extGlUniform1uiv(GLint loc, GLsizei count, const GLuint *v); + void extGlUniform2uiv(GLint loc, GLsizei count, const GLuint *v); + void extGlUniform3uiv(GLint loc, GLsizei count, const GLuint *v); + void extGlUniform4uiv(GLint loc, GLsizei count, const GLuint *v); void extGlUniformMatrix2fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v); void extGlUniformMatrix2x3fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v); void extGlUniformMatrix2x4fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v); @@ -1199,6 +1203,9 @@ class COpenGLExtensionHandler void extGlGetTextureImage(GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void* pixels); void extGlNamedFramebufferTexture(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); void extGlTextureParameteri(GLuint texture, GLenum pname, GLint param); + void extGlTextureParameterf(GLuint texture, GLenum pname, GLfloat param); + void extGlTextureParameteriv(GLuint texture, GLenum pname, const GLint* params); + void extGlTextureParameterfv(GLuint texture, GLenum pname, const GLfloat* params); void extGlCreateTextures(GLenum target, GLsizei n, GLuint* textures); void extGlCreateFramebuffers(GLsizei n, GLuint* framebuffers); void extGlBindTextures(GLuint first, GLsizei count, const GLuint *textures, const GLenum* targets); @@ -1262,6 +1269,10 @@ class COpenGLExtensionHandler PFNGLUNIFORM2IVARBPROC pGlUniform2ivARB; PFNGLUNIFORM3IVARBPROC pGlUniform3ivARB; PFNGLUNIFORM4IVARBPROC pGlUniform4ivARB; + PFNGLUNIFORM1UIVPROC pGlUniform1uiv; + PFNGLUNIFORM2UIVPROC pGlUniform2uiv; + PFNGLUNIFORM3UIVPROC pGlUniform3uiv; + PFNGLUNIFORM4UIVPROC pGlUniform4uiv; PFNGLUNIFORMMATRIX2FVARBPROC pGlUniformMatrix2fvARB; PFNGLUNIFORMMATRIX2X3FVPROC pGlUniformMatrix2x3fv; PFNGLUNIFORMMATRIX2X4FVPROC pGlUniformMatrix2x4fv; @@ -1365,6 +1376,10 @@ class COpenGLExtensionHandler PFNGLGETTEXTUREIMAGEPROC pGlGetTextureImage; PFNGLNAMEDFRAMEBUFFERTEXTUREPROC pGlNamedFramebufferTexture; PFNGLTEXTUREPARAMETERIPROC pGlTextureParameteri; + PFNGLTEXTUREPARAMETERFPROC pGlTextureParameterf; + PFNGLTEXTUREPARAMETERIVPROC pGlTextureParameteriv; + PFNGLTEXTUREPARAMETERFVPROC pGlTextureParameterfv; + PFNGLCREATETEXTURESPROC pGlCreateTextures; PFNGLCREATEFRAMEBUFFERSPROC pGlCreateFramebuffers; PFNGLBINDTEXTURESPROC pGlBindTextures; @@ -1895,6 +1910,46 @@ inline void COpenGLExtensionHandler::extGlUniform4fv(GLint loc, GLsizei count, c #endif } +inline void COpenGLExtensionHandler::extGlUniform1uiv(GLint loc, GLsizei count, const GLuint *v) +{ +#ifdef _IRR_OPENGL_USE_EXTPOINTER_ + if (pGlUniform1uiv) + pGlUniform1uiv(loc, count, v); +#else + glUniform1uiv(loc, count, v); +#endif +} + +inline void COpenGLExtensionHandler::extGlUniform2uiv(GLint loc, GLsizei count, const GLuint *v) +{ +#ifdef _IRR_OPENGL_USE_EXTPOINTER_ + if (pGlUniform2uiv) + pGlUniform2uiv(loc, count, v); +#else + glUniform2uiv(loc, count, v); +#endif +} + +inline void COpenGLExtensionHandler::extGlUniform3uiv(GLint loc, GLsizei count, const GLuint *v) +{ +#ifdef _IRR_OPENGL_USE_EXTPOINTER_ + if (pGlUniform3uiv) + pGlUniform3uiv(loc, count, v); +#else + glUniform3uiv(loc, count, v); +#endif +} + +inline void COpenGLExtensionHandler::extGlUniform4uiv(GLint loc, GLsizei count, const GLuint *v) +{ +#ifdef _IRR_OPENGL_USE_EXTPOINTER_ + if (pGlUniform4uiv) + pGlUniform4uiv(loc, count, v); +#else + glUniform4uiv(loc, count, v); +#endif +} + inline void COpenGLExtensionHandler::extGlUniform1iv(GLint loc, GLsizei count, const GLint *v) { #ifdef _IRR_OPENGL_USE_EXTPOINTER_ @@ -3038,8 +3093,30 @@ inline void COpenGLExtensionHandler::extGlTextureParameteri(GLuint texture, GLen #ifdef _IRR_OPENGL_USE_EXTPOINTER_ if (pGlTextureParameteri) pGlTextureParameteri(texture, pname, param); -#else - // TODO +#endif//_IRR_OPENGL_USE_EXTPOINTER_ +} + +inline void COpenGLExtensionHandler::extGlTextureParameterf(GLuint texture, GLenum pname, GLfloat param) +{ +#ifdef _IRR_OPENGL_USE_EXTPOINTER_ + if (pGlTextureParameterf) + pGlTextureParameterf(texture, pname, param); +#endif//_IRR_OPENGL_USE_EXTPOINTER_ +} + +inline void COpenGLExtensionHandler::extGlTextureParameteriv(GLuint texture, GLenum pname, const GLint* params) +{ +#ifdef _IRR_OPENGL_USE_EXTPOINTER_ + if (pGlTextureParameteriv) + pGlTextureParameteriv(texture, pname, params); +#endif//_IRR_OPENGL_USE_EXTPOINTER_ +} + +inline void COpenGLExtensionHandler::extGlTextureParameterfv(GLuint texture, GLenum pname, const GLfloat* params) +{ +#ifdef _IRR_OPENGL_USE_EXTPOINTER_ + if (pGlTextureParameterfv) + pGlTextureParameterfv(texture, pname, params); #endif//_IRR_OPENGL_USE_EXTPOINTER_ } diff --git a/source/Irrlicht/COpenGLSLMaterialRenderer.cpp b/source/Irrlicht/COpenGLSLMaterialRenderer.cpp index 13df6a6..14a0ecf 100644 --- a/source/Irrlicht/COpenGLSLMaterialRenderer.cpp +++ b/source/Irrlicht/COpenGLSLMaterialRenderer.cpp @@ -608,9 +608,13 @@ bool COpenGLSLMaterialRenderer::setVertexShaderConstant(s32 index, const s32* in return setPixelShaderConstant(index, ints, count); } +bool COpenGLSLMaterialRenderer::setVertexShaderConstant(s32 index, const u32* ints, int count) +{ + return setPixelShaderConstant(index, ints, count); +} + bool COpenGLSLMaterialRenderer::setPixelShaderConstant(s32 index, const f32* floats, int count) { -#ifdef GL_ARB_shader_objects if(index < 0 || UniformInfo[index].location < 0) return false; @@ -678,14 +682,10 @@ bool COpenGLSLMaterialRenderer::setPixelShaderConstant(s32 index, const f32* flo break; } return status; -#else - return false; -#endif } bool COpenGLSLMaterialRenderer::setPixelShaderConstant(s32 index, const s32* ints, int count) { -#ifdef GL_ARB_shader_objects if(index < 0 || UniformInfo[index].location < 0) return false; @@ -722,9 +722,34 @@ bool COpenGLSLMaterialRenderer::setPixelShaderConstant(s32 index, const s32* int break; } return status; -#else - return false; -#endif +} + +bool COpenGLSLMaterialRenderer::setPixelShaderConstant(s32 index, const u32* ints, int count) +{ + if(index < 0 || UniformInfo[index].location < 0) + return false; + + bool status = true; + + switch (UniformInfo[index].type) + { + case GL_UNSIGNED_INT: + Driver->extGlUniform1uiv(UniformInfo[index].location, count, reinterpret_cast(ints)); + break; + case GL_UNSIGNED_INT_VEC2: + Driver->extGlUniform2uiv(UniformInfo[index].location, count/2, reinterpret_cast(ints)); + break; + case GL_UNSIGNED_INT_VEC3: + Driver->extGlUniform3uiv(UniformInfo[index].location, count/3, reinterpret_cast(ints)); + break; + case GL_UNSIGNED_INT_VEC4: + Driver->extGlUniform4uiv(UniformInfo[index].location, count/4, reinterpret_cast(ints)); + break; + default: + status = false; + break; + } + return status; } IVideoDriver* COpenGLSLMaterialRenderer::getVideoDriver() diff --git a/source/Irrlicht/COpenGLSLMaterialRenderer.h b/source/Irrlicht/COpenGLSLMaterialRenderer.h index e3129ea..354f1a0 100644 --- a/source/Irrlicht/COpenGLSLMaterialRenderer.h +++ b/source/Irrlicht/COpenGLSLMaterialRenderer.h @@ -79,8 +79,10 @@ public: virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) _IRR_OVERRIDE_; virtual bool setVertexShaderConstant(s32 index, const f32* floats, int count) _IRR_OVERRIDE_; virtual bool setVertexShaderConstant(s32 index, const s32* ints, int count) _IRR_OVERRIDE_; + virtual bool setVertexShaderConstant(s32 index, const u32* ints, int count) _IRR_OVERRIDE_; virtual bool setPixelShaderConstant(s32 index, const f32* floats, int count) _IRR_OVERRIDE_; virtual bool setPixelShaderConstant(s32 index, const s32* ints, int count) _IRR_OVERRIDE_; + virtual bool setPixelShaderConstant(s32 index, const u32* ints, int count) _IRR_OVERRIDE_; virtual IVideoDriver* getVideoDriver() _IRR_OVERRIDE_; protected: diff --git a/tests/tests-last-passed-at.txt b/tests/tests-last-passed-at.txt index 1034815..673e1c4 100644 --- a/tests/tests-last-passed-at.txt +++ b/tests/tests-last-passed-at.txt @@ -1,4 +1,4 @@ -Tests finished. 72 tests of 72 passed. -Compiled as DEBUG -Test suite pass at GMT Fri Jan 3 17:05:41 2020 - +Tests finished. 72 tests of 72 passed. +Compiled as DEBUG +Test suite pass at GMT Mon Feb 10 14:59:56 2020 +