}\r
\r
// Applies the indices and element array bindings\r
-GLenum Context::applyIndexBuffer(const void *indices, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo)\r
+GLenum Context::applyIndexBuffer(const void *indices, GLuint start, GLuint end, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo)\r
{\r
- GLenum err = mIndexDataManager->prepareIndexData(type, count, mState.elementArrayBuffer, indices, indexInfo);\r
+ GLenum err = mIndexDataManager->prepareIndexData(type, start, end, count, mState.elementArrayBuffer, indices, indexInfo);\r
\r
if(err == GL_NO_ERROR)\r
{\r
}\r
}\r
\r
-void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const void *indices)\r
+void Context::drawElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices)\r
{\r
if(!mState.currentProgram)\r
{\r
applyState(mode);\r
\r
TranslatedIndexData indexInfo;\r
- GLenum err = applyIndexBuffer(indices, count, mode, type, &indexInfo);\r
+ GLenum err = applyIndexBuffer(indices, start, end, count, mode, type, &indexInfo);\r
if(err != GL_NO_ERROR)\r
{\r
return error(err);\r
void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei *bufSize, void* pixels);\r
void clear(GLbitfield mask);\r
void drawArrays(GLenum mode, GLint first, GLsizei count);\r
- void drawElements(GLenum mode, GLsizei count, GLenum type, const void *indices);\r
+ void drawElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);\r
void finish();\r
void flush();\r
\r
bool applyRenderTarget();\r
void applyState(GLenum drawMode);\r
GLenum applyVertexBuffer(GLint base, GLint first, GLsizei count);\r
- GLenum applyIndexBuffer(const void *indices, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);\r
+ GLenum applyIndexBuffer(const void *indices, GLuint start, GLuint end, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);\r
void applyShaders();\r
void applyTextures();\r
void applyTextures(sw::SamplerType type);\r
else UNREACHABLE();\r
}\r
\r
-GLenum IndexDataManager::prepareIndexData(GLenum type, GLsizei count, Buffer *buffer, const void *indices, TranslatedIndexData *translated)\r
+GLenum IndexDataManager::prepareIndexData(GLenum type, GLuint start, GLuint end, GLsizei count, Buffer *buffer, const void *indices, TranslatedIndexData *translated)\r
{\r
if(!mStreamingBuffer)\r
{\r
translated->indexOffset = streamOffset;\r
}\r
\r
+ if(translated->minIndex < start || translated->maxIndex > end)\r
+ {\r
+ ERR("glDrawRangeElements: out of range access. Range provided: [%d -> %d]. Range used: [%d -> %d].", start, end, translated->minIndex, translated->maxIndex);\r
+ }\r
+\r
return GL_NO_ERROR;\r
}\r
\r
IndexDataManager();\r
virtual ~IndexDataManager();\r
\r
- GLenum prepareIndexData(GLenum type, GLsizei count, Buffer *arrayElementBuffer, const void *indices, TranslatedIndexData *translated);\r
+ GLenum prepareIndexData(GLenum type, GLuint start, GLuint end, GLsizei count, Buffer *arrayElementBuffer, const void *indices, TranslatedIndexData *translated);\r
\r
static std::size_t typeSize(GLenum type);\r
\r
return error(GL_INVALID_ENUM);\r
}\r
\r
- context->drawElements(mode, count, type, indices);\r
+ context->drawElements(mode, 0, UINT_MAX, count, type, indices);\r
}\r
}\r
\r
return error(GL_INVALID_VALUE);\r
}\r
\r
- UNIMPLEMENTED();\r
+ es2::Context *context = es2::getContext();\r
+\r
+ if(context)\r
+ {\r
+ context->drawElements(mode, start, end, count, type, indices);\r
+ }\r
}\r
\r
void GL_APIENTRY glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels)\r