mirror of
https://github.com/minetest/minetest.git
synced 2024-12-22 22:22:23 +01:00
GL: fix and clean up some code
This commit is contained in:
parent
36edc3f161
commit
1fb7202028
@ -109,11 +109,6 @@ protected:
|
||||
|
||||
//! Driver type of render target.
|
||||
E_DRIVER_TYPE DriverType;
|
||||
|
||||
private:
|
||||
// no copying (IReferenceCounted still allows that for reasons which take some time to work around)
|
||||
IRenderTarget(const IRenderTarget &);
|
||||
IRenderTarget &operator=(const IRenderTarget &);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -55,9 +55,6 @@ enum E_SCENE_NODE_RENDER_PASS
|
||||
//! Camera pass. The active view is set up here. The very first pass.
|
||||
ESNRP_CAMERA = 1,
|
||||
|
||||
//! In this pass, lights are transformed into camera space and added to the driver
|
||||
ESNRP_LIGHT = 2,
|
||||
|
||||
//! This is used for sky boxes.
|
||||
ESNRP_SKY_BOX = 4,
|
||||
|
||||
@ -85,9 +82,6 @@ enum E_SCENE_NODE_RENDER_PASS
|
||||
//! Transparent effect scene nodes, drawn after Transparent nodes. They are sorted from back to front and drawn in that order.
|
||||
ESNRP_TRANSPARENT_EFFECT = 32,
|
||||
|
||||
//! Drawn after the solid nodes, before the transparent nodes, the time for drawing shadow volumes
|
||||
ESNRP_SHADOW = 64,
|
||||
|
||||
//! Drawn after transparent effect nodes. For custom gui's. Unsorted (in order nodes registered themselves).
|
||||
ESNRP_GUI = 128
|
||||
|
||||
@ -602,12 +596,6 @@ public:
|
||||
for details. */
|
||||
virtual ISkinnedMesh *createSkinnedMesh() = 0;
|
||||
|
||||
//! Sets ambient color of the scene
|
||||
virtual void setAmbientLight(const video::SColorf &ambientColor) = 0;
|
||||
|
||||
//! Get ambient color of the scene
|
||||
virtual const video::SColorf &getAmbientLight() const = 0;
|
||||
|
||||
//! Get current render pass.
|
||||
virtual E_SCENE_NODE_RENDER_PASS getCurrentRenderPass() const = 0;
|
||||
|
||||
|
@ -131,7 +131,6 @@ public:
|
||||
/** The following names can be queried for the given types:
|
||||
MaxTextures (int) The maximum number of simultaneous textures supported by the driver. This can be less than the supported number of textures of the driver. Use _IRR_MATERIAL_MAX_TEXTURES_ to adapt the number.
|
||||
MaxSupportedTextures (int) The maximum number of simultaneous textures supported by the fixed function pipeline of the (hw) driver. The actual supported number of textures supported by the engine can be lower.
|
||||
MaxLights (int) Number of hardware lights supported in the fixed function pipeline of the driver, typically 6-8. Use light manager or deferred shading for more.
|
||||
MaxAnisotropy (int) Number of anisotropy levels supported for filtering. At least 1, max is typically at 16 or 32.
|
||||
MaxAuxBuffers (int) Special render buffers, which are currently not really usable inside Irrlicht. Only supported by OpenGL
|
||||
MaxMultipleRenderTargets (int) Number of render targets which can be bound simultaneously. Rendering to MRTs is done via shaders.
|
||||
@ -1110,15 +1109,6 @@ public:
|
||||
//! Get the graphics card vendor name.
|
||||
virtual core::stringc getVendorInfo() = 0;
|
||||
|
||||
//! Only used by the engine internally.
|
||||
/** The ambient color is set in the scene manager, see
|
||||
scene::ISceneManager::setAmbientLight().
|
||||
\param color New color of the ambient light. */
|
||||
virtual void setAmbientLight(const SColorf &color) = 0;
|
||||
|
||||
//! Get the global ambient light currently used by the driver
|
||||
virtual const SColorf &getAmbientLight() const = 0;
|
||||
|
||||
//! Only used by the engine internally.
|
||||
/** Passes the global material flag AllowZWriteOnTransparent.
|
||||
Use the SceneManager attribute to set this value from your app.
|
||||
@ -1128,19 +1118,6 @@ public:
|
||||
//! Get the maximum texture size supported.
|
||||
virtual core::dimension2du getMaxTextureSize() const = 0;
|
||||
|
||||
//! Color conversion convenience function
|
||||
/** Convert an image (as array of pixels) from source to destination
|
||||
array, thereby converting the color format. The pixel size is
|
||||
determined by the color formats.
|
||||
\param sP Pointer to source
|
||||
\param sF Color format of source
|
||||
\param sN Number of pixels to convert, both array must be large enough
|
||||
\param dP Pointer to destination
|
||||
\param dF Color format of destination
|
||||
*/
|
||||
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;
|
||||
|
@ -743,19 +743,6 @@ SFrameStats CNullDriver::getFrameStats() const
|
||||
return FrameStats;
|
||||
}
|
||||
|
||||
//! Sets the dynamic ambient light color. The default color is
|
||||
//! (0,0,0,0) which means it is dark.
|
||||
//! \param color: New color of the ambient light.
|
||||
void CNullDriver::setAmbientLight(const SColorf &color)
|
||||
{
|
||||
AmbientLight = color;
|
||||
}
|
||||
|
||||
const SColorf &CNullDriver::getAmbientLight() const
|
||||
{
|
||||
return AmbientLight;
|
||||
}
|
||||
|
||||
//! \return Returns the name of the video driver. Example: In case of the DIRECT3D8
|
||||
//! driver, it would return "Direct3D8".
|
||||
|
||||
@ -1774,21 +1761,5 @@ bool CNullDriver::needsTransparentRenderPass(const irr::video::SMaterial &materi
|
||||
return false;
|
||||
}
|
||||
|
||||
//! Color conversion convenience function
|
||||
/** Convert an image (as array of pixels) from source to destination
|
||||
array, thereby converting the color format. The pixel size is
|
||||
determined by the color formats.
|
||||
\param sP Pointer to source
|
||||
\param sF Color format of source
|
||||
\param sN Number of pixels to convert, both array must be large enough
|
||||
\param dP Pointer to destination
|
||||
\param dF Color format of destination
|
||||
*/
|
||||
void CNullDriver::convertColor(const void *sP, ECOLOR_FORMAT sF, s32 sN,
|
||||
void *dP, ECOLOR_FORMAT dF) const
|
||||
{
|
||||
video::CColorConverter::convert_viaFormat(sP, sF, sN, dP, dF);
|
||||
}
|
||||
|
||||
} // end namespace
|
||||
} // end namespace
|
||||
|
@ -201,14 +201,6 @@ public:
|
||||
//! driver, it would return "Direct3D8.1".
|
||||
const char *getName() const override;
|
||||
|
||||
//! Sets the dynamic ambient light color. The default color is
|
||||
//! (0,0,0,0) which means it is dark.
|
||||
//! \param color: New color of the ambient light.
|
||||
void setAmbientLight(const SColorf &color) override;
|
||||
|
||||
//! Get the global ambient light currently used by the driver
|
||||
const SColorf &getAmbientLight() const override;
|
||||
|
||||
//! Adds an external image loader to the engine.
|
||||
void addExternalImageLoader(IImageLoader *loader) override;
|
||||
|
||||
@ -559,19 +551,6 @@ public:
|
||||
//! Used by some SceneNodes to check if a material should be rendered in the transparent render pass
|
||||
bool needsTransparentRenderPass(const irr::video::SMaterial &material) const override;
|
||||
|
||||
//! Color conversion convenience function
|
||||
/** Convert an image (as array of pixels) from source to destination
|
||||
array, thereby converting the color format. The pixel size is
|
||||
determined by the color formats.
|
||||
\param sP Pointer to source
|
||||
\param sF Color format of source
|
||||
\param sN Number of pixels to convert, both array must be large enough
|
||||
\param dP Pointer to destination
|
||||
\param dF Color format of destination
|
||||
*/
|
||||
virtual void convertColor(const void *sP, ECOLOR_FORMAT sF, s32 sN,
|
||||
void *dP, ECOLOR_FORMAT dF) const override;
|
||||
|
||||
protected:
|
||||
//! deletes all textures
|
||||
void deleteAllTextures();
|
||||
@ -759,8 +738,6 @@ protected:
|
||||
bool AllowZWriteOnTransparent;
|
||||
|
||||
bool FeatureEnabled[video::EVDF_COUNT];
|
||||
|
||||
SColorf AmbientLight;
|
||||
};
|
||||
|
||||
} // end namespace video
|
||||
|
@ -170,6 +170,17 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef IRR_COMPILE_GL_COMMON
|
||||
// On GLES 3.0 we must use sized internal formats for textures in certain
|
||||
// cases (e.g. with ETT_2D_MS). However ECF_A8R8G8B8 is mapped to GL_BGRA
|
||||
// (an unsized format).
|
||||
// Since we don't upload to RTT we can safely pick a different combo that works.
|
||||
if (InternalFormat == GL_BGRA && Driver->Version.Major >= 3) {
|
||||
InternalFormat = GL_RGBA8;
|
||||
PixelFormat = GL_RGBA;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
char lbuf[100];
|
||||
snprintf_irr(lbuf, sizeof(lbuf),
|
||||
|
@ -122,7 +122,6 @@ bool COpenGLDriver::genericDriverInit()
|
||||
os::Printer::log("GLSL not available.", ELL_INFORMATION);
|
||||
DriverAttributes->setAttribute("MaxTextures", (s32)Feature.MaxTextureUnits);
|
||||
DriverAttributes->setAttribute("MaxSupportedTextures", (s32)Feature.MaxTextureUnits);
|
||||
DriverAttributes->setAttribute("MaxLights", MaxLights);
|
||||
DriverAttributes->setAttribute("MaxAnisotropy", MaxAnisotropy);
|
||||
DriverAttributes->setAttribute("MaxAuxBuffers", MaxAuxBuffers);
|
||||
DriverAttributes->setAttribute("MaxMultipleRenderTargets", (s32)Feature.MultipleRenderTarget);
|
||||
@ -139,13 +138,6 @@ bool COpenGLDriver::genericDriverInit()
|
||||
for (i = 0; i < ETS_COUNT; ++i)
|
||||
setTransform(static_cast<E_TRANSFORMATION_STATE>(i), core::IdentityMatrix);
|
||||
|
||||
setAmbientLight(SColorf(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
#ifdef GL_EXT_separate_specular_color
|
||||
if (FeatureAvailable[IRR_EXT_separate_specular_color])
|
||||
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
|
||||
#endif
|
||||
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
|
||||
|
||||
// This is a fast replacement for NORMALIZE_NORMALS
|
||||
// if ((Version>101) || FeatureAvailable[IRR_EXT_rescale_normal])
|
||||
// glEnable(GL_RESCALE_NORMAL_EXT);
|
||||
@ -2420,16 +2412,6 @@ const char *COpenGLDriver::getName() const
|
||||
return Name.c_str();
|
||||
}
|
||||
|
||||
//! Sets the dynamic ambient light color. The default color is
|
||||
//! (0,0,0,0) which means it is dark.
|
||||
//! \param color: New color of the ambient light.
|
||||
void COpenGLDriver::setAmbientLight(const SColorf &color)
|
||||
{
|
||||
CNullDriver::setAmbientLight(color);
|
||||
GLfloat data[4] = {color.r, color.g, color.b, color.a};
|
||||
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, data);
|
||||
}
|
||||
|
||||
// this code was sent in by Oliver Klems, thank you! (I modified the glViewport
|
||||
// method just a bit.
|
||||
void COpenGLDriver::setViewPort(const core::rect<s32> &area)
|
||||
|
@ -182,11 +182,6 @@ public:
|
||||
//! driver, it would return "Direct3D8.1".
|
||||
const char *getName() const override;
|
||||
|
||||
//! Sets the dynamic ambient light color. The default color is
|
||||
//! (0,0,0,0) which means it is dark.
|
||||
//! \param color: New color of the ambient light.
|
||||
void setAmbientLight(const SColorf &color) override;
|
||||
|
||||
//! sets a viewport
|
||||
void setViewPort(const core::rect<s32> &area) override;
|
||||
|
||||
|
@ -19,7 +19,7 @@ namespace video
|
||||
bool COpenGLExtensionHandler::needsDSAFramebufferHack = true;
|
||||
|
||||
COpenGLExtensionHandler::COpenGLExtensionHandler() :
|
||||
StencilBuffer(false), TextureCompressionExtension(false), MaxLights(1),
|
||||
StencilBuffer(false), TextureCompressionExtension(false),
|
||||
MaxAnisotropy(1), MaxAuxBuffers(0), MaxIndices(65535),
|
||||
MaxTextureSize(1), MaxGeometryVerticesOut(0),
|
||||
MaxTextureLODBias(0.f), Version(0), ShaderLanguageVersion(0),
|
||||
@ -399,8 +399,6 @@ void COpenGLExtensionHandler::initExtensions(video::IContextManager *cmgr, bool
|
||||
Feature.MaxTextureUnits = core::max_(Feature.MaxTextureUnits, static_cast<u8>(num));
|
||||
}
|
||||
#endif
|
||||
glGetIntegerv(GL_MAX_LIGHTS, &num);
|
||||
MaxLights = static_cast<u8>(num);
|
||||
#ifdef GL_EXT_texture_filter_anisotropic
|
||||
if (FeatureAvailable[IRR_EXT_texture_filter_anisotropic]) {
|
||||
glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &num);
|
||||
|
@ -1015,8 +1015,6 @@ public:
|
||||
bool TextureCompressionExtension;
|
||||
|
||||
// Some non-boolean properties
|
||||
//! Maximum hardware lights supported
|
||||
u8 MaxLights;
|
||||
//! Maximal Anisotropy
|
||||
u8 MaxAnisotropy;
|
||||
//! Number of auxiliary buffers
|
||||
|
@ -41,7 +41,7 @@ CSceneManager::CSceneManager(video::IVideoDriver *driver,
|
||||
ISceneNode(0, 0),
|
||||
Driver(driver),
|
||||
CursorControl(cursorControl),
|
||||
ActiveCamera(0), ShadowColor(150, 0, 0, 0), AmbientLight(0, 0, 0, 0), Parameters(0),
|
||||
ActiveCamera(0), Parameters(0),
|
||||
MeshCache(cache), CurrentRenderPass(ESNRP_NONE)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
@ -445,9 +445,6 @@ u32 CSceneManager::registerNodeForRendering(ISceneNode *node, E_SCENE_NODE_RENDE
|
||||
taken = 1;
|
||||
}
|
||||
|
||||
// as of yet unused
|
||||
case ESNRP_LIGHT:
|
||||
case ESNRP_SHADOW:
|
||||
case ESNRP_NONE: // ignore this one
|
||||
break;
|
||||
}
|
||||
@ -775,18 +772,6 @@ ISceneManager *CSceneManager::createNewSceneManager(bool cloneContent)
|
||||
return manager;
|
||||
}
|
||||
|
||||
//! Sets ambient color of the scene
|
||||
void CSceneManager::setAmbientLight(const video::SColorf &ambientColor)
|
||||
{
|
||||
AmbientLight = ambientColor;
|
||||
}
|
||||
|
||||
//! Returns ambient color of the scene
|
||||
const video::SColorf &CSceneManager::getAmbientLight() const
|
||||
{
|
||||
return AmbientLight;
|
||||
}
|
||||
|
||||
//! Get a skinned mesh, which is not available as header-only code
|
||||
ISkinnedMesh *CSceneManager::createSkinnedMesh()
|
||||
{
|
||||
|
@ -170,12 +170,6 @@ public:
|
||||
//! Get a skinned mesh, which is not available as header-only code
|
||||
ISkinnedMesh *createSkinnedMesh() override;
|
||||
|
||||
//! Sets ambient color of the scene
|
||||
void setAmbientLight(const video::SColorf &ambientColor) override;
|
||||
|
||||
//! Returns ambient color of the scene
|
||||
const video::SColorf &getAmbientLight() const override;
|
||||
|
||||
//! Get current render time.
|
||||
E_SCENE_NODE_RENDER_PASS getCurrentRenderPass() const override { return CurrentRenderPass; }
|
||||
|
||||
@ -291,9 +285,6 @@ private:
|
||||
ICameraSceneNode *ActiveCamera;
|
||||
core::vector3df camWorldPos; // Position of camera for transparent nodes.
|
||||
|
||||
video::SColor ShadowColor;
|
||||
video::SColorf AmbientLight;
|
||||
|
||||
//! String parameters
|
||||
// NOTE: Attributes are slow and should only be used for debug-info and not in release
|
||||
io::CAttributes *Parameters;
|
||||
|
@ -40,7 +40,7 @@ typedef COpenGLCoreTexture<COpenGL3DriverBase> COpenGL3Texture;
|
||||
typedef COpenGLCoreRenderTarget<COpenGL3DriverBase, COpenGL3Texture> COpenGL3RenderTarget;
|
||||
typedef COpenGLCoreCacheHandler<COpenGL3DriverBase, COpenGL3Texture> COpenGL3CacheHandler;
|
||||
|
||||
enum class OpenGLSpec : u8
|
||||
enum OpenGLSpec : u8
|
||||
{
|
||||
Core,
|
||||
Compat,
|
||||
|
@ -27,37 +27,32 @@ namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
|
||||
struct VertexAttribute
|
||||
{
|
||||
enum class Mode
|
||||
enum Mode : u8
|
||||
{
|
||||
Regular,
|
||||
Normalized,
|
||||
Integral,
|
||||
Integer,
|
||||
};
|
||||
int Index;
|
||||
int ComponentCount;
|
||||
u8 Index;
|
||||
u8 ComponentCount;
|
||||
GLenum ComponentType;
|
||||
Mode mode;
|
||||
int Offset;
|
||||
u32 Offset;
|
||||
};
|
||||
|
||||
struct VertexType
|
||||
{
|
||||
int VertexSize;
|
||||
u32 VertexSize;
|
||||
std::vector<VertexAttribute> Attributes;
|
||||
|
||||
// allow ranged for loops
|
||||
inline auto begin() const { return Attributes.begin(); }
|
||||
inline auto end() const { return Attributes.end(); }
|
||||
};
|
||||
|
||||
static const VertexAttribute *begin(const VertexType &type)
|
||||
{
|
||||
return type.Attributes.data();
|
||||
}
|
||||
|
||||
static const VertexAttribute *end(const VertexType &type)
|
||||
{
|
||||
return type.Attributes.data() + type.Attributes.size();
|
||||
}
|
||||
|
||||
static const VertexType vtStandard = {
|
||||
sizeof(S3DVertex),
|
||||
{
|
||||
@ -68,6 +63,9 @@ static const VertexType vtStandard = {
|
||||
},
|
||||
};
|
||||
|
||||
// FIXME: this is actually UB because these vertex classes are not "standard-layout"
|
||||
// they violate the following requirement:
|
||||
// - only one class in the hierarchy has non-static data members
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
|
||||
|
||||
@ -170,11 +168,15 @@ COpenGL3DriverBase::COpenGL3DriverBase(const SIrrlichtCreationParameters ¶ms
|
||||
ExposedData = ContextManager->getContext();
|
||||
ContextManager->activateContext(ExposedData, false);
|
||||
GL.LoadAllProcedures(ContextManager);
|
||||
if (EnableErrorTest) {
|
||||
if (EnableErrorTest && GL.IsExtensionPresent("GL_KHR_debug")) {
|
||||
GL.Enable(GL_DEBUG_OUTPUT);
|
||||
GL.DebugMessageCallback(debugCb, this);
|
||||
} else if (EnableErrorTest) {
|
||||
os::Printer::log("GL debug extension not available");
|
||||
}
|
||||
initQuadsIndices();
|
||||
|
||||
TEST_GL_ERROR(this);
|
||||
}
|
||||
|
||||
COpenGL3DriverBase::~COpenGL3DriverBase()
|
||||
@ -267,7 +269,6 @@ bool COpenGL3DriverBase::genericDriverInit(const core::dimension2d<u32> &screenS
|
||||
for (s32 i = 0; i < ETS_COUNT; ++i)
|
||||
setTransform(static_cast<E_TRANSFORMATION_STATE>(i), core::IdentityMatrix);
|
||||
|
||||
setAmbientLight(SColorf(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
GL.ClearDepthf(1.0f);
|
||||
|
||||
GL.Hint(GL_GENERATE_MIPMAP_HINT, GL_NICEST);
|
||||
@ -760,6 +761,13 @@ void COpenGL3DriverBase::drawVertexPrimitiveList(const void *vertices, u32 verte
|
||||
endDraw(vTypeDesc);
|
||||
}
|
||||
|
||||
void COpenGL3DriverBase::draw2DVertexPrimitiveList(const void *vertices, u32 vertexCount,
|
||||
const void *indexList, u32 primitiveCount,
|
||||
E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType)
|
||||
{
|
||||
os::Printer::log("draw2DVertexPrimitiveList unimplemented", ELL_ERROR);
|
||||
}
|
||||
|
||||
void COpenGL3DriverBase::draw2DImage(const video::ITexture *texture, const core::position2d<s32> &destPos,
|
||||
const core::rect<s32> &sourceRect, const core::rect<s32> *clipRect, SColor color,
|
||||
bool useAlphaChannelOfTexture)
|
||||
@ -1066,7 +1074,7 @@ void COpenGL3DriverBase::drawElements(GLenum primitiveType, const VertexType &ve
|
||||
|
||||
void COpenGL3DriverBase::beginDraw(const VertexType &vertexType, uintptr_t verticesBase)
|
||||
{
|
||||
for (auto attr : vertexType) {
|
||||
for (auto &attr : vertexType) {
|
||||
GL.EnableVertexAttribArray(attr.Index);
|
||||
switch (attr.mode) {
|
||||
case VertexAttribute::Mode::Regular:
|
||||
@ -1075,7 +1083,7 @@ void COpenGL3DriverBase::beginDraw(const VertexType &vertexType, uintptr_t verti
|
||||
case VertexAttribute::Mode::Normalized:
|
||||
GL.VertexAttribPointer(attr.Index, attr.ComponentCount, attr.ComponentType, GL_TRUE, vertexType.VertexSize, reinterpret_cast<void *>(verticesBase + attr.Offset));
|
||||
break;
|
||||
case VertexAttribute::Mode::Integral:
|
||||
case VertexAttribute::Mode::Integer:
|
||||
GL.VertexAttribIPointer(attr.Index, attr.ComponentCount, attr.ComponentType, vertexType.VertexSize, reinterpret_cast<void *>(verticesBase + attr.Offset));
|
||||
break;
|
||||
}
|
||||
@ -1084,7 +1092,7 @@ void COpenGL3DriverBase::beginDraw(const VertexType &vertexType, uintptr_t verti
|
||||
|
||||
void COpenGL3DriverBase::endDraw(const VertexType &vertexType)
|
||||
{
|
||||
for (auto attr : vertexType)
|
||||
for (auto &attr : vertexType)
|
||||
GL.DisableVertexAttribArray(attr.Index);
|
||||
}
|
||||
|
||||
|
@ -81,6 +81,11 @@ public:
|
||||
const void *indexList, u32 primitiveCount,
|
||||
E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType) override;
|
||||
|
||||
//! draws a vertex primitive list in 2d
|
||||
virtual void draw2DVertexPrimitiveList(const void *vertices, u32 vertexCount,
|
||||
const void *indexList, u32 primitiveCount,
|
||||
E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType) override;
|
||||
|
||||
//! queries the features of the driver, returns true if feature is available
|
||||
bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) const override
|
||||
{
|
||||
|
@ -43,8 +43,6 @@ void COpenGLES2Driver::initFeatures()
|
||||
}
|
||||
initExtensions();
|
||||
|
||||
static const GLenum BGRA8_EXT = 0x93A1;
|
||||
|
||||
if (Version.Major >= 3) {
|
||||
// NOTE floating-point formats may not be suitable for render targets.
|
||||
TextureFormats[ECF_A1R5G5B5] = {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, CColorConverter::convert_A1R5G5B5toR5G5B5A1};
|
||||
@ -64,10 +62,11 @@ void COpenGLES2Driver::initFeatures()
|
||||
TextureFormats[ECF_D24] = {GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT};
|
||||
TextureFormats[ECF_D24S8] = {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8};
|
||||
|
||||
if (FeatureAvailable[IRR_GL_EXT_texture_format_BGRA8888])
|
||||
// NOTE a recent (2024) revision of EXT_texture_format_BGRA8888 also
|
||||
// adds a sized format GL_BGRA8_EXT. We have a workaround in place to
|
||||
// fix up the InternalFormat in case of render targets.
|
||||
if (FeatureAvailable[IRR_GL_EXT_texture_format_BGRA8888] || FeatureAvailable[IRR_GL_APPLE_texture_format_BGRA8888])
|
||||
TextureFormats[ECF_A8R8G8B8] = {GL_BGRA, GL_BGRA, GL_UNSIGNED_BYTE};
|
||||
else if (FeatureAvailable[IRR_GL_APPLE_texture_format_BGRA8888])
|
||||
TextureFormats[ECF_A8R8G8B8] = {BGRA8_EXT, GL_BGRA, GL_UNSIGNED_BYTE};
|
||||
|
||||
// OpenGL ES 3 doesn't include a GL_DEPTH_COMPONENT32, so still use
|
||||
// OES_depth_texture for 32-bit depth texture support.
|
||||
@ -87,10 +86,8 @@ void COpenGLES2Driver::initFeatures()
|
||||
TextureFormats[ECF_R8G8B8] = {GL_RGB, GL_RGB, GL_UNSIGNED_BYTE};
|
||||
TextureFormats[ECF_A8R8G8B8] = {GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, CColorConverter::convert_A8R8G8B8toA8B8G8R8};
|
||||
|
||||
if (FeatureAvailable[IRR_GL_EXT_texture_format_BGRA8888])
|
||||
if (FeatureAvailable[IRR_GL_EXT_texture_format_BGRA8888] || FeatureAvailable[IRR_GL_APPLE_texture_format_BGRA8888])
|
||||
TextureFormats[ECF_A8R8G8B8] = {GL_BGRA, GL_BGRA, GL_UNSIGNED_BYTE};
|
||||
else if (FeatureAvailable[IRR_GL_APPLE_texture_format_BGRA8888])
|
||||
TextureFormats[ECF_A8R8G8B8] = {BGRA8_EXT, GL_BGRA, GL_UNSIGNED_BYTE};
|
||||
|
||||
if (FeatureAvailable[IRR_GL_OES_texture_half_float]) {
|
||||
TextureFormats[ECF_A16B16G16R16F] = {GL_RGBA, GL_RGBA, HALF_FLOAT_OES};
|
||||
|
@ -21,8 +21,7 @@ void SetColorMaskStep::run(PipelineContext &context)
|
||||
mat.Material.ColorMask = color_mask;
|
||||
mat.EnableProps = video::EMP_COLOR_MASK;
|
||||
mat.EnablePasses = scene::ESNRP_SKY_BOX | scene::ESNRP_SOLID |
|
||||
scene::ESNRP_TRANSPARENT | scene::ESNRP_TRANSPARENT_EFFECT |
|
||||
scene::ESNRP_SHADOW;
|
||||
scene::ESNRP_TRANSPARENT | scene::ESNRP_TRANSPARENT_EFFECT;
|
||||
}
|
||||
|
||||
/// ClearDepthBufferTarget
|
||||
|
Loading…
Reference in New Issue
Block a user