axmol/core/renderer/backend/opengl/CommandBufferGLES2.cpp

48 lines
1.5 KiB
C++
Raw Normal View History

#include "CommandBufferGLES2.h"
2023-08-22 19:34:28 +08:00
#if !defined(__APPLE__) && AX_TARGET_PLATFORM != AX_PLATFORM_WINRT
# include "platform/GL.h"
NS_AX_BACKEND_BEGIN
CommandBufferGLES2::CommandBufferGLES2()
{
if (glDrawElementsInstancedEXT)
glDrawElementsInstanced = glDrawElementsInstancedEXT;
else if (glDrawElementsInstancedANGLE)
glDrawElementsInstanced = glDrawElementsInstancedANGLE;
if (glVertexAttribDivisorEXT)
glVertexAttribDivisor = glVertexAttribDivisorEXT;
else if (glVertexAttribDivisorANGLE)
glVertexAttribDivisor = glVertexAttribDivisorANGLE;
2023-08-24 19:30:00 +08:00
if (!glDrawElementsInstanced)
AXLOG("%s", "Device not support instancing draw");
}
void CommandBufferGLES2::drawElementsInstanced(PrimitiveType primitiveType,
IndexFormat indexType,
std::size_t count,
std::size_t offset,
int instanceCount,
bool wireframe)
{
if (!glDrawElementsInstanced)
return;
CommandBufferGL::drawElementsInstanced(primitiveType, indexType, count, offset, instanceCount, wireframe);
}
2023-08-18 10:22:53 +08:00
void CommandBufferGLES2::bindInstanceBuffer(ProgramGL* program, uint32_t& usedBits) const
{
if (!glDrawElementsInstanced)
return;
2023-08-18 10:22:53 +08:00
CommandBufferGL::bindInstanceBuffer(program, usedBits);
}
NS_AX_BACKEND_END
#endif