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

Unified Diff: gpu/command_buffer/service/context_group.cc

Issue 1950233002: Fix a bug in texture validation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/framebuffer_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/context_group.cc
diff --git a/gpu/command_buffer/service/context_group.cc b/gpu/command_buffer/service/context_group.cc
index 0fee5b9525025036e11e3aa0e29f926c41ec36fc..3deebc700c16cc8f57bdbaa0973b239e8d000981 100644
--- a/gpu/command_buffer/service/context_group.cc
+++ b/gpu/command_buffer/service/context_group.cc
@@ -113,8 +113,8 @@ bool ContextGroup::Initialize(GLES2Decoder* decoder,
const DisallowedFeatures& disallowed_features) {
if (HaveContexts()) {
if (context_type != feature_info_->context_type()) {
- LOG(ERROR) << "ContextGroup::Initialize failed because the type of "
- << "the context does not fit with the group.";
+ DLOG(ERROR) << "ContextGroup::Initialize failed because the type of "
+ << "the context does not fit with the group.";
return false;
}
// If we've already initialized the group just add the context.
@@ -126,8 +126,8 @@ bool ContextGroup::Initialize(GLES2Decoder* decoder,
AdjustDisallowedFeatures(context_type, disallowed_features);
if (!feature_info_->Initialize(context_type, adjusted_disallowed_features)) {
- LOG(ERROR) << "ContextGroup::Initialize failed because FeatureInfo "
- << "initialization failed.";
+ DLOG(ERROR) << "ContextGroup::Initialize failed because FeatureInfo "
+ << "initialization failed.";
return false;
}
@@ -138,9 +138,9 @@ bool ContextGroup::Initialize(GLES2Decoder* decoder,
if (!QueryGLFeature(
GL_MAX_RENDERBUFFER_SIZE, kMinRenderbufferSize,
&max_renderbuffer_size)) {
- LOG(ERROR) << "ContextGroup::Initialize failed because maximum "
- << "renderbuffer size too small (" << max_renderbuffer_size
- << ", should be " << kMinRenderbufferSize << ").";
+ DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
+ << "renderbuffer size too small (" << max_renderbuffer_size
+ << ", should be " << kMinRenderbufferSize << ").";
return false;
}
GLint max_samples = 0;
@@ -173,10 +173,10 @@ bool ContextGroup::Initialize(GLES2Decoder* decoder,
if (!QueryGLFeatureU(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS,
kMinTransformFeedbackSeparateAttribs,
&max_transform_feedback_separate_attribs_)) {
- LOG(ERROR) << "ContextGroup::Initialize failed because maximum "
- << "transform feedback separate attribs is too small ("
- << max_transform_feedback_separate_attribs_ << ", should be "
- << kMinTransformFeedbackSeparateAttribs << ").";
+ DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
+ << "transform feedback separate attribs is too small ("
+ << max_transform_feedback_separate_attribs_ << ", should be "
+ << kMinTransformFeedbackSeparateAttribs << ").";
return false;
}
@@ -184,10 +184,10 @@ bool ContextGroup::Initialize(GLES2Decoder* decoder,
if (!QueryGLFeatureU(GL_MAX_UNIFORM_BUFFER_BINDINGS,
kMinUniformBufferBindings,
&max_uniform_buffer_bindings_)) {
- LOG(ERROR) << "ContextGroup::Initialize failed because maximum "
- << "uniform buffer bindings is too small ("
- << max_uniform_buffer_bindings_ << ", should be "
- << kMinUniformBufferBindings << ").";
+ DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
+ << "uniform buffer bindings is too small ("
+ << max_uniform_buffer_bindings_ << ", should be "
+ << kMinUniformBufferBindings << ").";
return false;
}
@@ -212,9 +212,9 @@ bool ContextGroup::Initialize(GLES2Decoder* decoder,
if (!QueryGLFeatureU(
GL_MAX_VERTEX_ATTRIBS, kGLES2RequiredMinimumVertexAttribs,
&max_vertex_attribs_)) {
- LOG(ERROR) << "ContextGroup::Initialize failed because too few "
- << "vertex attributes supported (" << max_vertex_attribs_
- << ", should be " << kGLES2RequiredMinimumVertexAttribs << ").";
+ DLOG(ERROR) << "ContextGroup::Initialize failed because too few "
+ << "vertex attributes supported (" << max_vertex_attribs_
+ << ", should be " << kGLES2RequiredMinimumVertexAttribs << ").";
return false;
}
@@ -222,9 +222,9 @@ bool ContextGroup::Initialize(GLES2Decoder* decoder,
if (!QueryGLFeatureU(
GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, kGLES2RequiredMinimumTextureUnits,
&max_texture_units_)) {
- LOG(ERROR) << "ContextGroup::Initialize failed because too few "
- << "texture units supported (" << max_texture_units_
- << ", should be " << kGLES2RequiredMinimumTextureUnits << ").";
+ DLOG(ERROR) << "ContextGroup::Initialize failed because too few "
+ << "texture units supported (" << max_texture_units_
+ << ", should be " << kGLES2RequiredMinimumTextureUnits << ").";
return false;
}
@@ -232,42 +232,53 @@ bool ContextGroup::Initialize(GLES2Decoder* decoder,
GLint max_cube_map_texture_size = 0;
GLint max_rectangle_texture_size = 0;
GLint max_3d_texture_size = 0;
+ GLint max_array_texture_layers = 0;
const GLint kMinTextureSize = 2048; // GL actually says 64!?!?
const GLint kMinCubeMapSize = 256; // GL actually says 16!?!?
const GLint kMinRectangleTextureSize = 64;
const GLint kMin3DTextureSize = 256;
+ const GLint kMinArrayTextureLayers = 256;
if (!QueryGLFeature(GL_MAX_TEXTURE_SIZE, kMinTextureSize,
&max_texture_size)) {
- LOG(ERROR) << "ContextGroup::Initialize failed because maximum "
- << "2d texture size is too small (" << max_texture_size
- << ", should be " << kMinTextureSize << ").";
+ DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
+ << "2d texture size is too small (" << max_texture_size
+ << ", should be " << kMinTextureSize << ").";
return false;
}
if (!QueryGLFeature(GL_MAX_CUBE_MAP_TEXTURE_SIZE, kMinCubeMapSize,
&max_cube_map_texture_size)) {
- LOG(ERROR) << "ContextGroup::Initialize failed because maximum "
- << "cube texture size is too small ("
- << max_cube_map_texture_size << ", should be " << kMinCubeMapSize
- << ").";
+ DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
+ << "cube texture size is too small ("
+ << max_cube_map_texture_size << ", should be "
+ << kMinCubeMapSize << ").";
return false;
}
if (feature_info_->gl_version_info().IsES3Capable() &&
!QueryGLFeature(GL_MAX_3D_TEXTURE_SIZE, kMin3DTextureSize,
&max_3d_texture_size)) {
- LOG(ERROR) << "ContextGroup::Initialize failed because maximum "
- << "3d texture size is too small (" << max_3d_texture_size
- << ", should be " << kMin3DTextureSize << ").";
+ DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
+ << "3d texture size is too small (" << max_3d_texture_size
+ << ", should be " << kMin3DTextureSize << ").";
+ return false;
+ }
+ if (feature_info_->gl_version_info().IsES3Capable() &&
+ !QueryGLFeature(GL_MAX_ARRAY_TEXTURE_LAYERS, kMinArrayTextureLayers,
+ &max_array_texture_layers)) {
+ DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
+ << "array texture layers is too small ("
+ << max_array_texture_layers
+ << ", should be " << kMinArrayTextureLayers << ").";
return false;
}
if (feature_info_->feature_flags().arb_texture_rectangle &&
!QueryGLFeature(GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB,
kMinRectangleTextureSize, &max_rectangle_texture_size)) {
- LOG(ERROR) << "ContextGroup::Initialize failed because maximum "
- << "rectangle texture size is too small ("
- << max_rectangle_texture_size << ", should be "
- << kMinRectangleTextureSize << ").";
+ DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
+ << "rectangle texture size is too small ("
+ << max_rectangle_texture_size << ", should be "
+ << kMinRectangleTextureSize << ").";
return false;
}
@@ -291,6 +302,7 @@ bool ContextGroup::Initialize(GLES2Decoder* decoder,
max_cube_map_texture_size,
max_rectangle_texture_size,
max_3d_texture_size,
+ max_array_texture_layers,
bind_generates_resource_));
texture_manager_->set_framebuffer_manager(framebuffer_manager_.get());
@@ -298,17 +310,18 @@ bool ContextGroup::Initialize(GLES2Decoder* decoder,
const GLint kMinVertexTextureImageUnits = 0;
if (!QueryGLFeatureU(GL_MAX_TEXTURE_IMAGE_UNITS, kMinTextureImageUnits,
&max_texture_image_units_)) {
- LOG(ERROR) << "ContextGroup::Initialize failed because too few "
- << "texture image units supported (" << max_texture_image_units_
- << ", should be " << kMinTextureImageUnits << ").";
+ DLOG(ERROR) << "ContextGroup::Initialize failed because too few "
+ << "texture image units supported ("
+ << max_texture_image_units_
+ << ", should be " << kMinTextureImageUnits << ").";
}
if (!QueryGLFeatureU(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS,
kMinVertexTextureImageUnits,
&max_vertex_texture_image_units_)) {
- LOG(ERROR) << "ContextGroup::Initialize failed because too few "
- << "vertex texture image units supported ("
- << max_vertex_texture_image_units_ << ", should be "
- << kMinTextureImageUnits << ").";
+ DLOG(ERROR) << "ContextGroup::Initialize failed because too few "
+ << "vertex texture image units supported ("
+ << max_vertex_texture_image_units_ << ", should be "
+ << kMinTextureImageUnits << ").";
return false;
}
@@ -335,8 +348,8 @@ bool ContextGroup::Initialize(GLES2Decoder* decoder,
!CheckGLFeatureU(kMinVaryingVectors, &max_varying_vectors_) ||
!CheckGLFeatureU(
kMinVertexUniformVectors, &max_vertex_uniform_vectors_)) {
- LOG(ERROR) << "ContextGroup::Initialize failed because too few "
- << "uniforms or varyings supported.";
+ DLOG(ERROR) << "ContextGroup::Initialize failed because too few "
+ << "uniforms or varyings supported.";
return false;
}
@@ -371,27 +384,27 @@ bool ContextGroup::Initialize(GLES2Decoder* decoder,
if (!QueryGLFeatureU(GL_MAX_VERTEX_OUTPUT_COMPONENTS,
kMinVertexOutputComponents,
&max_vertex_output_components_)) {
- LOG(ERROR) << "ContextGroup::Initialize failed because maximum "
- << "vertex output components is too small ("
- << max_vertex_output_components_ << ", should be "
- << kMinVertexOutputComponents << ").";
+ DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
+ << "vertex output components is too small ("
+ << max_vertex_output_components_ << ", should be "
+ << kMinVertexOutputComponents << ").";
return false;
}
if (!QueryGLFeatureU(GL_MAX_FRAGMENT_INPUT_COMPONENTS,
kMinFragmentInputComponents,
&max_fragment_input_components_)) {
- LOG(ERROR) << "ContextGroup::Initialize failed because maximum "
- << "fragment input components is too small ("
- << max_fragment_input_components_ << ", should be "
- << kMinFragmentInputComponents << ").";
+ DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
+ << "fragment input components is too small ("
+ << max_fragment_input_components_ << ", should be "
+ << kMinFragmentInputComponents << ").";
return false;
}
if (!QueryGLFeature(GL_MAX_PROGRAM_TEXEL_OFFSET, kMin_MaxProgramTexelOffset,
&max_program_texel_offset_)) {
- LOG(ERROR) << "ContextGroup::Initialize failed because maximum "
- << "program texel offset is too small ("
- << max_program_texel_offset_ << ", should be "
- << kMin_MaxProgramTexelOffset << ").";
+ DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
+ << "program texel offset is too small ("
+ << max_program_texel_offset_ << ", should be "
+ << kMin_MaxProgramTexelOffset << ").";
return false;
}
glGetIntegerv(GL_MIN_PROGRAM_TEXEL_OFFSET, &min_program_texel_offset_);
@@ -400,19 +413,19 @@ bool ContextGroup::Initialize(GLES2Decoder* decoder,
std::max(min_program_texel_offset_, kMax_MinProgramTexelOffset);
}
if (min_program_texel_offset_ > kMax_MinProgramTexelOffset) {
- LOG(ERROR) << "ContextGroup::Initialize failed because minimum "
- << "program texel offset is too big ("
- << min_program_texel_offset_ << ", should be "
- << kMax_MinProgramTexelOffset << ").";
+ DLOG(ERROR) << "ContextGroup::Initialize failed because minimum "
+ << "program texel offset is too big ("
+ << min_program_texel_offset_ << ", should be "
+ << kMax_MinProgramTexelOffset << ").";
return false;
}
const GLint kES3MinCubeMapSize = 2048;
if (max_cube_map_texture_size < kES3MinCubeMapSize) {
- LOG(ERROR) << "ContextGroup::Initialize failed because maximum "
- << "cube texture size is too small ("
- << max_cube_map_texture_size << ", should be "
- << kES3MinCubeMapSize << ").";
+ DLOG(ERROR) << "ContextGroup::Initialize failed because maximum "
+ << "cube texture size is too small ("
+ << max_cube_map_texture_size << ", should be "
+ << kES3MinCubeMapSize << ").";
return false;
}
}
@@ -425,8 +438,8 @@ bool ContextGroup::Initialize(GLES2Decoder* decoder,
feature_info_.get()));
if (!texture_manager_->Initialize()) {
- LOG(ERROR) << "Context::Group::Initialize failed because texture manager "
- << "failed to initialize.";
+ DLOG(ERROR) << "Context::Group::Initialize failed because texture manager "
+ << "failed to initialize.";
return false;
}
« no previous file with comments | « no previous file | gpu/command_buffer/service/framebuffer_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698