Line data Source code
1 : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #include "WebGLExtensions.h"
7 :
8 : #include "mozilla/dom/WebGLRenderingContextBinding.h"
9 : #include "WebGLContext.h"
10 : #include "WebGLShader.h"
11 :
12 : namespace mozilla {
13 :
14 0 : WebGLExtensionDebugShaders::WebGLExtensionDebugShaders(WebGLContext* webgl)
15 0 : : WebGLExtensionBase(webgl)
16 : {
17 0 : }
18 :
19 0 : WebGLExtensionDebugShaders::~WebGLExtensionDebugShaders()
20 : {
21 0 : }
22 :
23 : // If no source has been defined, compileShader() has not been called, or the
24 : // translation has failed for shader, an empty string is returned; otherwise,
25 : // return the translated source.
26 : void
27 0 : WebGLExtensionDebugShaders::GetTranslatedShaderSource(const WebGLShader& shader,
28 : nsAString& retval) const
29 : {
30 0 : retval.SetIsVoid(true);
31 :
32 0 : if (mIsLost) {
33 0 : mContext->ErrorInvalidOperation("%s: Extension is lost.",
34 0 : "getTranslatedShaderSource");
35 0 : return;
36 : }
37 :
38 0 : if (mContext->IsContextLost())
39 0 : return;
40 :
41 0 : if (!mContext->ValidateObject("getShaderTranslatedSource: shader", shader))
42 0 : return;
43 :
44 0 : shader.GetShaderTranslatedSource(&retval);
45 : }
46 :
47 0 : IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionDebugShaders, WEBGL_debug_shaders)
48 :
49 : } // namespace mozilla
|