rsdGL.h revision c19ff0177a7a0dadfc01b1990f822354fdc95991
1/*
2 * Copyright (C) 2011 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 RSD_GL_H
18#define RSD_GL_H
19
20#include <rs_hal.h>
21
22class RsdShaderCache;
23class RsdVertexArrayState;
24
25typedef void (* InvokeFunc_t)(void);
26typedef void (*WorkerCallback_t)(void *usr, uint32_t idx);
27
28typedef struct RsdGLRec {
29    struct {
30        EGLint numConfigs;
31        EGLint majorVersion;
32        EGLint minorVersion;
33        EGLConfig config;
34        EGLContext context;
35        EGLSurface surface;
36        EGLSurface surfaceDefault;
37        EGLDisplay display;
38    } egl;
39
40    struct {
41        const uint8_t * vendor;
42        const uint8_t * renderer;
43        const uint8_t * version;
44        const uint8_t * extensions;
45
46        uint32_t majorVersion;
47        uint32_t minorVersion;
48
49        int32_t maxVaryingVectors;
50        int32_t maxTextureImageUnits;
51
52        int32_t maxFragmentTextureImageUnits;
53        int32_t maxFragmentUniformVectors;
54
55        int32_t maxVertexAttribs;
56        int32_t maxVertexUniformVectors;
57        int32_t maxVertexTextureUnits;
58
59        bool OES_texture_npot;
60        bool GL_IMG_texture_npot;
61        bool GL_NV_texture_npot_2D_mipmap;
62        float EXT_texture_max_aniso;
63    } gl;
64
65    ANativeWindow *wndSurface;
66    uint32_t width;
67    uint32_t height;
68    RsdShaderCache *shaderCache;
69    RsdVertexArrayState *vertexArrayState;
70} RsdGL;
71
72
73
74bool rsdGLInit(const android::renderscript::Context *rsc);
75void rsdGLShutdown(const android::renderscript::Context *rsc);
76bool rsdGLSetSurface(const android::renderscript::Context *rsc,
77                     uint32_t w, uint32_t h, ANativeWindow *sur);
78void rsdGLSwap(const android::renderscript::Context *rsc);
79void rsdGLCheckError(const android::renderscript::Context *rsc,
80                     const char *msg, bool isFatal = false);
81
82#endif
83
84