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

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

Issue 1131273005: Fine tune vertex attrib commands handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: working Created 5 years, 7 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/vertex_array_object_manager.cc
diff --git a/gpu/command_buffer/client/vertex_array_object_manager.cc b/gpu/command_buffer/client/vertex_array_object_manager.cc
index 8b0385d7cbb430346a78213e9660870bfd9b0712..415abe610cef1750cf53318d222474f89519f03c 100644
--- a/gpu/command_buffer/client/vertex_array_object_manager.cc
+++ b/gpu/command_buffer/client/vertex_array_object_manager.cc
@@ -47,7 +47,8 @@ class GLES2_IMPL_EXPORT VertexArrayObject {
normalized_(GL_FALSE),
pointer_(NULL),
gl_stride_(0),
- divisor_(0) {
+ divisor_(0),
+ integer_(GL_FALSE) {
}
bool enabled() const {
@@ -94,19 +95,25 @@ class GLES2_IMPL_EXPORT VertexArrayObject {
return divisor_;
}
+ GLboolean integer() const {
+ return integer_;
+ }
+
void SetInfo(
GLuint buffer_id,
GLint size,
GLenum type,
GLboolean normalized,
GLsizei gl_stride,
- const GLvoid* pointer) {
+ const GLvoid* pointer,
+ GLboolean integer) {
buffer_id_ = buffer_id;
size_ = size;
type_ = type;
normalized_ = normalized;
gl_stride_ = gl_stride;
pointer_ = pointer;
+ integer_ = integer;
}
void SetDivisor(GLuint divisor) {
@@ -138,6 +145,8 @@ class GLES2_IMPL_EXPORT VertexArrayObject {
// Divisor, for geometry instancing.
GLuint divisor_;
+
+ GLboolean integer_;
};
typedef std::vector<VertexAttrib> VertexAttribs;
@@ -155,7 +164,7 @@ class GLES2_IMPL_EXPORT VertexArrayObject {
void SetAttribPointer(
GLuint buffer_id,
GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride,
- const void* ptr);
+ const void* ptr, GLboolean integer);
bool GetVertexAttrib(
GLuint index, GLenum pname, uint32* param) const;
@@ -240,7 +249,8 @@ void VertexArrayObject::SetAttribPointer(
GLenum type,
GLboolean normalized,
GLsizei stride,
- const void* ptr) {
+ const void* ptr,
+ GLboolean integer) {
if (index < vertex_attribs_.size()) {
VertexAttrib& attrib = vertex_attribs_[index];
if (attrib.IsClientSide() && attrib.enabled()) {
@@ -248,7 +258,7 @@ void VertexArrayObject::SetAttribPointer(
DCHECK_GE(num_client_side_pointers_enabled_, 0);
}
- attrib.SetInfo(buffer_id, size, type, normalized, stride, ptr);
+ attrib.SetInfo(buffer_id, size, type, normalized, stride, ptr, integer);
if (attrib.IsClientSide() && attrib.enabled()) {
++num_client_side_pointers_enabled_;
@@ -283,8 +293,8 @@ bool VertexArrayObject::GetVertexAttrib(
*param = attrib->normalized();
break;
case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
- // TODO(zmo): cache this on the client side.
- return false;
+ *param = attrib->integer();
+ break;
default:
return false; // pass through to service side.
}
@@ -431,13 +441,14 @@ bool VertexArrayObjectManager::SetAttribPointer(
GLenum type,
GLboolean normalized,
GLsizei stride,
- const void* ptr) {
+ const void* ptr,
+ GLboolean integer) {
// Client side arrays are not allowed in vaos.
if (buffer_id == 0 && !IsDefaultVAOBound()) {
return false;
}
bound_vertex_array_object_->SetAttribPointer(
- buffer_id, index, size, type, normalized, stride, ptr);
+ buffer_id, index, size, type, normalized, stride, ptr, integer);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698