Index: gpu/command_buffer/service/gles2_cmd_decoder.cc |
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
index cd007c451a6f4671c722fd34124818d37387fbe2..9c344e1cecb0b523169d7d7a3a77c72e7af87f87 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
@@ -777,6 +777,8 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>, |
// Initialize or re-initialize the shader translator. |
bool InitializeShaderTranslator(); |
+ void UpdateCapabilities(); |
+ |
// Helpers for the glGen and glDelete functions. |
bool GenTexturesHelper(GLsizei n, const GLuint* client_ids); |
void DeleteTexturesHelper(GLsizei n, const GLuint* client_ids); |
@@ -1851,7 +1853,6 @@ GLES2DecoderImpl::GLES2DecoderImpl(SurfaceManager* surface_manager, |
surface_manager_(surface_manager), |
group_(ContextGroup::Ref(group ? group : new ContextGroup())), |
error_bits_(0), |
- util_(0), // TODO(gman): Set to actual num compress texture formats. |
pack_alignment_(4), |
unpack_alignment_(4), |
attrib_0_buffer_id_(0), |
@@ -1958,6 +1959,9 @@ bool GLES2DecoderImpl::Initialize( |
vertex_attrib_manager_.Initialize(group_->max_vertex_attribs()); |
+ util_.set_num_compressed_texture_formats( |
+ validators_->compressed_texture_format.GetValues().size()); |
+ |
if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { |
// We have to enable vertex array 0 on OpenGL or it won't render. Note that |
// OpenGL ES 2.0 does not have this issue. |
@@ -2145,6 +2149,13 @@ bool GLES2DecoderImpl::Initialize( |
return true; |
} |
+void GLES2DecoderImpl::UpdateCapabilities() { |
+ util_.set_num_compressed_texture_formats( |
+ validators_->compressed_texture_format.GetValues().size()); |
+ util_.set_num_shader_binary_formats( |
+ validators_->shader_binary_format.GetValues().size()); |
+} |
+ |
bool GLES2DecoderImpl::InitializeShaderTranslator() { |
// Re-check the state of use_shader_translator_ each time this is called. |
if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 && |
@@ -3196,24 +3207,33 @@ bool GLES2DecoderImpl::GetHelper( |
} |
return true; |
case GL_COMPRESSED_TEXTURE_FORMATS: |
- *num_written = 0; |
- // We don't support compressed textures. |
+ *num_written = validators_->compressed_texture_format.GetValues().size(); |
+ if (params) { |
+ for (GLint ii = 0; ii < *num_written; ++ii) { |
+ params[ii] = validators_->compressed_texture_format.GetValues()[ii]; |
+ } |
+ } |
return true; |
case GL_NUM_COMPRESSED_TEXTURE_FORMATS: |
*num_written = 1; |
if (params) { |
- *params = 0; // We don't support compressed textures. |
+ *params = validators_->compressed_texture_format.GetValues().size(); |
} |
return true; |
case GL_NUM_SHADER_BINARY_FORMATS: |
*num_written = 1; |
if (params) { |
- *params = 0; // We don't support binary shader formats. |
+ *params = validators_->shader_binary_format.GetValues().size(); |
} |
return true; |
case GL_SHADER_BINARY_FORMATS: |
- *num_written = 0; |
- return true; // We don't support binary shader format.s |
+ *num_written = validators_->shader_binary_format.GetValues().size(); |
+ if (params) { |
+ for (GLint ii = 0; ii < *num_written; ++ii) { |
+ params[ii] = validators_->shader_binary_format.GetValues()[ii]; |
+ } |
+ } |
+ return true; |
case GL_SHADER_COMPILER: |
*num_written = 1; |
if (params) { |
@@ -6855,6 +6875,8 @@ error::Error GLES2DecoderImpl::HandleRequestExtensionCHROMIUM( |
InitializeShaderTranslator(); |
} |
+ UpdateCapabilities(); |
+ |
return error::kNoError; |
} |