Index: gpu/command_buffer/service/gles2_cmd_decoder.cc |
=================================================================== |
--- gpu/command_buffer/service/gles2_cmd_decoder.cc (revision 40176) |
+++ gpu/command_buffer/service/gles2_cmd_decoder.cc (working copy) |
@@ -103,53 +103,6 @@ |
#undef GLES2_CMD_OP |
}; |
-namespace GLErrorBit { |
-enum GLErrorBit { |
- kNoError = 0, |
- kInvalidEnum = (1 << 0), |
- kInvalidValue = (1 << 1), |
- kInvalidOperation = (1 << 2), |
- kOutOfMemory = (1 << 3), |
- kInvalidFrameBufferOperation = (1 << 4), |
-}; |
-} |
- |
-uint32 GLErrorToErrorBit(GLenum error) { |
- switch (error) { |
- case GL_INVALID_ENUM: |
- return GLErrorBit::kInvalidEnum; |
- case GL_INVALID_VALUE: |
- return GLErrorBit::kInvalidValue; |
- case GL_INVALID_OPERATION: |
- return GLErrorBit::kInvalidOperation; |
- case GL_OUT_OF_MEMORY: |
- return GLErrorBit::kOutOfMemory; |
- case GL_INVALID_FRAMEBUFFER_OPERATION: |
- return GLErrorBit::kInvalidFrameBufferOperation; |
- default: |
- DCHECK(false); |
- return GLErrorBit::kNoError; |
- } |
-} |
- |
-GLenum GLErrorBitToGLError(uint32 error_bit) { |
- switch (error_bit) { |
- case GLErrorBit::kInvalidEnum: |
- return GL_INVALID_ENUM; |
- case GLErrorBit::kInvalidValue: |
- return GL_INVALID_VALUE; |
- case GLErrorBit::kInvalidOperation: |
- return GL_INVALID_OPERATION; |
- case GLErrorBit::kOutOfMemory: |
- return GL_OUT_OF_MEMORY; |
- case GLErrorBit::kInvalidFrameBufferOperation: |
- return GL_INVALID_FRAMEBUFFER_OPERATION; |
- default: |
- DCHECK(false); |
- return GL_NO_ERROR; |
- } |
-} |
- |
// } // anonymous namespace. |
GLES2Decoder::GLES2Decoder(ContextGroup* group) |
@@ -488,6 +441,9 @@ |
// Wrapper for glGenerateMipmap |
void DoGenerateMipmap(GLenum target); |
+ // Wrapper for glGetShaderiv |
+ void DoGetShaderiv(GLuint shader, GLenum pname, GLint* params); |
+ |
// Wrapper for glGetShaderSource. |
void DoGetShaderSource( |
GLuint shader, GLsizei bufsize, GLsizei* length, char* dst); |
@@ -1802,7 +1758,7 @@ |
if (error == GL_NO_ERROR && error_bits_ != 0) { |
for (uint32 mask = 1; mask != 0; mask = mask << 1) { |
if ((error_bits_ & mask) != 0) { |
- error = GLErrorBitToGLError(mask); |
+ error = GLES2Util::GLErrorBitToGLError(mask); |
break; |
} |
} |
@@ -1810,13 +1766,13 @@ |
if (error != GL_NO_ERROR) { |
// There was an error, clear the corresponding wrapped error. |
- error_bits_ &= ~GLErrorToErrorBit(error); |
+ error_bits_ &= ~GLES2Util::GLErrorToErrorBit(error); |
} |
return error; |
} |
void GLES2DecoderImpl::SetGLError(GLenum error) { |
- error_bits_ |= GLErrorToErrorBit(error); |
+ error_bits_ |= GLES2Util::GLErrorToErrorBit(error); |
} |
void GLES2DecoderImpl::CopyRealGLErrorsToWrapper() { |
@@ -2048,6 +2004,20 @@ |
glCompileShader(shader); |
}; |
+void GLES2DecoderImpl::DoGetShaderiv( |
+ GLuint shader, GLenum pname, GLint* params) { |
+ ShaderManager::ShaderInfo* info = GetShaderInfo(shader); |
+ if (!info) { |
+ SetGLError(GL_INVALID_OPERATION); |
+ return; |
+ } |
+ if (pname == GL_SHADER_SOURCE_LENGTH) { |
+ *params = info->source().size(); |
+ } else { |
+ glGetShaderiv(shader, pname, params); |
+ } |
+} |
+ |
void GLES2DecoderImpl::DoGetShaderSource( |
GLuint shader, GLsizei bufsize, GLsizei* length, char* dst) { |
ShaderManager::ShaderInfo* info = GetShaderInfo(shader); |
@@ -2277,6 +2247,18 @@ |
return error::kNoError; |
} |
+error::Error GLES2DecoderImpl::HandleGetString( |
+ uint32 immediate_data_size, const gles2::GetString& c) { |
+ GLenum name = static_cast<GLenum>(c.name); |
+ if (!ValidateGLenumStringType(name)) { |
+ SetGLError(GL_INVALID_ENUM); |
+ return error::kNoError; |
+ } |
+ Bucket* bucket = CreateBucket(c.bucket_id); |
+ bucket->SetFromString(reinterpret_cast<const char*>(glGetString(name))); |
+ return error::kNoError; |
+} |
+ |
error::Error GLES2DecoderImpl::HandleBufferData( |
uint32 immediate_data_size, const gles2::BufferData& c) { |
GLenum target = static_cast<GLenum>(c.target); |
@@ -2437,8 +2419,6 @@ |
target, level, internal_format, width, height, border, image_size, data); |
} |
-// TODO(gman): handle CopyTexImage2D because we need to track what was created. |
- |
error::Error GLES2DecoderImpl::DoTexImage2D( |
GLenum target, |
GLint level, |