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

Unified Diff: gpu/command_buffer/service/context_state.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/context_state.h
diff --git a/gpu/command_buffer/service/context_state.h b/gpu/command_buffer/service/context_state.h
index d026df9a06fd38c22f76e0d508d994063614921c..f2016359c2cc69743f155671d51a7924dc127598 100644
--- a/gpu/command_buffer/service/context_state.h
+++ b/gpu/command_buffer/service/context_state.h
@@ -243,6 +243,22 @@ struct GPU_EXPORT ContextState {
void SetBoundBuffer(GLenum target, Buffer* buffer);
void RemoveBoundBuffer(Buffer* buffer);
+ void SetGenericVertexAttribBaseType(GLuint index, GLenum base_type) {
+ DCHECK(index >=0 && index < 16);
+ int shift_bits = index * 2;
+ generic_attrib_type_written_mask_ |= ~(0x3 << shift_bits);
Zhenyao Mo 2016/07/20 17:54:56 You don't need this written mask. Every vertex at
yunchao 2016/07/22 13:43:53 Done.
+ generic_attrib_base_type_ &= ~(0x3 << shift_bits);
+ generic_attrib_base_type_ |= base_type << shift_bits;
+ }
+
+ uint32_t GetGenericVertexAttribBaseType() {
+ return generic_attrib_base_type_;
+ }
+
+ uint32_t GetGenericVertexAttribTypeMask() {
+ return generic_attrib_type_written_mask_;
+ }
+
void UnbindTexture(TextureRef* texture);
void UnbindSampler(Sampler* sampler);
@@ -320,6 +336,14 @@ struct GPU_EXPORT ContextState {
bool framebuffer_srgb_;
+ // Generic vertex attrib base types: FLOAT, INT, or UINT.
+ // We have up to 16 attribs, each is encoded into 2 bits, total 32 bits
Zhenyao Mo 2016/07/20 17:54:56 You can't really limit it to 16. Instead, it shou
yunchao 2016/07/22 13:43:53 Done.
+ // the lowest 2 bits for location 0, the highest 2 bits for location 15.
+ uint32_t generic_attrib_base_type_;
Zhenyao Mo 2016/07/20 17:54:56 I really think we should keep the type_mask_ inste
yunchao 2016/07/22 13:43:53 Acknowledged.
+ // Same layout as above, 2 bits per location, 0x03 if a location is set
+ // by vertexAttrib API, 0x00 if not.
+ uint32_t generic_attrib_type_written_mask_;
+
FeatureInfo* feature_info_;
std::unique_ptr<ErrorState> error_state_;
};
« no previous file with comments | « no previous file | gpu/command_buffer/service/context_state.cc » ('j') | gpu/command_buffer/service/feature_info.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698