| Index: client/deps/glbench/src/fillratetest.cc
|
| diff --git a/client/deps/glbench/src/fillratetest.cc b/client/deps/glbench/src/fillratetest.cc
|
| index 426a3a4e45b38e3c16bdc832868047dcdb1a15f8..e31eec2d2c6eb0bbd0d5d448cb4274ed06c8adfc 100644
|
| --- a/client/deps/glbench/src/fillratetest.cc
|
| +++ b/client/deps/glbench/src/fillratetest.cc
|
| @@ -21,6 +21,41 @@ class FillRateTest : public DrawArraysTestFunc {
|
| DISALLOW_COPY_AND_ASSIGN(FillRateTest);
|
| };
|
|
|
| +#if defined(I915_WORKAROUND)
|
| +#define V1 "gl_TexCoord[0]"
|
| +#else
|
| +#define V1 "v1"
|
| +#endif
|
| +
|
| +const char* kVertexShader1 =
|
| + "attribute vec4 position;"
|
| + "void main() {"
|
| + " gl_Position = position;"
|
| + "}";
|
| +
|
| +const char* kFragmentShader1 =
|
| + "uniform vec4 color;"
|
| + "void main() {"
|
| + " gl_FragColor = color;"
|
| + "}";
|
| +
|
| +
|
| +const char* kVertexShader2 =
|
| + "attribute vec4 position;"
|
| + "attribute vec4 texcoord;"
|
| + "uniform float scale;"
|
| + "varying vec2 v1;"
|
| + "void main() {"
|
| + " gl_Position = position * vec4(scale, scale, 1., 1.);"
|
| + " " V1 " = texcoord;"
|
| + "}";
|
| +
|
| +const char* kFragmentShader2 =
|
| + "uniform sampler2D texture;"
|
| + "varying vec2 v1;"
|
| + "void main() {"
|
| + " gl_FragColor = texture2D(texture, " V1 ".xy);"
|
| + "}";
|
|
|
| bool FillRateTest::Run() {
|
| glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
| @@ -39,25 +74,43 @@ bool FillRateTest::Run() {
|
| 0.f, 1.f,
|
| 1.f, 1.f,
|
| };
|
| - glEnableClientState(GL_VERTEX_ARRAY);
|
|
|
| GLuint vbo_vertex = SetupVBO(GL_ARRAY_BUFFER,
|
| sizeof(buffer_vertex), buffer_vertex);
|
| - glVertexPointer(2, GL_FLOAT, 0, 0);
|
| + GLuint program = InitShaderProgram(kVertexShader1, kFragmentShader1);
|
| + GLint position_attribute = glGetAttribLocation(program, "position");
|
| + glVertexAttribPointer(position_attribute, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
| + glEnableVertexAttribArray(position_attribute);
|
|
|
| - GLuint vbo_texture = SetupVBO(GL_ARRAY_BUFFER,
|
| - sizeof(buffer_texture), buffer_texture);
|
| - glTexCoordPointer(2, GL_FLOAT, 0, 0);
|
| + GLint color_uniform = glGetUniformLocation(program, "color");
|
| + const GLfloat red[4] = {1.f, 0.f, 0.f, 1.f};
|
| + glUniform4fv(color_uniform, 1, red);
|
|
|
| - glColor4f(1.f, 0.f, 0.f, 1.f);
|
| FillRateTestNormal("fill_solid");
|
| FillRateTestBlendDepth("fill_solid");
|
|
|
| - glColor4f(1.f, 1.f, 1.f, 1.f);
|
| - glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
| - glEnable(GL_TEXTURE_2D);
|
| + glDeleteProgram(program);
|
| +
|
| + program = InitShaderProgram(kVertexShader2, kFragmentShader2);
|
| + position_attribute = glGetAttribLocation(program, "position");
|
| + // Reusing vbo_vertex buffer from the previous test.
|
| + glVertexAttribPointer(position_attribute, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
| + glEnableVertexAttribArray(position_attribute);
|
| +
|
| + GLuint vbo_texture = SetupVBO(GL_ARRAY_BUFFER,
|
| + sizeof(buffer_texture), buffer_texture);
|
| + GLuint texcoord_attribute = glGetAttribLocation(program, "texcoord");
|
| + glVertexAttribPointer(texcoord_attribute, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
| + glEnableVertexAttribArray(texcoord_attribute);
|
|
|
| GLuint texture = SetupTexture(9);
|
| +
|
| + GLuint texture_uniform = glGetUniformLocation(program, "texture");
|
| + glUniform1i(texture_uniform, 0);
|
| +
|
| + GLuint scale_uinform = glGetUniformLocation(program, "scale");
|
| + glUniform1f(scale_uinform, 1.f);
|
| +
|
| FillRateTestNormal("fill_tex_nearest");
|
|
|
| glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
| @@ -65,7 +118,7 @@ bool FillRateTest::Run() {
|
| FillRateTestNormal("fill_tex_bilinear");
|
|
|
| // lod = 0.5
|
| - glScalef(0.7071f, 0.7071f, 1.f);
|
| + glUniform1f(scale_uinform, 0.7071f);
|
| glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
| GL_LINEAR_MIPMAP_NEAREST);
|
| FillRateTestNormalSubWindow("fill_tex_trilinear_nearest_05",
|
| @@ -77,21 +130,20 @@ bool FillRateTest::Run() {
|
| 0.7071f * g_width, 0.7071f * g_height);
|
|
|
| // lod = 0.4
|
| - glLoadIdentity();
|
| - glScalef(0.758f, 0.758f, 1.f);
|
| + glUniform1f(scale_uinform, 0.758f);
|
| glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
| GL_LINEAR_MIPMAP_LINEAR);
|
| FillRateTestNormalSubWindow("fill_tex_trilinear_linear_04",
|
| 0.758f * g_width, 0.758f * g_height);
|
|
|
| // lod = 0.1
|
| - glLoadIdentity();
|
| - glScalef(0.933f, 0.933f, 1.f);
|
| + glUniform1f(scale_uinform, 0.933f);
|
| glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
| GL_LINEAR_MIPMAP_LINEAR);
|
| FillRateTestNormalSubWindow("fill_tex_trilinear_linear_01",
|
| 0.933f * g_width, 0.933f * g_height);
|
|
|
| + glDeleteProgram(program);
|
| glDeleteBuffers(1, &vbo_vertex);
|
| glDeleteBuffers(1, &vbo_texture);
|
| glDeleteTextures(1, &texture);
|
|
|