WebGL2ContextTextures.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "GLContext.h"
  6. #include "WebGL2Context.h"
  7. #include "WebGLContextUtils.h"
  8. #include "WebGLTexture.h"
  9. namespace mozilla {
  10. void
  11. WebGL2Context::TexStorage(const char* funcName, uint8_t funcDims, GLenum rawTarget,
  12. GLsizei levels, GLenum internalFormat, GLsizei width,
  13. GLsizei height, GLsizei depth)
  14. {
  15. TexTarget target;
  16. WebGLTexture* tex;
  17. if (!ValidateTexTarget(this, funcName, funcDims, rawTarget, &target, &tex))
  18. return;
  19. tex->TexStorage(funcName, target, levels, internalFormat, width, height, depth);
  20. }
  21. ////////////////////
  22. /*virtual*/ bool
  23. WebGL2Context::IsTexParamValid(GLenum pname) const
  24. {
  25. switch (pname) {
  26. case LOCAL_GL_TEXTURE_BASE_LEVEL:
  27. case LOCAL_GL_TEXTURE_COMPARE_FUNC:
  28. case LOCAL_GL_TEXTURE_COMPARE_MODE:
  29. case LOCAL_GL_TEXTURE_IMMUTABLE_FORMAT:
  30. case LOCAL_GL_TEXTURE_IMMUTABLE_LEVELS:
  31. case LOCAL_GL_TEXTURE_MAX_LEVEL:
  32. case LOCAL_GL_TEXTURE_WRAP_R:
  33. case LOCAL_GL_TEXTURE_MAX_LOD:
  34. case LOCAL_GL_TEXTURE_MIN_LOD:
  35. return true;
  36. default:
  37. return WebGLContext::IsTexParamValid(pname);
  38. }
  39. }
  40. } // namespace mozilla