1875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian/*
2875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian * Copyright 2013 The Android Open Source Project
3875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian *
4875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian * Licensed under the Apache License, Version 2.0 (the "License");
5875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian * you may not use this file except in compliance with the License.
6875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian * You may obtain a copy of the License at
7875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian *
8875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian *      http://www.apache.org/licenses/LICENSE-2.0
9875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian *
10875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian * Unless required by applicable law or agreed to in writing, software
11875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian * distributed under the License is distributed on an "AS IS" BASIS,
12875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian * See the License for the specific language governing permissions and
14875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian * limitations under the License.
15875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian */
16875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian
17875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian
18875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian#ifndef SF_GLES11RENDERENGINE_H_
19875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian#define SF_GLES11RENDERENGINE_H_
20875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian
21875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian#include <stdint.h>
22875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian#include <sys/types.h>
23875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian
24875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian#include <GLES/gl.h>
25875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian
26875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian#include "RenderEngine.h"
27875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian
28875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian// ---------------------------------------------------------------------------
29875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopiannamespace android {
30875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian// ---------------------------------------------------------------------------
31875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian
32875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopianclass String8;
333f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopianclass Mesh;
3449457ac092071a8f964f7f69156093657ccdc3d0Mathias Agopianclass Texture;
35875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian
36875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopianclass GLES11RenderEngine : public RenderEngine {
37875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian    GLuint mProtectedTexName;
38875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian    GLint mMaxViewportDims[2];
39875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian    GLint mMaxTextureSize;
40875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian
41458197de008be8fe561286b09f4edddb2f5c540aMathias Agopian    virtual void bindImageAsFramebuffer(EGLImageKHR image,
42458197de008be8fe561286b09f4edddb2f5c540aMathias Agopian            uint32_t* texName, uint32_t* fbName, uint32_t* status);
43458197de008be8fe561286b09f4edddb2f5c540aMathias Agopian    virtual void unbindFramebuffer(uint32_t texName, uint32_t fbName);
44458197de008be8fe561286b09f4edddb2f5c540aMathias Agopian
45875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopianpublic:
46875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian    GLES11RenderEngine();
47875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian
48875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopianprotected:
49875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian    virtual ~GLES11RenderEngine();
50875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian
51875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian    virtual void dump(String8& result);
523f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    virtual void setViewportAndProjection(size_t vpw, size_t vph, size_t w, size_t h, bool yswap);
53875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian    virtual void setupLayerBlending(bool premultipliedAlpha, bool opaque, int alpha);
54875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian    virtual void setupDimLayerBlending(int alpha);
5549457ac092071a8f964f7f69156093657ccdc3d0Mathias Agopian    virtual void setupLayerTexturing(const Texture& texture);
56875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian    virtual void setupLayerBlackedOut();
5719733a32799f792125913e746e8644d16f8dc223Mathias Agopian    virtual void setupFillWithColor(float r, float g, float b, float a) ;
58875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian    virtual void disableTexturing();
59875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian    virtual void disableBlending();
60875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian
613f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    virtual void drawMesh(const Mesh& mesh);
62875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian
63ff2ed70fa30f04b90dd1a2c06ec2319e157152d7Mathias Agopian    virtual void beginGroup(const mat4& colorTransform);
64ff2ed70fa30f04b90dd1a2c06ec2319e157152d7Mathias Agopian    virtual void endGroup();
65ff2ed70fa30f04b90dd1a2c06ec2319e157152d7Mathias Agopian
66875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian    virtual size_t getMaxTextureSize() const;
67875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian    virtual size_t getMaxViewportDims() const;
68875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian};
69875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian
70875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian// ---------------------------------------------------------------------------
71875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian}; // namespace android
72875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian// ---------------------------------------------------------------------------
73875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian
74875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian#endif /* SF_GLES11RENDERENGINE_H_ */
75