1 /* 2 * Copyright 2023 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 package androidx.graphics.lowlatency 18 19 import android.opengl.GLES20 20 21 /** 22 * Class that represents information about the current buffer that is target for rendered output 23 * 24 * @param width Current width of the buffer taking pre-rotation into account. 25 * @param height Current height of the buffer taking pre-rotation into account 26 * @param frameBufferId Frame buffer object identifier. This is useful for retargeting rendering 27 * operations to the original destination after rendering to intermediate scratch buffers. 28 */ 29 class BufferInfo internal constructor(width: Int = 0, height: Int = 0, frameBufferId: Int = -1) { 30 31 /** 32 * Width of the buffer that is being rendered into. This can be different than the corresponding 33 * dimensions specified as pre-rotation can occasionally swap width and height parameters in 34 * order to avoid GPU composition to rotate content. This should be used as input to 35 * [GLES20.glViewport]. 36 */ 37 var width: Int = width 38 internal set 39 40 /** 41 * Height of the buffer that is being rendered into. This can be different than the 42 * corresponding dimensions specified as pre-rotation can occasionally swap width and height 43 * parameters in order to avoid GPU composition to rotate content. This should be used as input 44 * to [GLES20.glViewport]. 45 */ 46 var height: Int = height 47 internal set 48 49 /** 50 * Identifier of the destination frame buffer object that is being rendered into. This is useful 51 * for re-binding to the original target after rendering to intermediate frame buffer objects. 52 */ 53 var frameBufferId: Int = frameBufferId 54 internal set 55 } 56