blob: ac15b70a7cb6374ff9e5903c88fc7d0507d7a963 [file] [log] [blame]
Jason Samsd19f10d2009-05-22 14:03:28 -07001/*
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_VERTEX_H
18#define ANDROID_RS_PROGRAM_VERTEX_H
19
20#include "rsProgram.h"
21
22// ---------------------------------------------------------------------------
23namespace android {
24namespace renderscript {
25
26
27class ProgramVertex : public Program
28{
29public:
30 const static uint32_t MAX_CONSTANTS = 2;
Jason Samsee411122009-07-21 12:20:54 -070031 const static uint32_t MAX_LIGHTS = 8;
Jason Samsd19f10d2009-05-22 14:03:28 -070032
33 ProgramVertex(Element *in, Element *out);
34 virtual ~ProgramVertex();
35
36 virtual void setupGL();
37
38
39 void setConstantType(uint32_t slot, const Type *);
40 void bindAllocation(uint32_t slot, Allocation *);
41 void setTextureMatrixEnable(bool e) {mTextureMatrixEnable = e;}
Jason Samsee411122009-07-21 12:20:54 -070042 void addLight(const Light *);
Jason Samsd19f10d2009-05-22 14:03:28 -070043
44protected:
45 bool mDirty;
Jason Samsee411122009-07-21 12:20:54 -070046 uint32_t mLightCount;
Jason Samsd19f10d2009-05-22 14:03:28 -070047
48 ObjectBaseRef<Allocation> mConstants[MAX_CONSTANTS];
49 ObjectBaseRef<const Type> mConstantTypes[MAX_CONSTANTS];
Jason Samsee411122009-07-21 12:20:54 -070050 ObjectBaseRef<const Light> mLights[MAX_LIGHTS];
51
Jason Samsd19f10d2009-05-22 14:03:28 -070052
53 // Hacks to create a program for now
54 bool mTextureMatrixEnable;
Jason Samsd19f10d2009-05-22 14:03:28 -070055
56};
57
58
59class ProgramVertexState
60{
61public:
62 ProgramVertexState();
63 ~ProgramVertexState();
64
Jason Sams9c54bdb2009-06-17 16:52:59 -070065 void init(Context *rsc, int32_t w, int32_t h);
66
67 ObjectBaseRef<ProgramVertex> mDefault;
68 ObjectBaseRef<Allocation> mDefaultAlloc;
Jason Samsee411122009-07-21 12:20:54 -070069
70
Jason Sams9c54bdb2009-06-17 16:52:59 -070071
Jason Samsd19f10d2009-05-22 14:03:28 -070072 ProgramVertex *mPV;
73
74 //ObjectBaseRef<Type> mTextureTypes[ProgramFragment::MAX_TEXTURE];
75
76
77};
78
79
80}
81}
82#endif
83
84