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

Unified Diff: gpu/command_buffer/service/program_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: code clean 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/program_manager.h
diff --git a/gpu/command_buffer/service/program_manager.h b/gpu/command_buffer/service/program_manager.h
index 8b9d62f150ff3d3c9c6c6b7723a3504af4dffb28..a3fd9f2e6e48534487f7cea6d7ba32f763d6cd0c 100644
--- a/gpu/command_buffer/service/program_manager.h
+++ b/gpu/command_buffer/service/program_manager.h
@@ -403,6 +403,20 @@ class GPU_EXPORT Program : public base::RefCounted<Program> {
return fragment_output_written_mask_;
}
+ // The data are only valid after a successful link.
+ // Return 16 attributes' base types, in which the attribute
+ // specified by argument 'loc' located.
+ uint32_t vertex_input_base_type_mask(GLuint loc) const {
+ DCHECK(loc < max_vertex_attribs_);
+ return vertex_input_base_type_mask_[loc / 16];
+ }
+ // Return 16 attributes' type written masks, in which the
+ // attribute specified by argument 'loc' located.
+ uint32_t vertex_input_type_written_mask(GLuint loc) const {
+ DCHECK(loc < max_vertex_attribs_);
+ return vertex_input_type_written_mask_[loc / 16];
+ }
+
// Update uniform block binding after a successful glUniformBlockBinding().
void SetUniformBlockBinding(GLuint index, GLuint binding);
@@ -447,6 +461,7 @@ class GPU_EXPORT Program : public base::RefCounted<Program> {
void UpdateFragmentInputs();
void UpdateProgramOutputs();
void UpdateFragmentOutputBaseTypes();
+ void UpdateVertexInputBaseTypes();
void UpdateUniformBlockSizeInfo();
// Process the program log, replacing the hashed names with original names.
@@ -565,6 +580,15 @@ class GPU_EXPORT Program : public base::RefCounted<Program> {
// Same layout as above, 2 bits per location, 0x03 if a location is occupied
// by an output variable, 0x00 if not.
uint32_t fragment_output_written_mask_;
+
+ uint32_t max_vertex_attribs_;
+ // Vertex input attrib base types: FLOAT, INT, or UINT.
+ // Each base type is encoded into 2 bits, the lowest 2 bits for location 0,
+ // the highest 2 bits for location (max_vertex_attribs_ - 1).
+ std::vector<uint32_t> vertex_input_base_type_mask_;
+ // Same layout as above, 2 bits per location, 0x03 if a location is set
+ // by vertexAttrib API, 0x00 if not.
+ std::vector<uint32_t> vertex_input_type_written_mask_;
};
// Tracks the Programs.
@@ -577,6 +601,7 @@ class GPU_EXPORT ProgramManager {
uint32_t max_varying_vectors,
uint32_t max_draw_buffers,
uint32_t max_dual_source_draw_buffers,
+ uint32_t max_vertex_attribs,
const GpuPreferences& gpu_preferences,
FeatureInfo* feature_info);
~ProgramManager();
@@ -625,6 +650,8 @@ class GPU_EXPORT ProgramManager {
return max_dual_source_draw_buffers_;
}
+ uint32_t max_vertex_attribs() const { return max_vertex_attribs_; }
+
private:
friend class Program;
@@ -653,6 +680,7 @@ class GPU_EXPORT ProgramManager {
uint32_t max_varying_vectors_;
uint32_t max_draw_buffers_;
uint32_t max_dual_source_draw_buffers_;
+ uint32_t max_vertex_attribs_;
const GpuPreferences& gpu_preferences_;
scoped_refptr<FeatureInfo> feature_info_;

Powered by Google App Engine
This is Rietveld 408576698