blob: 5f830e33e0e85f70a60ba4ec3de6899e123cd5be [file] [log] [blame]
Lingfeng Yang74e29292017-01-10 14:54:38 -08001/*
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 Zhoufb7a0c52022-06-02 16:15:43 -070021#include <memory>
Lingfeng Yang74e29292017-01-10 14:54:38 -080022
Joshua Duongcda9cf12022-10-17 21:41:48 -070023#include "aemu/base/synchronization/AndroidLock.h"
Gurchetan Singh50db30e2022-01-12 17:57:26 -080024
Jason Macnak99bf7ec2023-07-20 13:40:09 -070025using gfxstream::guest::ReadWriteLock;
Gurchetan Singh50db30e2022-01-12 17:57:26 -080026
Lingfeng Yang74e29292017-01-10 14:54:38 -080027struct TextureDims {
28 std::map<GLsizei, GLsizei> widths;
29 std::map<GLsizei, GLsizei> heights;
30 std::map<GLsizei, GLsizei> depths;
31};
32
33struct 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 Yanged069c52020-09-03 19:11:02 -070043 bool hasStorage;
44 bool hasCubeNegX;
45 bool hasCubePosX;
46 bool hasCubeNegY;
47 bool hasCubePosY;
48 bool hasCubeNegZ;
49 bool hasCubePosZ;
Lingfeng Yang74e29292017-01-10 14:54:38 -080050};
51
Gurchetan Singh50db30e2022-01-12 17:57:26 -080052struct SharedTextureDataMap {
Yahan Zhoufb7a0c52022-06-02 16:15:43 -070053 using MapType = std::map<GLuint, std::shared_ptr<TextureRec>>;
Gurchetan Singh50db30e2022-01-12 17:57:26 -080054
55 using iterator = MapType::iterator;
56 using const_iterator = MapType::const_iterator;
57
58 MapType map;
59 ReadWriteLock lock;
60};
Lingfeng Yang74e29292017-01-10 14:54:38 -080061
62#endif