Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Unified Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 954183006: Add glDrawRangeElements to GPU command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and update CL description Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/client/gles2_implementation.cc
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index c31ee5eb85633d92056a3106a4255cb004b4f041..fe59c2a0f099550a0dd144195e2c753e014910dd 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -816,23 +816,44 @@ void GLES2Implementation::DrawElements(
<< count << ", "
<< GLES2Util::GetStringIndexType(type) << ", "
<< static_cast<const void*>(indices) << ")");
- if (count < 0) {
- SetGLError(GL_INVALID_VALUE, "glDrawElements", "count less than 0.");
- return;
- }
- if (count == 0) {
+ DrawElementsImpl(mode, count, type, indices, "glDrawRangeElements");
+}
+
+void GLES2Implementation::DrawRangeElements(
+ GLenum mode, GLuint start, GLuint end,
+ GLsizei count, GLenum type, const void* indices) {
+ GPU_CLIENT_SINGLE_THREAD_CHECK();
+ GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDrawRangeElements("
+ << GLES2Util::GetStringDrawMode(mode) << ", "
+ << start << ", " << end << ", " << count << ", "
+ << GLES2Util::GetStringIndexType(type) << ", "
+ << static_cast<const void*>(indices) << ")");
+ if (end < start) {
+ SetGLError(GL_INVALID_VALUE, "glDrawRangeElements", "end < start");
return;
}
- if (vertex_array_object_manager_->bound_element_array_buffer() != 0 &&
- !ValidateOffset("glDrawElements", reinterpret_cast<GLintptr>(indices))) {
+ DrawElementsImpl(mode, count, type, indices, "glDrawRangeElements");
+}
+
+void GLES2Implementation::DrawElementsImpl(
+ GLenum mode, GLsizei count, GLenum type, const void* indices,
+ const char* func_name) {
+ if (count < 0) {
+ SetGLError(GL_INVALID_VALUE, func_name, "count < 0");
return;
}
- GLuint offset = 0;
bool simulated = false;
- if (!vertex_array_object_manager_->SetupSimulatedIndexAndClientSideBuffers(
- "glDrawElements", this, helper_, count, type, 0, indices,
- &offset, &simulated)) {
- return;
+ GLuint offset = ToGLuint(indices);
+ if (count > 0) {
+ if (vertex_array_object_manager_->bound_element_array_buffer() != 0 &&
+ !ValidateOffset(func_name, reinterpret_cast<GLintptr>(indices))) {
+ return;
+ }
+ if (!vertex_array_object_manager_->SetupSimulatedIndexAndClientSideBuffers(
+ func_name, this, helper_, count, type, 0, indices,
+ &offset, &simulated)) {
+ return;
+ }
}
helper_->DrawElements(mode, count, type, offset);
RestoreElementAndArrayBuffers(simulated);
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation.h ('k') | gpu/command_buffer/client/gles2_implementation_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698