blob: e113ab638b70c4e6231c9c263c4e80e371f92ea7 [file] [log] [blame]
Geoff Langf9a6f082015-01-22 13:32:49 -05001//
2// Copyright 2015 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
7// TextureGL.cpp: Implements the class methods for TextureGL.
8
9#include "libANGLE/renderer/gl/TextureGL.h"
10
11#include "common/debug.h"
Geoff Langc05f7062015-03-10 09:50:57 -070012#include "common/utilities.h"
Jamie Madill67102f02015-03-16 10:41:42 -040013#include "libANGLE/State.h"
Geoff Langc05f7062015-03-10 09:50:57 -070014#include "libANGLE/angletypes.h"
15#include "libANGLE/formatutils.h"
16#include "libANGLE/renderer/gl/BufferGL.h"
Geoff Langfbfa47c2015-03-31 11:26:00 -040017#include "libANGLE/renderer/gl/FramebufferGL.h"
Geoff Langc05f7062015-03-10 09:50:57 -070018#include "libANGLE/renderer/gl/FunctionsGL.h"
19#include "libANGLE/renderer/gl/StateManagerGL.h"
Geoff Langfd216c42015-05-27 16:12:30 -040020#include "libANGLE/renderer/gl/formatutilsgl.h"
Geoff Langf9a6f082015-01-22 13:32:49 -050021
22namespace rx
23{
24
Geoff Langc05f7062015-03-10 09:50:57 -070025static void SetUnpackStateForTexImage(StateManagerGL *stateManager, const gl::PixelUnpackState &unpack)
26{
27 const gl::Buffer *unpackBuffer = unpack.pixelBuffer.get();
28 if (unpackBuffer != nullptr)
29 {
30 UNIMPLEMENTED();
31 }
32 if (unpack.skipRows != 0 || unpack.skipPixels != 0 || unpack.imageHeight != 0 || unpack.skipImages != 0)
33 {
34 UNIMPLEMENTED();
35 }
36 stateManager->setPixelUnpackState(unpack.alignment, unpack.rowLength);
37}
38
39static bool UseTexImage2D(GLenum textureType)
40{
41 return textureType == GL_TEXTURE_2D || textureType == GL_TEXTURE_CUBE_MAP;
42}
43
44static bool UseTexImage3D(GLenum textureType)
45{
46 return textureType == GL_TEXTURE_2D_ARRAY || textureType == GL_TEXTURE_3D;
47}
48
Geoff Lang968992e2015-03-17 18:01:49 -040049static bool CompatibleTextureTarget(GLenum textureType, GLenum textureTarget)
Geoff Langc05f7062015-03-10 09:50:57 -070050{
51 if (textureType != GL_TEXTURE_CUBE_MAP)
52 {
53 return textureType == textureTarget;
54 }
55 else
56 {
Geoff Langfb2a5592015-03-20 11:25:37 -040057 return gl::IsCubeMapTextureTarget(textureTarget);
Geoff Langc05f7062015-03-10 09:50:57 -070058 }
59}
60
61TextureGL::TextureGL(GLenum type, const FunctionsGL *functions, StateManagerGL *stateManager)
62 : TextureImpl(),
63 mTextureType(type),
64 mFunctions(functions),
65 mStateManager(stateManager),
66 mAppliedSamplerState(),
67 mTextureID(0)
68{
69 ASSERT(mFunctions);
70 ASSERT(mStateManager);
71
72 mFunctions->genTextures(1, &mTextureID);
Geoff Lang90d98af2015-05-26 16:41:38 -040073 mStateManager->bindTexture(mTextureType, mTextureID);
Geoff Langc05f7062015-03-10 09:50:57 -070074}
Geoff Langf9a6f082015-01-22 13:32:49 -050075
76TextureGL::~TextureGL()
Geoff Langc05f7062015-03-10 09:50:57 -070077{
Geoff Lang1eb708e2015-05-04 14:58:23 -040078 mStateManager->deleteTexture(mTextureID);
79 mTextureID = 0;
Geoff Langc05f7062015-03-10 09:50:57 -070080}
Geoff Langf9a6f082015-01-22 13:32:49 -050081
82void TextureGL::setUsage(GLenum usage)
83{
Geoff Langc05f7062015-03-10 09:50:57 -070084 // GL_ANGLE_texture_usage not implemented for desktop GL
85 UNREACHABLE();
Geoff Langf9a6f082015-01-22 13:32:49 -050086}
87
88gl::Error TextureGL::setImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size, GLenum format, GLenum type,
89 const gl::PixelUnpackState &unpack, const uint8_t *pixels)
90{
Geoff Langfb2a5592015-03-20 11:25:37 -040091 UNUSED_ASSERTION_VARIABLE(&CompatibleTextureTarget); // Reference this function to avoid warnings.
Geoff Lang968992e2015-03-17 18:01:49 -040092 ASSERT(CompatibleTextureTarget(mTextureType, target));
Geoff Langc05f7062015-03-10 09:50:57 -070093
94 SetUnpackStateForTexImage(mStateManager, unpack);
95
Geoff Langfd216c42015-05-27 16:12:30 -040096 const nativegl::InternalFormat &nativeInternalFormatInfo = nativegl::GetInternalFormatInfo(internalFormat, mFunctions->standard);
97
Geoff Langc05f7062015-03-10 09:50:57 -070098 mStateManager->bindTexture(mTextureType, mTextureID);
99 if (UseTexImage2D(mTextureType))
Jamie Madill67102f02015-03-16 10:41:42 -0400100 {
Geoff Langc05f7062015-03-10 09:50:57 -0700101 ASSERT(size.depth == 1);
Geoff Langfd216c42015-05-27 16:12:30 -0400102 mFunctions->texImage2D(target, level, nativeInternalFormatInfo.internalFormat, size.width, size.height, 0, format, type, pixels);
Geoff Langc05f7062015-03-10 09:50:57 -0700103 }
104 else if (UseTexImage3D(mTextureType))
105 {
Geoff Langfd216c42015-05-27 16:12:30 -0400106 mFunctions->texImage3D(target, level, nativeInternalFormatInfo.internalFormat, size.width, size.height, size.depth, 0, format, type, pixels);
Geoff Langc05f7062015-03-10 09:50:57 -0700107 }
108 else
109 {
110 UNREACHABLE();
Jamie Madill67102f02015-03-16 10:41:42 -0400111 }
112
Geoff Langc05f7062015-03-10 09:50:57 -0700113 return gl::Error(GL_NO_ERROR);
Geoff Langf9a6f082015-01-22 13:32:49 -0500114}
115
116gl::Error TextureGL::setSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format, GLenum type,
117 const gl::PixelUnpackState &unpack, const uint8_t *pixels)
118{
Geoff Lang968992e2015-03-17 18:01:49 -0400119 ASSERT(CompatibleTextureTarget(mTextureType, target));
Geoff Langc05f7062015-03-10 09:50:57 -0700120
121 SetUnpackStateForTexImage(mStateManager, unpack);
122
123 mStateManager->bindTexture(mTextureType, mTextureID);
124 if (UseTexImage2D(mTextureType))
Jamie Madill67102f02015-03-16 10:41:42 -0400125 {
Geoff Langc05f7062015-03-10 09:50:57 -0700126 ASSERT(area.z == 0 && area.depth == 1);
127 mFunctions->texSubImage2D(target, level, area.x, area.y, area.width, area.height, format, type, pixels);
128 }
129 else if (UseTexImage3D(mTextureType))
130 {
131 mFunctions->texSubImage3D(target, level, area.x, area.y, area.z, area.width, area.height, area.depth,
132 format, type, pixels);
133 }
134 else
135 {
136 UNREACHABLE();
Jamie Madill67102f02015-03-16 10:41:42 -0400137 }
138
Geoff Langc05f7062015-03-10 09:50:57 -0700139 return gl::Error(GL_NO_ERROR);
Geoff Langf9a6f082015-01-22 13:32:49 -0500140}
141
142gl::Error TextureGL::setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size,
Geoff Lang8509d862015-05-20 14:06:13 -0400143 const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels)
Geoff Langf9a6f082015-01-22 13:32:49 -0500144{
Geoff Lang968992e2015-03-17 18:01:49 -0400145 ASSERT(CompatibleTextureTarget(mTextureType, target));
Geoff Langc05f7062015-03-10 09:50:57 -0700146
147 SetUnpackStateForTexImage(mStateManager, unpack);
148
Geoff Langfd216c42015-05-27 16:12:30 -0400149 const nativegl::InternalFormat &nativeInternalFormatInfo = nativegl::GetInternalFormatInfo(internalFormat, mFunctions->standard);
150
Geoff Langc05f7062015-03-10 09:50:57 -0700151 mStateManager->bindTexture(mTextureType, mTextureID);
152 if (UseTexImage2D(mTextureType))
Jamie Madill67102f02015-03-16 10:41:42 -0400153 {
Geoff Langc05f7062015-03-10 09:50:57 -0700154 ASSERT(size.depth == 1);
Geoff Langfd216c42015-05-27 16:12:30 -0400155 mFunctions->compressedTexImage2D(target, level, nativeInternalFormatInfo.internalFormat, size.width, size.height, 0, imageSize, pixels);
Geoff Langc05f7062015-03-10 09:50:57 -0700156 }
157 else if (UseTexImage3D(mTextureType))
158 {
Geoff Langfd216c42015-05-27 16:12:30 -0400159 mFunctions->compressedTexImage3D(target, level, nativeInternalFormatInfo.internalFormat, size.width, size.height, size.depth, 0,
Geoff Lang8509d862015-05-20 14:06:13 -0400160 imageSize, pixels);
Geoff Langc05f7062015-03-10 09:50:57 -0700161 }
162 else
163 {
164 UNREACHABLE();
Jamie Madill67102f02015-03-16 10:41:42 -0400165 }
166
Geoff Langc05f7062015-03-10 09:50:57 -0700167 return gl::Error(GL_NO_ERROR);
Geoff Langf9a6f082015-01-22 13:32:49 -0500168}
169
170gl::Error TextureGL::setCompressedSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format,
Geoff Lang8509d862015-05-20 14:06:13 -0400171 const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels)
Geoff Langf9a6f082015-01-22 13:32:49 -0500172{
Geoff Lang968992e2015-03-17 18:01:49 -0400173 ASSERT(CompatibleTextureTarget(mTextureType, target));
Geoff Langc05f7062015-03-10 09:50:57 -0700174
175 SetUnpackStateForTexImage(mStateManager, unpack);
176
Geoff Langfd216c42015-05-27 16:12:30 -0400177 const nativegl::InternalFormat &nativeInternalFormatInfo = nativegl::GetInternalFormatInfo(format, mFunctions->standard);
178
Geoff Langc05f7062015-03-10 09:50:57 -0700179 mStateManager->bindTexture(mTextureType, mTextureID);
180 if (UseTexImage2D(mTextureType))
Jamie Madill67102f02015-03-16 10:41:42 -0400181 {
Geoff Langc05f7062015-03-10 09:50:57 -0700182 ASSERT(area.z == 0 && area.depth == 1);
Geoff Langfd216c42015-05-27 16:12:30 -0400183 mFunctions->compressedTexSubImage2D(target, level, area.x, area.y, area.width, area.height, nativeInternalFormatInfo.internalFormat, imageSize,
Geoff Langc05f7062015-03-10 09:50:57 -0700184 pixels);
185 }
186 else if (UseTexImage3D(mTextureType))
187 {
188 mFunctions->compressedTexSubImage3D(target, level, area.x, area.y, area.z, area.width, area.height, area.depth,
Geoff Langfd216c42015-05-27 16:12:30 -0400189 nativeInternalFormatInfo.internalFormat, imageSize, pixels);
Geoff Langc05f7062015-03-10 09:50:57 -0700190 }
191 else
192 {
193 UNREACHABLE();
Jamie Madill67102f02015-03-16 10:41:42 -0400194 }
195
Geoff Langc05f7062015-03-10 09:50:57 -0700196 return gl::Error(GL_NO_ERROR);
Geoff Langf9a6f082015-01-22 13:32:49 -0500197}
198
199gl::Error TextureGL::copyImage(GLenum target, size_t level, const gl::Rectangle &sourceArea, GLenum internalFormat,
200 const gl::Framebuffer *source)
201{
Geoff Langfd216c42015-05-27 16:12:30 -0400202 const nativegl::InternalFormat &nativeInternalFormatInfo = nativegl::GetInternalFormatInfo(internalFormat, mFunctions->standard);
203
Geoff Langfbfa47c2015-03-31 11:26:00 -0400204 const FramebufferGL *sourceFramebufferGL = GetImplAs<FramebufferGL>(source);
205
206 mStateManager->bindTexture(mTextureType, mTextureID);
207 mStateManager->bindFramebuffer(GL_READ_FRAMEBUFFER, sourceFramebufferGL->getFramebufferID());
208
209 if (UseTexImage2D(mTextureType))
210 {
Geoff Langfd216c42015-05-27 16:12:30 -0400211 mFunctions->copyTexImage2D(target, level, nativeInternalFormatInfo.internalFormat, sourceArea.x, sourceArea.y,
Geoff Langfbfa47c2015-03-31 11:26:00 -0400212 sourceArea.width, sourceArea.height, 0);
213 }
214 else
215 {
216 UNREACHABLE();
217 }
218
219 return gl::Error(GL_NO_ERROR);
Geoff Langf9a6f082015-01-22 13:32:49 -0500220}
221
222gl::Error TextureGL::copySubImage(GLenum target, size_t level, const gl::Offset &destOffset, const gl::Rectangle &sourceArea,
223 const gl::Framebuffer *source)
224{
Geoff Langfbfa47c2015-03-31 11:26:00 -0400225 const FramebufferGL *sourceFramebufferGL = GetImplAs<FramebufferGL>(source);
226
227 mStateManager->bindTexture(mTextureType, mTextureID);
228 mStateManager->bindFramebuffer(GL_READ_FRAMEBUFFER, sourceFramebufferGL->getFramebufferID());
229
230 if (UseTexImage2D(mTextureType))
231 {
232 ASSERT(destOffset.z == 0);
233 mFunctions->copyTexSubImage2D(target, level, destOffset.x, destOffset.y,
234 sourceArea.x, sourceArea.y, sourceArea.width, sourceArea.height);
235 }
236 else if (UseTexImage3D(mTextureType))
237 {
238 mFunctions->copyTexSubImage3D(target, level, destOffset.x, destOffset.y, destOffset.z,
239 sourceArea.x, sourceArea.y, sourceArea.width, sourceArea.height);
240 }
241 else
242 {
243 UNREACHABLE();
244 }
245
246 return gl::Error(GL_NO_ERROR);
Geoff Langf9a6f082015-01-22 13:32:49 -0500247}
248
249gl::Error TextureGL::setStorage(GLenum target, size_t levels, GLenum internalFormat, const gl::Extents &size)
250{
Geoff Langc05f7062015-03-10 09:50:57 -0700251 // TODO: emulate texture storage with TexImage calls if on GL version <4.2 or the
252 // ARB_texture_storage extension is not available.
253
Geoff Langfd216c42015-05-27 16:12:30 -0400254 const nativegl::InternalFormat &nativeInternalFormatInfo = nativegl::GetInternalFormatInfo(internalFormat, mFunctions->standard);
255
Geoff Langc05f7062015-03-10 09:50:57 -0700256 mStateManager->bindTexture(mTextureType, mTextureID);
257 if (UseTexImage2D(mTextureType))
258 {
259 ASSERT(size.depth == 1);
Geoff Lang1c0ad622015-03-24 10:27:45 -0400260 if (mFunctions->texStorage2D)
261 {
Geoff Langfd216c42015-05-27 16:12:30 -0400262 mFunctions->texStorage2D(target, levels, nativeInternalFormatInfo.internalFormat, size.width, size.height);
Geoff Lang1c0ad622015-03-24 10:27:45 -0400263 }
264 else
265 {
266 // Make sure no pixel unpack buffer is bound
267 mStateManager->bindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
268
269 const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat);
270
271 // Internal format must be sized
272 ASSERT(internalFormatInfo.pixelBytes != 0);
273
274 for (size_t level = 0; level < levels; level++)
275 {
276 gl::Extents levelSize(std::max(size.width >> level, 1),
277 std::max(size.height >> level, 1),
278 1);
279
280 if (mTextureType == GL_TEXTURE_2D)
281 {
Geoff Lang42c98f62015-05-20 14:09:25 -0400282 if (internalFormatInfo.compressed)
283 {
284 size_t dataSize = internalFormatInfo.computeBlockSize(GL_UNSIGNED_BYTE, levelSize.width, levelSize.height);
Geoff Langfd216c42015-05-27 16:12:30 -0400285 mFunctions->compressedTexImage2D(target, level, nativeInternalFormatInfo.internalFormat, levelSize.width, levelSize.height,
Geoff Lang42c98f62015-05-20 14:09:25 -0400286 0, dataSize, nullptr);
287 }
288 else
289 {
Geoff Langfd216c42015-05-27 16:12:30 -0400290 mFunctions->texImage2D(target, level, nativeInternalFormatInfo.internalFormat, levelSize.width, levelSize.height,
Geoff Lang42c98f62015-05-20 14:09:25 -0400291 0, internalFormatInfo.format, internalFormatInfo.type, nullptr);
292 }
Geoff Lang1c0ad622015-03-24 10:27:45 -0400293 }
294 else if (mTextureType == GL_TEXTURE_CUBE_MAP)
295 {
296 for (GLenum face = gl::FirstCubeMapTextureTarget; face <= gl::LastCubeMapTextureTarget; face++)
297 {
Geoff Lang42c98f62015-05-20 14:09:25 -0400298 if (internalFormatInfo.compressed)
299 {
300 size_t dataSize = internalFormatInfo.computeBlockSize(GL_UNSIGNED_BYTE, levelSize.width, levelSize.height);
Geoff Langfd216c42015-05-27 16:12:30 -0400301 mFunctions->compressedTexImage2D(face, level, nativeInternalFormatInfo.internalFormat, levelSize.width, levelSize.height,
Geoff Lang42c98f62015-05-20 14:09:25 -0400302 0, dataSize, nullptr);
303 }
304 else
305 {
Geoff Langfd216c42015-05-27 16:12:30 -0400306 mFunctions->texImage2D(face, level, nativeInternalFormatInfo.internalFormat, levelSize.width, levelSize.height,
Geoff Lang42c98f62015-05-20 14:09:25 -0400307 0, internalFormatInfo.format, internalFormatInfo.type, nullptr);
308 }
Geoff Lang1c0ad622015-03-24 10:27:45 -0400309 }
310 }
311 else
312 {
313 UNREACHABLE();
314 }
315 }
316 }
Geoff Langc05f7062015-03-10 09:50:57 -0700317 }
318 else if (UseTexImage3D(mTextureType))
319 {
Geoff Lang1c0ad622015-03-24 10:27:45 -0400320 if (mFunctions->texStorage3D)
321 {
Geoff Langfd216c42015-05-27 16:12:30 -0400322 mFunctions->texStorage3D(target, levels, nativeInternalFormatInfo.internalFormat, size.width, size.height, size.depth);
Geoff Lang1c0ad622015-03-24 10:27:45 -0400323 }
324 else
325 {
326 // Make sure no pixel unpack buffer is bound
327 mStateManager->bindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
328
329 const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat);
330
331 // Internal format must be sized
332 ASSERT(internalFormatInfo.pixelBytes != 0);
333
334 for (size_t i = 0; i < levels; i++)
335 {
336 gl::Extents levelSize(std::max(size.width >> i, 1),
337 std::max(size.height >> i, 1),
338 mTextureType == GL_TEXTURE_3D ? std::max(size.depth >> i, 1) : size.depth);
339
Geoff Lang42c98f62015-05-20 14:09:25 -0400340 if (internalFormatInfo.compressed)
341 {
342 size_t dataSize = internalFormatInfo.computeBlockSize(GL_UNSIGNED_BYTE, levelSize.width, levelSize.height) * levelSize.depth;
Geoff Langfd216c42015-05-27 16:12:30 -0400343 mFunctions->compressedTexImage3D(target, i, nativeInternalFormatInfo.internalFormat, levelSize.width, levelSize.height, levelSize.depth,
Geoff Lang42c98f62015-05-20 14:09:25 -0400344 0, dataSize, nullptr);
345 }
346 else
347 {
Geoff Langfd216c42015-05-27 16:12:30 -0400348 mFunctions->texImage3D(target, i, nativeInternalFormatInfo.internalFormat, levelSize.width, levelSize.height, levelSize.depth,
Geoff Lang42c98f62015-05-20 14:09:25 -0400349 0, internalFormatInfo.format, internalFormatInfo.type, nullptr);
350 }
Geoff Lang1c0ad622015-03-24 10:27:45 -0400351 }
352 }
Geoff Langc05f7062015-03-10 09:50:57 -0700353 }
354 else
355 {
356 UNREACHABLE();
357 }
358
359 return gl::Error(GL_NO_ERROR);
Geoff Langf9a6f082015-01-22 13:32:49 -0500360}
361
Gregoire Payen de La Garanderie752ce192015-04-14 11:11:12 +0100362gl::Error TextureGL::generateMipmaps(const gl::SamplerState &samplerState)
Geoff Langf9a6f082015-01-22 13:32:49 -0500363{
Geoff Langc05f7062015-03-10 09:50:57 -0700364 mStateManager->bindTexture(mTextureType, mTextureID);
365 mFunctions->generateMipmap(mTextureType);
366 return gl::Error(GL_NO_ERROR);
Geoff Langf9a6f082015-01-22 13:32:49 -0500367}
368
369void TextureGL::bindTexImage(egl::Surface *surface)
370{
Geoff Lang03053202015-04-09 11:21:13 -0400371 ASSERT(mTextureType == GL_TEXTURE_2D);
372
373 // Make sure this texture is bound
374 mStateManager->bindTexture(mTextureType, mTextureID);
Geoff Langf9a6f082015-01-22 13:32:49 -0500375}
376
377void TextureGL::releaseTexImage()
378{
Geoff Lang03053202015-04-09 11:21:13 -0400379 // Not all Surface implementations reset the size of mip 0 when releasing, do it manually
380 ASSERT(mTextureType == GL_TEXTURE_2D);
381
382 mStateManager->bindTexture(mTextureType, mTextureID);
383 if (UseTexImage2D(mTextureType))
384 {
385 mFunctions->texImage2D(mTextureType, 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
386 }
387 else
388 {
389 UNREACHABLE();
390 }
Geoff Langf9a6f082015-01-22 13:32:49 -0500391}
392
Geoff Langc05f7062015-03-10 09:50:57 -0700393template <typename T>
394static inline void SyncSamplerStateMember(const FunctionsGL *functions, const gl::SamplerState &newState,
395 gl::SamplerState &curState, GLenum textureType, GLenum name,
396 T(gl::SamplerState::*samplerMember))
397{
398 if (curState.*samplerMember != newState.*samplerMember)
399 {
400 curState.*samplerMember = newState.*samplerMember;
Minmin Gong794e0002015-04-07 18:31:54 -0700401 functions->texParameterf(textureType, name, static_cast<GLfloat>(curState.*samplerMember));
Geoff Langc05f7062015-03-10 09:50:57 -0700402 }
403}
404
405void TextureGL::syncSamplerState(const gl::SamplerState &samplerState) const
406{
407 if (mAppliedSamplerState != samplerState)
408 {
409 mStateManager->bindTexture(mTextureType, mTextureID);
410 SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_MIN_FILTER, &gl::SamplerState::minFilter);
411 SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_MAG_FILTER, &gl::SamplerState::magFilter);
412 SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_WRAP_S, &gl::SamplerState::wrapS);
413 SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_WRAP_T, &gl::SamplerState::wrapT);
414 SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_WRAP_R, &gl::SamplerState::wrapR);
415 SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_MAX_ANISOTROPY_EXT, &gl::SamplerState::maxAnisotropy);
416 SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_BASE_LEVEL, &gl::SamplerState::baseLevel);
417 SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_MAX_LEVEL, &gl::SamplerState::maxLevel);
418 SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_MIN_LOD, &gl::SamplerState::minLod);
419 SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_MAX_LOD, &gl::SamplerState::maxLod);
420 SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_COMPARE_MODE, &gl::SamplerState::compareMode);
421 SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_COMPARE_FUNC, &gl::SamplerState::compareFunc);
422 SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_SWIZZLE_R, &gl::SamplerState::swizzleRed);
423 SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_SWIZZLE_G, &gl::SamplerState::swizzleGreen);
424 SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_SWIZZLE_B, &gl::SamplerState::swizzleBlue);
425 SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_SWIZZLE_A, &gl::SamplerState::swizzleAlpha);
426 }
427}
428
429GLuint TextureGL::getTextureID() const
430{
431 return mTextureID;
432}
433
Geoff Langf9a6f082015-01-22 13:32:49 -0500434}