summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-29 04:21:36 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-29 04:21:36 +0000
commit8bf5a3eff3ae66eb2f4dae5feb1ae58dd240b4f3 (patch)
tree71919c02268fd8a8d462cccd5d3f211c3da57d81 /gpu
parenta8125d2a01d5d1f12f6dc23881b457804c904509 (diff)
downloadchromium_src-8bf5a3eff3ae66eb2f4dae5feb1ae58dd240b4f3.zip
chromium_src-8bf5a3eff3ae66eb2f4dae5feb1ae58dd240b4f3.tar.gz
chromium_src-8bf5a3eff3ae66eb2f4dae5feb1ae58dd240b4f3.tar.bz2
Implements glGetVertexAttribPointerv
TEST=none BUG=none Review URL: http://codereview.chromium.org/549201 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37496 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rwxr-xr-xgpu/command_buffer/build_gles2_cmd_buffer.py81
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc78
-rw-r--r--gpu/command_buffer/client/gles2_implementation.h3
-rw-r--r--gpu/command_buffer/client/gles2_implementation_gen.h75
-rw-r--r--gpu/command_buffer/common/gles2_cmd_format.h12
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc37
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc62
-rw-r--r--gpu/gpu.gyp1
8 files changed, 185 insertions, 164 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
index 170d4cf..97de292 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -1344,17 +1344,6 @@ TEST_F(GLES2DecoderTest, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
func.MakeTypedOriginalArgString("")))
file.Write("\n")
- def WriteGLES2ImplementationImpl(self, func, file):
- """Writes the GLES2 Implemention definition."""
- if not func.can_auto_generate:
- file.Write("%s GLES2Implementation::%s(%s) {\n" %
- (func.return_type, func.original_name,
- func.MakeTypedOriginalArgString("")))
- if not func.return_type == "void":
- file.Write(" return 0;\n")
- file.Write("}\n")
- file.Write("\n")
-
def WriteImmediateCmdComputeSize(self, func, file):
"""Writes the size computation code for the immediate version of a cmd."""
file.Write(" static uint32 ComputeSize(uint32 size_in_bytes) {\n")
@@ -1484,10 +1473,6 @@ class HandWrittenHandler(CustomHandler):
"""Overrriden from TypeHandler."""
pass
- def WriteGLES2ImplementationImpl(self, func, file):
- """Overrriden from TypeHandler."""
- pass
-
def WriteImmediateCmdHelper(self, func, file):
"""Overrriden from TypeHandler."""
pass
@@ -1538,10 +1523,6 @@ class ManualHandler(CustomHandler):
func.MakeTypedOriginalArgString("")))
file.Write("\n")
- def WriteGLES2ImplementationImpl(self, func, file):
- """Overrriden from TypeHandler."""
- pass
-
def WriteImmediateCmdGetTotalSize(self, func, file):
"""Overrriden from TypeHandler."""
# TODO(gman): Move this data to _FUNCTION_INFO?
@@ -1646,10 +1627,6 @@ class DataHandler(TypeHandler):
file.Write("// TODO(gman): Implement test for %s\n" % func.name)
return
- def WriteGLES2ImplementationImpl(self, func, file):
- """Overrriden from TypeHandler."""
- pass
-
def WriteServiceUnitTest(self, func, file):
"""Overrriden from TypeHandler."""
file.Write("// TODO(gman): %s\n\n" % func.name)
@@ -1698,10 +1675,6 @@ class GENnHandler(TypeHandler):
file.Write("}\n")
file.Write("\n")
- def WriteGLES2ImplementationImpl(self, func, file):
- """Overrriden from TypeHandler."""
- pass
-
def WriteServiceUnitTest(self, func, file):
"""Overrriden from TypeHandler."""
valid_test = """
@@ -1919,10 +1892,6 @@ TEST_F(GLES2DecoderTest, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
file.Write("}\n")
file.Write("\n")
- def WriteGLES2ImplementationImpl(self, func, file):
- """Overrriden from TypeHandler."""
- pass
-
class DELnHandler(TypeHandler):
"""Handler for glDelete___ type functions."""
@@ -2024,10 +1993,6 @@ TEST_F(GLES2DecoderTest, %(name)sInvalidArgs) {
file.Write("}\n")
file.Write("\n")
- def WriteGLES2ImplementationImpl(self, func, file):
- """Overrriden from TypeHandler."""
- pass
-
def WriteImmediateCmdComputeSize(self, func, file):
"""Overrriden from TypeHandler."""
file.Write(" static uint32 ComputeDataSize(GLsizei n) {\n")
@@ -2177,10 +2142,6 @@ class GETnHandler(TypeHandler):
file.Write("}\n")
file.Write("\n")
- def WriteGLES2ImplementationImpl(self, func, file):
- """Overrriden from TypeHandler."""
- pass
-
class PUTHandler(TypeHandler):
"""Handler for glTexParameter_v, glVertexAttrib_v functions."""
@@ -2248,10 +2209,6 @@ TEST_F(GLES2DecoderTest, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
file.Write("}\n")
file.Write("\n")
- def WriteGLES2ImplementationImpl(self, func, file):
- """Overrriden from TypeHandler."""
- pass
-
def WriteImmediateCmdComputeSize(self, func, file):
"""Overrriden from TypeHandler."""
file.Write(" static uint32 ComputeDataSize() {\n")
@@ -2423,10 +2380,6 @@ TEST_F(GLES2DecoderTest, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
file.Write("}\n")
file.Write("\n")
- def WriteGLES2ImplementationImpl(self, func, file):
- """Overrriden from TypeHandler."""
- pass
-
def WriteImmediateCmdComputeSize(self, func, file):
"""Overrriden from TypeHandler."""
file.Write(" static uint32 ComputeDataSize(GLsizei count) {\n")
@@ -2612,10 +2565,6 @@ class GLcharHandler(TypeHandler):
file.Write("}\n")
file.Write("\n")
- def WriteGLES2ImplementationImpl(self, func, file):
- """Overrriden from TypeHandler."""
- pass
-
def WriteImmediateCmdComputeSize(self, func, file):
"""Overrriden from TypeHandler."""
file.Write(" static uint32 ComputeSize(uint32 data_size) {\n")
@@ -2810,10 +2759,6 @@ class GetGLcharHandler(GLcharHandler):
file.Write("}\n")
file.Write("\n")
- def WriteGLES2ImplementationImpl(self, func, file):
- """Overrriden from TypeHandler."""
- pass
-
def WriteImmediateCmdComputeSize(self, func, file):
"""Overrriden from TypeHandler."""
file.Write(" static uint32 ComputeDataSize(const char* s) {\n")
@@ -2980,10 +2925,6 @@ TEST_F(GLES2DecoderTest, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
file.Write("}\n")
file.Write("\n")
- def WriteGLES2ImplementationImpl(self, func, file):
- """Overrriden from TypeHandler."""
- pass
-
class STRnHandler(TypeHandler):
"""Handler for GetProgramInfoLog, GetShaderInfoLog and GetShaderSource."""
@@ -3511,10 +3452,6 @@ class Function(object):
"""Writes the GLES2 Implemention declaration."""
self.type_handler.WriteGLES2ImplementationHeader(self, file)
- def WriteGLES2ImplementationImpl(self, file):
- """Writes the GLES2 Implemention definition."""
- self.type_handler.WriteGLES2ImplementationImpl(self, file)
-
def WriteFormatTest(self, file):
"""Writes the cmd's format test."""
self.type_handler.WriteFormatTest(self, file)
@@ -3897,21 +3834,6 @@ class GLGenerator(object):
func.WriteGLES2ImplementationHeader(file)
file.Close()
- def WriteGLES2ImplementationImpl(self, filename):
- """Writes the gles2 helper implementation."""
- file = CHeaderWriter(
- filename,
- "// A class to emluate GLES2 over command buffers.\n")
- file.Write(
- "#include \"gpu/command_buffer/client/gles2_implementation.h\"\n")
- self.WriteNamespaceOpen(file)
- for func in self.original_functions:
- func.WriteGLES2ImplementationImpl(file)
- file.Write("\n")
-
- self.WriteNamespaceClose(file)
- file.Close()
-
def WriteServiceUtilsHeader(self, filename):
"""Writes the gles2 auto generated utility header."""
file = CHeaderWriter(filename)
@@ -3966,9 +3888,6 @@ def main(argv):
gen.WriteServiceUtilsImplementation(
"service/gles2_cmd_validation_implementation_autogen.h")
- if options.generate_implementation_templates:
- gen.WriteGLES2ImplementationImpl("client/gles2_implementation_gen.h")
-
if options.generate_command_id_tests:
gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h")
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 032717d..61639b8 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -5,8 +5,6 @@
// A class to emluate GLES2 over command buffers.
#include "gpu/command_buffer/client/gles2_implementation.h"
-// TODO(gman): remove when all functions have been implemented.
-#include "gpu/command_buffer/client/gles2_implementation_gen.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
namespace gpu {
@@ -56,6 +54,11 @@ void GLES2Implementation::FreeIds(GLsizei n, const GLuint* ids) {
}
}
+void GLES2Implementation::CopyResult(void* dst) {
+ SizedResult* result = static_cast<SizedResult*>(result_buffer_);
+ memcpy(dst, result->GetDataAs<void*>(), result->size);
+}
+
void GLES2Implementation::WaitForCmd() {
int32 token = helper_->InsertToken();
helper_->WaitForToken(token);
@@ -76,6 +79,14 @@ void GLES2Implementation::SwapBuffers() {
Finish();
}
+void GLES2Implementation::GetVertexAttribPointerv(
+ GLuint index, GLenum pname, void** ptr) {
+ helper_->GetVertexAttribPointerv(
+ index, pname, result_shm_id(), result_shm_offset());
+ WaitForCmd();
+ CopyResult(ptr);
+};
+
GLint GLES2Implementation::GetAttribLocation(
GLuint program, const char* name) {
helper_->GetAttribLocationImmediate(
@@ -270,5 +281,68 @@ void GLES2Implementation::TexSubImage2D(
}
+GLenum GLES2Implementation::CheckFramebufferStatus(GLenum target) {
+ // TODO(gman): implement.
+ return 0;
+}
+
+void GLES2Implementation::GetActiveAttrib(
+ GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size,
+ GLenum* type, char* name) {
+ // TODO(gman): implement.
+}
+
+void GLES2Implementation::GetActiveUniform(
+ GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size,
+ GLenum* type, char* name) {
+ // TODO(gman): implement.
+}
+
+void GLES2Implementation::GetAttachedShaders(
+ GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) {
+ // TODO(gman): implement.
+}
+
+void GLES2Implementation::GetProgramInfoLog(
+ GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) {
+ // TODO(gman): implement.
+}
+
+void GLES2Implementation::GetShaderInfoLog(
+ GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) {
+ // TODO(gman): implement.
+}
+
+void GLES2Implementation::GetShaderPrecisionFormat(
+ GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) {
+ // TODO(gman): implement.
+}
+
+void GLES2Implementation::GetShaderSource(
+ GLuint shader, GLsizei bufsize, GLsizei* length, char* source) {
+ // TODO(gman): implement.
+}
+
+const GLubyte* GLES2Implementation::GetString(GLenum name) {
+ // TODO(gman): implement.
+ return 0;
+}
+
+void GLES2Implementation::GetUniformfv(
+ GLuint program, GLint location, GLfloat* params) {
+ // TODO(gman): implement.
+}
+
+void GLES2Implementation::GetUniformiv(
+ GLuint program, GLint location, GLint* params) {
+ // TODO(gman): implement.
+}
+
+void GLES2Implementation::ReadPixels(
+ GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
+ void* pixels) {
+ // TODO(gman): implement.
+}
+
} // namespace gles2
} // namespace gpu
diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h
index 35776704..ac519f9 100644
--- a/gpu/command_buffer/client/gles2_implementation.h
+++ b/gpu/command_buffer/client/gles2_implementation.h
@@ -63,6 +63,9 @@ class GLES2Implementation {
return *static_cast<T*>(result_buffer_);
}
+ // Copies the result.
+ void CopyResult(void* dst);
+
// Waits for all commands to execute.
void WaitForCmd();
diff --git a/gpu/command_buffer/client/gles2_implementation_gen.h b/gpu/command_buffer/client/gles2_implementation_gen.h
deleted file mode 100644
index a6b4ebd..0000000
--- a/gpu/command_buffer/client/gles2_implementation_gen.h
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// This file is auto-generated. DO NOT EDIT!
-
-// A class to emluate GLES2 over command buffers.
-#ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_GEN_H_
-#define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_GEN_H_
-
-#include "gpu/command_buffer/client/gles2_implementation.h"
-namespace gpu {
-namespace gles2 {
-
-GLenum GLES2Implementation::CheckFramebufferStatus(GLenum target) {
- return 0;
-}
-
-void GLES2Implementation::GetActiveAttrib(
- GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size,
- GLenum* type, char* name) {
-}
-
-void GLES2Implementation::GetActiveUniform(
- GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size,
- GLenum* type, char* name) {
-}
-
-void GLES2Implementation::GetAttachedShaders(
- GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) {
-}
-
-void GLES2Implementation::GetProgramInfoLog(
- GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) {
-}
-
-void GLES2Implementation::GetShaderInfoLog(
- GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) {
-}
-
-void GLES2Implementation::GetShaderPrecisionFormat(
- GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) {
-}
-
-void GLES2Implementation::GetShaderSource(
- GLuint shader, GLsizei bufsize, GLsizei* length, char* source) {
-}
-
-const GLubyte* GLES2Implementation::GetString(GLenum name) {
- return 0;
-}
-
-void GLES2Implementation::GetUniformfv(
- GLuint program, GLint location, GLfloat* params) {
-}
-
-void GLES2Implementation::GetUniformiv(
- GLuint program, GLint location, GLint* params) {
-}
-
-void GLES2Implementation::GetVertexAttribPointerv(
- GLuint index, GLenum pname, void** pointer) {
-}
-
-void GLES2Implementation::ReadPixels(
- GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
- void* pixels) {
-}
-
-
-} // namespace gles2
-} // namespace gpu
-
-#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_GEN_H_
-
diff --git a/gpu/command_buffer/common/gles2_cmd_format.h b/gpu/command_buffer/common/gles2_cmd_format.h
index 931b709..7598318 100644
--- a/gpu/command_buffer/common/gles2_cmd_format.h
+++ b/gpu/command_buffer/common/gles2_cmd_format.h
@@ -32,6 +32,18 @@ namespace gles2 {
#pragma pack(push, 1)
+// Used for some glGetXXX commands that return a result through a pointer. We
+// need to know if the command succeeded or not and the size of the result. If
+// the command failed its result size will 0.
+struct SizedResult {
+ template <typename T>
+ T GetDataAs() {
+ return static_cast<T>(static_cast<void*>(&data));
+ }
+ uint32 size; // in bytes.
+ int32 data; // this is just here to get an offset.
+};
+
#include "gpu/command_buffer/common/gles2_cmd_format_autogen.h"
// These are hand written commands.
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 6be74ea..90cde84 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -413,6 +413,10 @@ class GLES2DecoderImpl : public GLES2Decoder {
return buffer_;
}
+ GLsizei offset() const {
+ return offset_;
+ }
+
void Clear() {
buffer_ = 0;
SetBufferSize(0);
@@ -1726,7 +1730,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexImage2D(
}
// TODO(gman): Validate internal_format
if (!ValidateGLenumTextureTarget(target)) {
- SetGLError(GL_INVALID_VALUE);
+ SetGLError(GL_INVALID_ENUM);
return parse_error::kParseNoError;
}
scoped_array<int8> zero;
@@ -1756,7 +1760,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexImage2DImmediate(
}
// TODO(gman): Validate internal_format
if (!ValidateGLenumTextureTarget(target)) {
- SetGLError(GL_INVALID_VALUE);
+ SetGLError(GL_INVALID_ENUM);
return parse_error::kParseNoError;
}
glCompressedTexImage2D(
@@ -1790,7 +1794,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexImage2D(
!ValidateGLenumTextureFormat(internal_format) ||
!ValidateGLenumTextureFormat(format) ||
!ValidateGLenumPixelType(type)) {
- SetGLError(GL_INVALID_VALUE);
+ SetGLError(GL_INVALID_ENUM);
return parse_error::kParseNoError;
}
scoped_array<int8> zero;
@@ -1826,7 +1830,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexImage2DImmediate(
!ValidateGLenumTextureFormat(internal_format) ||
!ValidateGLenumTextureFormat(format) ||
!ValidateGLenumPixelType(type)) {
- SetGLError(GL_INVALID_VALUE);
+ SetGLError(GL_INVALID_ENUM);
return parse_error::kParseNoError;
}
glTexImage2D(
@@ -1837,43 +1841,66 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexImage2DImmediate(
parse_error::ParseError GLES2DecoderImpl::HandleGetVertexAttribPointerv(
uint32 immediate_data_size, const gles2::GetVertexAttribPointerv& c) {
- // TODO(gman): Implement.
+ GLuint index = static_cast<GLuint>(c.index);
+ GLenum pname = static_cast<GLenum>(c.pname);
+ SizedResult* result = GetSharedMemoryAs<SizedResult*>(
+ c.pointer_shm_id, c.pointer_shm_offset, sizeof(SizedResult));
+ if (!result) {
+ return parse_error::kParseOutOfBounds;
+ }
+ result->size = 0;
+ if (!ValidateGLenumVertexPointer(pname)) {
+ SetGLError(GL_INVALID_ENUM);
+ return parse_error::kParseNoError;
+ }
+ if (index >= max_vertex_attribs_) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ result->size = sizeof(GLuint);
+ *result->GetDataAs<GLuint*>() = vertex_attrib_infos_[index].offset();
return parse_error::kParseNoError;
}
parse_error::ParseError GLES2DecoderImpl::HandleGetUniformiv(
uint32 immediate_data_size, const gles2::GetUniformiv& c) {
// TODO(gman): Implement.
+ NOTREACHED();
return parse_error::kParseNoError;
}
parse_error::ParseError GLES2DecoderImpl::HandleGetUniformfv(
uint32 immediate_data_size, const gles2::GetUniformfv& c) {
// TODO(gman): Implement.
+ NOTREACHED();
return parse_error::kParseNoError;
}
parse_error::ParseError GLES2DecoderImpl::HandleGetShaderPrecisionFormat(
uint32 immediate_data_size, const gles2::GetShaderPrecisionFormat& c) {
// TODO(gman): Implement.
+ NOTREACHED();
return parse_error::kParseNoError;
}
parse_error::ParseError GLES2DecoderImpl::HandleGetAttachedShaders(
uint32 immediate_data_size, const gles2::GetAttachedShaders& c) {
// TODO(gman): Implement.
+ NOTREACHED();
return parse_error::kParseNoError;
}
parse_error::ParseError GLES2DecoderImpl::HandleGetActiveUniform(
uint32 immediate_data_size, const gles2::GetActiveUniform& c) {
// TODO(gman): Implement.
+ NOTREACHED();
return parse_error::kParseNoError;
}
parse_error::ParseError GLES2DecoderImpl::HandleGetActiveAttrib(
uint32 immediate_data_size, const gles2::GetActiveAttrib& c) {
// TODO(gman): Implement.
+ NOTREACHED();
return parse_error::kParseNoError;
}
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
index c7fd244..2aace97f 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
@@ -50,6 +50,7 @@ class GLES2DecoderTest : public testing::Test {
static const uint32 kSharedMemoryOffset = 132;
static const int32 kInvalidSharedMemoryId = 402;
static const uint32 kInvalidSharedMemoryOffset = kSharedBufferSize + 1;
+ static const uint32 kInitialResult = 0xDEADBEEFu;
static const uint32 kNewClientId = 501;
static const uint32 kNewServiceId = 502;
@@ -144,6 +145,11 @@ class GLES2DecoderTest : public testing::Test {
}
EXPECT_EQ(GL_NO_ERROR, GetGLError());
+
+ result_ = GetSharedMemoryAs<SizedResult*>();
+ GLuint* result_value = result_->GetDataAs<GLuint*>();
+ result_->size = kInitialResult;
+ *result_value = kInitialResult;
}
virtual void TearDown() {
@@ -203,6 +209,7 @@ class GLES2DecoderTest : public testing::Test {
uint32 shared_memory_id_;
uint32 shared_memory_offset_;
void* shared_memory_address_;
+ SizedResult* result_;
int8 immediate_buffer_[256];
@@ -695,6 +702,61 @@ TEST_F(GLES2DecoderWithShaderTest, DrawElementsOutOfRangeIndicesFails) {
}
#endif
+TEST_F(GLES2DecoderWithShaderTest, GetVertexAttribPointervSucceeds) {
+ const float dummy = 0;
+ const GLuint kOffsetToTestFor = sizeof(dummy) * 4;
+ const GLuint kIndexToTest = 1;
+ const GLuint* result_value = result_->GetDataAs<const GLuint*>();
+ // Test that initial value is 0.
+ GetVertexAttribPointerv cmd;
+ cmd.Init(kIndexToTest, GL_VERTEX_ATTRIB_ARRAY_POINTER,
+ shared_memory_id_, shared_memory_offset_);
+ EXPECT_EQ(parse_error::kParseNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(sizeof(*result_value), result_->size);
+ EXPECT_EQ(0u, *result_value);
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+
+ // Set the value and see that we get it.
+ SetupVertexBuffer();
+ DoVertexAttribPointer(kIndexToTest, 2, GL_FLOAT, 0, kOffsetToTestFor);
+ EXPECT_EQ(parse_error::kParseNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(sizeof(*result_value), result_->size);
+ EXPECT_EQ(kOffsetToTestFor, *result_value);
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+}
+
+TEST_F(GLES2DecoderWithShaderTest, GetVertexAttribPointervBadArgsFails) {
+ const GLuint kIndexToTest = 1;
+ const GLuint* result_value = result_->GetDataAs<const GLuint*>();
+ // Test pname invalid fails.
+ GetVertexAttribPointerv cmd;
+ cmd.Init(kIndexToTest, GL_VERTEX_ATTRIB_ARRAY_POINTER + 1,
+ shared_memory_id_, shared_memory_offset_);
+ EXPECT_EQ(parse_error::kParseNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(0u, result_->size);
+ EXPECT_EQ(kInitialResult, *result_value);
+ EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
+
+ // Test index out of range fails.
+ cmd.Init(kNumVertexAttribs, GL_VERTEX_ATTRIB_ARRAY_POINTER,
+ shared_memory_id_, shared_memory_offset_);
+ EXPECT_EQ(parse_error::kParseNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(0u, result_->size);
+ EXPECT_EQ(kInitialResult, *result_value);
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+
+ // Test memory id bad fails.
+ cmd.Init(kIndexToTest, GL_VERTEX_ATTRIB_ARRAY_POINTER,
+ kInvalidSharedMemoryId, shared_memory_offset_);
+ EXPECT_NE(parse_error::kParseNoError, ExecuteCmd(cmd));
+
+ // Test memory offset bad fails.
+ cmd.Init(kIndexToTest, GL_VERTEX_ATTRIB_ARRAY_POINTER,
+ shared_memory_id_, kInvalidSharedMemoryOffset);
+ EXPECT_NE(parse_error::kParseNoError, ExecuteCmd(cmd));
+}
+
+
#include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_autogen.h"
} // namespace gles2
diff --git a/gpu/gpu.gyp b/gpu/gpu.gyp
index dd98c60..c20338e 100644
--- a/gpu/gpu.gyp
+++ b/gpu/gpu.gyp
@@ -141,7 +141,6 @@
'sources': [
'command_buffer/client/gles2_implementation_autogen.h',
'command_buffer/client/gles2_implementation.cc',
- 'command_buffer/client/gles2_implementation_gen.h',
'command_buffer/client/gles2_implementation.h',
],
},