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_texture_storage_unittest.cc

Issue 2945673002: Allow creating GLImage-backed textures with glTexStorage2D. (Closed)
Patch Set: rebase Created 3 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/texture_manager.cc ('k') | gpu/command_buffer/tests/texture_image_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/tests/gl_texture_storage_unittest.cc
diff --git a/gpu/command_buffer/tests/gl_texture_storage_unittest.cc b/gpu/command_buffer/tests/gl_texture_storage_unittest.cc
index 703baff645921577e2e04910720702872a09c74e..df6b75cfd74739d29b97848dd931597ad581edc3 100644
--- a/gpu/command_buffer/tests/gl_texture_storage_unittest.cc
+++ b/gpu/command_buffer/tests/gl_texture_storage_unittest.cc
@@ -6,8 +6,10 @@
#include <GLES2/gl2ext.h>
#include <stdint.h>
+#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/tests/gl_manager.h"
#include "gpu/command_buffer/tests/gl_test_utils.h"
+#include "gpu/command_buffer/tests/texture_image_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -18,7 +20,9 @@ class TextureStorageTest : public testing::Test {
static const GLsizei kResolution = 64;
void SetUp() override {
GLManager::Options options;
+ image_factory_.SetRequiredTextureType(GL_TEXTURE_2D);
options.size = gfx::Size(kResolution, kResolution);
+ options.image_factory = &image_factory_;
gl_.Initialize(options);
gl_.MakeCurrent();
@@ -40,6 +44,7 @@ class TextureStorageTest : public testing::Test {
void TearDown() override { gl_.Destroy(); }
+ TextureImageFactory image_factory_;
GLManager gl_;
GLuint tex_;
GLuint fbo_;
@@ -161,6 +166,24 @@ TEST_F(TextureStorageTest, InternalFormatBleedingToTexImage) {
EXPECT_EQ(static_cast<GLenum>(GL_INVALID_VALUE), glGetError());
}
+TEST_F(TextureStorageTest, CorrectImagePixels) {
+ if (!extension_available_)
+ return;
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BUFFER_USAGE_CHROMIUM,
+ GL_TEXTURE_BUFFER_SCANOUT_CHROMIUM);
+
+ glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8_OES, 2, 2);
+
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
+ tex_, 0);
+
+ uint8_t source_pixels[16] = {1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4};
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 2, 2, GL_RGBA, GL_UNSIGNED_BYTE,
+ source_pixels);
+ EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 2, 2, 0, source_pixels, nullptr));
+}
+
} // namespace gpu
« no previous file with comments | « gpu/command_buffer/service/texture_manager.cc ('k') | gpu/command_buffer/tests/texture_image_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698