Merge revisions r5520 through r5523 from trunk to ogl-es.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@5524 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
33bfe098e7
commit
f184d58cfe
|
@ -10,6 +10,7 @@ Changes in ogl-es (not yet released - will be merged with trunk at some point)
|
|||
--------------------------
|
||||
Changes in 1.9 (not yet released)
|
||||
|
||||
- Add function IVideoDriver::queryTextureFormat to allow checking if a driver supports textures with a specific color format.
|
||||
- ISceneManager::getMesh can now creates meshes with alternative cache-names.
|
||||
- Lets the BSP loader find textures inserted with relative paths. Thx@ curaga for patch
|
||||
- Slightly simplified ALLOC_STRATEGY_DOUBLE in arrays
|
||||
|
|
|
@ -1561,6 +1561,10 @@ namespace video
|
|||
*/
|
||||
virtual void convertColor(const void* sP, ECOLOR_FORMAT sF, s32 sN,
|
||||
void* dP, ECOLOR_FORMAT dF) const =0;
|
||||
|
||||
//! Check if the driver supports creating textures with the given color format
|
||||
/** \return True if the format is available, false if not. */
|
||||
virtual bool queryTextureFormat(ECOLOR_FORMAT format) const = 0;
|
||||
};
|
||||
|
||||
} // end namespace video
|
||||
|
|
|
@ -2834,7 +2834,7 @@ void CD3D9Driver::draw3DBox( const core::aabbox3d<f32>& box, SColor color)
|
|||
{
|
||||
core::vector3df edges[8];
|
||||
box.getEdges(edges);
|
||||
|
||||
|
||||
setVertexShader(EVT_STANDARD);
|
||||
setRenderStates3DMode();
|
||||
|
||||
|
@ -3499,6 +3499,10 @@ core::dimension2du CD3D9Driver::getMaxTextureSize() const
|
|||
return core::dimension2du(Caps.MaxTextureWidth, Caps.MaxTextureHeight);
|
||||
}
|
||||
|
||||
bool CD3D9Driver::queryTextureFormat(ECOLOR_FORMAT format) const
|
||||
{
|
||||
return getD3DFormatFromColorFormat(format) != D3DFMT_UNKNOWN;
|
||||
}
|
||||
|
||||
u32 CD3D9Driver::getD3DBlend(E_BLEND_FACTOR factor) const
|
||||
{
|
||||
|
|
|
@ -293,6 +293,9 @@ namespace video
|
|||
//! Returns the maximum texture size supported.
|
||||
virtual core::dimension2du getMaxTextureSize() const _IRR_OVERRIDE_;
|
||||
|
||||
//! Check if the driver supports creating textures with the given color format
|
||||
virtual bool queryTextureFormat(ECOLOR_FORMAT format) const _IRR_OVERRIDE_;
|
||||
|
||||
//! Get the current color format of the color buffer
|
||||
/** \return Color format of the color buffer as D3D color value. */
|
||||
D3DFORMAT getD3DColorFormat() const;
|
||||
|
|
|
@ -379,6 +379,12 @@ namespace video
|
|||
virtual void drawMeshBufferNormals(const scene::IMeshBuffer* mb, f32 length=10.f,
|
||||
SColor color=0xffffffff) _IRR_OVERRIDE_;
|
||||
|
||||
//! Check if the driver supports creating textures with the given color format
|
||||
virtual bool queryTextureFormat(ECOLOR_FORMAT format) const _IRR_OVERRIDE_
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
struct SHWBufferLink
|
||||
{
|
||||
|
|
|
@ -3571,6 +3571,15 @@ void COpenGLDriver::removeTexture(ITexture* texture)
|
|||
CNullDriver::removeTexture(texture);
|
||||
}
|
||||
|
||||
//! Check if the driver supports creating textures with the given color format
|
||||
bool COpenGLDriver::queryTextureFormat(ECOLOR_FORMAT format) const
|
||||
{
|
||||
GLint dummyInternalFormat;
|
||||
GLenum dummyPixelFormat;
|
||||
GLenum dummyPixelType;
|
||||
void (*dummyConverter)(const void*, s32, void*);
|
||||
return getColorFormatParameters(format, dummyInternalFormat, dummyPixelFormat, dummyPixelType, &dummyConverter);
|
||||
}
|
||||
|
||||
//! Only used by the internal engine. Used to notify the driver that
|
||||
//! the window was resized.
|
||||
|
@ -4109,9 +4118,10 @@ GLenum COpenGLDriver::getZBufferBits() const
|
|||
return bits;
|
||||
}
|
||||
|
||||
void COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& internalFormat, GLenum& pixelFormat,
|
||||
GLenum& pixelType, void(**converter)(const void*, s32, void*))
|
||||
bool COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& internalFormat, GLenum& pixelFormat,
|
||||
GLenum& pixelType, void(**converter)(const void*, s32, void*)) const
|
||||
{
|
||||
bool supported = false;
|
||||
internalFormat = GL_RGBA;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_UNSIGNED_BYTE;
|
||||
|
@ -4119,49 +4129,58 @@ void COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||
switch (format)
|
||||
{
|
||||
case ECF_A1R5G5B5:
|
||||
supported = true;
|
||||
internalFormat = GL_RGBA;
|
||||
pixelFormat = GL_BGRA_EXT;
|
||||
pixelType = GL_UNSIGNED_SHORT_1_5_5_5_REV;
|
||||
break;
|
||||
case ECF_R5G6B5:
|
||||
supported = true;
|
||||
internalFormat = GL_RGB;
|
||||
pixelFormat = GL_RGB;
|
||||
pixelType = GL_UNSIGNED_SHORT_5_6_5;
|
||||
break;
|
||||
case ECF_R8G8B8:
|
||||
supported = true;
|
||||
internalFormat = GL_RGB;
|
||||
pixelFormat = GL_BGR;
|
||||
pixelType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
case ECF_A8R8G8B8:
|
||||
supported = true;
|
||||
internalFormat = GL_RGBA;
|
||||
pixelFormat = GL_BGRA_EXT;
|
||||
if (Version > 101)
|
||||
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;
|
||||
break;
|
||||
case ECF_DXT2:
|
||||
case ECF_DXT3:
|
||||
supported = true;
|
||||
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
||||
pixelFormat = GL_BGRA_EXT;
|
||||
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
||||
break;
|
||||
case ECF_DXT4:
|
||||
case ECF_DXT5:
|
||||
supported = true;
|
||||
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||
pixelFormat = GL_BGRA_EXT;
|
||||
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||
break;
|
||||
case ECF_D16:
|
||||
supported = true;
|
||||
internalFormat = GL_DEPTH_COMPONENT16;
|
||||
pixelFormat = GL_DEPTH_COMPONENT;
|
||||
pixelType = GL_UNSIGNED_SHORT;
|
||||
break;
|
||||
case ECF_D32:
|
||||
supported = true;
|
||||
internalFormat = GL_DEPTH_COMPONENT32;
|
||||
pixelFormat = GL_DEPTH_COMPONENT;
|
||||
pixelType = GL_UNSIGNED_INT;
|
||||
|
@ -4170,6 +4189,7 @@ void COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||
#ifdef GL_VERSION_3_0
|
||||
if (Version >= 300)
|
||||
{
|
||||
supported = true;
|
||||
internalFormat = GL_DEPTH_STENCIL;
|
||||
pixelFormat = GL_DEPTH_STENCIL;
|
||||
pixelType = GL_UNSIGNED_INT_24_8;
|
||||
|
@ -4179,6 +4199,7 @@ void COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||
#ifdef GL_EXT_packed_depth_stencil
|
||||
if (queryOpenGLFeature(COpenGLExtensionHandler::IRR_EXT_packed_depth_stencil))
|
||||
{
|
||||
supported = true;
|
||||
internalFormat = GL_DEPTH_STENCIL_EXT;
|
||||
pixelFormat = GL_DEPTH_STENCIL_EXT;
|
||||
pixelType = GL_UNSIGNED_INT_24_8_EXT;
|
||||
|
@ -4190,6 +4211,7 @@ void COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||
case ECF_R8:
|
||||
if (queryOpenGLFeature(COpenGLExtensionHandler::IRR_ARB_texture_rg))
|
||||
{
|
||||
supported = true;
|
||||
internalFormat = GL_R8;
|
||||
pixelFormat = GL_RED;
|
||||
pixelType = GL_UNSIGNED_BYTE;
|
||||
|
@ -4200,6 +4222,7 @@ void COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||
case ECF_R8G8:
|
||||
if (queryOpenGLFeature(COpenGLExtensionHandler::IRR_ARB_texture_rg))
|
||||
{
|
||||
supported = true;
|
||||
internalFormat = GL_RG8;
|
||||
pixelFormat = GL_RG;
|
||||
pixelType = GL_UNSIGNED_BYTE;
|
||||
|
@ -4210,6 +4233,7 @@ void COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||
case ECF_R16:
|
||||
if (queryOpenGLFeature(COpenGLExtensionHandler::IRR_ARB_texture_rg))
|
||||
{
|
||||
supported = true;
|
||||
internalFormat = GL_R16;
|
||||
pixelFormat = GL_RED;
|
||||
pixelType = GL_UNSIGNED_SHORT;
|
||||
|
@ -4220,6 +4244,7 @@ void COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||
case ECF_R16G16:
|
||||
if (queryOpenGLFeature(COpenGLExtensionHandler::IRR_ARB_texture_rg))
|
||||
{
|
||||
supported = true;
|
||||
internalFormat = GL_RG16;
|
||||
pixelFormat = GL_RG;
|
||||
pixelType = GL_UNSIGNED_SHORT;
|
||||
|
@ -4230,6 +4255,7 @@ void COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||
case ECF_R16F:
|
||||
if (queryOpenGLFeature(COpenGLExtensionHandler::IRR_ARB_texture_rg))
|
||||
{
|
||||
supported = true;
|
||||
internalFormat = GL_R16F;
|
||||
pixelFormat = GL_RED;
|
||||
#ifdef GL_ARB_half_float_pixel
|
||||
|
@ -4245,6 +4271,7 @@ void COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||
case ECF_G16R16F:
|
||||
if (queryOpenGLFeature(COpenGLExtensionHandler::IRR_ARB_texture_rg))
|
||||
{
|
||||
supported = true;
|
||||
internalFormat = GL_RG16F;
|
||||
pixelFormat = GL_RG;
|
||||
#ifdef GL_ARB_half_float_pixel
|
||||
|
@ -4260,6 +4287,7 @@ void COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||
case ECF_A16B16G16R16F:
|
||||
if (queryOpenGLFeature(COpenGLExtensionHandler::IRR_ARB_texture_float))
|
||||
{
|
||||
supported = true;
|
||||
internalFormat = GL_RGBA16F_ARB;
|
||||
pixelFormat = GL_RGBA;
|
||||
#ifdef GL_ARB_half_float_pixel
|
||||
|
@ -4275,6 +4303,7 @@ void COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||
case ECF_R32F:
|
||||
if (queryOpenGLFeature(COpenGLExtensionHandler::IRR_ARB_texture_rg))
|
||||
{
|
||||
supported = true;
|
||||
internalFormat = GL_R32F;
|
||||
pixelFormat = GL_RED;
|
||||
pixelType = GL_FLOAT;
|
||||
|
@ -4285,6 +4314,7 @@ void COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||
case ECF_G32R32F:
|
||||
if (queryOpenGLFeature(COpenGLExtensionHandler::IRR_ARB_texture_rg))
|
||||
{
|
||||
supported = true;
|
||||
internalFormat = GL_RG32F;
|
||||
pixelFormat = GL_RG;
|
||||
pixelType = GL_FLOAT;
|
||||
|
@ -4295,6 +4325,7 @@ void COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||
case ECF_A32B32G32R32F:
|
||||
if (queryOpenGLFeature(COpenGLExtensionHandler::IRR_ARB_texture_float))
|
||||
{
|
||||
supported = true;
|
||||
internalFormat = GL_RGBA32F_ARB;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_FLOAT;
|
||||
|
@ -4316,6 +4347,8 @@ void COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||
internalFormat = GL_SRGB_EXT;
|
||||
}
|
||||
#endif
|
||||
|
||||
return supported;
|
||||
}
|
||||
|
||||
COpenGLDriver::E_OPENGL_FIXED_PIPELINE_STATE COpenGLDriver::getFixedPipelineState() const
|
||||
|
|
|
@ -372,7 +372,10 @@ namespace video
|
|||
virtual core::dimension2du getMaxTextureSize() const _IRR_OVERRIDE_;
|
||||
|
||||
//! Removes a texture from the texture cache and deletes it, freeing lot of memory.
|
||||
void removeTexture(ITexture* texture) _IRR_OVERRIDE_;
|
||||
virtual void removeTexture(ITexture* texture) _IRR_OVERRIDE_;
|
||||
|
||||
//! Check if the driver supports creating textures with the given color format
|
||||
virtual bool queryTextureFormat(ECOLOR_FORMAT format) const _IRR_OVERRIDE_;
|
||||
|
||||
//! Convert E_PRIMITIVE_TYPE to OpenGL equivalent
|
||||
GLenum primitiveTypeToGL(scene::E_PRIMITIVE_TYPE type) const;
|
||||
|
@ -383,8 +386,8 @@ namespace video
|
|||
//! Get ZBuffer bits.
|
||||
GLenum getZBufferBits() const;
|
||||
|
||||
void getColorFormatParameters(ECOLOR_FORMAT format, GLint& internalFormat, GLenum& pixelFormat,
|
||||
GLenum& pixelType, void(**converter)(const void*, s32, void*));
|
||||
bool getColorFormatParameters(ECOLOR_FORMAT format, GLint& internalFormat, GLenum& pixelFormat,
|
||||
GLenum& pixelType, void(**converter)(const void*, s32, void*)) const;
|
||||
|
||||
//! Return info about fixed pipeline state.
|
||||
E_OPENGL_FIXED_PIPELINE_STATE getFixedPipelineState() const;
|
||||
|
|
|
@ -938,6 +938,12 @@ u32 CSoftwareDriver::getMaximalPrimitiveCount() const
|
|||
return 0x00800000;
|
||||
}
|
||||
|
||||
bool CSoftwareDriver::queryTextureFormat(ECOLOR_FORMAT format) const
|
||||
{
|
||||
return format == ECF_A1R5G5B5;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
|
|
|
@ -114,6 +114,9 @@ namespace video
|
|||
//! call.
|
||||
virtual u32 getMaximalPrimitiveCount() const _IRR_OVERRIDE_;
|
||||
|
||||
//! Check if the driver supports creating textures with the given color format
|
||||
virtual bool queryTextureFormat(ECOLOR_FORMAT format) const _IRR_OVERRIDE_;
|
||||
|
||||
protected:
|
||||
|
||||
//! sets a render target
|
||||
|
|
|
@ -2373,6 +2373,11 @@ core::dimension2du CBurningVideoDriver::getMaxTextureSize() const
|
|||
return core::dimension2du(SOFTWARE_DRIVER_2_TEXTURE_MAXSIZE, SOFTWARE_DRIVER_2_TEXTURE_MAXSIZE);
|
||||
}
|
||||
|
||||
bool CBurningVideoDriver::queryTextureFormat(ECOLOR_FORMAT format) const
|
||||
{
|
||||
return format == BURNINGSHADER_COLOR_FORMAT;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
|
|
@ -161,6 +161,9 @@ namespace video
|
|||
//! Returns the maximum texture size supported.
|
||||
virtual core::dimension2du getMaxTextureSize() const _IRR_OVERRIDE_;
|
||||
|
||||
//! Check if the driver supports creating textures with the given color format
|
||||
virtual bool queryTextureFormat(ECOLOR_FORMAT format) const _IRR_OVERRIDE_;
|
||||
|
||||
IDepthBuffer * getDepthBuffer () { return DepthBuffer; }
|
||||
IStencilBuffer * getStencilBuffer () { return StencilBuffer; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue