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

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

Issue 1269503007: Unify graphics buffer format & usage enums for GpuMemoryBuffer & SurfaceFactoryOzone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add header to BUILD.gn Created 5 years, 4 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/service/in_process_command_buffer.cc ('k') | gpu/command_buffer/tests/gl_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc
diff --git a/gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc b/gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc
index 2184feb55512cd6986fa6b04706215c30bf7fa3a..d544d10c90ca4c8f338933b9359510420242ab3b 100644
--- a/gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc
+++ b/gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc
@@ -34,8 +34,7 @@ namespace gles2 {
static const int kImageWidth = 32;
static const int kImageHeight = 32;
-class GpuMemoryBufferTest
- : public testing::TestWithParam<gfx::GpuMemoryBuffer::Format> {
+class GpuMemoryBufferTest : public testing::TestWithParam<gfx::BufferFormat> {
protected:
void SetUp() override {
GLManager::Options options;
@@ -77,22 +76,22 @@ SHADER(
);
// clang-format on
-void SetRow(gfx::GpuMemoryBuffer::Format format,
+void SetRow(gfx::BufferFormat format,
uint8_t* buffer,
int width,
uint8_t pixel[4]) {
switch (format) {
- case gfx::GpuMemoryBuffer::R_8:
+ case gfx::BufferFormat::R_8:
for (int i = 0; i < width; ++i)
buffer[i] = pixel[0];
return;
- case gfx::GpuMemoryBuffer::RGBA_4444:
+ case gfx::BufferFormat::RGBA_4444:
for (int i = 0; i < width * 2; i += 2) {
buffer[i + 0] = (pixel[1] << 4) | (pixel[0] & 0xf);
buffer[i + 1] = (pixel[3] << 4) | (pixel[2] & 0xf);
}
return;
- case gfx::GpuMemoryBuffer::RGBA_8888:
+ case gfx::BufferFormat::RGBA_8888:
for (int i = 0; i < width * 4; i += 4) {
buffer[i + 0] = pixel[0];
buffer[i + 1] = pixel[1];
@@ -100,7 +99,7 @@ void SetRow(gfx::GpuMemoryBuffer::Format format,
buffer[i + 3] = pixel[3];
}
return;
- case gfx::GpuMemoryBuffer::BGRA_8888:
+ case gfx::BufferFormat::BGRA_8888:
for (int i = 0; i < width * 4; i += 4) {
buffer[i + 0] = pixel[2];
buffer[i + 1] = pixel[1];
@@ -108,13 +107,13 @@ void SetRow(gfx::GpuMemoryBuffer::Format format,
buffer[i + 3] = pixel[3];
}
return;
- case gfx::GpuMemoryBuffer::ATC:
- case gfx::GpuMemoryBuffer::ATCIA:
- case gfx::GpuMemoryBuffer::DXT1:
- case gfx::GpuMemoryBuffer::DXT5:
- case gfx::GpuMemoryBuffer::ETC1:
- case gfx::GpuMemoryBuffer::RGBX_8888:
- case gfx::GpuMemoryBuffer::YUV_420:
+ case gfx::BufferFormat::ATC:
+ case gfx::BufferFormat::ATCIA:
+ case gfx::BufferFormat::DXT1:
+ case gfx::BufferFormat::DXT5:
+ case gfx::BufferFormat::ETC1:
+ case gfx::BufferFormat::RGBX_8888:
+ case gfx::BufferFormat::YUV_420:
NOTREACHED();
return;
}
@@ -122,22 +121,22 @@ void SetRow(gfx::GpuMemoryBuffer::Format format,
NOTREACHED();
}
-GLenum InternalFormat(gfx::GpuMemoryBuffer::Format format) {
+GLenum InternalFormat(gfx::BufferFormat format) {
switch (format) {
- case gfx::GpuMemoryBuffer::R_8:
+ case gfx::BufferFormat::R_8:
return GL_R8;
- case gfx::GpuMemoryBuffer::RGBA_4444:
- case gfx::GpuMemoryBuffer::RGBA_8888:
+ case gfx::BufferFormat::RGBA_4444:
+ case gfx::BufferFormat::RGBA_8888:
return GL_RGBA;
- case gfx::GpuMemoryBuffer::BGRA_8888:
+ case gfx::BufferFormat::BGRA_8888:
return GL_BGRA_EXT;
- case gfx::GpuMemoryBuffer::ATC:
- case gfx::GpuMemoryBuffer::ATCIA:
- case gfx::GpuMemoryBuffer::DXT1:
- case gfx::GpuMemoryBuffer::DXT5:
- case gfx::GpuMemoryBuffer::ETC1:
- case gfx::GpuMemoryBuffer::RGBX_8888:
- case gfx::GpuMemoryBuffer::YUV_420:
+ case gfx::BufferFormat::ATC:
+ case gfx::BufferFormat::ATCIA:
+ case gfx::BufferFormat::DXT1:
+ case gfx::BufferFormat::DXT5:
+ case gfx::BufferFormat::ETC1:
+ case gfx::BufferFormat::RGBX_8888:
+ case gfx::BufferFormat::YUV_420:
NOTREACHED();
return 0;
}
@@ -150,7 +149,7 @@ GLenum InternalFormat(gfx::GpuMemoryBuffer::Format format) {
// An end to end test that tests the whole GpuMemoryBuffer lifecycle.
TEST_P(GpuMemoryBufferTest, Lifecycle) {
- ASSERT_TRUE((GetParam() != gfx::GpuMemoryBuffer::R_8) ||
+ ASSERT_TRUE((GetParam() != gfx::BufferFormat::R_8) ||
gl_.GetCapabilities().texture_rg);
GLuint texture_id = 0;
@@ -234,10 +233,10 @@ TEST_P(GpuMemoryBufferTest, Lifecycle) {
INSTANTIATE_TEST_CASE_P(GpuMemoryBufferTests,
GpuMemoryBufferTest,
- ::testing::Values(gfx::GpuMemoryBuffer::R_8,
- gfx::GpuMemoryBuffer::RGBA_4444,
- gfx::GpuMemoryBuffer::RGBA_8888,
- gfx::GpuMemoryBuffer::BGRA_8888));
+ ::testing::Values(gfx::BufferFormat::R_8,
+ gfx::BufferFormat::RGBA_4444,
+ gfx::BufferFormat::RGBA_8888,
+ gfx::BufferFormat::BGRA_8888));
} // namespace gles2
} // namespace gpu
« no previous file with comments | « gpu/command_buffer/service/in_process_command_buffer.cc ('k') | gpu/command_buffer/tests/gl_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698