| 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" | |
| 8 #include "modules/webgl/WebGL2RenderingContextBase.h" | 7 #include "modules/webgl/WebGL2RenderingContextBase.h" |
| 9 | 8 |
| 10 namespace blink { | 9 namespace blink { |
| 11 | 10 |
| 12 WebGLSampler* WebGLSampler::create(WebGL2RenderingContextBase* ctx) | 11 WebGLSampler* WebGLSampler::create(WebGL2RenderingContextBase* ctx) |
| 13 { | 12 { |
| 14 return new WebGLSampler(ctx); | 13 return new WebGLSampler(ctx); |
| 15 } | 14 } |
| 16 | 15 |
| 17 WebGLSampler::~WebGLSampler() | 16 WebGLSampler::~WebGLSampler() |
| 18 { | 17 { |
| 19 // See the comment in WebGLObject::detachAndDeleteObject(). | 18 // See the comment in WebGLObject::detachAndDeleteObject(). |
| 20 detachAndDeleteObject(); | 19 detachAndDeleteObject(); |
| 21 } | 20 } |
| 22 | 21 |
| 23 WebGLSampler::WebGLSampler(WebGL2RenderingContextBase* ctx) | 22 WebGLSampler::WebGLSampler(WebGL2RenderingContextBase* ctx) |
| 24 : WebGLSharedPlatform3DObject(ctx) | 23 : WebGLSharedPlatform3DObject(ctx) |
| 25 { | 24 { |
| 26 GLuint sampler; | 25 setObject(ctx->webContext()->createSampler()); |
| 27 ctx->contextGL()->GenSamplers(1, &sampler); | |
| 28 setObject(sampler); | |
| 29 } | 26 } |
| 30 | 27 |
| 31 void WebGLSampler::deleteObjectImpl(WebGraphicsContext3D* context3d, gpu::gles2:
:GLES2Interface* gl) | 28 void WebGLSampler::deleteObjectImpl(WebGraphicsContext3D* context3d, gpu::gles2:
:GLES2Interface* gl) |
| 32 { | 29 { |
| 33 gl->DeleteSamplers(1, &m_object); | 30 context3d->deleteSampler(m_object); |
| 34 m_object = 0; | 31 m_object = 0; |
| 35 } | 32 } |
| 36 | 33 |
| 37 } // namespace blink | 34 } // namespace blink |
| OLD | NEW |