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 * Bind this texture, ensure Native image is initialized if necessary.
54 void Bind(uint32_t textureUnit);
57 * Prepare ensures that the native texture is updated if necessary (SourceChanged)
62 * Writes actual texture data to GL.
64 void Update(Graphics::TextureUpdateInfo updateInfo, Graphics::TextureUpdateSourceInfo source);
67 TestGlAbstraction& mGlAbstraction;
68 Graphics::TextureCreateInfo mCreateInfo;
69 bool mIsCompressed{false};
70 GLint mGlInternalFormat; ///< The gl internal format of the pixel data
71 GLenum mGlFormat; ///< The gl format of the pixel data
72 GLenum mPixelDataType; ///< The data type of the pixel data
77 #endif //DALI_TEST_GRAPHICS_TEXTURE_H