Jason Sams | 803626f | 2011-04-06 17:52:23 -0700 | [diff] [blame] | 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 | |
Alex Sakhartchouk | 4a36b45 | 2011-04-29 16:49:08 -0700 | [diff] [blame^] | 22 | class RsdShaderCache; |
| 23 | class RsdVertexArrayState; |
Jason Sams | 803626f | 2011-04-06 17:52:23 -0700 | [diff] [blame] | 24 | |
| 25 | typedef void (* InvokeFunc_t)(void); |
| 26 | typedef void (*WorkerCallback_t)(void *usr, uint32_t idx); |
| 27 | |
| 28 | typedef 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; |
Alex Sakhartchouk | 4a36b45 | 2011-04-29 16:49:08 -0700 | [diff] [blame^] | 68 | RsdShaderCache *shaderCache; |
| 69 | RsdVertexArrayState *vertexArrayState; |
Jason Sams | 803626f | 2011-04-06 17:52:23 -0700 | [diff] [blame] | 70 | } RsdGL; |
| 71 | |
| 72 | |
| 73 | |
| 74 | bool rsdGLInit(const android::renderscript::Context *rsc); |
| 75 | void rsdGLShutdown(const android::renderscript::Context *rsc); |
| 76 | bool rsdGLSetSurface(const android::renderscript::Context *rsc, |
| 77 | uint32_t w, uint32_t h, ANativeWindow *sur); |
| 78 | void rsdGLSwap(const android::renderscript::Context *rsc); |
| 79 | |
| 80 | #endif |
| 81 | |