Commit 2208da11 authored by dcastagna's avatar dcastagna Committed by Commit bot

gpu: Benchmark GL_RED instead of GL_LUMINANCE on OpenGL ES3.

This patch tests GL_LUMINANCE only when OpenGL is not ES3
and tests GL_RED when on OpengGL ES3.

This change should allow crrev.com/1022603002 to run on Android perf
bots. Without this patch crrev.com/1022603002 fails on perf bots because
glTextureStorage2D doesn't always accept GL_LUMINANCE8 as
internalformat.

glTextureStorage2D has been added to OpenGL ES3 and it's available
as an extension (GL_{EXT,ARB}_texture_storage) prior to that.
If glTextureStorage2D is availabe via the extension it accepts
GL_LUMINANCE8_EXT as internal format, otherwise it doesn't.

BUG=468748

Review URL: https://codereview.chromium.org/1022923002

Cr-Commit-Position: refs/heads/master@{#321462}
parent 5f32298d
...@@ -20,14 +20,15 @@ ...@@ -20,14 +20,15 @@
#include "ui/gl/gl_context.h" #include "ui/gl/gl_context.h"
#include "ui/gl/gl_enums.h" #include "ui/gl/gl_enums.h"
#include "ui/gl/gl_surface.h" #include "ui/gl/gl_surface.h"
#include "ui/gl/gl_version_info.h"
#include "ui/gl/gpu_timing.h" #include "ui/gl/gpu_timing.h"
#include "ui/gl/scoped_make_current.h" #include "ui/gl/scoped_make_current.h"
namespace gpu { namespace gpu {
namespace { namespace {
const int kUploadPerfWarmupRuns = 10; const int kUploadPerfWarmupRuns = 5;
const int kUploadPerfTestRuns = 100; const int kUploadPerfTestRuns = 30;
#define SHADER(Src) #Src #define SHADER(Src) #Src
...@@ -126,7 +127,7 @@ bool CompareBufferToRGBABuffer(GLenum format, ...@@ -126,7 +127,7 @@ bool CompareBufferToRGBABuffer(GLenum format,
case GL_LUMINANCE: // (L_t, L_t, L_t, 1) case GL_LUMINANCE: // (L_t, L_t, L_t, 1)
expected[1] = pixels[pixels_index]; expected[1] = pixels[pixels_index];
expected[2] = pixels[pixels_index]; expected[2] = pixels[pixels_index];
case GL_RED_EXT: // (R_t, 0, 0, 1)n case GL_RED: // (R_t, 0, 0, 1)
expected[0] = pixels[pixels_index]; expected[0] = pixels[pixels_index];
expected[3] = 255; expected[3] = 255;
break; break;
...@@ -386,17 +387,21 @@ TEST_F(TextureUploadPerfTest, glTexImage2d) { ...@@ -386,17 +387,21 @@ TEST_F(TextureUploadPerfTest, glTexImage2d) {
int sizes[] = {21, 128, 256, 512, 1024}; int sizes[] = {21, 128, 256, 512, 1024};
std::vector<GLenum> formats; std::vector<GLenum> formats;
formats.push_back(GL_RGBA); formats.push_back(GL_RGBA);
// Used by default for ResourceProvider::yuv_resource_format_.
formats.push_back(GL_LUMINANCE); if (!gl_context_->GetVersionInfo()->is_es3) {
// Used by default for ResourceProvider::yuv_resource_format_.
formats.push_back(GL_LUMINANCE);
}
ui::ScopedMakeCurrent smc(gl_context_.get(), surface_.get()); ui::ScopedMakeCurrent smc(gl_context_.get(), surface_.get());
bool has_texture_rg = gl_context_->HasExtension("GL_EXT_texture_rg") || const bool has_texture_rg = gl_context_->GetVersionInfo()->is_es3 ||
gl_context_->HasExtension("GL_ARB_texture_rg"); gl_context_->HasExtension("GL_EXT_texture_rg") ||
gl_context_->HasExtension("GL_ARB_texture_rg");
if (has_texture_rg) { if (has_texture_rg) {
// Used as ResourceProvider::yuv_resource_format_ if // Used as ResourceProvider::yuv_resource_format_ if
// {ARB,EXT}_texture_rg are available. // {ARB,EXT}_texture_rg are available.
formats.push_back(GL_RED_EXT); formats.push_back(GL_RED);
} }
for (int side : sizes) { for (int side : sizes) {
ASSERT_GE(fbo_size_.width(), side); ASSERT_GE(fbo_size_.width(), side);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment