OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Tests for GLES2Implementation. | 5 // Tests for GLES2Implementation. |
6 | 6 |
7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
8 | 8 |
9 #include <GLES2/gl2ext.h> | 9 #include <GLES2/gl2ext.h> |
10 #include "gpu/command_buffer/client/client_test_helper.h" | 10 #include "gpu/command_buffer/client/client_test_helper.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 } | 289 } |
290 | 290 |
291 void MockTransferBuffer::FreePendingToken(void* p, unsigned int /* token */) { | 291 void MockTransferBuffer::FreePendingToken(void* p, unsigned int /* token */) { |
292 EXPECT_EQ(last_alloc_, p); | 292 EXPECT_EQ(last_alloc_, p); |
293 last_alloc_ = NULL; | 293 last_alloc_ = NULL; |
294 } | 294 } |
295 | 295 |
296 class GLES2ImplementationTest : public testing::Test { | 296 class GLES2ImplementationTest : public testing::Test { |
297 protected: | 297 protected: |
298 static const uint8 kInitialValue = 0xBD; | 298 static const uint8 kInitialValue = 0xBD; |
299 static const int32 kNumCommandEntries = 400; | 299 static const int32 kNumCommandEntries = 500; |
300 static const int32 kCommandBufferSizeBytes = | 300 static const int32 kCommandBufferSizeBytes = |
301 kNumCommandEntries * sizeof(CommandBufferEntry); | 301 kNumCommandEntries * sizeof(CommandBufferEntry); |
302 static const size_t kTransferBufferSize = 256; | 302 static const size_t kTransferBufferSize = 256; |
303 | 303 |
304 static const GLint kMaxCombinedTextureImageUnits = 8; | 304 static const GLint kMaxCombinedTextureImageUnits = 8; |
305 static const GLint kMaxCubeMapTextureSize = 64; | 305 static const GLint kMaxCubeMapTextureSize = 64; |
306 static const GLint kMaxFragmentUniformVectors = 16; | 306 static const GLint kMaxFragmentUniformVectors = 16; |
307 static const GLint kMaxRenderbufferSize = 64; | 307 static const GLint kMaxRenderbufferSize = 64; |
308 static const GLint kMaxTextureImageUnits = 8; | 308 static const GLint kMaxTextureImageUnits = 8; |
309 static const GLint kMaxTextureSize = 128; | 309 static const GLint kMaxTextureSize = 128; |
(...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1903 expected.set_token.Init(GetNextToken()); | 1903 expected.set_token.Init(GetNextToken()); |
1904 gl_->TexImage2D( | 1904 gl_->TexImage2D( |
1905 kTarget, kLevel, kFormat, kWidth, kHeight, kBorder, kFormat, kType, | 1905 kTarget, kLevel, kFormat, kWidth, kHeight, kBorder, kFormat, kType, |
1906 pixels); | 1906 pixels); |
1907 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1907 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1908 EXPECT_TRUE(CheckRect( | 1908 EXPECT_TRUE(CheckRect( |
1909 kWidth, kHeight, kFormat, kType, kPixelStoreUnpackAlignment, false, | 1909 kWidth, kHeight, kFormat, kType, kPixelStoreUnpackAlignment, false, |
1910 pixels, mem1.ptr)); | 1910 pixels, mem1.ptr)); |
1911 | 1911 |
1912 ClearCommands(); | 1912 ClearCommands(); |
| 1913 gl_->PixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE); |
| 1914 |
1913 ExpectedMemoryInfo mem2 = GetExpectedMemory(sizeof(pixels)); | 1915 ExpectedMemoryInfo mem2 = GetExpectedMemory(sizeof(pixels)); |
1914 Cmds2 expected2; | 1916 Cmds2 expected2; |
1915 expected2.tex_image_2d.Init( | 1917 expected2.tex_image_2d.Init( |
1916 kTarget, kLevel, kFormat, kWidth, kHeight, kBorder, kFormat, kType, | 1918 kTarget, kLevel, kFormat, kWidth, kHeight, kBorder, kFormat, kType, |
1917 mem2.id, mem2.offset); | 1919 mem2.id, mem2.offset); |
1918 expected2.set_token.Init(GetNextToken()); | 1920 expected2.set_token.Init(GetNextToken()); |
1919 const void* commands2 = GetPut(); | 1921 const void* commands2 = GetPut(); |
1920 gl_->PixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE); | |
1921 gl_->TexImage2D( | 1922 gl_->TexImage2D( |
1922 kTarget, kLevel, kFormat, kWidth, kHeight, kBorder, kFormat, kType, | 1923 kTarget, kLevel, kFormat, kWidth, kHeight, kBorder, kFormat, kType, |
1923 pixels); | 1924 pixels); |
1924 EXPECT_EQ(0, memcmp(&expected2, commands2, sizeof(expected2))); | 1925 EXPECT_EQ(0, memcmp(&expected2, commands2, sizeof(expected2))); |
1925 EXPECT_TRUE(CheckRect( | 1926 EXPECT_TRUE(CheckRect( |
1926 kWidth, kHeight, kFormat, kType, kPixelStoreUnpackAlignment, true, | 1927 kWidth, kHeight, kFormat, kType, kPixelStoreUnpackAlignment, true, |
1927 pixels, mem2.ptr)); | 1928 pixels, mem2.ptr)); |
1928 } | 1929 } |
1929 | 1930 |
1930 // Test TexImage2D with 2 writes | 1931 // Test TexImage2D with 2 writes |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1990 | 1991 |
1991 gl_->TexImage2D( | 1992 gl_->TexImage2D( |
1992 kTarget, kLevel, kFormat, kWidth, kHeight, kBorder, kFormat, kType, | 1993 kTarget, kLevel, kFormat, kWidth, kHeight, kBorder, kFormat, kType, |
1993 pixels.get()); | 1994 pixels.get()); |
1994 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 1995 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
1995 EXPECT_TRUE(CheckRect( | 1996 EXPECT_TRUE(CheckRect( |
1996 kWidth, kHeight / 2, kFormat, kType, kPixelStoreUnpackAlignment, false, | 1997 kWidth, kHeight / 2, kFormat, kType, kPixelStoreUnpackAlignment, false, |
1997 pixels.get() + kHeight / 2 * padded_row_size, mem2.ptr)); | 1998 pixels.get() + kHeight / 2 * padded_row_size, mem2.ptr)); |
1998 | 1999 |
1999 ClearCommands(); | 2000 ClearCommands(); |
| 2001 gl_->PixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE); |
2000 const void* commands2 = GetPut(); | 2002 const void* commands2 = GetPut(); |
2001 ExpectedMemoryInfo mem3 = GetExpectedMemory(half_size); | 2003 ExpectedMemoryInfo mem3 = GetExpectedMemory(half_size); |
2002 ExpectedMemoryInfo mem4 = GetExpectedMemory(half_size); | 2004 ExpectedMemoryInfo mem4 = GetExpectedMemory(half_size); |
2003 expected.tex_image_2d.Init( | 2005 expected.tex_image_2d.Init( |
2004 kTarget, kLevel, kFormat, kWidth, kHeight, kBorder, kFormat, kType, | 2006 kTarget, kLevel, kFormat, kWidth, kHeight, kBorder, kFormat, kType, |
2005 0, 0); | 2007 0, 0); |
2006 expected.tex_sub_image_2d1.Init( | 2008 expected.tex_sub_image_2d1.Init( |
2007 kTarget, kLevel, 0, kHeight / 2, kWidth, kHeight / 2, kFormat, kType, | 2009 kTarget, kLevel, 0, kHeight / 2, kWidth, kHeight / 2, kFormat, kType, |
2008 mem3.id, mem3.offset, true); | 2010 mem3.id, mem3.offset, true); |
2009 expected.set_token1.Init(GetNextToken()); | 2011 expected.set_token1.Init(GetNextToken()); |
2010 expected.tex_sub_image_2d2.Init( | 2012 expected.tex_sub_image_2d2.Init( |
2011 kTarget, kLevel, 0, 0, kWidth, kHeight / 2, kFormat, kType, | 2013 kTarget, kLevel, 0, 0, kWidth, kHeight / 2, kFormat, kType, |
2012 mem4.id, mem4.offset, true); | 2014 mem4.id, mem4.offset, true); |
2013 expected.set_token2.Init(GetNextToken()); | 2015 expected.set_token2.Init(GetNextToken()); |
2014 | 2016 |
2015 // TODO(gman): Make it possible to run this test | 2017 // TODO(gman): Make it possible to run this test |
2016 // EXPECT_CALL(*command_buffer(), OnFlush()) | 2018 // EXPECT_CALL(*command_buffer(), OnFlush()) |
2017 // .WillOnce(CheckRectAction( | 2019 // .WillOnce(CheckRectAction( |
2018 // kWidth, kHeight / 2, kFormat, kType, kPixelStoreUnpackAlignment, | 2020 // kWidth, kHeight / 2, kFormat, kType, kPixelStoreUnpackAlignment, |
2019 // true, pixels.get(), | 2021 // true, pixels.get(), |
2020 // GetExpectedTransferAddressFromOffsetAs<uint8>(offset3, half_size))) | 2022 // GetExpectedTransferAddressFromOffsetAs<uint8>(offset3, half_size))) |
2021 // .RetiresOnSaturation(); | 2023 // .RetiresOnSaturation(); |
2022 | 2024 |
2023 gl_->PixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE); | |
2024 gl_->TexImage2D( | 2025 gl_->TexImage2D( |
2025 kTarget, kLevel, kFormat, kWidth, kHeight, kBorder, kFormat, kType, | 2026 kTarget, kLevel, kFormat, kWidth, kHeight, kBorder, kFormat, kType, |
2026 pixels.get()); | 2027 pixels.get()); |
2027 EXPECT_EQ(0, memcmp(&expected, commands2, sizeof(expected))); | 2028 EXPECT_EQ(0, memcmp(&expected, commands2, sizeof(expected))); |
2028 EXPECT_TRUE(CheckRect( | 2029 EXPECT_TRUE(CheckRect( |
2029 kWidth, kHeight / 2, kFormat, kType, kPixelStoreUnpackAlignment, true, | 2030 kWidth, kHeight / 2, kFormat, kType, kPixelStoreUnpackAlignment, true, |
2030 pixels.get() + kHeight / 2 * padded_row_size, mem4.ptr)); | 2031 pixels.get() + kHeight / 2 * padded_row_size, mem4.ptr)); |
2031 } | 2032 } |
2032 | 2033 |
2033 // Test TexSubImage2D with GL_PACK_FLIP_Y set and partial multirow transfers | 2034 // Test TexSubImage2D with GL_PACK_FLIP_Y set and partial multirow transfers |
2034 TEST_F(GLES2ImplementationTest, TexSubImage2DFlipY) { | 2035 TEST_F(GLES2ImplementationTest, TexSubImage2DFlipY) { |
2035 const GLsizei kTextureWidth = MaxTransferBufferSize() / 4; | 2036 const GLsizei kTextureWidth = MaxTransferBufferSize() / 4; |
2036 const GLsizei kTextureHeight = 7; | 2037 const GLsizei kTextureHeight = 7; |
2037 const GLsizei kSubImageWidth = MaxTransferBufferSize() / 8; | 2038 const GLsizei kSubImageWidth = MaxTransferBufferSize() / 8; |
2038 const GLsizei kSubImageHeight = 4; | 2039 const GLsizei kSubImageHeight = 4; |
2039 const GLint kSubImageXOffset = 1; | 2040 const GLint kSubImageXOffset = 1; |
2040 const GLint kSubImageYOffset = 2; | 2041 const GLint kSubImageYOffset = 2; |
2041 const GLenum kFormat = GL_RGBA; | 2042 const GLenum kFormat = GL_RGBA; |
2042 const GLenum kType = GL_UNSIGNED_BYTE; | 2043 const GLenum kType = GL_UNSIGNED_BYTE; |
2043 const GLenum kTarget = GL_TEXTURE_2D; | 2044 const GLenum kTarget = GL_TEXTURE_2D; |
2044 const GLint kLevel = 0; | 2045 const GLint kLevel = 0; |
2045 const GLint kBorder = 0; | 2046 const GLint kBorder = 0; |
2046 const GLint kPixelStoreUnpackAlignment = 4; | 2047 const GLint kPixelStoreUnpackAlignment = 4; |
2047 | 2048 |
2048 struct Cmds { | 2049 struct Cmds { |
2049 PixelStorei pixel_store_i1; | 2050 PixelStorei pixel_store_i1; |
2050 TexImage2D tex_image_2d; | 2051 TexImage2D tex_image_2d; |
| 2052 PixelStorei pixel_store_i2; |
2051 TexSubImage2D tex_sub_image_2d1; | 2053 TexSubImage2D tex_sub_image_2d1; |
2052 cmd::SetToken set_token1; | 2054 cmd::SetToken set_token1; |
2053 TexSubImage2D tex_sub_image_2d2; | 2055 TexSubImage2D tex_sub_image_2d2; |
2054 cmd::SetToken set_token2; | 2056 cmd::SetToken set_token2; |
2055 }; | 2057 }; |
2056 | 2058 |
2057 uint32 sub_2_high_size = 0; | 2059 uint32 sub_2_high_size = 0; |
2058 ASSERT_TRUE(GLES2Util::ComputeImageDataSizes( | 2060 ASSERT_TRUE(GLES2Util::ComputeImageDataSizes( |
2059 kSubImageWidth, 2, kFormat, kType, kPixelStoreUnpackAlignment, | 2061 kSubImageWidth, 2, kFormat, kType, kPixelStoreUnpackAlignment, |
2060 &sub_2_high_size, NULL, NULL)); | 2062 &sub_2_high_size, NULL, NULL)); |
2061 | 2063 |
2062 ExpectedMemoryInfo mem1 = GetExpectedMemory(sub_2_high_size); | 2064 ExpectedMemoryInfo mem1 = GetExpectedMemory(sub_2_high_size); |
2063 ExpectedMemoryInfo mem2 = GetExpectedMemory(sub_2_high_size); | 2065 ExpectedMemoryInfo mem2 = GetExpectedMemory(sub_2_high_size); |
2064 | 2066 |
2065 Cmds expected; | 2067 Cmds expected; |
2066 expected.pixel_store_i1.Init(GL_UNPACK_ALIGNMENT, kPixelStoreUnpackAlignment); | 2068 expected.pixel_store_i1.Init(GL_UNPACK_ALIGNMENT, kPixelStoreUnpackAlignment); |
2067 expected.tex_image_2d.Init( | 2069 expected.tex_image_2d.Init( |
2068 kTarget, kLevel, kFormat, kTextureWidth, kTextureHeight, kBorder, kFormat, | 2070 kTarget, kLevel, kFormat, kTextureWidth, kTextureHeight, kBorder, kFormat, |
2069 kType, 0, 0); | 2071 kType, 0, 0); |
| 2072 expected.pixel_store_i2.Init(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE); |
2070 expected.tex_sub_image_2d1.Init(kTarget, kLevel, kSubImageXOffset, | 2073 expected.tex_sub_image_2d1.Init(kTarget, kLevel, kSubImageXOffset, |
2071 kSubImageYOffset + 2, kSubImageWidth, 2, kFormat, kType, | 2074 kSubImageYOffset + 2, kSubImageWidth, 2, kFormat, kType, |
2072 mem1.id, mem1.offset, false); | 2075 mem1.id, mem1.offset, false); |
2073 expected.set_token1.Init(GetNextToken()); | 2076 expected.set_token1.Init(GetNextToken()); |
2074 expected.tex_sub_image_2d2.Init(kTarget, kLevel, kSubImageXOffset, | 2077 expected.tex_sub_image_2d2.Init(kTarget, kLevel, kSubImageXOffset, |
2075 kSubImageYOffset, kSubImageWidth , 2, kFormat, kType, | 2078 kSubImageYOffset, kSubImageWidth , 2, kFormat, kType, |
2076 mem2.id, mem2.offset, false); | 2079 mem2.id, mem2.offset, false); |
2077 expected.set_token2.Init(GetNextToken()); | 2080 expected.set_token2.Init(GetNextToken()); |
2078 | 2081 |
2079 gl_->PixelStorei(GL_UNPACK_ALIGNMENT, kPixelStoreUnpackAlignment); | 2082 gl_->PixelStorei(GL_UNPACK_ALIGNMENT, kPixelStoreUnpackAlignment); |
2080 gl_->TexImage2D( | 2083 gl_->TexImage2D( |
2081 kTarget, kLevel, kFormat, kTextureWidth, kTextureHeight, kBorder, kFormat, | 2084 kTarget, kLevel, kFormat, kTextureWidth, kTextureHeight, kBorder, kFormat, |
2082 kType, NULL); | 2085 kType, NULL); |
2083 // this call should not emit commands (handled client-side) | |
2084 gl_->PixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE); | 2086 gl_->PixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE); |
2085 scoped_array<uint32> pixels(new uint32[kSubImageWidth * kSubImageHeight]); | 2087 scoped_array<uint32> pixels(new uint32[kSubImageWidth * kSubImageHeight]); |
2086 for (int y = 0; y < kSubImageHeight; ++y) { | 2088 for (int y = 0; y < kSubImageHeight; ++y) { |
2087 for (int x = 0; x < kSubImageWidth; ++x) { | 2089 for (int x = 0; x < kSubImageWidth; ++x) { |
2088 pixels.get()[kSubImageWidth * y + x] = x | (y << 16); | 2090 pixels.get()[kSubImageWidth * y + x] = x | (y << 16); |
2089 } | 2091 } |
2090 } | 2092 } |
2091 gl_->TexSubImage2D( | 2093 gl_->TexSubImage2D( |
2092 GL_TEXTURE_2D, 0, kSubImageXOffset, kSubImageYOffset, kSubImageWidth, | 2094 GL_TEXTURE_2D, 0, kSubImageXOffset, kSubImageYOffset, kSubImageWidth, |
2093 kSubImageHeight, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get()); | 2095 kSubImageHeight, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get()); |
2094 | 2096 |
2095 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 2097 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
2096 EXPECT_TRUE(CheckRect( | 2098 EXPECT_TRUE(CheckRect( |
2097 kSubImageWidth, 2, kFormat, kType, kPixelStoreUnpackAlignment, true, | 2099 kSubImageWidth, 2, kFormat, kType, kPixelStoreUnpackAlignment, true, |
2098 reinterpret_cast<uint8*>(pixels.get() + 2 * kSubImageWidth), | 2100 reinterpret_cast<uint8*>(pixels.get() + 2 * kSubImageWidth), |
(...skipping 19 matching lines...) Expand all Loading... |
2118 static const GLint kSrcSubImageHeight = kSrcSubImageY1 - kSrcSubImageY0; | 2120 static const GLint kSrcSubImageHeight = kSrcSubImageY1 - kSrcSubImageY0; |
2119 | 2121 |
2120 // these are only used in the texsubimage tests | 2122 // these are only used in the texsubimage tests |
2121 static const GLint kTexWidth = 1023; | 2123 static const GLint kTexWidth = 1023; |
2122 static const GLint kTexHeight = 511; | 2124 static const GLint kTexHeight = 511; |
2123 static const GLint kTexSubXOffset = 419; | 2125 static const GLint kTexSubXOffset = 419; |
2124 static const GLint kTexSubYOffset = 103; | 2126 static const GLint kTexSubYOffset = 103; |
2125 | 2127 |
2126 struct { | 2128 struct { |
2127 PixelStorei pixel_store_i; | 2129 PixelStorei pixel_store_i; |
| 2130 PixelStorei pixel_store_i2; |
2128 TexImage2D tex_image_2d; | 2131 TexImage2D tex_image_2d; |
2129 } texImageExpected; | 2132 } texImageExpected; |
2130 | 2133 |
2131 struct { | 2134 struct { |
2132 PixelStorei pixel_store_i; | 2135 PixelStorei pixel_store_i; |
| 2136 PixelStorei pixel_store_i2; |
2133 TexImage2D tex_image_2d; | 2137 TexImage2D tex_image_2d; |
2134 TexSubImage2D tex_sub_image_2d; | 2138 TexSubImage2D tex_sub_image_2d; |
2135 } texSubImageExpected; | 2139 } texSubImageExpected; |
2136 | 2140 |
2137 uint32 src_size; | 2141 uint32 src_size; |
2138 ASSERT_TRUE(GLES2Util::ComputeImageDataSizes( | 2142 ASSERT_TRUE(GLES2Util::ComputeImageDataSizes( |
2139 kSrcWidth, kSrcSubImageY1, kFormat, kType, 8, &src_size, NULL, NULL)); | 2143 kSrcWidth, kSrcSubImageY1, kFormat, kType, 8, &src_size, NULL, NULL)); |
2140 scoped_array<uint8> src_pixels; | 2144 scoped_array<uint8> src_pixels; |
2141 src_pixels.reset(new uint8[src_size]); | 2145 src_pixels.reset(new uint8[src_size]); |
2142 for (size_t i = 0; i < src_size; ++i) { | 2146 for (size_t i = 0; i < src_size; ++i) { |
(...skipping 22 matching lines...) Expand all Loading... |
2165 if (sub) { | 2169 if (sub) { |
2166 gl_->TexImage2D( | 2170 gl_->TexImage2D( |
2167 GL_TEXTURE_2D, kLevel, kFormat, kTexWidth, kTexHeight, kBorder, | 2171 GL_TEXTURE_2D, kLevel, kFormat, kTexWidth, kTexHeight, kBorder, |
2168 kFormat, kType, NULL); | 2172 kFormat, kType, NULL); |
2169 gl_->TexSubImage2D( | 2173 gl_->TexSubImage2D( |
2170 GL_TEXTURE_2D, kLevel, kTexSubXOffset, kTexSubYOffset, | 2174 GL_TEXTURE_2D, kLevel, kTexSubXOffset, kTexSubYOffset, |
2171 kSrcSubImageWidth, kSrcSubImageHeight, kFormat, kType, | 2175 kSrcSubImageWidth, kSrcSubImageHeight, kFormat, kType, |
2172 src_pixels.get()); | 2176 src_pixels.get()); |
2173 texSubImageExpected.pixel_store_i.Init( | 2177 texSubImageExpected.pixel_store_i.Init( |
2174 GL_UNPACK_ALIGNMENT, alignment); | 2178 GL_UNPACK_ALIGNMENT, alignment); |
| 2179 texSubImageExpected.pixel_store_i2.Init( |
| 2180 GL_UNPACK_FLIP_Y_CHROMIUM, flip_y); |
2175 texSubImageExpected.tex_image_2d.Init( | 2181 texSubImageExpected.tex_image_2d.Init( |
2176 GL_TEXTURE_2D, kLevel, kFormat, kTexWidth, kTexHeight, kBorder, | 2182 GL_TEXTURE_2D, kLevel, kFormat, kTexWidth, kTexHeight, kBorder, |
2177 kFormat, kType, 0, 0); | 2183 kFormat, kType, 0, 0); |
2178 texSubImageExpected.tex_sub_image_2d.Init( | 2184 texSubImageExpected.tex_sub_image_2d.Init( |
2179 GL_TEXTURE_2D, kLevel, kTexSubXOffset, kTexSubYOffset, | 2185 GL_TEXTURE_2D, kLevel, kTexSubXOffset, kTexSubYOffset, |
2180 kSrcSubImageWidth, kSrcSubImageHeight, kFormat, kType, mem.id, | 2186 kSrcSubImageWidth, kSrcSubImageHeight, kFormat, kType, mem.id, |
2181 mem.offset, GL_FALSE); | 2187 mem.offset, GL_FALSE); |
2182 EXPECT_EQ(0, memcmp( | 2188 EXPECT_EQ(0, memcmp( |
2183 &texSubImageExpected, commands, sizeof(texSubImageExpected))); | 2189 &texSubImageExpected, commands, sizeof(texSubImageExpected))); |
2184 } else { | 2190 } else { |
2185 gl_->TexImage2D( | 2191 gl_->TexImage2D( |
2186 GL_TEXTURE_2D, kLevel, kFormat, | 2192 GL_TEXTURE_2D, kLevel, kFormat, |
2187 kSrcSubImageWidth, kSrcSubImageHeight, kBorder, kFormat, kType, | 2193 kSrcSubImageWidth, kSrcSubImageHeight, kBorder, kFormat, kType, |
2188 src_pixels.get()); | 2194 src_pixels.get()); |
2189 texImageExpected.pixel_store_i.Init(GL_UNPACK_ALIGNMENT, alignment); | 2195 texImageExpected.pixel_store_i.Init(GL_UNPACK_ALIGNMENT, alignment); |
| 2196 texImageExpected.pixel_store_i2.Init( |
| 2197 GL_UNPACK_FLIP_Y_CHROMIUM, flip_y); |
2190 texImageExpected.tex_image_2d.Init( | 2198 texImageExpected.tex_image_2d.Init( |
2191 GL_TEXTURE_2D, kLevel, kFormat, kSrcSubImageWidth, | 2199 GL_TEXTURE_2D, kLevel, kFormat, kSrcSubImageWidth, |
2192 kSrcSubImageHeight, kBorder, kFormat, kType, mem.id, mem.offset); | 2200 kSrcSubImageHeight, kBorder, kFormat, kType, mem.id, mem.offset); |
2193 EXPECT_EQ(0, memcmp( | 2201 EXPECT_EQ(0, memcmp( |
2194 &texImageExpected, commands, sizeof(texImageExpected))); | 2202 &texImageExpected, commands, sizeof(texImageExpected))); |
2195 } | 2203 } |
2196 uint32 src_padded_row_size; | 2204 uint32 src_padded_row_size; |
2197 ASSERT_TRUE(GLES2Util::ComputeImagePaddedRowSize( | 2205 ASSERT_TRUE(GLES2Util::ComputeImagePaddedRowSize( |
2198 kSrcWidth, kFormat, kType, alignment, &src_padded_row_size)); | 2206 kSrcWidth, kFormat, kType, alignment, &src_padded_row_size)); |
2199 uint32 bytes_per_group = GLES2Util::ComputeImageGroupSize( | 2207 uint32 bytes_per_group = GLES2Util::ComputeImageGroupSize( |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2504 EXPECT_TRUE(NoCommandsWritten()); | 2512 EXPECT_TRUE(NoCommandsWritten()); |
2505 EXPECT_EQ(0u, available); | 2513 EXPECT_EQ(0u, available); |
2506 } | 2514 } |
2507 | 2515 |
2508 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" | 2516 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" |
2509 | 2517 |
2510 } // namespace gles2 | 2518 } // namespace gles2 |
2511 } // namespace gpu | 2519 } // namespace gpu |
2512 | 2520 |
2513 | 2521 |
OLD | NEW |