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