blob: 45d8c617b2334bd6eba2cfe330bd495ffb6375d7 [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_SAMPLER_H
18#define ANDROID_RS_SAMPLER_H
19
20#include <math.h>
21#include <EGL/egl.h>
22#include <GLES/gl.h>
23#include <GLES/glext.h>
24
25#include "rsAllocation.h"
26#include "RenderScript.h"
27
28// ---------------------------------------------------------------------------
29namespace android {
30namespace renderscript {
31
32const static uint32_t RS_MAX_SAMPLER_SLOT = 16;
33
34class SamplerState;
35
36class Sampler : public ObjectBase
37{
38public:
39 Sampler(RsSamplerValue magFilter,
40 RsSamplerValue minFilter,
41 RsSamplerValue wrapS,
42 RsSamplerValue wrapT,
43 RsSamplerValue wrapR);
44
45 virtual ~Sampler();
46
47 void bind(Allocation *);
48 void setupGL();
49
50 void bindToContext(SamplerState *, uint32_t slot);
51 void unbindFromContext(SamplerState *);
52
53protected:
54 RsSamplerValue mMagFilter;
55 RsSamplerValue mMinFilter;
56 RsSamplerValue mWrapS;
57 RsSamplerValue mWrapT;
58 RsSamplerValue mWrapR;
59
60 int32_t mBoundSlot;
61
62private:
63 Sampler();
64
65};
66
67
68class SamplerState
69{
70public:
71
72 RsSamplerValue mMagFilter;
73 RsSamplerValue mMinFilter;
74 RsSamplerValue mWrapS;
75 RsSamplerValue mWrapT;
76 RsSamplerValue mWrapR;
77
78
79 ObjectBaseRef<Sampler> mSamplers[RS_MAX_SAMPLER_SLOT];
80
81 void setupGL();
82
83};
84
85
86
87}
88}
89#endif //ANDROID_RS_SAMPLER_H
90
91
92