GLES20RenderEngine.h revision 458197de008be8fe561286b09f4edddb2f5c540a
1/* 2 * Copyright 2013 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 18#ifndef SF_GLES20RENDERENGINE_H_ 19#define SF_GLES20RENDERENGINE_H_ 20 21#include <stdint.h> 22#include <sys/types.h> 23 24#include <GLES2/gl2.h> 25 26#include "RenderEngine.h" 27#include "ProgramCache.h" 28#include "Description.h" 29 30// --------------------------------------------------------------------------- 31namespace android { 32// --------------------------------------------------------------------------- 33 34class String8; 35class Mesh; 36 37class GLES20RenderEngine : public RenderEngine { 38 GLuint mProtectedTexName; 39 GLint mMaxViewportDims[2]; 40 GLint mMaxTextureSize; 41 42 Description mState; 43 44 virtual void bindImageAsFramebuffer(EGLImageKHR image, 45 uint32_t* texName, uint32_t* fbName, uint32_t* status); 46 virtual void unbindFramebuffer(uint32_t texName, uint32_t fbName); 47 48public: 49 GLES20RenderEngine(); 50 51protected: 52 virtual ~GLES20RenderEngine(); 53 54 virtual void dump(String8& result); 55 virtual void setViewportAndProjection(size_t vpw, size_t vph, size_t w, size_t h, bool yswap); 56 virtual void setupLayerBlending(bool premultipliedAlpha, bool opaque, int alpha); 57 virtual void setupDimLayerBlending(int alpha); 58 virtual void setupLayerTexturing(size_t textureName, bool useFiltering, const float* textureMatrix); 59 virtual void setupLayerBlackedOut(); 60 virtual void disableTexturing(); 61 virtual void disableBlending(); 62 63 virtual void fillWithColor(const Mesh& mesh, float r, float g, float b, float a); 64 virtual void drawMesh(const Mesh& mesh); 65 66 virtual size_t getMaxTextureSize() const; 67 virtual size_t getMaxViewportDims() const; 68}; 69 70// --------------------------------------------------------------------------- 71}; // namespace android 72// --------------------------------------------------------------------------- 73 74#endif /* SF_GLES20RENDERENGINE_H_ */ 75