Cogs.Core
TexturesGL20.h
1#pragma once
2
3#include "../ITextures.h"
4
5#include "CommonGL20.h"
6
7#include "../Base/TexturesCommon.h"
8
9namespace Cogs
10{
11 class GraphicsDeviceGL20;
12
14 {
15 GLenum type;
16 GLuint textureId;
17
18 uint32_t width;
19 uint32_t height;
20
21 uint32_t numSamples;
22 uint32_t arraySize;
23
24 TextureFormat format;
26
27 bool hasMipmaps;
28 bool textureView;
29 };
30
32 {
34
35 void initialize(GraphicsDeviceGL20 * device);
36
37 using TexturesCommon::loadTexture;
38
39 TextureHandle loadTexture(const TextureDescription & desc, const TextureData * data) override;
40 void releaseTexture(TextureHandle textureHandle) override;
41
42 void uploadTextureData(TextureGL20 &texture,
43 const TextureData &data,
44 uint32_t layer_offset = 0,
45 uint32_t face_offset = 0,
46 uint32_t level_offset = 0);
47
48 void uploadTextureData(TextureHandle textureHandle,
49 const TextureData &data,
50 uint32_t layer_offset,
51 uint32_t face_offset,
52 uint32_t level_offset) override;
53
54 SamplerStateHandle loadSamplerState(const SamplerState & state) override;
55 void releaseSamplerState(SamplerStateHandle handle) override;
56
58 void releaseTextureView(const TextureViewHandle & handle) override;
59
60 void * getNativeHandle(TextureHandle textureHandle) override { return (void*)(size_t)textures[textureHandle].textureId; }
61
62 void generateMipmaps(TextureHandle texureHandle) override;
63
64 void releaseResources() override;
65
66 void annotate(TextureHandle handle, const StringView& name) override;
67
69
70 bool useTextureStorage;
71 bool useAnisotropic;
72 };
73}
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
Encapsulates state for texture sampling in a state object.
Definition: SamplerState.h:12
ETextureFlags
Texture flags enumeration.
Definition: Flags.h:114
Describes how to fetch data from a texture in shaders.
Definition: ITextures.h:13
void releaseSamplerState(SamplerStateHandle handle) override
Release the sampler state with the given handle.
SamplerStateHandle loadSamplerState(const SamplerState &state) override
Load a sampler state object.
void generateMipmaps(TextureHandle texureHandle) override
Use the graphics device to generate mipmaps for the texture with the given texture handle.
TextureViewHandle createTextureView(TextureViewDescription &viewDescription) override
Create a texture view used to bind a limited view of the texture data to the rendering pipeline.
void releaseTextureView(const TextureViewHandle &handle) override
Release the given texture view.
void annotate(TextureHandle handle, const StringView &name) override
Associate a name with an object for use in graphics debugging.
void releaseResources() override
Release all allocated texture resources.
void * getNativeHandle(TextureHandle textureHandle) override
Get the device-specific handle (D3D texture pointer, OpenGL texture ID etc) associated with the given...
Definition: TexturesGL20.h:60
TextureHandle loadTexture(const TextureDescription &desc, const TextureData *data) override
Load a texture from the given description.
void releaseTexture(TextureHandle textureHandle) override
Release the texture with the given textureHandle.