From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- dom/canvas/WebGLShader.h | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 dom/canvas/WebGLShader.h (limited to 'dom/canvas/WebGLShader.h') diff --git a/dom/canvas/WebGLShader.h b/dom/canvas/WebGLShader.h new file mode 100644 index 0000000000..e2fc17664d --- /dev/null +++ b/dom/canvas/WebGLShader.h @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef WEBGL_SHADER_H_ +#define WEBGL_SHADER_H_ + +#include +#include +#include +#include + +#include "GLDefs.h" +#include "mozilla/MemoryReporting.h" + +#include "WebGLObjectModel.h" + +namespace mozilla { + +namespace webgl { +class ShaderValidatorResults; +} // namespace webgl + +class WebGLShader final : public WebGLContextBoundObject { + friend class WebGLContext; + friend class WebGLProgram; + + MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(WebGLShader, override) + + public: + WebGLShader(WebGLContext* webgl, GLenum type); + + protected: + ~WebGLShader() override; + + public: + // GL funcs + void CompileShader(); + void ShaderSource(const std::string& source); + + // Util funcs + size_t CalcNumSamplerUniforms() const; + size_t NumAttributes() const; + + const auto& CompileResults() const { return mCompileResults; } + const auto& CompileLog() const { return mCompilationLog; } + bool IsCompiled() const { return mCompilationSuccessful; } + + private: + void BindAttribLocation(GLuint prog, const std::string& userName, + GLuint index) const; + void MapTransformFeedbackVaryings( + const std::vector& varyings, + std::vector* out_mappedVaryings) const; + + public: + // Other funcs + size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const; + + public: + const GLuint mGLName; + const GLenum mType; + + protected: + std::string mSource; + + std::unique_ptr + mCompileResults; // Never null. + bool mCompilationSuccessful = false; + std::string mCompilationLog; +}; + +} // namespace mozilla + +#endif // WEBGL_SHADER_H_ -- cgit v1.2.3