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> 21 #include <memory> 22 23 #include "aemu/base/synchronization/AndroidLock.h" 24 25 using gfxstream::guest::ReadWriteLock; 26 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; 43 bool hasStorage; 44 bool hasCubeNegX; 45 bool hasCubePosX; 46 bool hasCubeNegY; 47 bool hasCubePosY; 48 bool hasCubeNegZ; 49 bool hasCubePosZ; 50 }; 51 52 struct SharedTextureDataMap { 53 using MapType = std::map<GLuint, std::shared_ptr<TextureRec>>; 54 55 using iterator = MapType::iterator; 56 using const_iterator = MapType::const_iterator; 57 58 MapType map; 59 ReadWriteLock lock; 60 }; 61 62 #endif 63