Alec Mouri | 6e57f68 | 2018-09-29 20:45:08 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <gtest/gtest.h> |
| 18 | |
| 19 | #include <renderengine/RenderEngine.h> |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 20 | #include <sync/sync.h> |
Alec Mouri | 6e57f68 | 2018-09-29 20:45:08 -0700 | [diff] [blame] | 21 | #include <ui/PixelFormat.h> |
| 22 | |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 23 | constexpr int DEFAULT_DISPLAY_WIDTH = 128; |
| 24 | constexpr int DEFAULT_DISPLAY_HEIGHT = 256; |
| 25 | constexpr int DEFAULT_DISPLAY_OFFSET = 64; |
| 26 | |
Alec Mouri | 6e57f68 | 2018-09-29 20:45:08 -0700 | [diff] [blame] | 27 | namespace android { |
| 28 | |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 29 | struct RenderEngineTest : public ::testing::Test { |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 30 | static sp<GraphicBuffer> allocateDefaultBuffer() { |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 31 | return new GraphicBuffer(DEFAULT_DISPLAY_WIDTH, DEFAULT_DISPLAY_HEIGHT, |
| 32 | HAL_PIXEL_FORMAT_RGBA_8888, 1, |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 33 | GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN | |
| 34 | GRALLOC_USAGE_HW_RENDER, |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 35 | "output"); |
Alec Mouri | 6e57f68 | 2018-09-29 20:45:08 -0700 | [diff] [blame] | 36 | } |
| 37 | |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 38 | // Allocates a 1x1 buffer to fill with a solid color |
| 39 | static sp<GraphicBuffer> allocateSourceBuffer(uint32_t width, uint32_t height) { |
| 40 | return new GraphicBuffer(width, height, HAL_PIXEL_FORMAT_RGBA_8888, 1, |
| 41 | GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN | |
| 42 | GRALLOC_USAGE_HW_TEXTURE, |
| 43 | "input"); |
| 44 | } |
| 45 | |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 46 | RenderEngineTest() { mBuffer = allocateDefaultBuffer(); } |
| 47 | |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 48 | ~RenderEngineTest() { |
| 49 | for (uint32_t texName : mTexNames) { |
| 50 | sRE->deleteTextures(1, &texName); |
| 51 | } |
| 52 | } |
| 53 | |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 54 | void expectBufferColor(const Rect& region, uint8_t r, uint8_t g, uint8_t b, uint8_t a, |
| 55 | uint8_t tolerance = 0) { |
| 56 | uint8_t* pixels; |
| 57 | mBuffer->lock(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN, |
| 58 | reinterpret_cast<void**>(&pixels)); |
| 59 | |
| 60 | auto colorCompare = [tolerance](uint8_t a, uint8_t b) { |
| 61 | uint8_t tmp = a >= b ? a - b : b - a; |
| 62 | return tmp <= tolerance; |
| 63 | }; |
| 64 | int32_t maxFails = 10; |
| 65 | int32_t fails = 0; |
| 66 | for (int32_t j = 0; j < region.getHeight(); j++) { |
| 67 | const uint8_t* src = |
| 68 | pixels + (mBuffer->getStride() * (region.top + j) + region.left) * 4; |
| 69 | for (int32_t i = 0; i < region.getWidth(); i++) { |
| 70 | const uint8_t expected[4] = {r, g, b, a}; |
| 71 | bool equal = std::equal(src, src + 4, expected, colorCompare); |
| 72 | EXPECT_TRUE(equal) |
| 73 | << "pixel @ (" << region.left + i << ", " << region.top + j << "): " |
| 74 | << "expected (" << static_cast<uint32_t>(r) << ", " |
| 75 | << static_cast<uint32_t>(g) << ", " << static_cast<uint32_t>(b) << ", " |
| 76 | << static_cast<uint32_t>(a) << "), " |
| 77 | << "got (" << static_cast<uint32_t>(src[0]) << ", " |
| 78 | << static_cast<uint32_t>(src[1]) << ", " << static_cast<uint32_t>(src[2]) |
| 79 | << ", " << static_cast<uint32_t>(src[3]) << ")"; |
| 80 | src += 4; |
| 81 | if (!equal && ++fails >= maxFails) { |
| 82 | break; |
| 83 | } |
| 84 | } |
| 85 | if (fails >= maxFails) { |
| 86 | break; |
| 87 | } |
| 88 | } |
| 89 | mBuffer->unlock(); |
| 90 | } |
| 91 | |
| 92 | static Rect fullscreenRect() { return Rect(DEFAULT_DISPLAY_WIDTH, DEFAULT_DISPLAY_HEIGHT); } |
| 93 | |
| 94 | static Rect offsetRect() { |
| 95 | return Rect(DEFAULT_DISPLAY_OFFSET, DEFAULT_DISPLAY_OFFSET, DEFAULT_DISPLAY_WIDTH, |
| 96 | DEFAULT_DISPLAY_HEIGHT); |
| 97 | } |
| 98 | |
| 99 | static Rect offsetRectAtZero() { |
| 100 | return Rect(DEFAULT_DISPLAY_WIDTH - DEFAULT_DISPLAY_OFFSET, |
| 101 | DEFAULT_DISPLAY_HEIGHT - DEFAULT_DISPLAY_OFFSET); |
| 102 | } |
| 103 | |
| 104 | static void invokeDraw(renderengine::DisplaySettings settings, |
| 105 | std::vector<renderengine::LayerSettings> layers, |
| 106 | sp<GraphicBuffer> buffer) { |
| 107 | base::unique_fd fence; |
| 108 | status_t status = sRE->drawLayers(settings, layers, buffer->getNativeBuffer(), &fence); |
| 109 | |
| 110 | int fd = fence.release(); |
| 111 | if (fd >= 0) { |
| 112 | sync_wait(fd, -1); |
| 113 | close(fd); |
| 114 | } |
| 115 | |
| 116 | ASSERT_EQ(NO_ERROR, status); |
| 117 | } |
| 118 | |
| 119 | static void drawEmptyLayers() { |
Alec Mouri | 6e57f68 | 2018-09-29 20:45:08 -0700 | [diff] [blame] | 120 | renderengine::DisplaySettings settings; |
| 121 | std::vector<renderengine::LayerSettings> layers; |
| 122 | // Meaningless buffer since we don't do any drawing |
| 123 | sp<GraphicBuffer> buffer = new GraphicBuffer(); |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 124 | invokeDraw(settings, layers, buffer); |
Alec Mouri | 6e57f68 | 2018-09-29 20:45:08 -0700 | [diff] [blame] | 125 | } |
| 126 | |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 127 | template <typename SourceVariant> |
| 128 | void fillBuffer(half r, half g, half b, half a); |
| 129 | |
| 130 | template <typename SourceVariant> |
| 131 | void fillRedBuffer(); |
| 132 | |
| 133 | template <typename SourceVariant> |
| 134 | void fillGreenBuffer(); |
| 135 | |
| 136 | template <typename SourceVariant> |
| 137 | void fillBlueBuffer(); |
| 138 | |
| 139 | template <typename SourceVariant> |
| 140 | void fillRedTransparentBuffer(); |
| 141 | |
| 142 | template <typename SourceVariant> |
| 143 | void fillRedOffsetBuffer(); |
| 144 | |
| 145 | template <typename SourceVariant> |
| 146 | void fillBufferPhysicalOffset(); |
| 147 | |
| 148 | template <typename SourceVariant> |
| 149 | void fillBufferCheckers(mat4 transform); |
| 150 | |
| 151 | template <typename SourceVariant> |
| 152 | void fillBufferCheckersRotate0(); |
| 153 | |
| 154 | template <typename SourceVariant> |
| 155 | void fillBufferCheckersRotate90(); |
| 156 | |
| 157 | template <typename SourceVariant> |
| 158 | void fillBufferCheckersRotate180(); |
| 159 | |
| 160 | template <typename SourceVariant> |
| 161 | void fillBufferCheckersRotate270(); |
| 162 | |
| 163 | template <typename SourceVariant> |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 164 | void fillBufferWithLayerTransform(); |
| 165 | |
| 166 | template <typename SourceVariant> |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 167 | void fillBufferLayerTransform(); |
| 168 | |
| 169 | template <typename SourceVariant> |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 170 | void fillBufferWithColorTransform(); |
| 171 | |
| 172 | template <typename SourceVariant> |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 173 | void fillBufferColorTransform(); |
| 174 | |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 175 | void fillRedBufferTextureTransform(); |
| 176 | |
| 177 | void fillBufferTextureTransform(); |
| 178 | |
| 179 | void fillRedBufferWithPremultiplyAlpha(); |
| 180 | |
| 181 | void fillBufferWithPremultiplyAlpha(); |
| 182 | |
| 183 | void fillRedBufferWithoutPremultiplyAlpha(); |
| 184 | |
| 185 | void fillBufferWithoutPremultiplyAlpha(); |
| 186 | |
Alec Mouri | ac33553 | 2018-11-12 15:01:33 -0800 | [diff] [blame^] | 187 | void fillGreenColorBufferThenClearRegion(); |
| 188 | |
| 189 | void clearLeftRegion(); |
| 190 | |
| 191 | void fillBufferThenClearRegion(); |
| 192 | |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 193 | // Dumb hack to get aroud the fact that tear-down for renderengine isn't |
| 194 | // well defined right now, so we can't create multiple instances |
| 195 | static std::unique_ptr<renderengine::RenderEngine> sRE; |
| 196 | |
| 197 | sp<GraphicBuffer> mBuffer; |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 198 | |
| 199 | std::vector<uint32_t> mTexNames; |
Alec Mouri | 6e57f68 | 2018-09-29 20:45:08 -0700 | [diff] [blame] | 200 | }; |
| 201 | |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 202 | std::unique_ptr<renderengine::RenderEngine> RenderEngineTest::sRE = |
| 203 | renderengine::RenderEngine::create(static_cast<int32_t>(ui::PixelFormat::RGBA_8888), 0); |
| 204 | |
| 205 | struct ColorSourceVariant { |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 206 | static void fillColor(renderengine::LayerSettings& layer, half r, half g, half b, |
| 207 | RenderEngineTest* /*fixture*/) { |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 208 | layer.source.solidColor = half3(r, g, b); |
| 209 | } |
| 210 | }; |
| 211 | |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 212 | struct RelaxOpaqueBufferVariant { |
| 213 | static void setOpaqueBit(renderengine::LayerSettings& layer) { |
| 214 | layer.source.buffer.isOpaque = false; |
| 215 | } |
| 216 | |
| 217 | static uint8_t getAlphaChannel() { return 255; } |
| 218 | }; |
| 219 | |
| 220 | struct ForceOpaqueBufferVariant { |
| 221 | static void setOpaqueBit(renderengine::LayerSettings& layer) { |
| 222 | layer.source.buffer.isOpaque = true; |
| 223 | } |
| 224 | |
| 225 | static uint8_t getAlphaChannel() { |
| 226 | // The isOpaque bit will override the alpha channel, so this should be |
| 227 | // arbitrary. |
| 228 | return 10; |
| 229 | } |
| 230 | }; |
| 231 | |
| 232 | template <typename OpaquenessVariant> |
| 233 | struct BufferSourceVariant { |
| 234 | static void fillColor(renderengine::LayerSettings& layer, half r, half g, half b, |
| 235 | RenderEngineTest* fixture) { |
| 236 | sp<GraphicBuffer> buf = RenderEngineTest::allocateSourceBuffer(1, 1); |
| 237 | uint32_t texName; |
| 238 | RenderEngineTest::sRE->genTextures(1, &texName); |
| 239 | fixture->mTexNames.push_back(texName); |
| 240 | |
| 241 | uint8_t* pixels; |
| 242 | buf->lock(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN, |
| 243 | reinterpret_cast<void**>(&pixels)); |
| 244 | |
| 245 | for (int32_t j = 0; j < buf->getHeight(); j++) { |
| 246 | uint8_t* iter = pixels + (buf->getStride() * j) * 4; |
| 247 | for (int32_t i = 0; i < buf->getWidth(); i++) { |
| 248 | iter[0] = uint8_t(r * 255); |
| 249 | iter[1] = uint8_t(g * 255); |
| 250 | iter[2] = uint8_t(b * 255); |
| 251 | iter[3] = OpaquenessVariant::getAlphaChannel(); |
| 252 | iter += 4; |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | buf->unlock(); |
| 257 | |
| 258 | layer.source.buffer.buffer = buf; |
| 259 | layer.source.buffer.textureName = texName; |
| 260 | OpaquenessVariant::setOpaqueBit(layer); |
| 261 | } |
| 262 | }; |
| 263 | |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 264 | template <typename SourceVariant> |
| 265 | void RenderEngineTest::fillBuffer(half r, half g, half b, half a) { |
| 266 | renderengine::DisplaySettings settings; |
| 267 | settings.physicalDisplay = fullscreenRect(); |
| 268 | settings.clip = fullscreenRect(); |
| 269 | |
| 270 | std::vector<renderengine::LayerSettings> layers; |
| 271 | |
| 272 | renderengine::LayerSettings layer; |
| 273 | layer.geometry.boundaries = fullscreenRect().toFloatRect(); |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 274 | SourceVariant::fillColor(layer, r, g, b, this); |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 275 | layer.alpha = a; |
| 276 | |
| 277 | layers.push_back(layer); |
| 278 | |
| 279 | invokeDraw(settings, layers, mBuffer); |
| 280 | } |
| 281 | |
| 282 | template <typename SourceVariant> |
| 283 | void RenderEngineTest::fillRedBuffer() { |
| 284 | fillBuffer<SourceVariant>(1.0f, 0.0f, 0.0f, 1.0f); |
| 285 | expectBufferColor(fullscreenRect(), 255, 0, 0, 255); |
| 286 | } |
| 287 | |
| 288 | template <typename SourceVariant> |
| 289 | void RenderEngineTest::fillGreenBuffer() { |
| 290 | fillBuffer<SourceVariant>(0.0f, 1.0f, 0.0f, 1.0f); |
| 291 | expectBufferColor(fullscreenRect(), 0, 255, 0, 255); |
| 292 | } |
| 293 | |
| 294 | template <typename SourceVariant> |
| 295 | void RenderEngineTest::fillBlueBuffer() { |
| 296 | fillBuffer<SourceVariant>(0.0f, 0.0f, 1.0f, 1.0f); |
| 297 | expectBufferColor(fullscreenRect(), 0, 0, 255, 255); |
| 298 | } |
| 299 | |
| 300 | template <typename SourceVariant> |
| 301 | void RenderEngineTest::fillRedTransparentBuffer() { |
| 302 | fillBuffer<SourceVariant>(1.0f, 0.0f, 0.0f, .2f); |
| 303 | expectBufferColor(fullscreenRect(), 51, 0, 0, 51); |
| 304 | } |
| 305 | |
| 306 | template <typename SourceVariant> |
| 307 | void RenderEngineTest::fillRedOffsetBuffer() { |
| 308 | renderengine::DisplaySettings settings; |
| 309 | settings.physicalDisplay = offsetRect(); |
| 310 | settings.clip = offsetRectAtZero(); |
| 311 | |
| 312 | std::vector<renderengine::LayerSettings> layers; |
| 313 | |
| 314 | renderengine::LayerSettings layer; |
| 315 | layer.geometry.boundaries = offsetRectAtZero().toFloatRect(); |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 316 | SourceVariant::fillColor(layer, 1.0f, 0.0f, 0.0f, this); |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 317 | layer.alpha = 1.0f; |
| 318 | |
| 319 | layers.push_back(layer); |
| 320 | invokeDraw(settings, layers, mBuffer); |
| 321 | } |
| 322 | |
| 323 | template <typename SourceVariant> |
| 324 | void RenderEngineTest::fillBufferPhysicalOffset() { |
| 325 | fillRedOffsetBuffer<SourceVariant>(); |
| 326 | |
| 327 | expectBufferColor(Rect(DEFAULT_DISPLAY_OFFSET, DEFAULT_DISPLAY_OFFSET, DEFAULT_DISPLAY_WIDTH, |
| 328 | DEFAULT_DISPLAY_HEIGHT), |
| 329 | 255, 0, 0, 255); |
| 330 | Rect offsetRegionLeft(DEFAULT_DISPLAY_OFFSET, DEFAULT_DISPLAY_HEIGHT); |
| 331 | Rect offsetRegionTop(DEFAULT_DISPLAY_WIDTH, DEFAULT_DISPLAY_OFFSET); |
| 332 | |
| 333 | expectBufferColor(offsetRegionLeft, 0, 0, 0, 0); |
| 334 | expectBufferColor(offsetRegionTop, 0, 0, 0, 0); |
| 335 | } |
| 336 | |
| 337 | template <typename SourceVariant> |
| 338 | void RenderEngineTest::fillBufferCheckers(mat4 transform) { |
| 339 | renderengine::DisplaySettings settings; |
| 340 | settings.physicalDisplay = fullscreenRect(); |
| 341 | // Here logical space is 2x2 |
| 342 | settings.clip = Rect(2, 2); |
| 343 | settings.globalTransform = transform; |
| 344 | |
| 345 | std::vector<renderengine::LayerSettings> layers; |
| 346 | |
| 347 | renderengine::LayerSettings layerOne; |
| 348 | Rect rectOne(0, 0, 1, 1); |
| 349 | layerOne.geometry.boundaries = rectOne.toFloatRect(); |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 350 | SourceVariant::fillColor(layerOne, 1.0f, 0.0f, 0.0f, this); |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 351 | layerOne.alpha = 1.0f; |
| 352 | |
| 353 | renderengine::LayerSettings layerTwo; |
| 354 | Rect rectTwo(0, 1, 1, 2); |
| 355 | layerTwo.geometry.boundaries = rectTwo.toFloatRect(); |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 356 | SourceVariant::fillColor(layerTwo, 0.0f, 1.0f, 0.0f, this); |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 357 | layerTwo.alpha = 1.0f; |
| 358 | |
| 359 | renderengine::LayerSettings layerThree; |
| 360 | Rect rectThree(1, 0, 2, 1); |
| 361 | layerThree.geometry.boundaries = rectThree.toFloatRect(); |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 362 | SourceVariant::fillColor(layerThree, 0.0f, 0.0f, 1.0f, this); |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 363 | layerThree.alpha = 1.0f; |
| 364 | |
| 365 | layers.push_back(layerOne); |
| 366 | layers.push_back(layerTwo); |
| 367 | layers.push_back(layerThree); |
| 368 | |
| 369 | invokeDraw(settings, layers, mBuffer); |
| 370 | } |
| 371 | |
| 372 | template <typename SourceVariant> |
| 373 | void RenderEngineTest::fillBufferCheckersRotate0() { |
| 374 | fillBufferCheckers<SourceVariant>(mat4()); |
| 375 | expectBufferColor(Rect(0, 0, DEFAULT_DISPLAY_WIDTH / 2, DEFAULT_DISPLAY_HEIGHT / 2), 255, 0, 0, |
| 376 | 255); |
| 377 | expectBufferColor(Rect(DEFAULT_DISPLAY_WIDTH / 2, 0, DEFAULT_DISPLAY_WIDTH, |
| 378 | DEFAULT_DISPLAY_HEIGHT / 2), |
| 379 | 0, 0, 255, 255); |
| 380 | expectBufferColor(Rect(DEFAULT_DISPLAY_WIDTH / 2, DEFAULT_DISPLAY_HEIGHT / 2, |
| 381 | DEFAULT_DISPLAY_WIDTH, DEFAULT_DISPLAY_HEIGHT), |
| 382 | 0, 0, 0, 0); |
| 383 | expectBufferColor(Rect(0, DEFAULT_DISPLAY_HEIGHT / 2, DEFAULT_DISPLAY_WIDTH / 2, |
| 384 | DEFAULT_DISPLAY_HEIGHT), |
| 385 | 0, 255, 0, 255); |
| 386 | } |
| 387 | |
| 388 | template <typename SourceVariant> |
| 389 | void RenderEngineTest::fillBufferCheckersRotate90() { |
| 390 | mat4 matrix = mat4(0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 1); |
| 391 | fillBufferCheckers<SourceVariant>(matrix); |
| 392 | expectBufferColor(Rect(0, 0, DEFAULT_DISPLAY_WIDTH / 2, DEFAULT_DISPLAY_HEIGHT / 2), 0, 255, 0, |
| 393 | 255); |
| 394 | expectBufferColor(Rect(DEFAULT_DISPLAY_WIDTH / 2, 0, DEFAULT_DISPLAY_WIDTH, |
| 395 | DEFAULT_DISPLAY_HEIGHT / 2), |
| 396 | 255, 0, 0, 255); |
| 397 | expectBufferColor(Rect(DEFAULT_DISPLAY_WIDTH / 2, DEFAULT_DISPLAY_HEIGHT / 2, |
| 398 | DEFAULT_DISPLAY_WIDTH, DEFAULT_DISPLAY_HEIGHT), |
| 399 | 0, 0, 255, 255); |
| 400 | expectBufferColor(Rect(0, DEFAULT_DISPLAY_HEIGHT / 2, DEFAULT_DISPLAY_WIDTH / 2, |
| 401 | DEFAULT_DISPLAY_HEIGHT), |
| 402 | 0, 0, 0, 0); |
| 403 | } |
| 404 | |
| 405 | template <typename SourceVariant> |
| 406 | void RenderEngineTest::fillBufferCheckersRotate180() { |
| 407 | mat4 matrix = mat4(-1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 2, 2, 0, 1); |
| 408 | fillBufferCheckers<SourceVariant>(matrix); |
| 409 | expectBufferColor(Rect(0, 0, DEFAULT_DISPLAY_WIDTH / 2, DEFAULT_DISPLAY_HEIGHT / 2), 0, 0, 0, |
| 410 | 0); |
| 411 | expectBufferColor(Rect(DEFAULT_DISPLAY_WIDTH / 2, 0, DEFAULT_DISPLAY_WIDTH, |
| 412 | DEFAULT_DISPLAY_HEIGHT / 2), |
| 413 | 0, 255, 0, 255); |
| 414 | expectBufferColor(Rect(DEFAULT_DISPLAY_WIDTH / 2, DEFAULT_DISPLAY_HEIGHT / 2, |
| 415 | DEFAULT_DISPLAY_WIDTH, DEFAULT_DISPLAY_HEIGHT), |
| 416 | 255, 0, 0, 255); |
| 417 | expectBufferColor(Rect(0, DEFAULT_DISPLAY_HEIGHT / 2, DEFAULT_DISPLAY_WIDTH / 2, |
| 418 | DEFAULT_DISPLAY_HEIGHT), |
| 419 | 0, 0, 255, 255); |
| 420 | } |
| 421 | |
| 422 | template <typename SourceVariant> |
| 423 | void RenderEngineTest::fillBufferCheckersRotate270() { |
| 424 | mat4 matrix = mat4(0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 1); |
| 425 | fillBufferCheckers<SourceVariant>(matrix); |
| 426 | expectBufferColor(Rect(0, 0, DEFAULT_DISPLAY_WIDTH / 2, DEFAULT_DISPLAY_HEIGHT / 2), 0, 0, 255, |
| 427 | 255); |
| 428 | expectBufferColor(Rect(DEFAULT_DISPLAY_WIDTH / 2, 0, DEFAULT_DISPLAY_WIDTH, |
| 429 | DEFAULT_DISPLAY_HEIGHT / 2), |
| 430 | 0, 0, 0, 0); |
| 431 | expectBufferColor(Rect(DEFAULT_DISPLAY_WIDTH / 2, DEFAULT_DISPLAY_HEIGHT / 2, |
| 432 | DEFAULT_DISPLAY_WIDTH, DEFAULT_DISPLAY_HEIGHT), |
| 433 | 0, 255, 0, 255); |
| 434 | expectBufferColor(Rect(0, DEFAULT_DISPLAY_HEIGHT / 2, DEFAULT_DISPLAY_WIDTH / 2, |
| 435 | DEFAULT_DISPLAY_HEIGHT), |
| 436 | 255, 0, 0, 255); |
| 437 | } |
| 438 | |
| 439 | template <typename SourceVariant> |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 440 | void RenderEngineTest::fillBufferWithLayerTransform() { |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 441 | renderengine::DisplaySettings settings; |
| 442 | settings.physicalDisplay = fullscreenRect(); |
| 443 | // Here logical space is 2x2 |
| 444 | settings.clip = Rect(2, 2); |
| 445 | |
| 446 | std::vector<renderengine::LayerSettings> layers; |
| 447 | |
| 448 | renderengine::LayerSettings layer; |
| 449 | layer.geometry.boundaries = Rect(1, 1).toFloatRect(); |
| 450 | // Translate one pixel diagonally |
| 451 | layer.geometry.positionTransform = mat4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1); |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 452 | SourceVariant::fillColor(layer, 1.0f, 0.0f, 0.0f, this); |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 453 | layer.source.solidColor = half3(1.0f, 0.0f, 0.0f); |
| 454 | layer.alpha = 1.0f; |
| 455 | |
| 456 | layers.push_back(layer); |
| 457 | |
| 458 | invokeDraw(settings, layers, mBuffer); |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 459 | } |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 460 | |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 461 | template <typename SourceVariant> |
| 462 | void RenderEngineTest::fillBufferLayerTransform() { |
| 463 | fillBufferWithLayerTransform<SourceVariant>(); |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 464 | expectBufferColor(Rect(0, 0, DEFAULT_DISPLAY_WIDTH, DEFAULT_DISPLAY_HEIGHT / 2), 0, 0, 0, 0); |
| 465 | expectBufferColor(Rect(0, 0, DEFAULT_DISPLAY_WIDTH / 2, DEFAULT_DISPLAY_HEIGHT), 0, 0, 0, 0); |
| 466 | expectBufferColor(Rect(DEFAULT_DISPLAY_WIDTH / 2, DEFAULT_DISPLAY_HEIGHT / 2, |
| 467 | DEFAULT_DISPLAY_WIDTH, DEFAULT_DISPLAY_HEIGHT), |
| 468 | 255, 0, 0, 255); |
| 469 | } |
| 470 | |
| 471 | template <typename SourceVariant> |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 472 | void RenderEngineTest::fillBufferWithColorTransform() { |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 473 | renderengine::DisplaySettings settings; |
| 474 | settings.physicalDisplay = fullscreenRect(); |
| 475 | settings.clip = Rect(1, 1); |
| 476 | |
| 477 | std::vector<renderengine::LayerSettings> layers; |
| 478 | |
| 479 | renderengine::LayerSettings layer; |
| 480 | layer.geometry.boundaries = Rect(1, 1).toFloatRect(); |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 481 | SourceVariant::fillColor(layer, 0.5f, 0.25f, 0.125f, this); |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 482 | layer.alpha = 1.0f; |
| 483 | |
| 484 | // construct a fake color matrix |
| 485 | // annihilate green and blue channels |
| 486 | settings.colorTransform = mat4::scale(vec4(1, 0, 0, 1)); |
| 487 | // set red channel to red + green |
| 488 | layer.colorTransform = mat4(1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); |
| 489 | |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 490 | layer.alpha = 1.0f; |
| 491 | layer.geometry.boundaries = Rect(1, 1).toFloatRect(); |
| 492 | |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 493 | layers.push_back(layer); |
| 494 | |
| 495 | invokeDraw(settings, layers, mBuffer); |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 496 | } |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 497 | |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 498 | template <typename SourceVariant> |
| 499 | void RenderEngineTest::fillBufferColorTransform() { |
| 500 | fillBufferWithColorTransform<SourceVariant>(); |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 501 | expectBufferColor(fullscreenRect(), 191, 0, 0, 255); |
| 502 | } |
| 503 | |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 504 | void RenderEngineTest::fillRedBufferTextureTransform() { |
| 505 | renderengine::DisplaySettings settings; |
| 506 | settings.physicalDisplay = fullscreenRect(); |
| 507 | settings.clip = Rect(1, 1); |
| 508 | |
| 509 | std::vector<renderengine::LayerSettings> layers; |
| 510 | |
| 511 | renderengine::LayerSettings layer; |
| 512 | // Here will allocate a checker board texture, but transform texture |
| 513 | // coordinates so that only the upper left is applied. |
| 514 | sp<GraphicBuffer> buf = allocateSourceBuffer(2, 2); |
| 515 | uint32_t texName; |
| 516 | RenderEngineTest::sRE->genTextures(1, &texName); |
| 517 | this->mTexNames.push_back(texName); |
| 518 | |
| 519 | uint8_t* pixels; |
| 520 | buf->lock(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN, |
| 521 | reinterpret_cast<void**>(&pixels)); |
| 522 | // Red top left, Green top right, Blue bottom left, Black bottom right |
| 523 | pixels[0] = 255; |
| 524 | pixels[1] = 0; |
| 525 | pixels[2] = 0; |
| 526 | pixels[3] = 255; |
| 527 | pixels[4] = 0; |
| 528 | pixels[5] = 255; |
| 529 | pixels[6] = 0; |
| 530 | pixels[7] = 255; |
| 531 | pixels[8] = 0; |
| 532 | pixels[9] = 0; |
| 533 | pixels[10] = 255; |
| 534 | pixels[11] = 255; |
| 535 | buf->unlock(); |
| 536 | |
| 537 | layer.source.buffer.buffer = buf; |
| 538 | layer.source.buffer.textureName = texName; |
| 539 | // Transform coordinates to only be inside the red quadrant. |
| 540 | layer.source.buffer.textureTransform = mat4::scale(vec4(0.2, 0.2, 1, 1)); |
| 541 | layer.alpha = 1.0f; |
| 542 | layer.geometry.boundaries = Rect(1, 1).toFloatRect(); |
| 543 | |
| 544 | layers.push_back(layer); |
| 545 | |
| 546 | invokeDraw(settings, layers, mBuffer); |
| 547 | } |
| 548 | |
| 549 | void RenderEngineTest::fillBufferTextureTransform() { |
| 550 | fillRedBufferTextureTransform(); |
| 551 | expectBufferColor(fullscreenRect(), 255, 0, 0, 255); |
| 552 | } |
| 553 | |
| 554 | void RenderEngineTest::fillRedBufferWithPremultiplyAlpha() { |
| 555 | renderengine::DisplaySettings settings; |
| 556 | settings.physicalDisplay = fullscreenRect(); |
| 557 | // Here logical space is 1x1 |
| 558 | settings.clip = Rect(1, 1); |
| 559 | |
| 560 | std::vector<renderengine::LayerSettings> layers; |
| 561 | |
| 562 | renderengine::LayerSettings layer; |
| 563 | sp<GraphicBuffer> buf = allocateSourceBuffer(1, 1); |
| 564 | uint32_t texName; |
| 565 | RenderEngineTest::sRE->genTextures(1, &texName); |
| 566 | this->mTexNames.push_back(texName); |
| 567 | |
| 568 | uint8_t* pixels; |
| 569 | buf->lock(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN, |
| 570 | reinterpret_cast<void**>(&pixels)); |
| 571 | pixels[0] = 255; |
| 572 | pixels[1] = 0; |
| 573 | pixels[2] = 0; |
| 574 | pixels[3] = 255; |
| 575 | buf->unlock(); |
| 576 | |
| 577 | layer.source.buffer.buffer = buf; |
| 578 | layer.source.buffer.textureName = texName; |
| 579 | layer.source.buffer.usePremultipliedAlpha = true; |
| 580 | layer.alpha = 0.5f; |
| 581 | layer.geometry.boundaries = Rect(1, 1).toFloatRect(); |
| 582 | |
| 583 | layers.push_back(layer); |
| 584 | |
| 585 | invokeDraw(settings, layers, mBuffer); |
| 586 | } |
| 587 | |
| 588 | void RenderEngineTest::fillBufferWithPremultiplyAlpha() { |
| 589 | fillRedBufferWithPremultiplyAlpha(); |
| 590 | expectBufferColor(fullscreenRect(), 128, 0, 0, 128); |
| 591 | } |
| 592 | |
| 593 | void RenderEngineTest::fillRedBufferWithoutPremultiplyAlpha() { |
| 594 | renderengine::DisplaySettings settings; |
| 595 | settings.physicalDisplay = fullscreenRect(); |
| 596 | // Here logical space is 1x1 |
| 597 | settings.clip = Rect(1, 1); |
| 598 | |
| 599 | std::vector<renderengine::LayerSettings> layers; |
| 600 | |
| 601 | renderengine::LayerSettings layer; |
| 602 | sp<GraphicBuffer> buf = allocateSourceBuffer(1, 1); |
| 603 | uint32_t texName; |
| 604 | RenderEngineTest::sRE->genTextures(1, &texName); |
| 605 | this->mTexNames.push_back(texName); |
| 606 | |
| 607 | uint8_t* pixels; |
| 608 | buf->lock(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN, |
| 609 | reinterpret_cast<void**>(&pixels)); |
| 610 | pixels[0] = 255; |
| 611 | pixels[1] = 0; |
| 612 | pixels[2] = 0; |
| 613 | pixels[3] = 255; |
| 614 | buf->unlock(); |
| 615 | |
| 616 | layer.source.buffer.buffer = buf; |
| 617 | layer.source.buffer.textureName = texName; |
| 618 | layer.source.buffer.usePremultipliedAlpha = false; |
| 619 | layer.alpha = 0.5f; |
| 620 | layer.geometry.boundaries = Rect(1, 1).toFloatRect(); |
| 621 | |
| 622 | layers.push_back(layer); |
| 623 | |
| 624 | invokeDraw(settings, layers, mBuffer); |
| 625 | } |
| 626 | |
| 627 | void RenderEngineTest::fillBufferWithoutPremultiplyAlpha() { |
| 628 | fillRedBufferWithoutPremultiplyAlpha(); |
| 629 | expectBufferColor(fullscreenRect(), 128, 0, 0, 64, 1); |
| 630 | } |
| 631 | |
Alec Mouri | ac33553 | 2018-11-12 15:01:33 -0800 | [diff] [blame^] | 632 | void RenderEngineTest::clearLeftRegion() { |
| 633 | renderengine::DisplaySettings settings; |
| 634 | settings.physicalDisplay = fullscreenRect(); |
| 635 | // Here logical space is 4x4 |
| 636 | settings.clip = Rect(4, 4); |
| 637 | settings.globalTransform = mat4::scale(vec4(2, 4, 0, 1)); |
| 638 | settings.clearRegion = Region(Rect(1, 1)); |
| 639 | std::vector<renderengine::LayerSettings> layers; |
| 640 | // dummy layer, without bounds should not render anything |
| 641 | renderengine::LayerSettings layer; |
| 642 | layers.push_back(layer); |
| 643 | invokeDraw(settings, layers, mBuffer); |
| 644 | } |
| 645 | |
| 646 | void RenderEngineTest::fillBufferThenClearRegion() { |
| 647 | fillGreenBuffer<ColorSourceVariant>(); |
| 648 | // Reuse mBuffer |
| 649 | clearLeftRegion(); |
| 650 | expectBufferColor(Rect(DEFAULT_DISPLAY_WIDTH / 2, DEFAULT_DISPLAY_HEIGHT), 0, 0, 0, 255); |
| 651 | expectBufferColor(Rect(DEFAULT_DISPLAY_WIDTH / 2, 0, DEFAULT_DISPLAY_WIDTH, |
| 652 | DEFAULT_DISPLAY_HEIGHT), |
| 653 | 0, 255, 0, 255); |
| 654 | } |
| 655 | |
Alec Mouri | 1089aed | 2018-10-25 21:33:57 -0700 | [diff] [blame] | 656 | TEST_F(RenderEngineTest, drawLayers_noLayersToDraw) { |
| 657 | drawEmptyLayers(); |
| 658 | } |
| 659 | |
| 660 | TEST_F(RenderEngineTest, drawLayers_fillRedBuffer_colorSource) { |
| 661 | fillRedBuffer<ColorSourceVariant>(); |
| 662 | } |
| 663 | |
| 664 | TEST_F(RenderEngineTest, drawLayers_fillGreenBuffer_colorSource) { |
| 665 | fillGreenBuffer<ColorSourceVariant>(); |
| 666 | } |
| 667 | |
| 668 | TEST_F(RenderEngineTest, drawLayers_fillBlueBuffer_colorSource) { |
| 669 | fillBlueBuffer<ColorSourceVariant>(); |
| 670 | } |
| 671 | |
| 672 | TEST_F(RenderEngineTest, drawLayers_fillRedTransparentBuffer_colorSource) { |
| 673 | fillRedTransparentBuffer<ColorSourceVariant>(); |
| 674 | } |
| 675 | |
| 676 | TEST_F(RenderEngineTest, drawLayers_fillBufferPhysicalOffset_colorSource) { |
| 677 | fillBufferPhysicalOffset<ColorSourceVariant>(); |
| 678 | } |
| 679 | |
| 680 | TEST_F(RenderEngineTest, drawLayers_fillBufferCheckersRotate0_colorSource) { |
| 681 | fillBufferCheckersRotate0<ColorSourceVariant>(); |
| 682 | } |
| 683 | |
| 684 | TEST_F(RenderEngineTest, drawLayers_fillBufferCheckersRotate90_colorSource) { |
| 685 | fillBufferCheckersRotate90<ColorSourceVariant>(); |
| 686 | } |
| 687 | |
| 688 | TEST_F(RenderEngineTest, drawLayers_fillBufferCheckersRotate180_colorSource) { |
| 689 | fillBufferCheckersRotate180<ColorSourceVariant>(); |
| 690 | } |
| 691 | |
| 692 | TEST_F(RenderEngineTest, drawLayers_fillBufferCheckersRotate270_colorSource) { |
| 693 | fillBufferCheckersRotate270<ColorSourceVariant>(); |
| 694 | } |
| 695 | |
| 696 | TEST_F(RenderEngineTest, drawLayers_fillBufferLayerTransform_colorSource) { |
| 697 | fillBufferLayerTransform<ColorSourceVariant>(); |
| 698 | } |
| 699 | |
| 700 | TEST_F(RenderEngineTest, drawLayers_fillBufferColorTransform_colorSource) { |
| 701 | fillBufferLayerTransform<ColorSourceVariant>(); |
Alec Mouri | 6e57f68 | 2018-09-29 20:45:08 -0700 | [diff] [blame] | 702 | } |
| 703 | |
Alec Mouri | 0d5e1eb | 2018-11-10 20:40:12 -0800 | [diff] [blame] | 704 | TEST_F(RenderEngineTest, drawLayers_fillRedBuffer_opaqueBufferSource) { |
| 705 | fillRedBuffer<BufferSourceVariant<ForceOpaqueBufferVariant>>(); |
| 706 | } |
| 707 | |
| 708 | TEST_F(RenderEngineTest, drawLayers_fillGreenBuffer_opaqueBufferSource) { |
| 709 | fillGreenBuffer<BufferSourceVariant<ForceOpaqueBufferVariant>>(); |
| 710 | } |
| 711 | |
| 712 | TEST_F(RenderEngineTest, drawLayers_fillBlueBuffer_opaqueBufferSource) { |
| 713 | fillBlueBuffer<BufferSourceVariant<ForceOpaqueBufferVariant>>(); |
| 714 | } |
| 715 | |
| 716 | TEST_F(RenderEngineTest, drawLayers_fillRedTransparentBuffer_opaqueBufferSource) { |
| 717 | fillRedTransparentBuffer<BufferSourceVariant<ForceOpaqueBufferVariant>>(); |
| 718 | } |
| 719 | |
| 720 | TEST_F(RenderEngineTest, drawLayers_fillBufferPhysicalOffset_opaqueBufferSource) { |
| 721 | fillBufferPhysicalOffset<BufferSourceVariant<ForceOpaqueBufferVariant>>(); |
| 722 | } |
| 723 | |
| 724 | TEST_F(RenderEngineTest, drawLayers_fillBufferCheckersRotate0_opaqueBufferSource) { |
| 725 | fillBufferCheckersRotate0<BufferSourceVariant<ForceOpaqueBufferVariant>>(); |
| 726 | } |
| 727 | |
| 728 | TEST_F(RenderEngineTest, drawLayers_fillBufferCheckersRotate90_opaqueBufferSource) { |
| 729 | fillBufferCheckersRotate90<BufferSourceVariant<ForceOpaqueBufferVariant>>(); |
| 730 | } |
| 731 | |
| 732 | TEST_F(RenderEngineTest, drawLayers_fillBufferCheckersRotate180_opaqueBufferSource) { |
| 733 | fillBufferCheckersRotate180<BufferSourceVariant<ForceOpaqueBufferVariant>>(); |
| 734 | } |
| 735 | |
| 736 | TEST_F(RenderEngineTest, drawLayers_fillBufferCheckersRotate270_opaqueBufferSource) { |
| 737 | fillBufferCheckersRotate270<BufferSourceVariant<ForceOpaqueBufferVariant>>(); |
| 738 | } |
| 739 | |
| 740 | TEST_F(RenderEngineTest, drawLayers_fillBufferLayerTransform_opaqueBufferSource) { |
| 741 | fillBufferLayerTransform<BufferSourceVariant<ForceOpaqueBufferVariant>>(); |
| 742 | } |
| 743 | |
| 744 | TEST_F(RenderEngineTest, drawLayers_fillBufferColorTransform_opaqueBufferSource) { |
| 745 | fillBufferLayerTransform<BufferSourceVariant<ForceOpaqueBufferVariant>>(); |
| 746 | } |
| 747 | |
| 748 | TEST_F(RenderEngineTest, drawLayers_fillRedBuffer_bufferSource) { |
| 749 | fillRedBuffer<BufferSourceVariant<RelaxOpaqueBufferVariant>>(); |
| 750 | } |
| 751 | |
| 752 | TEST_F(RenderEngineTest, drawLayers_fillGreenBuffer_bufferSource) { |
| 753 | fillGreenBuffer<BufferSourceVariant<RelaxOpaqueBufferVariant>>(); |
| 754 | } |
| 755 | |
| 756 | TEST_F(RenderEngineTest, drawLayers_fillBlueBuffer_bufferSource) { |
| 757 | fillBlueBuffer<BufferSourceVariant<RelaxOpaqueBufferVariant>>(); |
| 758 | } |
| 759 | |
| 760 | TEST_F(RenderEngineTest, drawLayers_fillRedTransparentBuffer_bufferSource) { |
| 761 | fillRedTransparentBuffer<BufferSourceVariant<RelaxOpaqueBufferVariant>>(); |
| 762 | } |
| 763 | |
| 764 | TEST_F(RenderEngineTest, drawLayers_fillBufferPhysicalOffset_bufferSource) { |
| 765 | fillBufferPhysicalOffset<BufferSourceVariant<RelaxOpaqueBufferVariant>>(); |
| 766 | } |
| 767 | |
| 768 | TEST_F(RenderEngineTest, drawLayers_fillBufferCheckersRotate0_bufferSource) { |
| 769 | fillBufferCheckersRotate0<BufferSourceVariant<RelaxOpaqueBufferVariant>>(); |
| 770 | } |
| 771 | |
| 772 | TEST_F(RenderEngineTest, drawLayers_fillBufferCheckersRotate90_bufferSource) { |
| 773 | fillBufferCheckersRotate90<BufferSourceVariant<RelaxOpaqueBufferVariant>>(); |
| 774 | } |
| 775 | |
| 776 | TEST_F(RenderEngineTest, drawLayers_fillBufferCheckersRotate180_bufferSource) { |
| 777 | fillBufferCheckersRotate180<BufferSourceVariant<RelaxOpaqueBufferVariant>>(); |
| 778 | } |
| 779 | |
| 780 | TEST_F(RenderEngineTest, drawLayers_fillBufferCheckersRotate270_bufferSource) { |
| 781 | fillBufferCheckersRotate270<BufferSourceVariant<RelaxOpaqueBufferVariant>>(); |
| 782 | } |
| 783 | |
| 784 | TEST_F(RenderEngineTest, drawLayers_fillBufferLayerTransform_bufferSource) { |
| 785 | fillBufferLayerTransform<BufferSourceVariant<RelaxOpaqueBufferVariant>>(); |
| 786 | } |
| 787 | |
| 788 | TEST_F(RenderEngineTest, drawLayers_fillBufferColorTransform_bufferSource) { |
| 789 | fillBufferLayerTransform<BufferSourceVariant<RelaxOpaqueBufferVariant>>(); |
| 790 | } |
| 791 | |
| 792 | TEST_F(RenderEngineTest, drawLayers_fillBufferTextureTransform) { |
| 793 | fillBufferTextureTransform(); |
| 794 | } |
| 795 | |
| 796 | TEST_F(RenderEngineTest, drawLayers_fillBuffer_premultipliesAlpha) { |
| 797 | fillBufferWithPremultiplyAlpha(); |
| 798 | } |
| 799 | |
| 800 | TEST_F(RenderEngineTest, drawLayers_fillBuffer_withoutPremultiplyingAlpha) { |
| 801 | fillBufferWithoutPremultiplyAlpha(); |
| 802 | } |
| 803 | |
Alec Mouri | ac33553 | 2018-11-12 15:01:33 -0800 | [diff] [blame^] | 804 | TEST_F(RenderEngineTest, drawLayers_fillBufferThenClearRegion) { |
| 805 | fillBufferThenClearRegion(); |
| 806 | } |
| 807 | |
Alec Mouri | 6e57f68 | 2018-09-29 20:45:08 -0700 | [diff] [blame] | 808 | } // namespace android |