Lines Matching refs:desc

132 void UploadData(const AHardwareBuffer_Desc& desc, GLenum format, GLenum type, const void* data) {  in UploadData()  argument
133 if (desc.layers <= 1) { in UploadData()
134 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, desc.width, desc.height, format, type, data); in UploadData()
136 for (uint32_t layer = 0; layer < desc.layers; ++layer) { in UploadData()
137 glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, layer, desc.width, desc.height, 1, in UploadData()
144 void UploadRedPixels(const AHardwareBuffer_Desc& desc) { in UploadRedPixels() argument
145 const bool use_srgb = desc.stride & kUseSrgb; in UploadRedPixels()
147 switch (desc.format) { in UploadRedPixels()
153 const int size = desc.width * desc.height * 3; in UploadRedPixels()
160 UploadData(desc, GL_RGB, GL_UNSIGNED_BYTE, pixels.get()); in UploadRedPixels()
166 const int size = desc.width * desc.height * 4; in UploadRedPixels()
174 UploadData(desc, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get()); in UploadRedPixels()
179 const int size = desc.width * desc.height * 4; in UploadRedPixels()
187 UploadData(desc, GL_RGBA, GL_FLOAT, pixels.get()); in UploadRedPixels()
192 const int size = desc.width * desc.height; in UploadRedPixels()
198 UploadData(desc, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV_EXT, pixels.get()); in UploadRedPixels()
613 virtual bool SetUpBuffer(const AHardwareBuffer_Desc& desc);
616 void SetUpTexture(const AHardwareBuffer_Desc& desc, int unit);
733 bool AHardwareBufferGLTest::SetUpBuffer(const AHardwareBuffer_Desc& desc) { in SetUpBuffer() argument
734 const bool use_srgb = desc.stride & kUseSrgb; in SetUpBuffer()
735 if (desc.usage & AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP) { in SetUpBuffer()
736 if (desc.layers > 6) { in SetUpBuffer()
747 if (desc.layers > 1) { in SetUpBuffer()
758 if (desc.format == GL_SRGB8_ALPHA8 && mGLVersion < 30) { in SetUpBuffer()
763 if (desc.format == GL_RGB10_A2 && mGLVersion < 30) { in SetUpBuffer()
768 if (desc.format == GL_RGBA16F && mGLVersion < 30) { in SetUpBuffer()
777 if (desc.stride & kGlFormat) { in SetUpBuffer()
785 if (desc.usage & AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP && in SetUpBuffer()
792 int result = AHardwareBuffer_allocate(&desc, &mBuffer); in SetUpBuffer()
796 AHBFormatAsString(desc.format)); in SetUpBuffer()
800 if (desc.format == AHARDWAREBUFFER_FORMAT_BLOB) return true; in SetUpBuffer()
876 void AHardwareBufferGLTest::SetUpTexture(const AHardwareBuffer_Desc& desc, int unit) { in SetUpTexture() argument
881 if (desc.stride & kGlFormat) { in SetUpTexture()
883 if (desc.usage & AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE) { in SetUpTexture()
884 levels = MipLevelCount(desc.width, desc.height); in SetUpTexture()
887 if ((desc.usage & AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP) ? desc.layers > 6 : desc.layers > 1) { in SetUpTexture()
888 glTexStorage3D(mTexTarget, levels, desc.format, desc.width, desc.height, desc.layers); in SetUpTexture()
890 glTexStorage2D(mTexTarget, levels, desc.format, desc.width, desc.height); in SetUpTexture()
893 switch (desc.format) { in SetUpTexture()
913 if (desc.usage & AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP) { in SetUpTexture()
916 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level, desc.format, in SetUpTexture()
917 desc.width, desc.height, 0, format, type, nullptr); in SetUpTexture()
922 glTexImage2D(mTexTarget, level, desc.format, desc.width, desc.height, 0, in SetUpTexture()
1034 bool SetUpBuffer(const AHardwareBuffer_Desc& desc) override { in SetUpBuffer() argument
1036 return AHardwareBufferGLTest::SetUpBuffer(desc); in SetUpBuffer()
1042 AHardwareBuffer_Desc desc = GetParam(); in TEST_P() local
1043 desc.width = sizeof kQuadPositions; in TEST_P()
1044 desc.usage = AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER; in TEST_P()
1045 if (!SetUpBuffer(desc)) return; in TEST_P()
1051 SetUpBufferObject(desc.width, GL_ARRAY_BUFFER, in TEST_P()
1055 glMapBufferRange(GL_ARRAY_BUFFER, 0, desc.width, in TEST_P()
1058 memcpy(data, kQuadPositions, desc.width); in TEST_P()
1081 AHardwareBuffer_Desc desc = GetParam(); in TEST_P() local
1082 desc.width = sizeof kQuadPositions; in TEST_P()
1083 desc.usage = AHARDWAREBUFFER_USAGE_CPU_WRITE_RARELY | AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER; in TEST_P()
1084 if (!SetUpBuffer(desc)) return; in TEST_P()
1090 SetUpBufferObject(desc.width, GL_ARRAY_BUFFER, in TEST_P()
1095 std::vector<float> zero_data(desc.width / sizeof(float), 0.f); in TEST_P()
1096 glBufferSubData(GL_ARRAY_BUFFER, 0, desc.width, zero_data.data()); in TEST_P()
1104 memcpy(data, kQuadPositions, desc.width); in TEST_P()
1127 AHardwareBuffer_Desc desc = GetParam(); in TEST_P() local
1128 desc.width = sizeof kQuadPositions; in TEST_P()
1129 desc.usage = AHARDWAREBUFFER_USAGE_CPU_READ_RARELY | AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER; in TEST_P()
1132 if (!SetUpBuffer(desc)) return; in TEST_P()
1136 SetUpBufferObject(desc.width, GL_SHADER_STORAGE_BUFFER, in TEST_P()
1141 std::vector<float> zero_data(desc.width / sizeof(float), 0.f); in TEST_P()
1142 glBufferSubData(GL_SHADER_STORAGE_BUFFER, 0, desc.width, zero_data.data()); in TEST_P()
1164 EXPECT_EQ(0, memcmp(kQuadPositions, data, desc.width)) << s.str(); in TEST_P()
1178 bool SetUpBuffer(const AHardwareBuffer_Desc& desc) override { in SetUpBuffer() argument
1179 if ((desc.usage & AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT) && in SetUpBuffer()
1180 !IsFormatColorRenderable(desc.format, desc.stride & kUseSrgb)) { in SetUpBuffer()
1184 return AHardwareBufferGLTest::SetUpBuffer(desc); in SetUpBuffer()
1192 AHardwareBuffer_Desc desc = GetParam(); in TEST_P() local
1193 desc.width = 100; in TEST_P()
1194 desc.height = 100; in TEST_P()
1195 desc.usage = AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT; in TEST_P()
1197 if (desc.layers > 1) return; in TEST_P()
1198 if (!SetUpBuffer(desc)) return; in TEST_P()
1202 SetUpFramebuffer(desc.width, desc.height, 0, kBufferAsRenderbuffer); in TEST_P()
1207 DrawCheckerboard(desc.width, desc.height); in TEST_P()
1217 CheckGoldenPixels(goldens, desc.format); in TEST_P()
1222 AHardwareBuffer_Desc desc = GetParam(); in TEST_P() local
1223 desc.width = 10; in TEST_P()
1224 desc.height = 10; in TEST_P()
1225 desc.usage = AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT | AHARDWAREBUFFER_USAGE_CPU_READ_RARELY; in TEST_P()
1227 if ((desc.stride & kGlFormat) || desc.layers > 1) return; in TEST_P()
1228 if (!SetUpBuffer(desc)) return; in TEST_P()
1231 SetUpFramebuffer(desc.width, desc.height, 0, kBufferAsRenderbuffer); in TEST_P()
1234 DrawCheckerboard(desc.width, desc.height); in TEST_P()
1239 AHardwareBuffer_describe(mBuffer, &desc); in TEST_P()
1252 ptrdiff_t row_offset = golden.y * desc.stride; in TEST_P()
1253 switch (desc.format) { in TEST_P()
1259 if (desc.format == AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM) { in TEST_P()
1262 CheckGoldenPixel(golden, pixel_to_check, desc.format); in TEST_P()
1270 CheckGoldenPixel(golden, pixel_to_check, desc.format); in TEST_P()
1282 CheckGoldenPixel(golden, pixel_to_check, desc.format); in TEST_P()
1304 CheckGoldenPixel(golden, pixel_to_check, desc.format); in TEST_P()
1317 AHardwareBuffer_Desc desc = GetParam(); in TEST_P() local
1318 desc.usage = AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE; in TEST_P()
1319 if (!SetUpBuffer(desc)) return; in TEST_P()
1325 SetUpTexture(desc, kTextureUnit); in TEST_P()
1328 UploadRedPixels(desc); in TEST_P()
1337 if (desc.layers > 1) { in TEST_P()
1348 if (desc.stride & kUseSrgb) { in TEST_P()
1349 color = FormatHasAlpha(desc.format) ? kRed50 : kRed50Alpha100; in TEST_P()
1363 AHardwareBuffer_Desc desc = GetParam(); in TEST_P() local
1364 desc.usage = AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT | AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE; in TEST_P()
1365 if (!SetUpBuffer(desc)) return; in TEST_P()
1371 SetUpTexture(desc, kTextureUnit); in TEST_P()
1375 SetUpFramebuffer(desc.width, desc.height, desc.layers - 1, kBufferAsTexture); in TEST_P()
1376 DrawCheckerboard(desc.width, desc.height); in TEST_P()
1385 if (desc.layers > 1) { in TEST_P()
1397 const GoldenColor kCBBlack = FormatHasAlpha(desc.format) ? kZero : kBlack; in TEST_P()
1409 AHardwareBuffer_Desc desc = GetParam(); in TEST_P() local
1411 desc.width = std::max(8u, RoundUpToPowerOf2(desc.width)); in TEST_P()
1412 desc.height = std::max(8u, RoundUpToPowerOf2(desc.height)); in TEST_P()
1413 desc.usage = in TEST_P()
1417 if (!SetUpBuffer(desc)) return; in TEST_P()
1422 SetUpTexture(desc, kTextureUnit); in TEST_P()
1427 const int kTileWidth = desc.width / kNumTiles; in TEST_P()
1428 const int kTileHeight = desc.height / kNumTiles; in TEST_P()
1429 SetUpFramebuffer(desc.width, desc.height, desc.layers - 1, kBufferAsTexture); in TEST_P()
1444 SetUpFramebuffer(1, 1, desc.layers - 1, kBufferAsTexture, kNone, kNone, kNone, in TEST_P()
1445 MipLevelCount(desc.width, desc.height) - 1); in TEST_P()
1446 std::vector<GoldenPixel> goldens{{0, 0, (desc.stride & kUseSrgb) ? kRed50Srgb : kRed50}}; in TEST_P()
1447 CheckGoldenPixels(goldens, desc.format); in TEST_P()
1451 AHardwareBuffer_Desc desc = GetParam(); in TEST_P() local
1452 desc.usage = in TEST_P()
1456 desc.height = desc.width; in TEST_P()
1457 desc.layers *= 6; in TEST_P()
1458 if (!SetUpBuffer(desc)) return; in TEST_P()
1463 SetUpTexture(desc, kTextureUnit); in TEST_P()
1467 SetUpFramebuffer(desc.width, desc.height, desc.layers - 6 + i, kBufferAsTexture); in TEST_P()
1468 DrawCheckerboard(desc.width, desc.height); in TEST_P()
1473 if (desc.layers > 6) { in TEST_P()
1488 const GoldenColor kCBBlack = FormatHasAlpha(desc.format) ? kZero : kBlack; in TEST_P()
1501 AHardwareBuffer_Desc desc = GetParam(); in TEST_P() local
1502 desc.usage = in TEST_P()
1508 desc.width = std::max(8u, RoundUpToPowerOf2(desc.width)); in TEST_P()
1509 desc.height = desc.width; in TEST_P()
1510 desc.layers *= 6; in TEST_P()
1511 if (!SetUpBuffer(desc)) return; in TEST_P()
1515 SetUpTexture(desc, 5); in TEST_P()
1518 const int kTileSize = desc.width / kNumTiles; in TEST_P()
1521 SetUpFramebuffer(desc.width, desc.height, desc.layers - 6 + face, kBufferAsTexture); in TEST_P()
1537 SetUpFramebuffer(1, 1, desc.layers - 6 + face, kBufferAsTexture, kNone, kNone, kNone, in TEST_P()
1538 MipLevelCount(desc.width, desc.height) - 1); in TEST_P()
1539 std::vector<GoldenPixel> goldens{{0, 0, (desc.stride & kUseSrgb) ? kRed50Srgb : kRed50}}; in TEST_P()
1540 CheckGoldenPixels(goldens, desc.format); in TEST_P()
1589 AHardwareBuffer_Desc desc = GetParam(); in TEST_P() local
1590 desc.width = 40; in TEST_P()
1591 desc.height = 40; in TEST_P()
1592 desc.usage = AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT; in TEST_P()
1594 if (desc.layers > 1) return; in TEST_P()
1595 if (!SetUpBuffer(desc)) return; in TEST_P()
1630 AHardwareBuffer_Desc desc = GetParam(); in TEST_P() local
1631 desc.usage = AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT | AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE; in TEST_P()
1635 if (!SetUpBuffer(desc)) return; in TEST_P()
1642 SetUpTexture(desc, kTextureUnit); in TEST_P()
1648 SetUpFramebuffer(desc.width, desc.height, desc.layers - 1, kNone, kBufferAsTexture); in TEST_P()
1658 if (desc.layers > 1) { in TEST_P()
1679 AHardwareBuffer_Desc desc = GetParam(); in TEST_P() local
1680 desc.usage = in TEST_P()
1684 desc.height = desc.width; in TEST_P()
1685 desc.layers *= 6; in TEST_P()
1686 if (!SetUpBuffer(desc)) return; in TEST_P()
1691 SetUpTexture(desc, kTextureUnit); in TEST_P()
1698 SetUpFramebuffer(desc.width, desc.height, desc.layers - 6 + i, kNone, kBufferAsTexture); in TEST_P()
1700 glScissor(0, 0, desc.width, desc.height); in TEST_P()
1703 glScissor(0, 0, desc.width / 2, desc.height / 2); in TEST_P()
1705 glScissor(desc.width / 2, desc.height / 2, desc.width / 2, desc.height / 2); in TEST_P()
1712 if (desc.layers > 6) { in TEST_P()
1767 AHardwareBuffer_Desc desc = GetParam(); in TEST_P() local
1768 desc.width = 40; in TEST_P()
1769 desc.height = 40; in TEST_P()
1770 desc.usage = AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT; in TEST_P()
1772 if (desc.layers > 1) return; in TEST_P()
1773 if (!SetUpBuffer(desc)) return; in TEST_P()
1818 AHardwareBuffer_Desc desc = GetParam(); in TEST_P() local
1819 desc.usage = AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT | AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE; in TEST_P()
1821 desc.format == GL_STENCIL_INDEX8 || desc.format == AHARDWAREBUFFER_FORMAT_S8_UINT; in TEST_P()
1825 if (desc.format == GL_STENCIL_INDEX8 && !HasGLExtension("GL_OES_texture_stencil8")) return; in TEST_P()
1828 if (!SetUpBuffer(desc)) return; in TEST_P()
1833 SetUpTexture(desc, kTextureUnit); in TEST_P()
1842 SetUpFramebuffer(desc.width, desc.height, desc.layers - 1, in TEST_P()
1844 DrawCheckerboard(desc.width, desc.height); in TEST_P()
1850 desc.layers > 1 ? kStencilArrayFragmentShaderEs30 : kStencilFragmentShaderEs30, in TEST_P()