1 // Copyright 2022 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #include "AstcCpuDecompressor.h"
16
17 namespace gfxstream {
18 namespace vk {
19 namespace {
20
21 class AstcCpuDecompressorNoOp : public AstcCpuDecompressor {
22 public:
available() const23 bool available() const override { return false; }
24
decompress(uint32_t imgWidth,uint32_t imgHeight,uint32_t blockWidth,uint32_t blockHeight,const uint8_t * astcData,size_t astcDataLength,uint8_t * output)25 int32_t decompress(uint32_t imgWidth, uint32_t imgHeight, uint32_t blockWidth,
26 uint32_t blockHeight, const uint8_t* astcData, size_t astcDataLength,
27 uint8_t* output) override {
28 return -1;
29 };
30
getStatusString(int32_t statusCode) const31 const char* getStatusString(int32_t statusCode) const override {
32 return "ASTC CPU decomp not available";
33 }
34 };
35
36 } // namespace
37
get()38 AstcCpuDecompressor& AstcCpuDecompressor::get() {
39 static AstcCpuDecompressorNoOp instance;
40 return instance;
41 }
42
43 } // namespace vk
44 } // namespace gfxstream
45