1 #ifndef DALI_TEST_GRAPHICS_TEXTURE_H
2 #define DALI_TEST_GRAPHICS_TEXTURE_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 #include <dali/graphics-api/graphics-texture-create-info.h>
21 #include <dali/graphics-api/graphics-texture.h>
22 #include <dali/graphics-api/graphics-types.h>
23 #include <dali/integration-api/gl-defines.h>
24 #include "test-gl-abstraction.h"
25 #include "test-graphics-sampler.h"
29 class TestGraphicsTexture : public Graphics::Texture
32 TestGraphicsTexture(TestGlAbstraction& glAbstraction, const Graphics::TextureCreateInfo& createInfo);
34 ~TestGraphicsTexture();
37 * Initialize the texture: allocate gl mem, apply default samplers
39 void Initialize(GLuint target);
42 * Ensure native resource is created, bound and targeted.
44 void InitializeNativeImage(GLuint target);
47 * Get the GL target of this texture
52 * Get the texture type
54 Graphics::TextureType GetType()
56 return mCreateInfo.textureType;
60 * Get the texture format
62 Graphics::Format GetFormat()
64 return mCreateInfo.format;
68 * Bind this texture, ensure Native image is initialized if necessary.
70 void Bind(uint32_t textureUnit);
73 * Prepare ensures that the native texture is updated if necessary (SourceChanged)
78 * Writes actual texture data to GL.
80 void Update(Graphics::TextureUpdateInfo updateInfo, Graphics::TextureUpdateSourceInfo source);
83 TestGlAbstraction& mGlAbstraction;
84 Graphics::TextureCreateInfo mCreateInfo;
85 bool mIsCompressed{false};
86 GLint mGlInternalFormat; ///< The gl internal format of the pixel data
87 GLenum mGlFormat; ///< The gl format of the pixel data
88 GLenum mPixelDataType; ///< The data type of the pixel data
93 #endif //DALI_TEST_GRAPHICS_TEXTURE_H