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

Unified Diff: gpu/perftests/texture_upload_perftest.cc

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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/perftests/measurements.cc ('k') | mojo/converters/surfaces/surfaces_type_converters.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/perftests/texture_upload_perftest.cc
diff --git a/gpu/perftests/texture_upload_perftest.cc b/gpu/perftests/texture_upload_perftest.cc
index 2e9ef6cea4346d217eeae515b89db88f9e0cf40f..f691c9e76d91f1b744f2609309ba91266e15f8b2 100644
--- a/gpu/perftests/texture_upload_perftest.cc
+++ b/gpu/perftests/texture_upload_perftest.cc
@@ -6,10 +6,8 @@
#include <vector>
#include "base/containers/small_map.h"
-#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
-#include "gpu/command_buffer/service/gpu_timing.h"
#include "gpu/perftests/measurements.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/size.h"
@@ -33,7 +31,7 @@ SHADER(
varying vec2 v_texCoord;
void main() {
gl_Position = vec4(a_position.x, a_position.y, 0.0, 1.0);
- v_texCoord = vec2((a_position.x + 1.0) * 0.5, (a_position.y + 1.0) * 0.5);
+ v_texCoord = vec2((a_position.x + 1) * 0.5, (a_position.y + 1) * 0.5);
}
);
const char kFragmentShader[] =
@@ -98,30 +96,12 @@ class TextureUploadPerfTest : public testing::Test {
void SetUp() override {
// Initialize an offscreen surface and a gl context.
gfx::GLSurface::InitializeOneOff();
- surface_ = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(4, 4));
+ surface_ = gfx::GLSurface::CreateOffscreenGLSurface(size_);
gl_context_ = gfx::GLContext::CreateGLContext(NULL, // share_group
surface_.get(),
gfx::PreferIntegratedGpu);
- ui::ScopedMakeCurrent smc(gl_context_.get(), surface_.get());
- glGenTextures(1, &color_texture_);
- glBindTexture(GL_TEXTURE_2D, color_texture_);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size_.width(), size_.height(), 0,
- GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
-
- glGenFramebuffersEXT(1, &framebuffer_object_);
- glBindFramebufferEXT(GL_FRAMEBUFFER, framebuffer_object_);
-
- glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- GL_TEXTURE_2D, color_texture_, 0);
- DCHECK_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE),
- glCheckFramebufferStatusEXT(GL_FRAMEBUFFER));
-
- glViewport(0, 0, size_.width(), size_.height());
+ ui::ScopedMakeCurrent smc(gl_context_.get(), surface_.get());
if (gpu_timing_.Initialize(gl_context_.get())) {
LOG(INFO) << "Gpu timing initialized with timer type: "
<< gpu_timing_.GetTimerTypeName();
@@ -130,6 +110,7 @@ class TextureUploadPerfTest : public testing::Test {
} else {
LOG(WARNING) << "Can't initialize gpu timing";
}
+
// Prepare a simple program and a vertex buffer that will be
// used to draw a quad on the offscreen surface.
vertex_shader_ = LoadShader(GL_VERTEX_SHADER, kVertexShader);
@@ -161,14 +142,18 @@ class TextureUploadPerfTest : public testing::Test {
void TearDown() override {
ui::ScopedMakeCurrent smc(gl_context_.get(), surface_.get());
- glDeleteProgram(program_object_);
- glDeleteShader(vertex_shader_);
- glDeleteShader(fragment_shader_);
- glDeleteShader(vertex_buffer_);
-
- glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
- glDeleteFramebuffersEXT(1, &framebuffer_object_);
- glDeleteTextures(1, &color_texture_);
+ if (program_object_ != 0) {
+ glDeleteProgram(program_object_);
+ }
+ if (vertex_shader_ != 0) {
+ glDeleteShader(vertex_shader_);
+ }
+ if (fragment_shader_ != 0) {
+ glDeleteShader(fragment_shader_);
+ }
+ if (vertex_buffer_ != 0) {
+ glDeleteShader(vertex_buffer_);
+ }
gl_context_ = nullptr;
surface_ = nullptr;
@@ -182,8 +167,6 @@ class TextureUploadPerfTest : public testing::Test {
const GLenum format,
const GLenum type) {
ui::ScopedMakeCurrent smc(gl_context_.get(), surface_.get());
- DCHECK_NE(0u, framebuffer_object_);
- glBindFramebufferEXT(GL_FRAMEBUFFER, framebuffer_object_);
MeasurementTimers total_timers(&gpu_timing_);
GLuint texture_id = 0;
@@ -195,8 +178,8 @@ class TextureUploadPerfTest : public testing::Test {
glTexImage2D(GL_TEXTURE_2D, 0, format, size_.width(), size_.height(), 0,
format, type, &pixels[0]);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
CheckNoGlError();
@@ -239,13 +222,11 @@ class TextureUploadPerfTest : public testing::Test {
return measurements;
}
- const gfx::Size size_; // for the fbo and the texture
+ const gfx::Size size_; // for the offscreen surface and the texture
scoped_refptr<gfx::GLContext> gl_context_;
scoped_refptr<gfx::GLSurface> surface_;
GPUTiming gpu_timing_;
- GLuint color_texture_ = 0;
- GLuint framebuffer_object_ = 0;
GLuint vertex_shader_ = 0;
GLuint fragment_shader_ = 0;
GLuint program_object_ = 0;
« no previous file with comments | « gpu/perftests/measurements.cc ('k') | mojo/converters/surfaces/surfaces_type_converters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698