• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2009-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 ANDROID_RS_PROGRAM_RASTER_H
18 #define ANDROID_RS_PROGRAM_RASTER_H
19 
20 #include "rsProgramBase.h"
21 
22 // ---------------------------------------------------------------------------
23 namespace android {
24 namespace renderscript {
25 
26 class ProgramRasterState;
27 
28 class ProgramRaster : public ProgramBase {
29 public:
30     virtual void setup(const Context *, ProgramRasterState *);
31     virtual void serialize(OStream *stream) const;
getClassId()32     virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_PROGRAM_RASTER; }
33     static ProgramRaster *createFromStream(Context *rsc, IStream *stream);
34 
35     static ObjectBaseRef<ProgramRaster> getProgramRaster(Context *rsc,
36                                                          bool pointSprite,
37                                                          RsCullMode cull);
38     struct Hal {
39         mutable void *drv;
40 
41         struct State {
42             bool pointSprite;
43             RsCullMode cull;
44         };
45         State state;
46     };
47     Hal mHal;
48 
49 protected:
50     virtual void preDestroy() const;
51     virtual ~ProgramRaster();
52 
53 private:
54     ProgramRaster(Context *rsc,
55                   bool pointSprite,
56                   RsCullMode cull);
57 
58 };
59 
60 class ProgramRasterState {
61 public:
62     ProgramRasterState();
63     ~ProgramRasterState();
64     void init(Context *rsc);
65     void deinit(Context *rsc);
66 
67     ObjectBaseRef<ProgramRaster> mDefault;
68     ObjectBaseRef<ProgramRaster> mLast;
69 
70     // Cache of all existing raster programs.
71     Vector<ProgramRaster *> mRasterPrograms;
72 };
73 
74 
75 }
76 }
77 #endif
78 
79 
80 
81 
82