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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 1708983002: Command buffer: Fix bugs for drawing when the type of vertex attrib is a packed type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « gpu/command_buffer/service/buffer_manager.cc ('k') | gpu/command_buffer/service/vertex_attrib_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index f69be1d3ad4d93713bc72bc4bfbaca05be513a1d..7db3cbb3601966b74beedee9cb28295af89b1a55 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -8908,22 +8908,22 @@ error::Error GLES2DecoderImpl::HandleVertexAttribIPointer(
GL_INVALID_VALUE, "glVertexAttribIPointer", "offset < 0");
return error::kNoError;
}
- GLsizei component_size =
- GLES2Util::GetGLTypeSizeForTexturesAndBuffers(type);
- // component_size must be a power of two to use & as optimized modulo.
- DCHECK(GLES2Util::IsPOT(component_size));
- if (offset & (component_size - 1)) {
+ GLsizei type_size = GLES2Util::GetGLTypeSizeForBuffers(type);
+ // type_size must be a power of two to use & as optimized modulo.
+ DCHECK(GLES2Util::IsPOT(type_size));
+ if (offset & (type_size - 1)) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
"glVertexAttribIPointer", "offset not valid for type");
return error::kNoError;
}
- if (stride & (component_size - 1)) {
+ if (stride & (type_size - 1)) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
"glVertexAttribIPointer", "stride not valid for type");
return error::kNoError;
}
+ GLsizei group_size = GLES2Util::GetGroupSizeForBufferType(size, type);
state_.vertex_attrib_manager
->SetAttribInfo(indx,
state_.bound_array_buffer.get(),
@@ -8931,7 +8931,7 @@ error::Error GLES2DecoderImpl::HandleVertexAttribIPointer(
type,
GL_FALSE,
stride,
- stride != 0 ? stride : component_size * size,
+ stride != 0 ? stride : group_size,
offset,
GL_TRUE);
glVertexAttribIPointer(indx, size, type, stride, ptr);
@@ -9002,22 +9002,22 @@ error::Error GLES2DecoderImpl::HandleVertexAttribPointer(
GL_INVALID_VALUE, "glVertexAttribPointer", "offset < 0");
return error::kNoError;
}
- GLsizei component_size =
- GLES2Util::GetGLTypeSizeForTexturesAndBuffers(type);
- // component_size must be a power of two to use & as optimized modulo.
- DCHECK(GLES2Util::IsPOT(component_size));
- if (offset & (component_size - 1)) {
+ GLsizei type_size = GLES2Util::GetGLTypeSizeForBuffers(type);
+ // type_size must be a power of two to use & as optimized modulo.
+ DCHECK(GLES2Util::IsPOT(type_size));
+ if (offset & (type_size - 1)) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
"glVertexAttribPointer", "offset not valid for type");
return error::kNoError;
}
- if (stride & (component_size - 1)) {
+ if (stride & (type_size - 1)) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
"glVertexAttribPointer", "stride not valid for type");
return error::kNoError;
}
+ GLsizei group_size = GLES2Util::GetGroupSizeForBufferType(size, type);
state_.vertex_attrib_manager
->SetAttribInfo(indx,
state_.bound_array_buffer.get(),
@@ -9025,7 +9025,7 @@ error::Error GLES2DecoderImpl::HandleVertexAttribPointer(
type,
normalized,
stride,
- stride != 0 ? stride : component_size * size,
+ stride != 0 ? stride : group_size,
offset,
GL_FALSE);
// We support GL_FIXED natively on EGL/GLES2 implementations
« no previous file with comments | « gpu/command_buffer/service/buffer_manager.cc ('k') | gpu/command_buffer/service/vertex_attrib_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698