1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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/. */
6 #ifndef WEBGL_SHADER_H_
7 #define WEBGL_SHADER_H_
15 #include "mozilla/MemoryReporting.h"
17 #include "WebGLObjectModel.h"
22 class ShaderValidatorResults
;
25 class WebGLShader final
: public WebGLContextBoundObject
{
26 friend class WebGLContext
;
27 friend class WebGLProgram
;
29 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(WebGLShader
, override
)
32 WebGLShader(WebGLContext
* webgl
, GLenum type
);
35 ~WebGLShader() override
;
40 void ShaderSource(const std::string
& source
);
43 size_t CalcNumSamplerUniforms() const;
44 size_t NumAttributes() const;
46 const auto& CompileResults() const { return mCompileResults
; }
47 const auto& CompileLog() const { return mCompilationLog
; }
48 bool IsCompiled() const { return mCompilationSuccessful
; }
51 void BindAttribLocation(GLuint prog
, const std::string
& userName
,
53 void MapTransformFeedbackVaryings(
54 const std::vector
<std::string
>& varyings
,
55 std::vector
<std::string
>* out_mappedVaryings
) const;
59 size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf
) const;
68 std::unique_ptr
<const webgl::ShaderValidatorResults
>
69 mCompileResults
; // Never null.
70 bool mCompilationSuccessful
= false;
71 std::string mCompilationLog
;
74 } // namespace mozilla
76 #endif // WEBGL_SHADER_H_