| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 return new WebGLProgram(ctx); | 36 return new WebGLProgram(ctx); |
| 37 } | 37 } |
| 38 | 38 |
| 39 WebGLProgram::WebGLProgram(WebGLRenderingContextBase* ctx) | 39 WebGLProgram::WebGLProgram(WebGLRenderingContextBase* ctx) |
| 40 : WebGLSharedPlatform3DObject(ctx) | 40 : WebGLSharedPlatform3DObject(ctx) |
| 41 , m_linkStatus(false) | 41 , m_linkStatus(false) |
| 42 , m_linkCount(0) | 42 , m_linkCount(0) |
| 43 , m_activeTransformFeedbackCount(0) | 43 , m_activeTransformFeedbackCount(0) |
| 44 , m_infoValid(true) | 44 , m_infoValid(true) |
| 45 { | 45 { |
| 46 setObject(ctx->webContext()->createProgram()); | 46 setObject(ctx->contextGL()->CreateProgram()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 WebGLProgram::~WebGLProgram() | 49 WebGLProgram::~WebGLProgram() |
| 50 { | 50 { |
| 51 // These heap objects handle detachment on their own. Clear out | 51 // These heap objects handle detachment on their own. Clear out |
| 52 // the references to prevent deleteObjectImpl() from trying to do | 52 // the references to prevent deleteObjectImpl() from trying to do |
| 53 // same, as we cannot safely access other heap objects from this | 53 // same, as we cannot safely access other heap objects from this |
| 54 // destructor. | 54 // destructor. |
| 55 m_vertexShader = nullptr; | 55 m_vertexShader = nullptr; |
| 56 m_fragmentShader = nullptr; | 56 m_fragmentShader = nullptr; |
| 57 | 57 |
| 58 // See the comment in WebGLObject::detachAndDeleteObject(). | 58 // See the comment in WebGLObject::detachAndDeleteObject(). |
| 59 detachAndDeleteObject(); | 59 detachAndDeleteObject(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void WebGLProgram::deleteObjectImpl(WebGraphicsContext3D* context3d) | 62 void WebGLProgram::deleteObjectImpl(WebGraphicsContext3D* context3d, gpu::gles2:
:GLES2Interface* gl) |
| 63 { | 63 { |
| 64 context3d->deleteProgram(m_object); | 64 gl->DeleteProgram(m_object); |
| 65 m_object = 0; | 65 m_object = 0; |
| 66 if (m_vertexShader) { | 66 if (m_vertexShader) { |
| 67 m_vertexShader->onDetached(context3d); | 67 m_vertexShader->onDetached(context3d, gl); |
| 68 m_vertexShader = nullptr; | 68 m_vertexShader = nullptr; |
| 69 } | 69 } |
| 70 if (m_fragmentShader) { | 70 if (m_fragmentShader) { |
| 71 m_fragmentShader->onDetached(context3d); | 71 m_fragmentShader->onDetached(context3d, gl); |
| 72 m_fragmentShader = nullptr; | 72 m_fragmentShader = nullptr; |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 unsigned WebGLProgram::numActiveAttribLocations() | 76 unsigned WebGLProgram::numActiveAttribLocations() |
| 77 { | 77 { |
| 78 cacheInfoIfNeeded(); | 78 cacheInfoIfNeeded(); |
| 79 return m_activeAttribLocations.size(); | 79 return m_activeAttribLocations.size(); |
| 80 } | 80 } |
| 81 | 81 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } | 208 } |
| 209 | 209 |
| 210 DEFINE_TRACE(WebGLProgram) | 210 DEFINE_TRACE(WebGLProgram) |
| 211 { | 211 { |
| 212 visitor->trace(m_vertexShader); | 212 visitor->trace(m_vertexShader); |
| 213 visitor->trace(m_fragmentShader); | 213 visitor->trace(m_fragmentShader); |
| 214 WebGLSharedPlatform3DObject::trace(visitor); | 214 WebGLSharedPlatform3DObject::trace(visitor); |
| 215 } | 215 } |
| 216 | 216 |
| 217 } // namespace blink | 217 } // namespace blink |
| OLD | NEW |