2 * Copyright 2013 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef SF_GLES20RENDERENGINE_H_
19 #define SF_GLES20RENDERENGINE_H_
22 #include <sys/types.h>
24 #include <GLES2/gl2.h>
26 #include "RenderEngine.h"
27 #include "ProgramCache.h"
28 #include "Description.h"
30 // ---------------------------------------------------------------------------
32 // ---------------------------------------------------------------------------
38 class GLES20RenderEngine : public RenderEngine {
39 GLuint mProtectedTexName;
40 GLint mMaxViewportDims[2];
41 GLint mMaxTextureSize;
54 Vector<Group> mGroupStack;
56 virtual void bindImageAsFramebuffer(EGLImageKHR image,
57 uint32_t* texName, uint32_t* fbName, uint32_t* status);
58 virtual void unbindFramebuffer(uint32_t texName, uint32_t fbName);
64 virtual ~GLES20RenderEngine();
66 virtual void dump(String8& result);
67 virtual void setViewportAndProjection(size_t vpw, size_t vph,
68 Rect sourceCrop, size_t hwh, bool yswap);
69 virtual void setupLayerBlending(bool premultipliedAlpha, bool opaque, int alpha);
70 virtual void setupDimLayerBlending(int alpha);
71 virtual void setupLayerTexturing(const Texture& texture);
72 virtual void setupLayerBlackedOut();
73 virtual void setupFillWithColor(float r, float g, float b, float a);
74 virtual void disableTexturing();
75 virtual void disableBlending();
77 virtual void drawMesh(const Mesh& mesh);
79 virtual void beginGroup(const mat4& colorTransform);
80 virtual void endGroup();
82 virtual size_t getMaxTextureSize() const;
83 virtual size_t getMaxViewportDims() const;
86 // ---------------------------------------------------------------------------
87 }; // namespace android
88 // ---------------------------------------------------------------------------
90 #endif /* SF_GLES20RENDERENGINE_H_ */