rsdFrameBufferObj.h revision 1cd84930b25bf12e094b416a0ea4ae5fe839f537
1/* 2 * Copyright (C) 2011 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 _RSD_FRAMEBUFFER_OBJ_H_ 18#define _RSD_FRAMEBUFFER_OBJ_H_ 19 20#include <rsContext.h> 21 22struct DrvAllocation; 23 24class RsdFrameBufferObj { 25public: 26 RsdFrameBufferObj(); 27 ~RsdFrameBufferObj(); 28 29 void setActive(const android::renderscript::Context *rsc); 30 void setColorTarget(DrvAllocation *color, uint32_t index) { 31 mColorTargets[index] = color; 32 mDirty = true; 33 } 34 void setDepthTarget(DrvAllocation *depth) { 35 mDepthTarget = depth; 36 mDirty = true; 37 } 38 void setDimensions(uint32_t width, uint32_t height) { 39 mWidth = width; 40 mHeight = height; 41 } 42protected: 43 uint32_t mFBOId; 44 DrvAllocation **mColorTargets; 45 uint32_t mColorTargetsCount; 46 DrvAllocation *mDepthTarget; 47 48 uint32_t mWidth; 49 uint32_t mHeight; 50 51 bool mDirty; 52 53 bool renderToFramebuffer(); 54 void checkError(const android::renderscript::Context *rsc); 55 void setColorAttachment(); 56 void setDepthAttachment(); 57}; 58 59#endif //_RSD_FRAMEBUFFER_STATE_H_ 60