blob: 5366cc429e96b82430cc73976289dc41351c4340 [file] [log] [blame]
Jason Sams326e0dd2009-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_STRUCTURED_COMPONENT_H
18#define ANDROID_RS_STRUCTURED_COMPONENT_H
19
Jason Sams1aa5a4e2009-06-22 17:15:15 -070020#include "rsUtils.h"
Jason Sams326e0dd2009-05-22 14:03:28 -070021#include "rsObjectBase.h"
22
23// ---------------------------------------------------------------------------
24namespace android {
25namespace renderscript {
26
27class Component : public ObjectBase
28{
29public:
30 enum DataType {
31 FLOAT,
32 UNSIGNED,
33 SIGNED
34 };
35
36 enum DataKind {
Jason Samse0158412009-08-20 16:10:36 -070037 USER,
Jason Sams326e0dd2009-05-22 14:03:28 -070038 RED, GREEN, BLUE, ALPHA, LUMINANCE, INTENSITY,
39 X, Y, Z, W,
40 S, T, Q, R,
41 NX, NY, NZ,
42 INDEX,
Jason Samse0158412009-08-20 16:10:36 -070043 POINT_SIZE
Jason Sams326e0dd2009-05-22 14:03:28 -070044 };
45
46
Jason Samse514b452009-09-25 14:51:22 -070047 Component(Context *rsc, DataKind dk, DataType dt, bool isNorm, uint32_t bits, const char *);
Jason Sams326e0dd2009-05-22 14:03:28 -070048 virtual ~Component();
49
50 DataType getType() const {return mType;}
51 bool getIsNormalized() const {return mIsNormalized;}
52 DataKind getKind() const {return mKind;}
53 uint32_t getBits() const {return mBits;}
54
Jason Samse5ffb872009-08-09 17:01:55 -070055 uint32_t getGLType() const;
Jason Samsfa517192009-08-13 12:59:04 -070056 const char * getCType() const;
Jason Samse5ffb872009-08-09 17:01:55 -070057
Jason Sams8b2c0652009-08-12 17:54:11 -070058 const char * getComponentName() const {return mName.string();}
Jason Samse12c1c52009-09-27 17:50:38 -070059 virtual void dumpLOGV(const char *prefix) const;
Jason Sams8b2c0652009-08-12 17:54:11 -070060
Jason Sams326e0dd2009-05-22 14:03:28 -070061protected:
62
63 DataType mType;
64 bool mIsNormalized;
65 DataKind mKind;
66 uint32_t mBits;
Jason Sams8b2c0652009-08-12 17:54:11 -070067 String8 mName;
Jason Sams326e0dd2009-05-22 14:03:28 -070068
69private:
Jason Samse514b452009-09-25 14:51:22 -070070 Component(Context *rsc);
Jason Sams326e0dd2009-05-22 14:03:28 -070071};
72
73
74}
75}
76
77#endif //ANDROID_RS_STRUCTURED_COMPONENT_H
78