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

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

Issue 2174173002: 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
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 6e2d2931883ee8a1f1237e6ff1998a390cfb2be1..2378eeb3906693caec6f0b98b451a2b5eeedc1c9 100644
--- a/gpu/command_buffer/service/context_state.h
+++ b/gpu/command_buffer/service/context_state.h
@@ -243,30 +243,27 @@ struct GPU_EXPORT ContextState {
void SetBoundBuffer(GLenum target, Buffer* buffer);
void RemoveBoundBuffer(Buffer* buffer);
- 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 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 SetGenericVertexAttribBaseType(GLuint index, GLenum base_type) {
- DCHECK(index < max_vertex_attribs_);
+ DCHECK_LT(index, attrib_values.size());
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);
}
- // 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];
+ const std::vector<uint32_t>& generic_attrib_base_type_mask() const {
+ return generic_attrib_base_type_mask_;
}
void UnbindTexture(TextureRef* texture);
@@ -346,10 +343,9 @@ struct GPU_EXPORT ContextState {
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') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698