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

Unified Diff: gpu/command_buffer/tests/gl_test_utils.cc

Issue 2410343002: [Reland] Add gl tests to make sure when a buffer is unmapped, all access path generates an INVALID_… (Closed)
Patch Set: Skip the test if context creation fails. Created 4 years, 2 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 | « gpu/command_buffer/tests/gl_test_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/tests/gl_test_utils.cc
diff --git a/gpu/command_buffer/tests/gl_test_utils.cc b/gpu/command_buffer/tests/gl_test_utils.cc
index b68320fc59572874f73cc43cf3da68e12f0d83c0..60d073383140a138adc869dc6f017a785e2eb5eb 100644
--- a/gpu/command_buffer/tests/gl_test_utils.cc
+++ b/gpu/command_buffer/tests/gl_test_utils.cc
@@ -161,13 +161,9 @@ GLuint GLTestHelper::SetupUnitQuad(GLint position_location) {
GLuint vbo = 0;
glGenBuffers(1, &vbo);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
- static float vertices[] = {
- 1.0f, 1.0f,
- -1.0f, 1.0f,
- -1.0f, -1.0f,
- 1.0f, 1.0f,
- -1.0f, -1.0f,
- 1.0f, -1.0f,
+ static const float vertices[] = {
+ 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, -1.0f,
+ 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f,
};
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
glEnableVertexAttribArray(position_location);
@@ -176,6 +172,20 @@ GLuint GLTestHelper::SetupUnitQuad(GLint position_location) {
return vbo;
}
+std::vector<GLuint> GLTestHelper::SetupIndexedUnitQuad(
+ GLint position_location) {
+ GLuint array_buffer = SetupUnitQuad(position_location);
+ static const uint8_t indices[] = {0, 1, 2, 3, 4, 5};
+ GLuint index_buffer = 0;
+ glGenBuffers(1, &index_buffer);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_buffer);
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, 6, indices, GL_STATIC_DRAW);
+ std::vector<GLuint> buffers(2);
+ buffers[0] = array_buffer;
+ buffers[1] = index_buffer;
+ return buffers;
+}
+
GLuint GLTestHelper::SetupColorsForUnitQuad(
GLint location, const GLfloat color[4], GLenum usage) {
GLuint vbo = 0;
« no previous file with comments | « gpu/command_buffer/tests/gl_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698