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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 WebGLProgram::~WebGLProgram() | 49 WebGLProgram::~WebGLProgram() |
50 { | 50 { |
51 deleteObject(0); | 51 deleteObject(0); |
52 } | 52 } |
53 | 53 |
54 void WebGLProgram::deleteObjectImpl(blink::WebGraphicsContext3D* context3d, Plat
form3DObject obj) | 54 void WebGLProgram::deleteObjectImpl(blink::WebGraphicsContext3D* context3d, Plat
form3DObject obj) |
55 { | 55 { |
56 context3d->deleteProgram(obj); | 56 context3d->deleteProgram(obj); |
57 if (m_vertexShader) { | 57 if (m_vertexShader) { |
58 m_vertexShader->onDetached(context3d); | 58 m_vertexShader->onDetached(context3d); |
59 m_vertexShader = 0; | 59 m_vertexShader = nullptr; |
60 } | 60 } |
61 if (m_fragmentShader) { | 61 if (m_fragmentShader) { |
62 m_fragmentShader->onDetached(context3d); | 62 m_fragmentShader->onDetached(context3d); |
63 m_fragmentShader = 0; | 63 m_fragmentShader = nullptr; |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 unsigned WebGLProgram::numActiveAttribLocations() | 67 unsigned WebGLProgram::numActiveAttribLocations() |
68 { | 68 { |
69 cacheInfoIfNeeded(); | 69 cacheInfoIfNeeded(); |
70 return m_activeAttribLocations.size(); | 70 return m_activeAttribLocations.size(); |
71 } | 71 } |
72 | 72 |
73 GLint WebGLProgram::getActiveAttribLocation(GLuint index) | 73 GLint WebGLProgram::getActiveAttribLocation(GLuint index) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 } | 139 } |
140 | 140 |
141 bool WebGLProgram::detachShader(WebGLShader* shader) | 141 bool WebGLProgram::detachShader(WebGLShader* shader) |
142 { | 142 { |
143 if (!shader || !shader->object()) | 143 if (!shader || !shader->object()) |
144 return false; | 144 return false; |
145 switch (shader->type()) { | 145 switch (shader->type()) { |
146 case GL_VERTEX_SHADER: | 146 case GL_VERTEX_SHADER: |
147 if (m_vertexShader != shader) | 147 if (m_vertexShader != shader) |
148 return false; | 148 return false; |
149 m_vertexShader = 0; | 149 m_vertexShader = nullptr; |
150 return true; | 150 return true; |
151 case GL_FRAGMENT_SHADER: | 151 case GL_FRAGMENT_SHADER: |
152 if (m_fragmentShader != shader) | 152 if (m_fragmentShader != shader) |
153 return false; | 153 return false; |
154 m_fragmentShader = 0; | 154 m_fragmentShader = nullptr; |
155 return true; | 155 return true; |
156 default: | 156 default: |
157 return false; | 157 return false; |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
161 void WebGLProgram::cacheActiveAttribLocations(blink::WebGraphicsContext3D* conte
xt3d) | 161 void WebGLProgram::cacheActiveAttribLocations(blink::WebGraphicsContext3D* conte
xt3d) |
162 { | 162 { |
163 m_activeAttribLocations.clear(); | 163 m_activeAttribLocations.clear(); |
164 | 164 |
(...skipping 20 matching lines...) Expand all Loading... |
185 return; | 185 return; |
186 GLint linkStatus = 0; | 186 GLint linkStatus = 0; |
187 context->getProgramiv(object(), GL_LINK_STATUS, &linkStatus); | 187 context->getProgramiv(object(), GL_LINK_STATUS, &linkStatus); |
188 m_linkStatus = linkStatus; | 188 m_linkStatus = linkStatus; |
189 if (m_linkStatus) | 189 if (m_linkStatus) |
190 cacheActiveAttribLocations(context); | 190 cacheActiveAttribLocations(context); |
191 m_infoValid = true; | 191 m_infoValid = true; |
192 } | 192 } |
193 | 193 |
194 } | 194 } |
OLD | NEW |