1#include "Foundation/Logging/Logger.h"
3#include "FormatsGLES30.h"
4#include "CapabilitiesGLES30.h"
5#include "../SamplerState.h"
11 { GL_NONE, GL_NONE, GL_NONE, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
14 { GL_R8, GL_RED, GL_UNSIGNED_BYTE, 1, 1, 1, 0, 1, 1, 0, 1, 1 },
15 { GL_RG8, GL_RG, GL_UNSIGNED_BYTE, 1, 1, 1, 0, 1, 1, 0, 2, 1 },
16 { GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, 1, 1, 1, 0, 1, 1, 0, 3, 1 },
17 { GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, 1, 1, 1, 0, 1, 1, 0, 4, 1 },
20 { GL_NONE, GL_NONE, GL_UNSIGNED_SHORT, 0, 0, 0, 0, 1, 1, 0, 1, 1 },
21 { GL_NONE, GL_NONE, GL_UNSIGNED_SHORT, 0, 0, 0, 0, 1, 1, 0, 2, 1 },
22 { GL_NONE, GL_NONE, GL_UNSIGNED_SHORT, 0, 0, 0, 0, 1, 1, 0, 3, 1 },
23 { GL_NONE, GL_NONE, GL_UNSIGNED_SHORT, 0, 0, 0, 0, 1, 1, 0, 4, 1 },
26 { GL_R8_SNORM, GL_RED, GL_BYTE, 1, 0, 1, 0, 1, 1, 0, 1, 1 },
27 { GL_RG8_SNORM, GL_RG, GL_BYTE, 1, 0, 1, 0, 1, 1, 0, 2, 1 },
28 { GL_RGB8_SNORM, GL_RGB, GL_BYTE, 1, 0, 1, 0, 1, 1, 0, 3, 1 },
29 { GL_RGBA8_SNORM, GL_RGBA, GL_BYTE, 1, 0, 1, 0, 1, 1, 0, 4, 1 },
32 { GL_NONE, GL_NONE, GL_SHORT, 0, 0, 0, 0, 1, 1, 0, 1, 1 },
33 { GL_NONE, GL_NONE, GL_SHORT, 0, 0, 0, 0, 1, 1, 0, 2, 1 },
34 { GL_NONE, GL_NONE, GL_SHORT, 0, 0, 0, 0, 1, 1, 0, 3, 1 },
35 { GL_NONE, GL_NONE, GL_SHORT, 0, 0, 0, 0, 1, 1, 0, 4, 1 },
38 { GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, 1, 1, 0, 0, 1, 0, 1, 1, 1 },
39 { GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_BYTE, 1, 1, 0, 0, 1, 0, 1, 2, 1 },
40 { GL_RGB8UI, GL_RGB_INTEGER, GL_UNSIGNED_BYTE, 1, 0, 0, 0, 1, 0, 1, 3, 1 },
41 { GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, 1, 1, 0, 0, 1, 0, 1, 4, 1 },
44 { GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT, 1, 1, 0, 0, 1, 0, 1, 1, 1 },
45 { GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT, 1, 1, 0, 0, 1, 0, 1, 2, 1 },
46 { GL_RGB16UI, GL_RGB_INTEGER, GL_UNSIGNED_SHORT, 1, 0, 0, 0, 1, 0, 1, 3, 1 },
47 { GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, 1, 1, 0, 0, 1, 0, 1, 4, 1 },
50 { GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, 1, 1, 0, 0, 1, 0, 1, 1, 1 },
51 { GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT, 1, 1, 0, 0, 1, 0, 1, 2, 1 },
52 { GL_RGB32UI, GL_RGB_INTEGER, GL_UNSIGNED_INT, 1, 0, 0, 0, 1, 0, 1, 3, 1 },
53 { GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT, 1, 1, 0, 0, 1, 0, 1, 4, 1 },
56 { GL_R8I, GL_RED_INTEGER, GL_BYTE, 1, 1, 0, 0, 1, 0, 1, 1, 1 },
57 { GL_RG8I, GL_RG_INTEGER, GL_BYTE, 1, 1, 0, 0, 1, 0, 1, 2, 1 },
58 { GL_RGB8I, GL_RGB_INTEGER, GL_BYTE, 1, 0, 0, 0, 1, 0, 1, 3, 1 },
59 { GL_RGBA8I, GL_RGBA_INTEGER, GL_BYTE, 1, 1, 0, 0, 1, 0, 1, 4, 1 },
62 { GL_R16I, GL_RED_INTEGER, GL_SHORT, 1, 1, 0, 0, 1, 0, 1, 1, 1 },
63 { GL_RG16I, GL_RG_INTEGER, GL_SHORT, 1, 1, 0, 0, 1, 0, 1, 2, 1 },
64 { GL_RGB16I, GL_RGB_INTEGER, GL_SHORT, 1, 0, 0, 0, 1, 0, 1, 3, 1 },
65 { GL_RGBA16I, GL_RGBA_INTEGER, GL_SHORT, 1, 1, 0, 0, 1, 0, 1, 4, 1 },
68 { GL_R32I, GL_RED_INTEGER, GL_INT, 1, 1, 0, 0, 1, 0, 1, 1, 1 },
69 { GL_RG32I, GL_RG_INTEGER, GL_INT, 1, 1, 0, 0, 1, 0, 1, 2, 1 },
70 { GL_RGB32I, GL_RGB_INTEGER, GL_INT, 1, 0, 0, 0, 1, 0, 1, 3, 1 },
71 { GL_RGBA32I, GL_RGBA_INTEGER, GL_INT, 1, 1, 0, 0, 1, 0, 1, 4, 1 },
74 { GL_R16F, GL_RED, GL_HALF_FLOAT, 1, 0, 1, 0, 1, 0, 0, 1, 1 },
75 { GL_RG16F, GL_RG, GL_HALF_FLOAT, 1, 0, 1, 0, 1, 0, 0, 2, 1 },
76 { GL_RGB16F, GL_RGB, GL_HALF_FLOAT, 1, 0, 1, 0, 1, 0, 0, 3, 1 },
77 { GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, 1, 0, 1, 0, 1, 0, 0, 4, 1 },
80 { GL_R32F, GL_RED, GL_FLOAT, 1, 0, 0, 0, 1, 0, 0, 1, 1 },
81 { GL_RG32F, GL_RG, GL_FLOAT, 1, 0, 0, 0, 1, 0, 0, 2, 1 },
82 { GL_RGB32F, GL_RGB, GL_FLOAT, 1, 0, 0, 0, 1, 0, 0, 3, 1 },
83 { GL_RGBA32F, GL_RGBA, GL_FLOAT, 1, 0, 0, 0, 1, 0, 0, 4, 1 },
86 { GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
87 { GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
88 { GL_DEPTH24_STENCIL8, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
89 { GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
90 { GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
91 { GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 1, 0, 0, 0, 0, 0, 0, 0, 0},
94 { GL_NONE, GL_NONE, GL_NONE, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
95 { GL_NONE, GL_NONE, GL_NONE, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
96 { GL_NONE, GL_NONE, GL_NONE, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
97 { GL_NONE, GL_NONE, GL_NONE, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
100 { GL_RGB8, GL_NONE, GL_UNSIGNED_BYTE, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
101 { GL_RGB8, GL_NONE, GL_UNSIGNED_BYTE, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
104 { GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
107 { GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
108 { GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
109 { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
110 { GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
111 { GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
112 { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
113 { GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
114 { GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
115 { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
116 { GL_COMPRESSED_RED_RGTC1_EXT, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
117 { GL_COMPRESSED_RED_RGTC1_EXT, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
118 { GL_COMPRESSED_SIGNED_RED_RGTC1_EXT, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
119 { GL_COMPRESSED_RED_GREEN_RGTC2_EXT, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
120 { GL_COMPRESSED_RED_GREEN_RGTC2_EXT, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
121 { GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
125 { GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
126 { GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
127 { GL_COMPRESSED_RGBA_BPTC_UNORM_EXT, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
128 { GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
131 { GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
132 { GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
133 { GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
134 { GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
137 { GL_COMPRESSED_R11_EAC, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
138 { GL_COMPRESSED_SIGNED_R11_EAC, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
139 { GL_COMPRESSED_RG11_EAC, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
140 { GL_COMPRESSED_SIGNED_RG11_EAC, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
142 { GL_COMPRESSED_RGB8_ETC2, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
143 { GL_COMPRESSED_SRGB8_ETC2, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
145 { GL_COMPRESSED_RGBA8_ETC2_EAC, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
146 { GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
149 { GL_COMPRESSED_RGBA_ASTC_4x4_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
150 { GL_COMPRESSED_RGBA_ASTC_5x4_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
151 { GL_COMPRESSED_RGBA_ASTC_5x5_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
152 { GL_COMPRESSED_RGBA_ASTC_6x5_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
153 { GL_COMPRESSED_RGBA_ASTC_6x6_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
154 { GL_COMPRESSED_RGBA_ASTC_8x5_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
155 { GL_COMPRESSED_RGBA_ASTC_8x6_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
156 { GL_COMPRESSED_RGBA_ASTC_8x8_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
157 { GL_COMPRESSED_RGBA_ASTC_10x5_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
158 { GL_COMPRESSED_RGBA_ASTC_10x6_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
159 { GL_COMPRESSED_RGBA_ASTC_10x8_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
160 { GL_COMPRESSED_RGBA_ASTC_10x10_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
161 { GL_COMPRESSED_RGBA_ASTC_12x10_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
162 { GL_COMPRESSED_RGBA_ASTC_12x12_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
164 { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
165 { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
166 { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
167 { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
168 { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
169 { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
170 { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
171 { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
172 { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
173 { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
174 { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
175 { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
176 { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
177 { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, GL_NONE, GL_NONE, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
180 { GL_SRGB8, GL_RGB, GL_UNSIGNED_BYTE, 1, 0, 1, 0, 0, 0, 0, 0, 0 },
181 { GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, 1, 1, 1, 0, 0, 0, 0, 0, 0 },
184 { GL_NONE, GL_NONE, GL_NONE, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
185 { GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, 1, 1, 1, 0, 1, 1, 0, 4, 1 },
186 { GL_RGB10_A2UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV, 1, 0, 1, 0, 1, 0, 1, 4, 1 },
187 { GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV,1, 0, 1, 0, 0, 0, 0, 3, 1 },
188 { GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 1, 1, 1, 0, 0, 0, 0, 3, 1 },
189 { GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 1, 1, 1, 0, 0, 0, 0, 4, 1 },
190 { GL_RGBA4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 1, 1, 1, 0, 0, 0, 0, 4, 1 },
191 { GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV, 1, 0, 1, 0, 0, 0, 0, 4, 1 },
193 { GL_NONE, GL_NONE, GL_FLOAT, 0, 0, 0, 0, 1, 0, 0, 4, 4 }
195 static_assert(
sizeof(DataFormats_) ==
sizeof(DataFormats_[0]) * size_t(Cogs::TextureFormat::TextureFormat_Size));
200void Cogs::OpenGLES30::enableExtensionFormats(CapabilitiesGLES30* caps)
202 if (caps->getDeviceCapabilities().TextureCompressionS3TC)
204 DataFormats_[size_t(TextureFormat::BC1_TYPELESS)].isTextureFormat = 1;
205 DataFormats_[size_t(TextureFormat::BC1_UNORM)].isTextureFormat = 1;
206 DataFormats_[size_t(TextureFormat::BC1_UNORM_SRGB)].isTextureFormat = 1;
207 DataFormats_[size_t(TextureFormat::BC2_TYPELESS)].isTextureFormat = 1;
208 DataFormats_[size_t(TextureFormat::BC2_UNORM)].isTextureFormat = 1;
209 DataFormats_[size_t(TextureFormat::BC2_UNORM_SRGB)].isTextureFormat = 1;
210 DataFormats_[size_t(TextureFormat::BC3_TYPELESS)].isTextureFormat = 1;
211 DataFormats_[size_t(TextureFormat::BC3_UNORM)].isTextureFormat = 1;
212 DataFormats_[size_t(TextureFormat::BC3_UNORM_SRGB)].isTextureFormat = 1;
213 LOG_DEBUG(logger,
"Enabled S3TC compressed texture formats");
216 if (caps->getDeviceCapabilities().TextureCompressionRGTC)
218 DataFormats_[size_t(TextureFormat::BC4_TYPELESS)].isTextureFormat = 1;
219 DataFormats_[size_t(TextureFormat::BC4_UNORM)].isTextureFormat = 1;
220 DataFormats_[size_t(TextureFormat::BC4_SNORM)].isTextureFormat = 1;
221 DataFormats_[size_t(TextureFormat::BC5_TYPELESS)].isTextureFormat = 1;
222 DataFormats_[size_t(TextureFormat::BC5_UNORM)].isTextureFormat = 1;
223 DataFormats_[size_t(TextureFormat::BC5_SNORM)].isTextureFormat = 1;
224 LOG_DEBUG(logger,
"Enabled BC4/BC5 compressed texture formats");
227 if (caps->getDeviceCapabilities().TextureCompressionBPTC)
229 DataFormats_[size_t(TextureFormat::BC6H_SIGNED_FLOAT_RGB)].isTextureFormat = 1;
230 DataFormats_[size_t(TextureFormat::BC6H_UNSIGNED_FLOAT_RGB)].isTextureFormat = 1;
231 DataFormats_[size_t(TextureFormat::BC7_UNORM_RGBA)].isTextureFormat = 1;
232 DataFormats_[size_t(TextureFormat::BC7_UNORM_SRGBA)].isTextureFormat = 1;
233 LOG_DEBUG(logger,
"Enabled BC7 compressed texture formats");
236 LOG_DEBUG(logger,
"Unsupported BC7 compressed texture formats not enabled");
239 if (caps->getDeviceCapabilities().TextureCompressionETC)
241 DataFormats_[size_t(TextureFormat::EAC_BLOCK8_UNSIGNED_FLOAT_R)].isTextureFormat = 1;
242 DataFormats_[size_t(TextureFormat::EAC_BLOCK8_SIGNED_FLOAT_R)].isTextureFormat = 1;
243 DataFormats_[size_t(TextureFormat::EAC_BLOCK16_UNSIGNED_FLOAT_RG)].isTextureFormat = 1;
244 DataFormats_[size_t(TextureFormat::EAC_BLOCK16_SIGNED_FLOAT_RG)].isTextureFormat = 1;
246 DataFormats_[size_t(TextureFormat::ETC2_BLOCK8_UNORM_RGB)].isTextureFormat = 1;
247 DataFormats_[size_t(TextureFormat::ETC2_BLOCK8_UNORM_SRGB)].isTextureFormat = 1;
248 DataFormats_[size_t(TextureFormat::ETC2_BLOCK16_UNORM_RGBA)].isTextureFormat = 1;
249 DataFormats_[size_t(TextureFormat::ETC2_BLOCK16_UNORM_SRGBA)].isTextureFormat = 1;
250 LOG_DEBUG(logger,
"Enabled ETC compressed texture formats");
253 LOG_DEBUG(logger,
"Unsupported ETC compressed texture formats not enabled");
256 if (caps->getDeviceCapabilities().TextureCompressionPVRTC)
258 DataFormats_[size_t(TextureFormat::PVRTC1_2BPP_UNORM_RGB)].isTextureFormat = 1;
259 DataFormats_[size_t(TextureFormat::PVRTC1_4BPP_UNORM_RGB)].isTextureFormat = 1;
260 DataFormats_[size_t(TextureFormat::PVRTC1_2BPP_UNORM_RGBA)].isTextureFormat = 1;
261 DataFormats_[size_t(TextureFormat::PVRTC1_4BPP_UNORM_RGBA)].isTextureFormat = 1;
262 LOG_DEBUG(logger,
"Enabled PVRTC compressed texture formats");
265 LOG_DEBUG(logger,
"Unsupported PVRTC compressed texture formats not enabled");
268 if (caps->getDeviceCapabilities().TextureCompressionASTC) {
269 DataFormats_[size_t(TextureFormat::ASTC_4x4_UNORM_RGBA)].isTextureFormat = 1;
270 DataFormats_[size_t(TextureFormat::ASTC_5x4_UNORM_RGBA)].isTextureFormat = 1;
271 DataFormats_[size_t(TextureFormat::ASTC_5x5_UNORM_RGBA)].isTextureFormat = 1;
272 DataFormats_[size_t(TextureFormat::ASTC_6x5_UNORM_RGBA)].isTextureFormat = 1;
273 DataFormats_[size_t(TextureFormat::ASTC_6x6_UNORM_RGBA)].isTextureFormat = 1;
274 DataFormats_[size_t(TextureFormat::ASTC_8x5_UNORM_RGBA)].isTextureFormat = 1;
275 DataFormats_[size_t(TextureFormat::ASTC_8x6_UNORM_RGBA)].isTextureFormat = 1;
276 DataFormats_[size_t(TextureFormat::ASTC_8x8_UNORM_RGBA)].isTextureFormat = 1;
277 DataFormats_[size_t(TextureFormat::ASTC_10x5_UNORM_RGBA)].isTextureFormat = 1;
278 DataFormats_[size_t(TextureFormat::ASTC_10x6_UNORM_RGBA)].isTextureFormat = 1;
279 DataFormats_[size_t(TextureFormat::ASTC_10x8_UNORM_RGBA)].isTextureFormat = 1;
280 DataFormats_[size_t(TextureFormat::ASTC_10x10_UNORM_RGBA)].isTextureFormat = 1;
281 DataFormats_[size_t(TextureFormat::ASTC_12x10_UNORM_RGBA)].isTextureFormat = 1;
282 DataFormats_[size_t(TextureFormat::ASTC_12x12_UNORM_RGBA)].isTextureFormat = 1;
284 DataFormats_[size_t(TextureFormat::ASTC_4x4_UNORM_SRGBA)].isTextureFormat = 1;
285 DataFormats_[size_t(TextureFormat::ASTC_5x4_UNORM_SRGBA)].isTextureFormat = 1;
286 DataFormats_[size_t(TextureFormat::ASTC_5x5_UNORM_SRGBA)].isTextureFormat = 1;
287 DataFormats_[size_t(TextureFormat::ASTC_6x5_UNORM_SRGBA)].isTextureFormat = 1;
288 DataFormats_[size_t(TextureFormat::ASTC_6x6_UNORM_SRGBA)].isTextureFormat = 1;
289 DataFormats_[size_t(TextureFormat::ASTC_8x5_UNORM_SRGBA)].isTextureFormat = 1;
290 DataFormats_[size_t(TextureFormat::ASTC_8x6_UNORM_SRGBA)].isTextureFormat = 1;
291 DataFormats_[size_t(TextureFormat::ASTC_8x8_UNORM_SRGBA)].isTextureFormat = 1;
292 DataFormats_[size_t(TextureFormat::ASTC_10x5_UNORM_SRGBA)].isTextureFormat = 1;
293 DataFormats_[size_t(TextureFormat::ASTC_10x6_UNORM_SRGBA)].isTextureFormat = 1;
294 DataFormats_[size_t(TextureFormat::ASTC_10x8_UNORM_SRGBA)].isTextureFormat = 1;
295 DataFormats_[size_t(TextureFormat::ASTC_10x10_UNORM_SRGBA)].isTextureFormat = 1;
296 DataFormats_[size_t(TextureFormat::ASTC_12x10_UNORM_SRGBA)].isTextureFormat = 1;
297 DataFormats_[size_t(TextureFormat::ASTC_12x12_UNORM_SRGBA)].isTextureFormat = 1;
298 LOG_DEBUG(logger,
"Enabled ASTC compressed texture formats");
301 LOG_DEBUG(logger,
"Unsupported ASTC compressed texture formats not enabled");
305 if (caps->isSupported(
"GL_EXT_color_buffer_float")) {
306 DataFormats_[size_t(TextureFormat::R32G32B32A32_FLOAT)].isDrawable = 1;
307 DataFormats_[size_t(TextureFormat::R32G32_FLOAT)].isDrawable = 1;
308 DataFormats_[size_t(TextureFormat::R32_FLOAT)].isDrawable = 1;
310 DataFormats_[size_t(TextureFormat::R16G16B16A16_FLOAT)].isDrawable = 1;
311 DataFormats_[size_t(TextureFormat::R16G16_FLOAT)].isDrawable = 1;
312 DataFormats_[size_t(TextureFormat::R16_FLOAT)].isDrawable = 1;
314 DataFormats_[size_t(TextureFormat::R11G11B10_FLOAT)].isDrawable = 1;
315 LOG_DEBUG(logger,
"Enabled float32 and float16 render targets");
317 if (caps->isSupported(
"GL_EXT_color_buffer_float")) {
318 DataFormats_[size_t(TextureFormat::R16G16B16A16_FLOAT)].isDrawable = 1;
319 DataFormats_[size_t(TextureFormat::R16G16B16_FLOAT)].isDrawable = 1;
320 DataFormats_[size_t(TextureFormat::R16G16_FLOAT)].isDrawable = 1;
321 DataFormats_[size_t(TextureFormat::R16_FLOAT)].isDrawable = 1;
322 LOG_DEBUG(logger,
"Enabled float16 render targets");
325 if (caps->isSupported(
"GL_OES_texture_float_linear")) {
326 DataFormats_[size_t(TextureFormat::R32G32B32A32_FLOAT)].isTextureFilterable = 1;
327 DataFormats_[size_t(TextureFormat::R32G32B32_FLOAT)].isTextureFilterable = 1;
328 DataFormats_[size_t(TextureFormat::R32G32_FLOAT)].isTextureFilterable = 1;
329 DataFormats_[size_t(TextureFormat::R32_FLOAT)].isTextureFilterable = 1;
330 LOG_DEBUG(logger,
"Enabled float32 texture filtering");
337const GLenum Cogs::OpenGLES30::PrimitiveFormats[] = {
353static_assert(
sizeof(Cogs::OpenGLES30::PrimitiveFormats) ==
sizeof(Cogs::OpenGLES30::PrimitiveFormats[0]) * size_t(Cogs::PrimitiveType::PrimitiveType_Size));
355const GLenum Cogs::OpenGLES30::MinFilterModes[] = {
361static_assert(
sizeof(Cogs::OpenGLES30::MinFilterModes) ==
sizeof(Cogs::OpenGLES30::MinFilterModes[0]) * size_t(Cogs::SamplerState::FilterMode_Size));
363const GLenum Cogs::OpenGLES30::MipMinFilterModes[] = {
364 GL_NEAREST_MIPMAP_LINEAR,
365 GL_LINEAR_MIPMAP_LINEAR,
366 GL_NEAREST_MIPMAP_LINEAR,
367 GL_LINEAR_MIPMAP_LINEAR,
369static_assert(
sizeof(Cogs::OpenGLES30::MipMinFilterModes) ==
sizeof(Cogs::OpenGLES30::MipMinFilterModes[0]) * size_t(Cogs::SamplerState::FilterMode_Size));
371const GLenum Cogs::OpenGLES30::MagFilterModes[] = {
377static_assert(
sizeof(Cogs::OpenGLES30::MagFilterModes) ==
sizeof(Cogs::OpenGLES30::MagFilterModes[0]) * size_t(Cogs::SamplerState::FilterMode_Size));
379const GLenum Cogs::OpenGLES30::AddressModes[] = {
385static_assert(
sizeof(Cogs::OpenGLES30::AddressModes) ==
sizeof(Cogs::OpenGLES30::AddressModes[0]) * size_t(Cogs::SamplerState::AddressMode_Size));
Log implementation class.
constexpr Log getLogger(const char(&name)[LEN]) noexcept