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

Unified Diff: gpu/command_buffer/service/vertex_attrib_manager.h

Issue 2148723004: WebGL 2: make sure VertexAttrib type match the corresponding attrib type in shader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update vertex attrib base type for vertexAttrib{I}Pointer only if the vertex attrib array is enabled Created 4 years, 5 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/service/vertex_attrib_manager.h
diff --git a/gpu/command_buffer/service/vertex_attrib_manager.h b/gpu/command_buffer/service/vertex_attrib_manager.h
index f3fae6d2d8f2e98ab144da10dad5f1ba210cfe1a..42ede30ebcf9a5b52bda4e0f8538d3d39272549d 100644
--- a/gpu/command_buffer/service/vertex_attrib_manager.h
+++ b/gpu/command_buffer/service/vertex_attrib_manager.h
@@ -200,6 +200,22 @@ class GPU_EXPORT VertexAttribManager :
return NULL;
}
+ void UpdateAttribBaseTypeAndMask(GLuint loc, GLenum base_type) {
+ DCHECK(loc >=0 && loc < 16);
+ int shift_bits = loc * 2;
+ attrib_written_mask_ |= 0x3 << shift_bits;
+ attrib_base_type_mask_ &= ~(0x3 << shift_bits);
+ attrib_base_type_mask_ |= base_type << shift_bits;
+ }
+
+ uint32_t attrib_base_type_mask() const {
+ return attrib_base_type_mask_;
+ }
+
+ uint32_t attrib_written_mask() const {
+ return attrib_written_mask_;
+ }
+
void SetAttribInfo(
GLuint index,
Buffer* buffer,
@@ -284,6 +300,14 @@ class GPU_EXPORT VertexAttribManager :
// if it is safe to draw.
std::vector<VertexAttrib> vertex_attribs_;
+ // Vertex attrib base types: FLOAT, INT, or UINT.
+ // We have up to 16 attribs, each is encoded into 2 bits, total 32 bits:
+ // the lowest 2 bits for location 0, the highest 2 bits for location 15.
+ uint32_t attrib_base_type_mask_;
Zhenyao Mo 2016/07/20 17:54:56 Same here, you need a array.
yunchao 2016/07/22 13:43:54 Done.
+ // Same layout as above, 2 bits per location, 0x03 if a location is set
+ // by vertexAttrib API, 0x00 if not.
+ uint32_t attrib_written_mask_;
+
// The currently bound element array buffer. If this is 0 it is illegal
// to call glDrawElements.
scoped_refptr<Buffer> element_array_buffer_;

Powered by Google App Engine
This is Rietveld 408576698