diff options
| author | 2019-01-02 16:27:05 -0800 | |
|---|---|---|
| committer | 2019-01-02 16:27:05 -0800 | |
| commit | c4b9ce02d0a230acf8b4acbcf1d7cde8ca467c8c (patch) | |
| tree | 83a299416a938ace97e68f89d954f899639a1192 | |
| parent | 7b2e64b9e4a7b143f7b29bc5a8c0334f3741bbd9 (diff) | |
Fix AHardwareBuffer_isSupported for cube maps.
Cube maps need a multiple of 6 layers, but the function attempted a trial
allocation with 1 or 2 layers instead, which cannot succeed.
Bug: 121285176
Bug: 122267389
Test: Builds successfully.
Change-Id: Id4cf26359ad2884d597c6571501b452b930fa4fa
| -rw-r--r-- | libs/nativewindow/AHardwareBuffer.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libs/nativewindow/AHardwareBuffer.cpp b/libs/nativewindow/AHardwareBuffer.cpp index a19fe17d16..6ea127064b 100644 --- a/libs/nativewindow/AHardwareBuffer.cpp +++ b/libs/nativewindow/AHardwareBuffer.cpp @@ -268,7 +268,11 @@ int AHardwareBuffer_isSupported(const AHardwareBuffer_Desc* desc) { AHardwareBuffer_Desc trialDesc = *desc; trialDesc.width = 4; trialDesc.height = desc->format == AHARDWAREBUFFER_FORMAT_BLOB ? 1 : 4; - trialDesc.layers = desc->layers == 1 ? 1 : 2; + if (desc->usage & AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP) { + trialDesc.layers = desc->layers == 6 ? 6 : 12; + } else { + trialDesc.layers = desc->layers == 1 ? 1 : 2; + } AHardwareBuffer* trialBuffer = nullptr; int result = AHardwareBuffer_allocate(&trialDesc, &trialBuffer); if (result == NO_ERROR) { |