1 /* 2 * Copyright (C) 2009 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 ANDROID_RS_PROGRAM_FRAGMENT_STORE_H 18 #define ANDROID_RS_PROGRAM_FRAGMENT_STORE_H 19 20 #include "rsProgram.h" 21 22 // --------------------------------------------------------------------------- 23 namespace android { 24 namespace renderscript { 25 26 class ProgramFragmentStoreState; 27 28 class ProgramFragmentStore : public Program 29 { 30 public: 31 ProgramFragmentStore(Context *); 32 virtual ~ProgramFragmentStore(); 33 34 virtual void setupGL(const Context *, ProgramFragmentStoreState *); 35 virtual void setupGL2(const Context *, ProgramFragmentStoreState *); 36 37 void setDepthFunc(RsDepthFunc); 38 void setDepthMask(bool); 39 40 void setBlendFunc(RsBlendSrcFunc src, RsBlendDstFunc dst); 41 void setColorMask(bool, bool, bool, bool); 42 43 void setDitherEnable(bool); 44 45 protected: 46 bool mDitherEnable; 47 48 bool mBlendEnable; 49 bool mColorRWriteEnable; 50 bool mColorGWriteEnable; 51 bool mColorBWriteEnable; 52 bool mColorAWriteEnable; 53 int32_t mBlendSrc; 54 int32_t mBlendDst; 55 56 bool mDepthTestEnable; 57 bool mDepthWriteEnable; 58 int32_t mDepthFunc; 59 60 bool mStencilTestEnable; 61 }; 62 63 class ProgramFragmentStoreState 64 { 65 public: 66 ProgramFragmentStoreState(); 67 ~ProgramFragmentStoreState(); 68 void init(Context *rsc, int32_t w, int32_t h); 69 void deinit(Context *rsc); 70 71 ObjectBaseRef<ProgramFragmentStore> mDefault; 72 ObjectBaseRef<ProgramFragmentStore> mLast; 73 74 75 ProgramFragmentStore *mPFS; 76 }; 77 78 79 } 80 } 81 #endif 82 83 84 85