ANGLEInstancedArrays.cpp [plain text]
#include "config.h"
#if ENABLE(WEBGL)
#include "ANGLEInstancedArrays.h"
#if PLATFORM(GTK) || USE(ANGLE)
#include "ExtensionsGL.h"
#endif
#include <wtf/IsoMallocInlines.h>
namespace WebCore {
WTF_MAKE_ISO_ALLOCATED_IMPL(ANGLEInstancedArrays);
ANGLEInstancedArrays::ANGLEInstancedArrays(WebGLRenderingContextBase& context)
: WebGLExtension(context)
{
#if USE(ANGLE)
context.graphicsContextGL()->getExtensions().ensureEnabled("GL_ANGLE_instanced_arrays");
#endif
}
ANGLEInstancedArrays::~ANGLEInstancedArrays() = default;
WebGLExtension::ExtensionName ANGLEInstancedArrays::getName() const
{
return ANGLEInstancedArraysName;
}
bool ANGLEInstancedArrays::supported(WebGLRenderingContextBase& context)
{
#if USE(ANGLE) || PLATFORM(GTK)
return context.graphicsContextGL()->getExtensions().supports("GL_ANGLE_instanced_arrays");
#else
UNUSED_PARAM(context);
return false;
#endif
}
void ANGLEInstancedArrays::drawArraysInstancedANGLE(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount)
{
if (!m_context || m_context->isContextLost())
return;
m_context->drawArraysInstanced(mode, first, count, primcount);
}
void ANGLEInstancedArrays::drawElementsInstancedANGLE(GCGLenum mode, GCGLsizei count, GCGLenum type, long long offset, GCGLsizei primcount)
{
if (!m_context || m_context->isContextLost())
return;
m_context->drawElementsInstanced(mode, count, type, offset, primcount);
}
void ANGLEInstancedArrays::vertexAttribDivisorANGLE(GCGLuint index, GCGLuint divisor)
{
if (!m_context || m_context->isContextLost())
return;
m_context->vertexAttribDivisor(index, divisor);
}
}
#endif // ENABLE(WEBGL)