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

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

Issue 2181193002: Revert of current program can be null in ES2/ES3 contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | gpu/command_buffer/service/context_state.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2378eeb3906693caec6f0b98b451a2b5eeedc1c9..6e2d2931883ee8a1f1237e6ff1998a390cfb2be1 100644
--- a/gpu/command_buffer/service/context_state.h
+++ b/gpu/command_buffer/service/context_state.h
@@ -243,27 +243,30 @@
void SetBoundBuffer(GLenum target, Buffer* buffer);
void RemoveBoundBuffer(Buffer* buffer);
- void InitGenericAttribs(GLuint max_vertex_attribs) {
- attrib_values.resize(max_vertex_attribs);
-
- uint32_t packed_size = max_vertex_attribs / 16;
- packed_size += (max_vertex_attribs % 16 == 0) ? 0 : 1;
- generic_attrib_base_type_mask_.resize(packed_size);
- for (uint32_t i = 0; i < packed_size; ++i) {
- // All generic attribs are float type by default.
- generic_attrib_base_type_mask_[i] = 0x55555555u * SHADER_VARIABLE_FLOAT;
- }
+ void InitGenericAttribBaseType(GLuint max_vertex_attribs) {
+ max_vertex_attribs_ = max_vertex_attribs;
+
+ uint32_t packed_size = max_vertex_attribs_ / 16;
+ packed_size += (max_vertex_attribs_ % 16 == 0) ? 0 : 1;
+ generic_attrib_base_type_mask_.resize(packed_size);
+ for (uint32_t i = 0; i < packed_size; ++i) {
+ // All generic attribs are float type by default.
+ generic_attrib_base_type_mask_[i] = 0x55555555u * SHADER_VARIABLE_FLOAT;
+ }
}
void SetGenericVertexAttribBaseType(GLuint index, GLenum base_type) {
- DCHECK_LT(index, attrib_values.size());
+ DCHECK(index < max_vertex_attribs_);
int shift_bits = (index % 16) * 2;
generic_attrib_base_type_mask_[index / 16] &= ~(0x3 << shift_bits);
generic_attrib_base_type_mask_[index / 16] |= (base_type << shift_bits);
}
- const std::vector<uint32_t>& generic_attrib_base_type_mask() const {
- return generic_attrib_base_type_mask_;
+ // Return 16 attributes' base types, in which the generic attribute
+ // specified by argument 'index' located.
+ uint32_t GetGenericVertexAttribBaseTypeMask(GLuint index) {
+ DCHECK(index < max_vertex_attribs_);
+ return generic_attrib_base_type_mask_[index / 16];
}
void UnbindTexture(TextureRef* texture);
@@ -343,9 +346,10 @@
bool framebuffer_srgb_;
+ uint32_t max_vertex_attribs_;
// Generic vertex 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).
+ // the highest 2 bits for location (max_vertex_attribs_ - 1).
std::vector<uint32_t> generic_attrib_base_type_mask_;
FeatureInfo* feature_info_;
« no previous file with comments | « no previous file | gpu/command_buffer/service/context_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698