1 /* 2 * Copyright 2013 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 #ifndef SF_RENDER_ENGINE_DESCRIPTION_H_ 18 #define SF_RENDER_ENGINE_DESCRIPTION_H_ 19 20 #include <renderengine/Texture.h> 21 #include <ui/GraphicTypes.h> 22 23 namespace android { 24 namespace renderengine { 25 26 /* 27 * This is the structure that holds the state of the rendering engine. 28 * This class is used to generate a corresponding GLSL program and set the 29 * appropriate uniform. 30 */ 31 struct Description { 32 enum class TransferFunction : int { 33 LINEAR, 34 SRGB, 35 ST2084, 36 HLG, // Hybrid Log-Gamma for HDR. 37 }; 38 39 static TransferFunction dataSpaceToTransferFunction(ui::Dataspace dataSpace); 40 41 Description() = default; 42 ~Description() = default; 43 44 bool hasInputTransformMatrix() const; 45 bool hasOutputTransformMatrix() const; 46 bool hasColorMatrix() const; 47 48 // whether textures are premultiplied 49 bool isPremultipliedAlpha = false; 50 // whether this layer is marked as opaque 51 bool isOpaque = true; 52 53 // corner radius of the layer 54 float cornerRadius = 0; 55 56 // Size of the rounded rectangle we are cropping to 57 half2 cropSize; 58 59 // Texture this layer uses 60 Texture texture; 61 bool textureEnabled = false; 62 63 // color used when texturing is disabled or when setting alpha. 64 half4 color; 65 66 // true if the sampled pixel values are in Y410/BT2020 rather than RGBA 67 bool isY410BT2020 = false; 68 69 // transfer functions for the input/output 70 TransferFunction inputTransferFunction = TransferFunction::LINEAR; 71 TransferFunction outputTransferFunction = TransferFunction::LINEAR; 72 73 float displayMaxLuminance; 74 75 // projection matrix 76 mat4 projectionMatrix; 77 78 // The color matrix will be applied in linear space right before OETF. 79 mat4 colorMatrix; 80 mat4 inputTransformMatrix; 81 mat4 outputTransformMatrix; 82 }; 83 84 } // namespace renderengine 85 } // namespace android 86 87 #endif /* SF_RENDER_ENGINE_DESCRIPTION_H_ */ 88