Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 1 | // |
| 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 Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 12 | #include "common/utilities.h" |
Jamie Madill | 67102f0 | 2015-03-16 10:41:42 -0400 | [diff] [blame] | 13 | #include "libANGLE/State.h" |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 14 | #include "libANGLE/angletypes.h" |
| 15 | #include "libANGLE/formatutils.h" |
| 16 | #include "libANGLE/renderer/gl/BufferGL.h" |
Geoff Lang | fbfa47c | 2015-03-31 11:26:00 -0400 | [diff] [blame] | 17 | #include "libANGLE/renderer/gl/FramebufferGL.h" |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 18 | #include "libANGLE/renderer/gl/FunctionsGL.h" |
| 19 | #include "libANGLE/renderer/gl/StateManagerGL.h" |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 20 | |
| 21 | namespace rx |
| 22 | { |
| 23 | |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 24 | static void SetUnpackStateForTexImage(StateManagerGL *stateManager, const gl::PixelUnpackState &unpack) |
| 25 | { |
| 26 | const gl::Buffer *unpackBuffer = unpack.pixelBuffer.get(); |
| 27 | if (unpackBuffer != nullptr) |
| 28 | { |
| 29 | UNIMPLEMENTED(); |
| 30 | } |
| 31 | if (unpack.skipRows != 0 || unpack.skipPixels != 0 || unpack.imageHeight != 0 || unpack.skipImages != 0) |
| 32 | { |
| 33 | UNIMPLEMENTED(); |
| 34 | } |
| 35 | stateManager->setPixelUnpackState(unpack.alignment, unpack.rowLength); |
| 36 | } |
| 37 | |
| 38 | static bool UseTexImage2D(GLenum textureType) |
| 39 | { |
| 40 | return textureType == GL_TEXTURE_2D || textureType == GL_TEXTURE_CUBE_MAP; |
| 41 | } |
| 42 | |
| 43 | static bool UseTexImage3D(GLenum textureType) |
| 44 | { |
| 45 | return textureType == GL_TEXTURE_2D_ARRAY || textureType == GL_TEXTURE_3D; |
| 46 | } |
| 47 | |
Geoff Lang | 968992e | 2015-03-17 18:01:49 -0400 | [diff] [blame] | 48 | static bool CompatibleTextureTarget(GLenum textureType, GLenum textureTarget) |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 49 | { |
| 50 | if (textureType != GL_TEXTURE_CUBE_MAP) |
| 51 | { |
| 52 | return textureType == textureTarget; |
| 53 | } |
| 54 | else |
| 55 | { |
Geoff Lang | fb2a559 | 2015-03-20 11:25:37 -0400 | [diff] [blame] | 56 | return gl::IsCubeMapTextureTarget(textureTarget); |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 57 | } |
| 58 | } |
| 59 | |
| 60 | TextureGL::TextureGL(GLenum type, const FunctionsGL *functions, StateManagerGL *stateManager) |
| 61 | : TextureImpl(), |
| 62 | mTextureType(type), |
| 63 | mFunctions(functions), |
| 64 | mStateManager(stateManager), |
| 65 | mAppliedSamplerState(), |
| 66 | mTextureID(0) |
| 67 | { |
| 68 | ASSERT(mFunctions); |
| 69 | ASSERT(mStateManager); |
| 70 | |
| 71 | mFunctions->genTextures(1, &mTextureID); |
| 72 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 73 | |
| 74 | TextureGL::~TextureGL() |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 75 | { |
| 76 | if (mTextureID) |
| 77 | { |
| 78 | mFunctions->deleteTextures(1, &mTextureID); |
| 79 | mTextureID = 0; |
| 80 | } |
| 81 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 82 | |
| 83 | void TextureGL::setUsage(GLenum usage) |
| 84 | { |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 85 | // GL_ANGLE_texture_usage not implemented for desktop GL |
| 86 | UNREACHABLE(); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | gl::Error TextureGL::setImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size, GLenum format, GLenum type, |
| 90 | const gl::PixelUnpackState &unpack, const uint8_t *pixels) |
| 91 | { |
Geoff Lang | fb2a559 | 2015-03-20 11:25:37 -0400 | [diff] [blame] | 92 | UNUSED_ASSERTION_VARIABLE(&CompatibleTextureTarget); // Reference this function to avoid warnings. |
Geoff Lang | 968992e | 2015-03-17 18:01:49 -0400 | [diff] [blame] | 93 | ASSERT(CompatibleTextureTarget(mTextureType, target)); |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 94 | |
| 95 | SetUnpackStateForTexImage(mStateManager, unpack); |
| 96 | |
| 97 | mStateManager->bindTexture(mTextureType, mTextureID); |
| 98 | if (UseTexImage2D(mTextureType)) |
Jamie Madill | 67102f0 | 2015-03-16 10:41:42 -0400 | [diff] [blame] | 99 | { |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 100 | ASSERT(size.depth == 1); |
| 101 | mFunctions->texImage2D(target, level, internalFormat, size.width, size.height, 0, format, type, pixels); |
| 102 | } |
| 103 | else if (UseTexImage3D(mTextureType)) |
| 104 | { |
| 105 | mFunctions->texImage3D(target, level, internalFormat, size.width, size.height, size.depth, 0, format, type, pixels); |
| 106 | } |
| 107 | else |
| 108 | { |
| 109 | UNREACHABLE(); |
Jamie Madill | 67102f0 | 2015-03-16 10:41:42 -0400 | [diff] [blame] | 110 | } |
| 111 | |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 112 | return gl::Error(GL_NO_ERROR); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | gl::Error TextureGL::setSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format, GLenum type, |
| 116 | const gl::PixelUnpackState &unpack, const uint8_t *pixels) |
| 117 | { |
Geoff Lang | 968992e | 2015-03-17 18:01:49 -0400 | [diff] [blame] | 118 | ASSERT(CompatibleTextureTarget(mTextureType, target)); |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 119 | |
| 120 | SetUnpackStateForTexImage(mStateManager, unpack); |
| 121 | |
| 122 | mStateManager->bindTexture(mTextureType, mTextureID); |
| 123 | if (UseTexImage2D(mTextureType)) |
Jamie Madill | 67102f0 | 2015-03-16 10:41:42 -0400 | [diff] [blame] | 124 | { |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 125 | ASSERT(area.z == 0 && area.depth == 1); |
| 126 | mFunctions->texSubImage2D(target, level, area.x, area.y, area.width, area.height, format, type, pixels); |
| 127 | } |
| 128 | else if (UseTexImage3D(mTextureType)) |
| 129 | { |
| 130 | mFunctions->texSubImage3D(target, level, area.x, area.y, area.z, area.width, area.height, area.depth, |
| 131 | format, type, pixels); |
| 132 | } |
| 133 | else |
| 134 | { |
| 135 | UNREACHABLE(); |
Jamie Madill | 67102f0 | 2015-03-16 10:41:42 -0400 | [diff] [blame] | 136 | } |
| 137 | |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 138 | return gl::Error(GL_NO_ERROR); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 139 | } |
| 140 | |
| 141 | gl::Error TextureGL::setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size, |
| 142 | const gl::PixelUnpackState &unpack, const uint8_t *pixels) |
| 143 | { |
Geoff Lang | 968992e | 2015-03-17 18:01:49 -0400 | [diff] [blame] | 144 | ASSERT(CompatibleTextureTarget(mTextureType, target)); |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 145 | |
| 146 | SetUnpackStateForTexImage(mStateManager, unpack); |
| 147 | |
| 148 | const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat); |
| 149 | size_t depthPitch = internalFormatInfo.computeDepthPitch(GL_UNSIGNED_BYTE, size.width, size.height, |
| 150 | unpack.alignment, unpack.rowLength); |
| 151 | size_t dataSize = internalFormatInfo.computeBlockSize(GL_UNSIGNED_BYTE, size.width, size.height) * depthPitch; |
| 152 | |
| 153 | mStateManager->bindTexture(mTextureType, mTextureID); |
| 154 | if (UseTexImage2D(mTextureType)) |
Jamie Madill | 67102f0 | 2015-03-16 10:41:42 -0400 | [diff] [blame] | 155 | { |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 156 | ASSERT(size.depth == 1); |
| 157 | mFunctions->compressedTexImage2D(target, level, internalFormat, size.width, size.height, 0, dataSize, pixels); |
| 158 | } |
| 159 | else if (UseTexImage3D(mTextureType)) |
| 160 | { |
| 161 | mFunctions->compressedTexImage3D(target, level, internalFormat, size.width, size.height, size.depth, 0, |
| 162 | dataSize, pixels); |
| 163 | } |
| 164 | else |
| 165 | { |
| 166 | UNREACHABLE(); |
Jamie Madill | 67102f0 | 2015-03-16 10:41:42 -0400 | [diff] [blame] | 167 | } |
| 168 | |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 169 | return gl::Error(GL_NO_ERROR); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 170 | } |
| 171 | |
| 172 | gl::Error TextureGL::setCompressedSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format, |
| 173 | const gl::PixelUnpackState &unpack, const uint8_t *pixels) |
| 174 | { |
Geoff Lang | 968992e | 2015-03-17 18:01:49 -0400 | [diff] [blame] | 175 | ASSERT(CompatibleTextureTarget(mTextureType, target)); |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 176 | |
| 177 | SetUnpackStateForTexImage(mStateManager, unpack); |
| 178 | |
| 179 | const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(format); |
| 180 | size_t depthPitch = internalFormatInfo.computeDepthPitch(GL_UNSIGNED_BYTE, area.width, area.height, |
| 181 | unpack.alignment, unpack.rowLength); |
| 182 | size_t dataSize = internalFormatInfo.computeBlockSize(GL_UNSIGNED_BYTE, area.width, area.height) * depthPitch; |
| 183 | |
| 184 | mStateManager->bindTexture(mTextureType, mTextureID); |
| 185 | if (UseTexImage2D(mTextureType)) |
Jamie Madill | 67102f0 | 2015-03-16 10:41:42 -0400 | [diff] [blame] | 186 | { |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 187 | ASSERT(area.z == 0 && area.depth == 1); |
| 188 | mFunctions->compressedTexSubImage2D(target, level, area.x, area.y, area.width, area.height, format, dataSize, |
| 189 | pixels); |
| 190 | } |
| 191 | else if (UseTexImage3D(mTextureType)) |
| 192 | { |
| 193 | mFunctions->compressedTexSubImage3D(target, level, area.x, area.y, area.z, area.width, area.height, area.depth, |
| 194 | format, dataSize, pixels); |
| 195 | } |
| 196 | else |
| 197 | { |
| 198 | UNREACHABLE(); |
Jamie Madill | 67102f0 | 2015-03-16 10:41:42 -0400 | [diff] [blame] | 199 | } |
| 200 | |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 201 | return gl::Error(GL_NO_ERROR); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 202 | } |
| 203 | |
| 204 | gl::Error TextureGL::copyImage(GLenum target, size_t level, const gl::Rectangle &sourceArea, GLenum internalFormat, |
| 205 | const gl::Framebuffer *source) |
| 206 | { |
Geoff Lang | fbfa47c | 2015-03-31 11:26:00 -0400 | [diff] [blame] | 207 | const FramebufferGL *sourceFramebufferGL = GetImplAs<FramebufferGL>(source); |
| 208 | |
| 209 | mStateManager->bindTexture(mTextureType, mTextureID); |
| 210 | mStateManager->bindFramebuffer(GL_READ_FRAMEBUFFER, sourceFramebufferGL->getFramebufferID()); |
| 211 | |
| 212 | if (UseTexImage2D(mTextureType)) |
| 213 | { |
| 214 | mFunctions->copyTexImage2D(target, level, internalFormat, sourceArea.x, sourceArea.y, |
| 215 | sourceArea.width, sourceArea.height, 0); |
| 216 | } |
| 217 | else |
| 218 | { |
| 219 | UNREACHABLE(); |
| 220 | } |
| 221 | |
| 222 | return gl::Error(GL_NO_ERROR); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 223 | } |
| 224 | |
| 225 | gl::Error TextureGL::copySubImage(GLenum target, size_t level, const gl::Offset &destOffset, const gl::Rectangle &sourceArea, |
| 226 | const gl::Framebuffer *source) |
| 227 | { |
Geoff Lang | fbfa47c | 2015-03-31 11:26:00 -0400 | [diff] [blame] | 228 | const FramebufferGL *sourceFramebufferGL = GetImplAs<FramebufferGL>(source); |
| 229 | |
| 230 | mStateManager->bindTexture(mTextureType, mTextureID); |
| 231 | mStateManager->bindFramebuffer(GL_READ_FRAMEBUFFER, sourceFramebufferGL->getFramebufferID()); |
| 232 | |
| 233 | if (UseTexImage2D(mTextureType)) |
| 234 | { |
| 235 | ASSERT(destOffset.z == 0); |
| 236 | mFunctions->copyTexSubImage2D(target, level, destOffset.x, destOffset.y, |
| 237 | sourceArea.x, sourceArea.y, sourceArea.width, sourceArea.height); |
| 238 | } |
| 239 | else if (UseTexImage3D(mTextureType)) |
| 240 | { |
| 241 | mFunctions->copyTexSubImage3D(target, level, destOffset.x, destOffset.y, destOffset.z, |
| 242 | sourceArea.x, sourceArea.y, sourceArea.width, sourceArea.height); |
| 243 | } |
| 244 | else |
| 245 | { |
| 246 | UNREACHABLE(); |
| 247 | } |
| 248 | |
| 249 | return gl::Error(GL_NO_ERROR); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 250 | } |
| 251 | |
| 252 | gl::Error TextureGL::setStorage(GLenum target, size_t levels, GLenum internalFormat, const gl::Extents &size) |
| 253 | { |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 254 | // TODO: emulate texture storage with TexImage calls if on GL version <4.2 or the |
| 255 | // ARB_texture_storage extension is not available. |
| 256 | |
| 257 | mStateManager->bindTexture(mTextureType, mTextureID); |
| 258 | if (UseTexImage2D(mTextureType)) |
| 259 | { |
| 260 | ASSERT(size.depth == 1); |
Geoff Lang | 1c0ad62 | 2015-03-24 10:27:45 -0400 | [diff] [blame] | 261 | if (mFunctions->texStorage2D) |
| 262 | { |
| 263 | mFunctions->texStorage2D(target, levels, internalFormat, size.width, size.height); |
| 264 | } |
| 265 | else |
| 266 | { |
| 267 | // Make sure no pixel unpack buffer is bound |
| 268 | mStateManager->bindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); |
| 269 | |
| 270 | const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat); |
| 271 | |
| 272 | // Internal format must be sized |
| 273 | ASSERT(internalFormatInfo.pixelBytes != 0); |
| 274 | |
| 275 | for (size_t level = 0; level < levels; level++) |
| 276 | { |
| 277 | gl::Extents levelSize(std::max(size.width >> level, 1), |
| 278 | std::max(size.height >> level, 1), |
| 279 | 1); |
| 280 | |
| 281 | if (mTextureType == GL_TEXTURE_2D) |
| 282 | { |
| 283 | mFunctions->texImage2D(target, level, internalFormat, levelSize.width, levelSize.height, |
| 284 | 0, internalFormatInfo.format, internalFormatInfo.type, nullptr); |
| 285 | } |
| 286 | else if (mTextureType == GL_TEXTURE_CUBE_MAP) |
| 287 | { |
| 288 | for (GLenum face = gl::FirstCubeMapTextureTarget; face <= gl::LastCubeMapTextureTarget; face++) |
| 289 | { |
| 290 | mFunctions->texImage2D(face, level, internalFormat, levelSize.width, levelSize.height, |
| 291 | 0, internalFormatInfo.format, internalFormatInfo.type, nullptr); |
| 292 | } |
| 293 | } |
| 294 | else |
| 295 | { |
| 296 | UNREACHABLE(); |
| 297 | } |
| 298 | } |
| 299 | } |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 300 | } |
| 301 | else if (UseTexImage3D(mTextureType)) |
| 302 | { |
Geoff Lang | 1c0ad62 | 2015-03-24 10:27:45 -0400 | [diff] [blame] | 303 | if (mFunctions->texStorage3D) |
| 304 | { |
| 305 | mFunctions->texStorage3D(target, levels, internalFormat, size.width, size.height, size.depth); |
| 306 | } |
| 307 | else |
| 308 | { |
| 309 | // Make sure no pixel unpack buffer is bound |
| 310 | mStateManager->bindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); |
| 311 | |
| 312 | const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat); |
| 313 | |
| 314 | // Internal format must be sized |
| 315 | ASSERT(internalFormatInfo.pixelBytes != 0); |
| 316 | |
| 317 | for (size_t i = 0; i < levels; i++) |
| 318 | { |
| 319 | gl::Extents levelSize(std::max(size.width >> i, 1), |
| 320 | std::max(size.height >> i, 1), |
| 321 | mTextureType == GL_TEXTURE_3D ? std::max(size.depth >> i, 1) : size.depth); |
| 322 | |
| 323 | mFunctions->texImage3D(target, i, internalFormat, levelSize.width, levelSize.height, levelSize.depth, |
| 324 | 0, internalFormatInfo.format, internalFormatInfo.type, nullptr); |
| 325 | } |
| 326 | } |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 327 | } |
| 328 | else |
| 329 | { |
| 330 | UNREACHABLE(); |
| 331 | } |
| 332 | |
| 333 | return gl::Error(GL_NO_ERROR); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 334 | } |
| 335 | |
| 336 | gl::Error TextureGL::generateMipmaps() |
| 337 | { |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 338 | mStateManager->bindTexture(mTextureType, mTextureID); |
| 339 | mFunctions->generateMipmap(mTextureType); |
| 340 | return gl::Error(GL_NO_ERROR); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 341 | } |
| 342 | |
| 343 | void TextureGL::bindTexImage(egl::Surface *surface) |
| 344 | { |
| 345 | UNIMPLEMENTED(); |
| 346 | } |
| 347 | |
| 348 | void TextureGL::releaseTexImage() |
| 349 | { |
| 350 | UNIMPLEMENTED(); |
| 351 | } |
| 352 | |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 353 | template <typename T> |
| 354 | static inline void SyncSamplerStateMember(const FunctionsGL *functions, const gl::SamplerState &newState, |
| 355 | gl::SamplerState &curState, GLenum textureType, GLenum name, |
| 356 | T(gl::SamplerState::*samplerMember)) |
| 357 | { |
| 358 | if (curState.*samplerMember != newState.*samplerMember) |
| 359 | { |
| 360 | curState.*samplerMember = newState.*samplerMember; |
Minmin Gong | 794e000 | 2015-04-07 18:31:54 -0700 | [diff] [blame] | 361 | functions->texParameterf(textureType, name, static_cast<GLfloat>(curState.*samplerMember)); |
Geoff Lang | c05f706 | 2015-03-10 09:50:57 -0700 | [diff] [blame] | 362 | } |
| 363 | } |
| 364 | |
| 365 | void TextureGL::syncSamplerState(const gl::SamplerState &samplerState) const |
| 366 | { |
| 367 | if (mAppliedSamplerState != samplerState) |
| 368 | { |
| 369 | mStateManager->bindTexture(mTextureType, mTextureID); |
| 370 | SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_MIN_FILTER, &gl::SamplerState::minFilter); |
| 371 | SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_MAG_FILTER, &gl::SamplerState::magFilter); |
| 372 | SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_WRAP_S, &gl::SamplerState::wrapS); |
| 373 | SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_WRAP_T, &gl::SamplerState::wrapT); |
| 374 | SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_WRAP_R, &gl::SamplerState::wrapR); |
| 375 | SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_MAX_ANISOTROPY_EXT, &gl::SamplerState::maxAnisotropy); |
| 376 | SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_BASE_LEVEL, &gl::SamplerState::baseLevel); |
| 377 | SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_MAX_LEVEL, &gl::SamplerState::maxLevel); |
| 378 | SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_MIN_LOD, &gl::SamplerState::minLod); |
| 379 | SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_MAX_LOD, &gl::SamplerState::maxLod); |
| 380 | SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_COMPARE_MODE, &gl::SamplerState::compareMode); |
| 381 | SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_COMPARE_FUNC, &gl::SamplerState::compareFunc); |
| 382 | SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_SWIZZLE_R, &gl::SamplerState::swizzleRed); |
| 383 | SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_SWIZZLE_G, &gl::SamplerState::swizzleGreen); |
| 384 | SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_SWIZZLE_B, &gl::SamplerState::swizzleBlue); |
| 385 | SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_SWIZZLE_A, &gl::SamplerState::swizzleAlpha); |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | GLuint TextureGL::getTextureID() const |
| 390 | { |
| 391 | return mTextureID; |
| 392 | } |
| 393 | |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 394 | } |