Lingfeng Yang | 74e2929 | 2017-01-10 14:54:38 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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 | #ifndef _GL_TEXTURE_SHARED_DATA_H_ |
| 17 | #define _GL_TEXTURE_SHARED_DATA_H_ |
| 18 | |
| 19 | #include <GLES/gl.h> |
| 20 | #include <map> |
Yahan Zhou | fb7a0c5 | 2022-06-02 16:15:43 -0700 | [diff] [blame] | 21 | #include <memory> |
Lingfeng Yang | 74e2929 | 2017-01-10 14:54:38 -0800 | [diff] [blame] | 22 | |
Joshua Duong | cda9cf1 | 2022-10-17 21:41:48 -0700 | [diff] [blame] | 23 | #include "aemu/base/synchronization/AndroidLock.h" |
Gurchetan Singh | 50db30e | 2022-01-12 17:57:26 -0800 | [diff] [blame] | 24 | |
Jason Macnak | 99bf7ec | 2023-07-20 13:40:09 -0700 | [diff] [blame] | 25 | using gfxstream::guest::ReadWriteLock; |
Gurchetan Singh | 50db30e | 2022-01-12 17:57:26 -0800 | [diff] [blame] | 26 | |
Lingfeng Yang | 74e2929 | 2017-01-10 14:54:38 -0800 | [diff] [blame] | 27 | struct TextureDims { |
| 28 | std::map<GLsizei, GLsizei> widths; |
| 29 | std::map<GLsizei, GLsizei> heights; |
| 30 | std::map<GLsizei, GLsizei> depths; |
| 31 | }; |
| 32 | |
| 33 | struct TextureRec { |
| 34 | GLuint id; |
| 35 | GLenum target; |
| 36 | GLint internalformat; |
| 37 | GLenum format; |
| 38 | GLenum type; |
| 39 | GLsizei multisamples; |
| 40 | TextureDims* dims; |
| 41 | bool immutable; |
| 42 | bool boundEGLImage; |
Lingfeng Yang | ed069c5 | 2020-09-03 19:11:02 -0700 | [diff] [blame] | 43 | bool hasStorage; |
| 44 | bool hasCubeNegX; |
| 45 | bool hasCubePosX; |
| 46 | bool hasCubeNegY; |
| 47 | bool hasCubePosY; |
| 48 | bool hasCubeNegZ; |
| 49 | bool hasCubePosZ; |
Lingfeng Yang | 74e2929 | 2017-01-10 14:54:38 -0800 | [diff] [blame] | 50 | }; |
| 51 | |
Gurchetan Singh | 50db30e | 2022-01-12 17:57:26 -0800 | [diff] [blame] | 52 | struct SharedTextureDataMap { |
Yahan Zhou | fb7a0c5 | 2022-06-02 16:15:43 -0700 | [diff] [blame] | 53 | using MapType = std::map<GLuint, std::shared_ptr<TextureRec>>; |
Gurchetan Singh | 50db30e | 2022-01-12 17:57:26 -0800 | [diff] [blame] | 54 | |
| 55 | using iterator = MapType::iterator; |
| 56 | using const_iterator = MapType::const_iterator; |
| 57 | |
| 58 | MapType map; |
| 59 | ReadWriteLock lock; |
| 60 | }; |
Lingfeng Yang | 74e2929 | 2017-01-10 14:54:38 -0800 | [diff] [blame] | 61 | |
| 62 | #endif |