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 14 matching lines...) Expand all Loading... | |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 | 27 |
28 #include "modules/webgl/WebGLProgram.h" | 28 #include "modules/webgl/WebGLProgram.h" |
29 | 29 |
30 #include "modules/webgl/WebGLContextGroup.h" | 30 #include "modules/webgl/WebGLContextGroup.h" |
31 #include "modules/webgl/WebGLRenderingContextBase.h" | 31 #include "modules/webgl/WebGLRenderingContextBase.h" |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 PassRefPtrWillBeRawPtr<WebGLProgram> WebGLProgram::create(WebGLRenderingContextB ase* ctx) | 35 WebGLProgram* WebGLProgram::create(WebGLRenderingContextBase* ctx) |
36 { | 36 { |
37 return adoptRefWillBeNoop(new WebGLProgram(ctx)); | 37 return new WebGLProgram(ctx); |
38 } | 38 } |
39 | 39 |
40 WebGLProgram::WebGLProgram(WebGLRenderingContextBase* ctx) | 40 WebGLProgram::WebGLProgram(WebGLRenderingContextBase* ctx) |
41 : WebGLSharedPlatform3DObject(ctx) | 41 : WebGLSharedPlatform3DObject(ctx) |
42 , m_linkStatus(false) | 42 , m_linkStatus(false) |
43 , m_linkCount(0) | 43 , m_linkCount(0) |
44 , m_infoValid(true) | 44 , m_infoValid(true) |
45 { | 45 { |
46 setObject(ctx->webContext()->createProgram()); | 46 setObject(ctx->webContext()->createProgram()); |
47 } | 47 } |
48 | 48 |
49 WebGLProgram::~WebGLProgram() | 49 WebGLProgram::~WebGLProgram() |
50 { | 50 { |
51 #if ENABLE(OILPAN) | 51 #if ENABLE(OILPAN) |
sof
2015/08/01 18:49:14
Could check/clarify why this is still needed? WebG
peria
2015/08/03 09:00:36
Done.
Thanks, this part seems not necessary.
| |
52 // These heap objects handle detachment on their own. Clear out | 52 // These heap objects handle detachment on their own. Clear out |
53 // the references to prevent deleteObjectImpl() from trying to do | 53 // the references to prevent deleteObjectImpl() from trying to do |
54 // same, as we cannot safely access other heap objects from this | 54 // same, as we cannot safely access other heap objects from this |
55 // destructor. | 55 // destructor. |
56 m_vertexShader = nullptr; | 56 m_vertexShader = nullptr; |
57 m_fragmentShader = nullptr; | 57 m_fragmentShader = nullptr; |
58 #endif | 58 #endif |
59 // Always call detach here to ensure that platform object deletion | 59 // Always call detach here to ensure that platform object deletion |
60 // happens with Oilpan enabled. It keeps the code regular to do it | 60 // happens with Oilpan enabled. It keeps the code regular to do it |
61 // with or without Oilpan enabled. | 61 // with or without Oilpan enabled. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 void WebGLProgram::increaseLinkCount() | 113 void WebGLProgram::increaseLinkCount() |
114 { | 114 { |
115 ++m_linkCount; | 115 ++m_linkCount; |
116 m_infoValid = false; | 116 m_infoValid = false; |
117 } | 117 } |
118 | 118 |
119 WebGLShader* WebGLProgram::getAttachedShader(GLenum type) | 119 WebGLShader* WebGLProgram::getAttachedShader(GLenum type) |
120 { | 120 { |
121 switch (type) { | 121 switch (type) { |
122 case GL_VERTEX_SHADER: | 122 case GL_VERTEX_SHADER: |
123 return m_vertexShader.get(); | 123 return m_vertexShader.get(); |
sof
2015/08/01 18:49:14
redundant get()
peria
2015/08/03 09:00:36
Done.
| |
124 case GL_FRAGMENT_SHADER: | 124 case GL_FRAGMENT_SHADER: |
125 return m_fragmentShader.get(); | 125 return m_fragmentShader.get(); |
126 default: | 126 default: |
127 return 0; | 127 return 0; |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 bool WebGLProgram::attachShader(WebGLShader* shader) | 131 bool WebGLProgram::attachShader(WebGLShader* shader) |
132 { | 132 { |
133 if (!shader || !shader->object()) | 133 if (!shader || !shader->object()) |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
204 } | 204 } |
205 | 205 |
206 DEFINE_TRACE(WebGLProgram) | 206 DEFINE_TRACE(WebGLProgram) |
207 { | 207 { |
208 visitor->trace(m_vertexShader); | 208 visitor->trace(m_vertexShader); |
209 visitor->trace(m_fragmentShader); | 209 visitor->trace(m_fragmentShader); |
210 WebGLSharedPlatform3DObject::trace(visitor); | 210 WebGLSharedPlatform3DObject::trace(visitor); |
211 } | 211 } |
212 | 212 |
213 } // namespace blink | 213 } // namespace blink |
OLD | NEW |