Home | History | Annotate | Download | only in driver
      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 
     22 struct DrvAllocation;
     23 
     24 class RsdFrameBufferObj {
     25 public:
     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     }
     42 protected:
     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