diff --git a/src/dawn_native/opengl/TextureGL.cpp b/src/dawn_native/opengl/TextureGL.cpp index 8d36bd2f43..bf9bac60cc 100644 --- a/src/dawn_native/opengl/TextureGL.cpp +++ b/src/dawn_native/opengl/TextureGL.cpp @@ -89,12 +89,6 @@ namespace dawn_native { namespace opengl { Texture::Texture(Device* device, const TextureDescriptor* descriptor) : Texture(device, descriptor, GenTexture()) { - } - - Texture::Texture(Device* device, const TextureDescriptor* descriptor, GLuint handle) - : TextureBase(device, descriptor), mHandle(handle) { - mTarget = TargetForDimensionAndArrayLayers(GetDimension(), GetArrayLayers()); - uint32_t width = GetSize().width; uint32_t height = GetSize().height; uint32_t levels = GetNumMipLevels(); @@ -102,7 +96,7 @@ namespace dawn_native { namespace opengl { auto formatInfo = GetGLFormatInfo(GetFormat()); - glBindTexture(mTarget, handle); + glBindTexture(mTarget, mHandle); // glTextureView() requires the value of GL_TEXTURE_IMMUTABLE_FORMAT for origtexture to be // GL_TRUE, so the storage of the texture must be allocated with glTexStorage*D. @@ -125,6 +119,11 @@ namespace dawn_native { namespace opengl { glTexParameteri(mTarget, GL_TEXTURE_MAX_LEVEL, levels - 1); } + Texture::Texture(Device* device, const TextureDescriptor* descriptor, GLuint handle) + : TextureBase(device, descriptor), mHandle(handle) { + mTarget = TargetForDimensionAndArrayLayers(GetDimension(), GetArrayLayers()); + } + Texture::~Texture() { // TODO(kainino@chromium.org): delete texture (but only when not using the native texture // constructor?)