Merging r6039 through r6072 from trunk to ogl-es branch.

Note: Not yet caught up with trunk.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@6114 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2020-06-10 22:19:09 +00:00
parent 3e26f3d7a9
commit cb62c685de
17 changed files with 344 additions and 128 deletions

@ -9,6 +9,7 @@ Changes in ogl-es (not yet released - will be merged with trunk at some point)
--------------------------
Changes in 1.9 (not yet released)
- Fix CPLYMeshFileLoader checking for wrong vertex count when switching between 16/32 bit. Thanks @randomMesh for reporting.
- Fix bug that AnimatedMeshSceneNode ignored ReadOnlyMaterials flag when checking materials for transparent render passes.
- Unify checks if materials should use transparent render pass with new IVideoDriver::needsTransparentRenderPass function.
- Material.ZWriteEnable is now of type E_ZWRITE instead of bool. This allows now setting materials to always "on" independent of material type and transparency.

@ -470,25 +470,29 @@ public:
return imageSize;
}
// Define to check for all compressed image formats cases in a switch
#define IRR_CASE_IIMAGE_COMPRESSED_FORMAT\
case ECF_DXT1:\
case ECF_DXT2:\
case ECF_DXT3:\
case ECF_DXT4:\
case ECF_DXT5:\
case ECF_PVRTC_RGB2:\
case ECF_PVRTC_ARGB2:\
case ECF_PVRTC2_ARGB2:\
case ECF_PVRTC_RGB4:\
case ECF_PVRTC_ARGB4:\
case ECF_PVRTC2_ARGB4:\
case ECF_ETC1:\
case ECF_ETC2_RGB:\
case ECF_ETC2_ARGB:
//! check if this is compressed color format
static bool isCompressedFormat(const ECOLOR_FORMAT format)
{
switch(format)
{
case ECF_DXT1:
case ECF_DXT2:
case ECF_DXT3:
case ECF_DXT4:
case ECF_DXT5:
case ECF_PVRTC_RGB2:
case ECF_PVRTC_ARGB2:
case ECF_PVRTC2_ARGB2:
case ECF_PVRTC_RGB4:
case ECF_PVRTC_ARGB4:
case ECF_PVRTC2_ARGB4:
case ECF_ETC1:
case ECF_ETC2_RGB:
case ECF_ETC2_ARGB:
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
return true;
default:
return false;

@ -757,8 +757,13 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
case ECF_R8G8B8:
convert_A1R5G5B5toR8G8B8(sP, sN, dP);
break;
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break;
#ifndef _DEBUG
default:
break;
#endif
}
break;
case ECF_R5G6B5:
@ -776,8 +781,13 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
case ECF_R8G8B8:
convert_R5G6B5toR8G8B8(sP, sN, dP);
break;
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break;
#ifndef _DEBUG
default:
break;
#endif
}
break;
case ECF_A8R8G8B8:
@ -795,8 +805,13 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
case ECF_R8G8B8:
convert_A8R8G8B8toR8G8B8(sP, sN, dP);
break;
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break;
#ifndef _DEBUG
default:
break;
#endif
}
break;
case ECF_R8G8B8:
@ -814,10 +829,18 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
case ECF_R8G8B8:
convert_R8G8B8toR8G8B8(sP, sN, dP);
break;
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break;
#ifndef _DEBUG
default:
break;
#endif
}
break;
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
break;
#ifndef _DEBUG
default:
break;

@ -3270,6 +3270,9 @@ ITexture* CD3D9Driver::addRenderTargetTexture(const core::dimension2d<u32>& size
const io::path& name,
const ECOLOR_FORMAT format)
{
if ( IImage::isCompressedFormat(format) )
return 0;
CD3D9Texture* tex = new CD3D9Texture(this, size, name, ETT_2D, format);
if (tex)
{
@ -3288,6 +3291,9 @@ ITexture* CD3D9Driver::addRenderTargetTexture(const core::dimension2d<u32>& size
ITexture* CD3D9Driver::addRenderTargetTextureCubemap(const irr::u32 sideLen,
const io::path& name, const ECOLOR_FORMAT format)
{
if ( IImage::isCompressedFormat(format) )
return 0;
CD3D9Texture* tex = new CD3D9Texture(this, core::dimension2d<u32>(sideLen, sideLen), name, ETT_CUBEMAP, format);
if (tex)
{

@ -43,12 +43,6 @@ CImage::CImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size) : IImag
//! sets a pixel
void CImage::setPixel(u32 x, u32 y, const SColor &color, bool blend)
{
if (IImage::isCompressedFormat(Format))
{
os::Printer::log("IImage::setPixel method doesn't work with compressed images.", ELL_WARNING);
return;
}
if (x >= Size.Width || y >= Size.Height)
return;
@ -79,6 +73,15 @@ void CImage::setPixel(u32 x, u32 y, const SColor &color, bool blend)
u32 * dest = (u32*) (Data + ( y * Pitch ) + ( x << 2 ));
*dest = blend ? PixelBlend32 ( *dest, color.color ) : color.color;
} break;
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("IImage::setPixel method doesn't work with compressed images.", ELL_WARNING);
return;
case ECF_UNKNOWN:
os::Printer::log("IImage::setPixel unknown format.", ELL_WARNING);
return;
default:
break;
}
@ -88,12 +91,6 @@ void CImage::setPixel(u32 x, u32 y, const SColor &color, bool blend)
//! returns a pixel
SColor CImage::getPixel(u32 x, u32 y) const
{
if (IImage::isCompressedFormat(Format))
{
os::Printer::log("IImage::getPixel method doesn't work with compressed images.", ELL_WARNING);
return SColor(0);
}
if (x >= Size.Width || y >= Size.Height)
return SColor(0);
@ -110,6 +107,15 @@ SColor CImage::getPixel(u32 x, u32 y) const
u8* p = Data+(y*3)*Size.Width + (x*3);
return SColor(255,p[0],p[1],p[2]);
}
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
os::Printer::log("IImage::getPixel method doesn't work with compressed images.", ELL_WARNING);
break;
case ECF_UNKNOWN:
os::Printer::log("IImage::getPixel unknown format.", ELL_WARNING);
break;
default:
break;
}

@ -10,6 +10,7 @@
#include "IWriteFile.h"
#include "CColorConverter.h"
#include "irrString.h"
#include "os.h"
namespace irr
{
@ -81,6 +82,7 @@ bool CImageWriterBMP::writeImage(io::IWriteFile* file, IImage* image, u32 param)
= CColorConverter::convert_R5G6B5toR8G8B8;
break;
default:
os::Printer::log("CImageWriterBMP does not support image format", ColorFormatNames[image->getColorFormat()], ELL_WARNING);
break;
}

@ -10,6 +10,7 @@
#include "IWriteFile.h"
#include "CImage.h"
#include "irrString.h"
#include "os.h"
#ifdef _IRR_COMPILE_WITH_LIBJPEG_
#include <stdio.h> // required for jpeglib.h
@ -122,6 +123,7 @@ static bool writeJPEGFile(io::IWriteFile* file, IImage* image, u32 quality)
format = CColorConverter::convert_R5G6B5toR8G8B8;
break;
default:
os::Printer::log("writeJPEGFile does not support image format", ColorFormatNames[image->getColorFormat()], ELL_WARNING);
break;
}

@ -163,7 +163,10 @@ bool CImageWriterPNG::writeImage(io::IWriteFile* file, IImage* image,u32 param)
break;
// TODO: Error handling in case of unsupported color format
default:
break;
os::Printer::log("CImageWriterPNG does not support image format", ColorFormatNames[image->getColorFormat()], ELL_WARNING);
png_destroy_write_struct(&png_ptr, &info_ptr);
delete [] tmpImage;
return false;
}
// Create array of pointers to rows in image data

@ -10,6 +10,7 @@
#include "IWriteFile.h"
#include "CColorConverter.h"
#include "irrString.h"
#include "os.h"
namespace irr
{
@ -85,6 +86,7 @@ bool CImageWriterTGA::writeImage(io::IWriteFile *file, IImage *image,u32 param)
imageHeader.ImageDescriptor |= 0;
break;
default:
os::Printer::log("CImageWriterTGA does not support image format", ColorFormatNames[image->getColorFormat()], ELL_WARNING);
break;
}

@ -274,6 +274,9 @@ public:
AssignedDepth = false;
AssignedStencil = false;
}
#ifdef _DEBUG
Driver->testGLError(__LINE__);
#endif
RequestDepthStencilUpdate = false;
}

@ -2752,7 +2752,7 @@ void COpenGLDriver::setTextureRenderStates(const SMaterial& material, bool reset
statesCache.IsCached = false;
#ifdef GL_VERSION_2_1
if (Version >= 210)
if (Version >= 201)
{
if (!statesCache.IsCached || material.TextureLayer[i].LODBias != statesCache.LODBias)
{
@ -3772,6 +3772,9 @@ IVideoDriver* COpenGLDriver::getVideoDriver()
ITexture* COpenGLDriver::addRenderTargetTexture(const core::dimension2d<u32>& size,
const io::path& name, const ECOLOR_FORMAT format)
{
if ( IImage::isCompressedFormat(format) )
return 0;
//disable mip-mapping
bool generateMipLevels = getTextureCreationFlag(ETCF_CREATE_MIP_MAPS);
setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, false);
@ -3799,6 +3802,9 @@ ITexture* COpenGLDriver::addRenderTargetTexture(const core::dimension2d<u32>& si
//! Creates a render target texture for a cubemap
ITexture* COpenGLDriver::addRenderTargetTextureCubemap(const irr::u32 sideLen, const io::path& name, const ECOLOR_FORMAT format)
{
if ( IImage::isCompressedFormat(format) )
return 0;
//disable mip-mapping
bool generateMipLevels = getTextureCreationFlag(ETCF_CREATE_MIP_MAPS);
setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, false);
@ -4231,10 +4237,13 @@ bool COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
pixelType = GL_UNSIGNED_INT_8_8_8_8_REV;
break;
case ECF_DXT1:
supported = true;
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
pixelFormat = GL_BGRA_EXT;
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
if (queryOpenGLFeature(COpenGLExtensionHandler::IRR_EXT_texture_compression_s3tc))
{
supported = true;
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
pixelFormat = GL_BGRA_EXT;
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
}
break;
case ECF_DXT2:
case ECF_DXT3:

@ -44,7 +44,9 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() :
pGlGetUniformLocationARB(0), pGlGetUniformLocation(0),
pGlUniform1fvARB(0), pGlUniform2fvARB(0), pGlUniform3fvARB(0), pGlUniform4fvARB(0),
pGlUniform1ivARB(0), pGlUniform2ivARB(0), pGlUniform3ivARB(0), pGlUniform4ivARB(0),
pGlUniformMatrix2fvARB(0), pGlUniformMatrix3fvARB(0), pGlUniformMatrix4fvARB(0),
pGlUniformMatrix2fvARB(0), pGlUniformMatrix2x3fv(0), pGlUniformMatrix2x4fv(0),
pGlUniformMatrix3x2fv(0), pGlUniformMatrix3fvARB(0), pGlUniformMatrix3x4fv(0),
pGlUniformMatrix4x2fv(0), pGlUniformMatrix4x3fv(0), pGlUniformMatrix4fvARB(0),
pGlGetActiveUniformARB(0), pGlGetActiveUniform(0),
pGlPointParameterfARB(0), pGlPointParameterfvARB(0),
pGlStencilFuncSeparate(0), pGlStencilOpSeparate(0),
@ -84,11 +86,11 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() :
pGlBlendFuncIndexedAMD(0), pGlBlendFunciARB(0), pGlBlendFuncSeparateIndexedAMD(0), pGlBlendFuncSeparateiARB(0),
pGlBlendEquationIndexedAMD(0), pGlBlendEquationiARB(0), pGlBlendEquationSeparateIndexedAMD(0), pGlBlendEquationSeparateiARB(0),
// DSA
pGlTextureStorage2D(0), pGlTextureStorage3D(0), pGlTextureSubImage2D(0), pGlNamedFramebufferTexture(0),
pGlTextureStorage2D(0), pGlTextureStorage3D(0), pGlTextureSubImage2D(0), pGlGetTextureImage(0), pGlNamedFramebufferTexture(0),
pGlTextureParameteri(0), pGlCreateTextures(0), pGlCreateFramebuffers(0), pGlBindTextures(0), pGlGenerateTextureMipmap(0),
// DSA with EXT or functions to simulate it
pGlTextureSubImage2DEXT(0), pGlTextureStorage2DEXT(0), pGlTexStorage2D(0), pGlTextureStorage3DEXT(0),
pGlTexStorage3D(0), pGlNamedFramebufferTextureEXT(0), pGlFramebufferTexture(0), pGlGenerateTextureMipmapEXT(0)
pGlTextureStorage2DEXT(0), pGlTexStorage2D(0), pGlTextureStorage3DEXT(0), pGlTexStorage3D(0), pGlTextureSubImage2DEXT(0), pGlGetTextureImageEXT(0),
pGlNamedFramebufferTextureEXT(0), pGlFramebufferTexture(0), pGlGenerateTextureMipmapEXT(0)
#if defined(GLX_SGI_swap_control)
,pGlxSwapIntervalSGI(0)
#endif
@ -465,7 +467,13 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
pGlUniform3ivARB = (PFNGLUNIFORM3IVARBPROC) IRR_OGL_LOAD_EXTENSION("glUniform3ivARB");
pGlUniform4ivARB = (PFNGLUNIFORM4IVARBPROC) IRR_OGL_LOAD_EXTENSION("glUniform4ivARB");
pGlUniformMatrix2fvARB = (PFNGLUNIFORMMATRIX2FVARBPROC) IRR_OGL_LOAD_EXTENSION("glUniformMatrix2fvARB");
pGlUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC) IRR_OGL_LOAD_EXTENSION("glUniformMatrix2x3fv");
pGlUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)IRR_OGL_LOAD_EXTENSION("glUniformMatrix2x4fv");
pGlUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)IRR_OGL_LOAD_EXTENSION("glUniformMatrix3x2fv");
pGlUniformMatrix3fvARB = (PFNGLUNIFORMMATRIX3FVARBPROC) IRR_OGL_LOAD_EXTENSION("glUniformMatrix3fvARB");
pGlUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)IRR_OGL_LOAD_EXTENSION("glUniformMatrix3x4fv");
pGlUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)IRR_OGL_LOAD_EXTENSION("glUniformMatrix4x2fv");
pGlUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)IRR_OGL_LOAD_EXTENSION("glUniformMatrix4x3fv");
pGlUniformMatrix4fvARB = (PFNGLUNIFORMMATRIX4FVARBPROC) IRR_OGL_LOAD_EXTENSION("glUniformMatrix4fvARB");
pGlGetActiveUniformARB = (PFNGLGETACTIVEUNIFORMARBPROC) IRR_OGL_LOAD_EXTENSION("glGetActiveUniformARB");
pGlGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC) IRR_OGL_LOAD_EXTENSION("glGetActiveUniform");
@ -567,9 +575,10 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
pGlBlendEquationSeparateIndexedAMD = (PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC) IRR_OGL_LOAD_EXTENSION("glBlendEquationSeparateIndexedAMD");
pGlBlendEquationSeparateiARB = (PFNGLBLENDEQUATIONSEPARATEIPROC) IRR_OGL_LOAD_EXTENSION("glBlendEquationSeparateiARB");
pGlTextureSubImage2D = (PFNGLTEXTURESUBIMAGE2DPROC)IRR_OGL_LOAD_EXTENSION("glTextureSubImage2D");
pGlTextureStorage2D = (PFNGLTEXTURESTORAGE2DPROC) IRR_OGL_LOAD_EXTENSION("glTextureStorage2D");
pGlTextureStorage3D = (PFNGLTEXTURESTORAGE3DPROC) IRR_OGL_LOAD_EXTENSION("glTextureStorage3D");
pGlTextureSubImage2D = (PFNGLTEXTURESUBIMAGE2DPROC)IRR_OGL_LOAD_EXTENSION("glTextureSubImage2D");
pGlGetTextureImage = (PFNGLGETTEXTUREIMAGEPROC)IRR_OGL_LOAD_EXTENSION("glGetTextureImage");
pGlNamedFramebufferTexture = (PFNGLNAMEDFRAMEBUFFERTEXTUREPROC) IRR_OGL_LOAD_EXTENSION("glNamedFramebufferTexture");
pGlTextureParameteri = (PFNGLTEXTUREPARAMETERIPROC) IRR_OGL_LOAD_EXTENSION("glTextureParameteri");
pGlCreateTextures = (PFNGLCREATETEXTURESPROC) IRR_OGL_LOAD_EXTENSION("glCreateTextures");
@ -577,11 +586,12 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
pGlBindTextures = (PFNGLBINDTEXTURESPROC) IRR_OGL_LOAD_EXTENSION("glBindTextures");
pGlGenerateTextureMipmap = (PFNGLGENERATETEXTUREMIPMAPPROC) IRR_OGL_LOAD_EXTENSION("glGenerateTextureMipmap");
//==============================
pGlTextureSubImage2DEXT = (PFNGLTEXTURESUBIMAGE2DEXTPROC)IRR_OGL_LOAD_EXTENSION("glTextureSubImage2DEXT");
pGlTextureStorage2DEXT = (PFNGLTEXTURESTORAGE2DEXTPROC)IRR_OGL_LOAD_EXTENSION("glTextureStorage2DEXT");
pGlTexStorage2D = (PFNGLTEXSTORAGE2DPROC)IRR_OGL_LOAD_EXTENSION("glTexStorage2D");
pGlTextureStorage3DEXT = (PFNGLTEXTURESTORAGE3DEXTPROC)IRR_OGL_LOAD_EXTENSION("glTextureStorage3DEXT");
pGlTexStorage3D = (PFNGLTEXSTORAGE3DPROC)IRR_OGL_LOAD_EXTENSION("glTexStorage3D");
pGlTextureSubImage2DEXT = (PFNGLTEXTURESUBIMAGE2DEXTPROC)IRR_OGL_LOAD_EXTENSION("glTextureSubImage2DEXT");
pGlGetTextureImageEXT = (PFNGLGETTEXTUREIMAGEEXTPROC)IRR_OGL_LOAD_EXTENSION("glGetTextureImageEXT");
pGlNamedFramebufferTextureEXT = (PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC)IRR_OGL_LOAD_EXTENSION("glNamedFramebufferTextureEXT");
pGlFramebufferTexture = (PFNGLFRAMEBUFFERTEXTUREPROC)IRR_OGL_LOAD_EXTENSION("glFramebufferTexture");
pGlActiveTexture = (PFNGLACTIVETEXTUREPROC)IRR_OGL_LOAD_EXTENSION("glActiveTexture");
@ -751,7 +761,7 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
#endif
OcclusionQuerySupport=false;
Feature.BlendOperation = (Version >= 140) ||
Feature.BlendOperation = (Version >= 104) ||
FeatureAvailable[IRR_EXT_blend_minmax] ||
FeatureAvailable[IRR_EXT_blend_subtract] ||
FeatureAvailable[IRR_EXT_blend_logic_op];
@ -850,17 +860,17 @@ bool COpenGLExtensionHandler::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const
return FeatureAvailable[IRR_ARB_occlusion_query] && OcclusionQuerySupport;
case EVDF_POLYGON_OFFSET:
// both features supported with OpenGL 1.1
return Version>=110;
return Version>=101;
case EVDF_BLEND_OPERATIONS:
return Feature.BlendOperation;
case EVDF_BLEND_SEPARATE:
return (Version>=140) || FeatureAvailable[IRR_EXT_blend_func_separate];
return (Version>=104) || FeatureAvailable[IRR_EXT_blend_func_separate];
case EVDF_TEXTURE_MATRIX:
return true;
case EVDF_TEXTURE_COMPRESSED_DXT:
return FeatureAvailable[IRR_EXT_texture_compression_s3tc];
case EVDF_TEXTURE_CUBEMAP:
return (Version >= 130) || FeatureAvailable[IRR_ARB_texture_cube_map] || FeatureAvailable[IRR_EXT_texture_cube_map];
return (Version >= 103) || FeatureAvailable[IRR_ARB_texture_cube_map] || FeatureAvailable[IRR_EXT_texture_cube_map];
case EVDF_TEXTURE_CUBEMAP_SEAMLESS:
return FeatureAvailable[IRR_ARB_seamless_cube_map];
case EVDF_DEPTH_CLAMP:

@ -85,6 +85,7 @@ static const char* const OpenGLFeatureStrings[] = {
"GL_ARB_depth_buffer_float",
"GL_ARB_depth_clamp",
"GL_ARB_depth_texture",
"GL_ARB_direct_state_access",
"GL_ARB_draw_buffers",
"GL_ARB_draw_buffers_blend",
"GL_ARB_draw_elements_base_vertex",
@ -571,6 +572,7 @@ class COpenGLExtensionHandler
IRR_ARB_depth_buffer_float,
IRR_ARB_depth_clamp,
IRR_ARB_depth_texture,
IRR_ARB_direct_state_access,
IRR_ARB_draw_buffers,
IRR_ARB_draw_buffers_blend,
IRR_ARB_draw_elements_base_vertex,
@ -1126,7 +1128,13 @@ class COpenGLExtensionHandler
void extGlUniform3iv(GLint loc, GLsizei count, const GLint *v);
void extGlUniform4iv(GLint loc, GLsizei count, const GLint *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);
void extGlUniformMatrix3x2fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v);
void extGlUniformMatrix3fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v);
void extGlUniformMatrix3x4fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v);
void extGlUniformMatrix4x2fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v);
void extGlUniformMatrix4x3fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v);
void extGlUniformMatrix4fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v);
void extGlGetActiveUniformARB(GLhandleARB program, GLuint index, GLsizei maxlength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
void extGlGetActiveUniform(GLuint program, GLuint index, GLsizei maxlength, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
@ -1188,6 +1196,7 @@ class COpenGLExtensionHandler
void extGlTextureSubImage2D(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels);
void extGlTextureStorage2D(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
void extGlTextureStorage3D(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
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 extGlCreateTextures(GLenum target, GLsizei n, GLuint* textures);
@ -1254,7 +1263,13 @@ class COpenGLExtensionHandler
PFNGLUNIFORM3IVARBPROC pGlUniform3ivARB;
PFNGLUNIFORM4IVARBPROC pGlUniform4ivARB;
PFNGLUNIFORMMATRIX2FVARBPROC pGlUniformMatrix2fvARB;
PFNGLUNIFORMMATRIX2X3FVPROC pGlUniformMatrix2x3fv;
PFNGLUNIFORMMATRIX2X4FVPROC pGlUniformMatrix2x4fv;
PFNGLUNIFORMMATRIX3X2FVPROC pGlUniformMatrix3x2fv;
PFNGLUNIFORMMATRIX3FVARBPROC pGlUniformMatrix3fvARB;
PFNGLUNIFORMMATRIX3X4FVPROC pGlUniformMatrix3x4fv;
PFNGLUNIFORMMATRIX4X2FVPROC pGlUniformMatrix4x2fv;
PFNGLUNIFORMMATRIX4X3FVPROC pGlUniformMatrix4x3fv;
PFNGLUNIFORMMATRIX4FVARBPROC pGlUniformMatrix4fvARB;
PFNGLGETACTIVEUNIFORMARBPROC pGlGetActiveUniformARB;
PFNGLGETACTIVEUNIFORMPROC pGlGetActiveUniform;
@ -1347,6 +1362,7 @@ class COpenGLExtensionHandler
PFNGLTEXTURESTORAGE2DPROC pGlTextureStorage2D;
PFNGLTEXTURESTORAGE3DPROC pGlTextureStorage3D;
PFNGLTEXTURESUBIMAGE2DPROC pGlTextureSubImage2D;
PFNGLGETTEXTUREIMAGEPROC pGlGetTextureImage;
PFNGLNAMEDFRAMEBUFFERTEXTUREPROC pGlNamedFramebufferTexture;
PFNGLTEXTUREPARAMETERIPROC pGlTextureParameteri;
PFNGLCREATETEXTURESPROC pGlCreateTextures;
@ -1354,11 +1370,12 @@ class COpenGLExtensionHandler
PFNGLBINDTEXTURESPROC pGlBindTextures;
PFNGLGENERATETEXTUREMIPMAPPROC pGlGenerateTextureMipmap;
// DSA with EXT or functions to simulate it
PFNGLTEXTURESUBIMAGE2DEXTPROC pGlTextureSubImage2DEXT;
PFNGLTEXTURESTORAGE2DEXTPROC pGlTextureStorage2DEXT;
PFNGLTEXSTORAGE2DPROC pGlTexStorage2D;
PFNGLTEXTURESTORAGE3DEXTPROC pGlTextureStorage3DEXT;
PFNGLTEXSTORAGE3DPROC pGlTexStorage3D;
PFNGLTEXTURESUBIMAGE2DEXTPROC pGlTextureSubImage2DEXT;
PFNGLGETTEXTUREIMAGEEXTPROC pGlGetTextureImageEXT;
PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC pGlNamedFramebufferTextureEXT;
PFNGLFRAMEBUFFERTEXTUREPROC pGlFramebufferTexture;
PFNGLGENERATETEXTUREMIPMAPEXTPROC pGlGenerateTextureMipmapEXT;
@ -1938,6 +1955,36 @@ inline void COpenGLExtensionHandler::extGlUniformMatrix2fv(GLint loc, GLsizei co
#endif
}
inline void COpenGLExtensionHandler::extGlUniformMatrix2x3fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat* v)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlUniformMatrix2x3fv)
pGlUniformMatrix2x3fv(loc, count, transpose, v);
else
os::Printer::log("glUniformMatrix2x3fv not supported", ELL_ERROR);
#endif
}
inline void COpenGLExtensionHandler::extGlUniformMatrix2x4fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat* v)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlUniformMatrix2x4fv)
pGlUniformMatrix2x4fv(loc, count, transpose, v);
else
os::Printer::log("glUniformMatrix2x4fv not supported", ELL_ERROR);
#endif
}
inline void COpenGLExtensionHandler::extGlUniformMatrix3x2fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat* v)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlUniformMatrix3x2fv)
pGlUniformMatrix3x2fv(loc, count, transpose, v);
else
os::Printer::log("glUniformMatrix3x2fv not supported", ELL_ERROR);
#endif
}
inline void COpenGLExtensionHandler::extGlUniformMatrix3fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
@ -1950,6 +1997,36 @@ inline void COpenGLExtensionHandler::extGlUniformMatrix3fv(GLint loc, GLsizei co
#endif
}
inline void COpenGLExtensionHandler::extGlUniformMatrix3x4fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat* v)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlUniformMatrix3x4fv)
pGlUniformMatrix3x4fv(loc, count, transpose, v);
else
os::Printer::log("glUniformMatrix3x4fv not supported", ELL_ERROR);
#endif
}
inline void COpenGLExtensionHandler::extGlUniformMatrix4x2fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat* v)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlUniformMatrix4x2fv)
pGlUniformMatrix4x2fv(loc, count, transpose, v);
else
os::Printer::log("glUniformMatrix4x2fv not supported", ELL_ERROR);
#endif
}
inline void COpenGLExtensionHandler::extGlUniformMatrix4x3fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat* v)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlUniformMatrix4x3fv)
pGlUniformMatrix4x3fv(loc, count, transpose, v);
else
os::Printer::log("glUniformMatrix4x3fv not supported", ELL_ERROR);
#endif
}
inline void COpenGLExtensionHandler::extGlUniformMatrix4fv(GLint loc, GLsizei count, GLboolean transpose, const GLfloat *v)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
@ -2730,7 +2807,7 @@ inline void COpenGLExtensionHandler::irrGlBlendEquationSeparateIndexed(GLuint bu
inline void COpenGLExtensionHandler::extGlTextureSubImage2D(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels)
{
if (Version>=450)
if (Version>=405 || FeatureAvailable[IRR_ARB_direct_state_access])
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlTextureSubImage2D)
@ -2784,7 +2861,7 @@ inline void COpenGLExtensionHandler::extGlTextureSubImage2D(GLuint texture, GLen
inline void COpenGLExtensionHandler::extGlTextureStorage2D(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
{
if (Version>=450)
if (Version>=405 || FeatureAvailable[IRR_ARB_direct_state_access])
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlTextureStorage2D)
@ -2838,7 +2915,7 @@ inline void COpenGLExtensionHandler::extGlTextureStorage2D(GLuint texture, GLenu
inline void COpenGLExtensionHandler::extGlTextureStorage3D(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
{
if (Version>=450)
if (Version>=405 || FeatureAvailable[IRR_ARB_direct_state_access])
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlTextureStorage3D)
@ -2887,11 +2964,54 @@ inline void COpenGLExtensionHandler::extGlTextureStorage3D(GLuint texture, GLenu
}
}
inline void COpenGLExtensionHandler::extGlGetTextureImage(GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void* pixels)
{
if (Version>=405 || FeatureAvailable[IRR_ARB_direct_state_access])
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlGetTextureImage)
pGlGetTextureImage(texture,level,format,type,bufSize,pixels);
#else
glGetTextureImage(texture,level,format,type,bufSize,pixels);
#endif // _IRR_OPENGL_USE_EXTPOINTER_
}
else if (FeatureAvailable[IRR_EXT_direct_state_access])
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlGetTextureImageEXT)
pGlGetTextureImageEXT(texture,target,level,format,type,pixels);
#else
glGetTextureImageEXT(texture,target,level,format,type,pixels);
#endif // _IRR_OPENGL_USE_EXTPOINTER_
}
else
{
GLint bound;
switch (target)
{
case GL_TEXTURE_2D_ARRAY:
glGetIntegerv(GL_TEXTURE_BINDING_2D_ARRAY, &bound);
break;
case GL_TEXTURE_3D:
glGetIntegerv(GL_TEXTURE_BINDING_3D, &bound);
break;
case GL_TEXTURE_CUBE_MAP_ARRAY:
glGetIntegerv(GL_TEXTURE_BINDING_CUBE_MAP_ARRAY, &bound);
break;
default:
return;
}
glBindTexture(target, texture);
glGetTexImage(target,level,format,type,pixels);
glBindTexture(target, bound);
}
}
inline void COpenGLExtensionHandler::extGlNamedFramebufferTexture(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level)
{
if (!needsDSAFramebufferHack)
{
if (Version>=450)
if (Version>=405 || FeatureAvailable[IRR_ARB_direct_state_access])
{
pGlNamedFramebufferTexture(framebuffer, attachment, texture, level);
return;
@ -2925,7 +3045,7 @@ inline void COpenGLExtensionHandler::extGlTextureParameteri(GLuint texture, GLen
inline void COpenGLExtensionHandler::extGlCreateTextures(GLenum target, GLsizei n, GLuint* textures)
{
if (Version>=450)
if (Version>=405)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlCreateTextures)
@ -2946,7 +3066,7 @@ inline void COpenGLExtensionHandler::extGlCreateFramebuffers(GLsizei n, GLuint*
{
if (!needsDSAFramebufferHack)
{
if (Version>=450)
if (Version>=405)
{
pGlCreateFramebuffers(n, framebuffers);
return;
@ -2963,7 +3083,7 @@ inline void COpenGLExtensionHandler::extGlBindTextures(GLuint first, GLsizei cou
GL_TEXTURE_1D_ARRAY,GL_TEXTURE_2D_ARRAY,GL_TEXTURE_BUFFER, // GL 3.x
GL_TEXTURE_CUBE_MAP_ARRAY,GL_TEXTURE_2D_MULTISAMPLE,GL_TEXTURE_2D_MULTISAMPLE_ARRAY}; // GL 4.x
if (Version>=440||FeatureAvailable[IRR_ARB_multi_bind])
if (Version>=404||FeatureAvailable[IRR_ARB_multi_bind])
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlBindTextures)
@ -2999,7 +3119,7 @@ inline void COpenGLExtensionHandler::extGlBindTextures(GLuint first, GLsizei cou
inline void COpenGLExtensionHandler::extGlGenerateTextureMipmap(GLuint texture, GLenum target)
{
if (Version>=450)
if (Version>=405 || FeatureAvailable[IRR_ARB_direct_state_access])
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlGenerateTextureMipmap)

@ -633,9 +633,27 @@ bool COpenGLSLMaterialRenderer::setPixelShaderConstant(s32 index, const f32* flo
case GL_FLOAT_MAT2:
Driver->extGlUniformMatrix2fv(UniformInfo[index].location, count/4, false, floats);
break;
case GL_FLOAT_MAT2x3:
Driver->extGlUniformMatrix2x3fv(UniformInfo[index].location, count/6, false, floats);
break;
case GL_FLOAT_MAT2x4:
Driver->extGlUniformMatrix2x4fv(UniformInfo[index].location, count/8, false, floats);
break;
case GL_FLOAT_MAT3x2:
Driver->extGlUniformMatrix3x2fv(UniformInfo[index].location, count/6, false, floats);
break;
case GL_FLOAT_MAT3:
Driver->extGlUniformMatrix3fv(UniformInfo[index].location, count/9, false, floats);
break;
case GL_FLOAT_MAT3x4:
Driver->extGlUniformMatrix3x4fv(UniformInfo[index].location, count/12, false, floats);
break;
case GL_FLOAT_MAT4x2:
Driver->extGlUniformMatrix4x2fv(UniformInfo[index].location, count/8, false, floats);
break;
case GL_FLOAT_MAT4x3:
Driver->extGlUniformMatrix4x3fv(UniformInfo[index].location, count/12, false, floats);
break;
case GL_FLOAT_MAT4:
Driver->extGlUniformMatrix4fv(UniformInfo[index].location, count/16, false, floats);
break;
@ -648,7 +666,7 @@ bool COpenGLSLMaterialRenderer::setPixelShaderConstant(s32 index, const f32* flo
{
if(floats)
{
const GLint id = static_cast<const GLint>(*floats);
const GLint id = static_cast<GLint>(*floats);
Driver->extGlUniform1iv(UniformInfo[index].location, 1, &id);
}
else

@ -230,7 +230,7 @@ IAnimatedMesh* CPLYMeshFileLoader::createMesh(io::IReadFile* file)
if (continueReading)
{
// create a mesh buffer
CDynamicMeshBuffer *mb = new CDynamicMeshBuffer(video::EVT_STANDARD, vertCount > 65565 ? video::EIT_32BIT : video::EIT_16BIT);
CDynamicMeshBuffer *mb = new CDynamicMeshBuffer(video::EVT_STANDARD, vertCount > 65536 ? video::EIT_32BIT : video::EIT_16BIT);
mb->getVertexBuffer().reallocate(vertCount);
mb->getIndexBuffer().reallocate(vertCount);
mb->setHardwareMappingHint(EHM_STATIC);

@ -125,10 +125,12 @@ aes_rval aes_encrypt(const void *in_blk, void *out_blk, const aes_encrypt_ctx cx
round(fwd_rnd, b1, b0, kp + 1 * N_COLS);
round(fwd_rnd, b0, b1, kp + 2 * N_COLS);
kp += 2 * N_COLS;
/* Falls through. */
case 12:
round(fwd_rnd, b1, b0, kp + 1 * N_COLS);
round(fwd_rnd, b0, b1, kp + 2 * N_COLS);
kp += 2 * N_COLS;
/* Falls through. */
case 10:
round(fwd_rnd, b1, b0, kp + 1 * N_COLS);
round(fwd_rnd, b0, b1, kp + 2 * N_COLS);
@ -249,10 +251,12 @@ aes_rval aes_decrypt(const void *in_blk, void *out_blk, const aes_decrypt_ctx cx
round(inv_rnd, b1, b0, kp - 1 * N_COLS);
round(inv_rnd, b0, b1, kp - 2 * N_COLS);
kp -= 2 * N_COLS;
/* Falls through. */
case 12:
round(inv_rnd, b1, b0, kp - 1 * N_COLS);
round(inv_rnd, b0, b1, kp - 2 * N_COLS);
kp -= 2 * N_COLS;
/* Falls through. */
case 10:
round(inv_rnd, b1, b0, kp - 1 * N_COLS);
round(inv_rnd, b0, b1, kp - 2 * N_COLS);

@ -576,12 +576,15 @@ sha2_int sha2_begin(unsigned long len, sha2_ctx ctx[1])
switch(len)
{
case 256: l = len >> 3;
/* Falls through. */
case 32: CTX_256(ctx)->count[0] = CTX_256(ctx)->count[1] = 0;
memcpy(CTX_256(ctx)->hash, i256, 32); break;
case 384: l = len >> 3;
/* Falls through. */
case 48: CTX_384(ctx)->count[0] = CTX_384(ctx)->count[1] = 0;
memcpy(CTX_384(ctx)->hash, i384, 64); break;
case 512: l = len >> 3;
/* Falls through. */
case 64: CTX_512(ctx)->count[0] = CTX_512(ctx)->count[1] = 0;
memcpy(CTX_512(ctx)->hash, i512, 64); break;
default: return SHA2_BAD;