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> |
Alex Sakhartchouk | 6c72eec | 2011-05-17 12:32:47 -0700 | [diff] [blame^] | 21 | #include <EGL/egl.h> |
Jason Sams | 803626f | 2011-04-06 17:52:23 -0700 | [diff] [blame] | 22 | |
Alex Sakhartchouk | 4a36b45 | 2011-04-29 16:49:08 -0700 | [diff] [blame] | 23 | class RsdShaderCache; |
| 24 | class RsdVertexArrayState; |
Jason Sams | 803626f | 2011-04-06 17:52:23 -0700 | [diff] [blame] | 25 | |
| 26 | typedef void (* InvokeFunc_t)(void); |
| 27 | typedef void (*WorkerCallback_t)(void *usr, uint32_t idx); |
| 28 | |
| 29 | typedef struct RsdGLRec { |
| 30 | struct { |
| 31 | EGLint numConfigs; |
| 32 | EGLint majorVersion; |
| 33 | EGLint minorVersion; |
| 34 | EGLConfig config; |
| 35 | EGLContext context; |
| 36 | EGLSurface surface; |
| 37 | EGLSurface surfaceDefault; |
| 38 | EGLDisplay display; |
| 39 | } egl; |
| 40 | |
| 41 | struct { |
| 42 | const uint8_t * vendor; |
| 43 | const uint8_t * renderer; |
| 44 | const uint8_t * version; |
| 45 | const uint8_t * extensions; |
| 46 | |
| 47 | uint32_t majorVersion; |
| 48 | uint32_t minorVersion; |
| 49 | |
| 50 | int32_t maxVaryingVectors; |
| 51 | int32_t maxTextureImageUnits; |
| 52 | |
| 53 | int32_t maxFragmentTextureImageUnits; |
| 54 | int32_t maxFragmentUniformVectors; |
| 55 | |
| 56 | int32_t maxVertexAttribs; |
| 57 | int32_t maxVertexUniformVectors; |
| 58 | int32_t maxVertexTextureUnits; |
| 59 | |
| 60 | bool OES_texture_npot; |
| 61 | bool GL_IMG_texture_npot; |
| 62 | bool GL_NV_texture_npot_2D_mipmap; |
| 63 | float EXT_texture_max_aniso; |
| 64 | } gl; |
| 65 | |
| 66 | ANativeWindow *wndSurface; |
| 67 | uint32_t width; |
| 68 | uint32_t height; |
Alex Sakhartchouk | 4a36b45 | 2011-04-29 16:49:08 -0700 | [diff] [blame] | 69 | RsdShaderCache *shaderCache; |
| 70 | RsdVertexArrayState *vertexArrayState; |
Jason Sams | 803626f | 2011-04-06 17:52:23 -0700 | [diff] [blame] | 71 | } RsdGL; |
| 72 | |
| 73 | |
| 74 | |
| 75 | bool rsdGLInit(const android::renderscript::Context *rsc); |
| 76 | void rsdGLShutdown(const android::renderscript::Context *rsc); |
| 77 | bool rsdGLSetSurface(const android::renderscript::Context *rsc, |
Alex Sakhartchouk | 6c72eec | 2011-05-17 12:32:47 -0700 | [diff] [blame^] | 78 | uint32_t w, uint32_t h, RsNativeWindow sur); |
Jason Sams | 803626f | 2011-04-06 17:52:23 -0700 | [diff] [blame] | 79 | void rsdGLSwap(const android::renderscript::Context *rsc); |
Alex Sakhartchouk | 407cae9 | 2011-05-06 14:59:45 -0700 | [diff] [blame] | 80 | void rsdGLCheckError(const android::renderscript::Context *rsc, |
| 81 | const char *msg, bool isFatal = false); |
Jason Sams | 803626f | 2011-04-06 17:52:23 -0700 | [diff] [blame] | 82 | |
| 83 | #endif |
| 84 | |