| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/webgl/WebGLSampler.h" | 5 #include "modules/webgl/WebGLSampler.h" |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/gles2_interface.h" | 7 #include "gpu/command_buffer/client/gles2_interface.h" |
| 8 #include "modules/webgl/WebGL2RenderingContextBase.h" | 8 #include "modules/webgl/WebGL2RenderingContextBase.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 WebGLSampler* WebGLSampler::create(WebGL2RenderingContextBase* ctx) { | 12 WebGLSampler* WebGLSampler::create(WebGL2RenderingContextBase* ctx) { |
| 13 return new WebGLSampler(ctx); | 13 return new WebGLSampler(ctx); |
| 14 } | 14 } |
| 15 | 15 |
| 16 WebGLSampler::~WebGLSampler() { | |
| 17 // See the comment in WebGLObject::detachAndDeleteObject(). | |
| 18 detachAndDeleteObject(); | |
| 19 } | |
| 20 | |
| 21 WebGLSampler::WebGLSampler(WebGL2RenderingContextBase* ctx) | 16 WebGLSampler::WebGLSampler(WebGL2RenderingContextBase* ctx) |
| 22 : WebGLSharedPlatform3DObject(ctx) { | 17 : WebGLSharedPlatform3DObject(ctx) { |
| 23 GLuint sampler; | 18 GLuint sampler; |
| 24 ctx->contextGL()->GenSamplers(1, &sampler); | 19 ctx->contextGL()->GenSamplers(1, &sampler); |
| 25 setObject(sampler); | 20 setObject(sampler); |
| 26 } | 21 } |
| 27 | 22 |
| 23 WebGLSampler::~WebGLSampler() { |
| 24 runDestructor(); |
| 25 } |
| 26 |
| 28 void WebGLSampler::deleteObjectImpl(gpu::gles2::GLES2Interface* gl) { | 27 void WebGLSampler::deleteObjectImpl(gpu::gles2::GLES2Interface* gl) { |
| 29 gl->DeleteSamplers(1, &m_object); | 28 gl->DeleteSamplers(1, &m_object); |
| 30 m_object = 0; | 29 m_object = 0; |
| 31 } | 30 } |
| 32 | 31 |
| 33 } // namespace blink | 32 } // namespace blink |
| OLD | NEW |