2018-11-30 22:52:05 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-10-05 00:35:54 +04:00
|
|
|
/* 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/. */
|
|
|
|
|
2012-12-03 17:10:23 +04:00
|
|
|
#include "WebGLShader.h"
|
2014-11-14 07:03:50 +03:00
|
|
|
|
2018-02-24 02:47:41 +03:00
|
|
|
#include "GLSLANG/ShaderLang.h"
|
2013-09-04 16:14:52 +04:00
|
|
|
#include "GLContext.h"
|
2014-11-14 07:03:50 +03:00
|
|
|
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
|
|
|
#include "mozilla/MemoryReporting.h"
|
2015-01-16 02:40:39 +03:00
|
|
|
#include "nsPrintfCString.h"
|
|
|
|
#include "nsString.h"
|
2015-11-25 07:15:29 +03:00
|
|
|
#include "prenv.h"
|
2014-11-14 07:03:50 +03:00
|
|
|
#include "WebGLContext.h"
|
|
|
|
#include "WebGLObjectModel.h"
|
2015-01-16 02:40:39 +03:00
|
|
|
#include "WebGLShaderValidator.h"
|
|
|
|
#include "WebGLValidateStrings.h"
|
2012-10-05 00:35:54 +04:00
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
namespace mozilla {
|
2012-10-05 00:35:54 +04:00
|
|
|
|
2018-05-31 23:58:53 +03:00
|
|
|
static void PrintLongString(const char* const begin, const size_t len) {
|
|
|
|
// Wow - Roll Your Own Foreach-Lines because printf_stderr has a hard-coded
|
|
|
|
// internal size, so long strings are truncated.
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-05-31 23:58:53 +03:00
|
|
|
const size_t chunkSize = 1000;
|
|
|
|
const UniqueBuffer buf(moz_xmalloc(chunkSize + 1)); // +1 for null-term
|
|
|
|
const auto bufBegin = (char*)buf.get();
|
|
|
|
bufBegin[chunkSize] = '\0';
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-05-31 23:58:53 +03:00
|
|
|
auto chunkBegin = begin;
|
|
|
|
const auto end = begin + len;
|
|
|
|
while (chunkBegin + chunkSize < end) {
|
|
|
|
memcpy(bufBegin, chunkBegin, chunkSize);
|
|
|
|
printf_stderr("%s", bufBegin);
|
|
|
|
chunkBegin += chunkSize;
|
|
|
|
}
|
|
|
|
printf_stderr("%s", chunkBegin);
|
|
|
|
}
|
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
// On success, writes to out_validator and out_translatedSource.
|
|
|
|
// On failure, writes to out_translationLog.
|
|
|
|
static bool Translate(const nsACString& source,
|
|
|
|
webgl::ShaderValidator* validator,
|
|
|
|
nsACString* const out_translationLog,
|
|
|
|
nsACString* const out_translatedSource) {
|
|
|
|
if (!validator->ValidateAndTranslate(source.BeginReading())) {
|
|
|
|
validator->GetInfoLog(out_translationLog);
|
|
|
|
return false;
|
|
|
|
}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
// Success
|
|
|
|
validator->GetOutput(out_translatedSource);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <size_t N>
|
|
|
|
static bool SubstringStartsWith(const std::string& testStr, size_t offset,
|
|
|
|
const char (&refStr)[N]) {
|
|
|
|
for (size_t i = 0; i < N - 1; i++) {
|
|
|
|
if (testStr[offset + i] != refStr[i]) return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* On success, writes to out_translatedSource.
|
|
|
|
* On failure, writes to out_translationLog.
|
|
|
|
*
|
|
|
|
* Requirements:
|
|
|
|
* #version is either omitted, `#version 100`, or `version 300 es`.
|
|
|
|
*/
|
|
|
|
static bool TranslateWithoutValidation(const nsACString& sourceNS,
|
|
|
|
bool isWebGL2,
|
|
|
|
nsACString* const out_translationLog,
|
|
|
|
nsACString* const out_translatedSource) {
|
|
|
|
std::string source = sourceNS.BeginReading();
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
size_t versionStrStart = source.find("#version");
|
|
|
|
size_t versionStrLen;
|
|
|
|
uint32_t glesslVersion;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
if (versionStrStart != std::string::npos) {
|
|
|
|
static const char versionStr100[] = "#version 100\n";
|
|
|
|
static const char versionStr300es[] = "#version 300 es\n";
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
if (isWebGL2 &&
|
|
|
|
SubstringStartsWith(source, versionStrStart, versionStr300es)) {
|
|
|
|
glesslVersion = 300;
|
|
|
|
versionStrLen = strlen(versionStr300es);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
} else if (SubstringStartsWith(source, versionStrStart, versionStr100)) {
|
|
|
|
glesslVersion = 100;
|
|
|
|
versionStrLen = strlen(versionStr100);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
} else {
|
|
|
|
nsPrintfCString error("#version, if declared, must be %s.",
|
|
|
|
isWebGL2 ? "`100` or `300 es`" : "`100`");
|
|
|
|
*out_translationLog = error;
|
|
|
|
return false;
|
|
|
|
}
|
2018-11-30 13:46:48 +03:00
|
|
|
} else {
|
2015-01-16 02:40:39 +03:00
|
|
|
versionStrStart = 0;
|
|
|
|
versionStrLen = 0;
|
|
|
|
glesslVersion = 100;
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
2015-01-16 02:40:39 +03:00
|
|
|
|
|
|
|
std::string reversionedSource = source;
|
|
|
|
reversionedSource.erase(versionStrStart, versionStrLen);
|
|
|
|
|
|
|
|
switch (glesslVersion) {
|
|
|
|
case 100:
|
2015-11-27 23:54:50 +03:00
|
|
|
/* According to ARB_ES2_compatibility extension glsl
|
|
|
|
* should accept #version 100 for ES 2 shaders. */
|
|
|
|
reversionedSource.insert(versionStrStart, "#version 100\n");
|
2015-01-16 02:40:39 +03:00
|
|
|
break;
|
|
|
|
case 300:
|
|
|
|
reversionedSource.insert(versionStrStart, "#version 330\n");
|
|
|
|
break;
|
|
|
|
default:
|
2016-06-06 18:17:23 +03:00
|
|
|
MOZ_CRASH("GFX: Bad `glesslVersion`.");
|
2015-01-16 02:40:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
out_translatedSource->Assign(reversionedSource.c_str(),
|
|
|
|
reversionedSource.length());
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void GetCompilationStatusAndLog(gl::GLContext* gl, GLuint shader,
|
|
|
|
bool* const out_success,
|
|
|
|
nsACString* const out_log) {
|
|
|
|
GLint compileStatus = LOCAL_GL_FALSE;
|
|
|
|
gl->fGetShaderiv(shader, LOCAL_GL_COMPILE_STATUS, &compileStatus);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
// It's simpler if we always get the log.
|
|
|
|
GLint lenWithNull = 0;
|
|
|
|
gl->fGetShaderiv(shader, LOCAL_GL_INFO_LOG_LENGTH, &lenWithNull);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
if (lenWithNull > 1) {
|
|
|
|
// SetLength takes the length without the null.
|
|
|
|
out_log->SetLength(lenWithNull - 1);
|
|
|
|
gl->fGetShaderInfoLog(shader, lenWithNull, nullptr,
|
|
|
|
out_log->BeginWriting());
|
|
|
|
} else {
|
|
|
|
out_log->SetLength(0);
|
|
|
|
}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
*out_success = (compileStatus == LOCAL_GL_TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
WebGLShader::WebGLShader(WebGLContext* webgl, GLenum type)
|
2016-11-30 05:30:28 +03:00
|
|
|
: WebGLRefCountedObject(webgl),
|
2017-12-20 04:21:18 +03:00
|
|
|
mGLName(webgl->gl->fCreateShader(type)),
|
2014-11-14 07:03:50 +03:00
|
|
|
mType(type),
|
2015-05-30 02:54:04 +03:00
|
|
|
mTranslationSuccessful(false),
|
|
|
|
mCompilationSuccessful(false) {
|
2012-12-03 17:10:23 +04:00
|
|
|
mContext->mShaders.insertBack(this);
|
|
|
|
}
|
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
WebGLShader::~WebGLShader() { DeleteOnce(); }
|
|
|
|
|
|
|
|
void WebGLShader::ShaderSource(const nsAString& source) {
|
2016-12-28 04:47:19 +03:00
|
|
|
nsString sourceWithoutComments;
|
|
|
|
if (!TruncateComments(source, &sourceWithoutComments)) {
|
2018-07-27 07:46:33 +03:00
|
|
|
mContext->ErrorOutOfMemory("Failed to alloc for empting comment contents.");
|
2016-12-28 04:47:19 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-07-27 07:46:33 +03:00
|
|
|
if (!ValidateGLSLPreprocString(mContext, sourceWithoutComments)) return;
|
2015-01-16 02:40:39 +03:00
|
|
|
|
|
|
|
// We checked that the source stripped of comments is in the
|
|
|
|
// 7-bit ASCII range, so we can skip the NS_IsAscii() check.
|
2016-12-28 04:47:19 +03:00
|
|
|
const NS_LossyConvertUTF16toASCII cleanSource(sourceWithoutComments);
|
2015-01-16 02:40:39 +03:00
|
|
|
|
|
|
|
mSource = source;
|
2016-12-28 04:47:19 +03:00
|
|
|
mCleanSource = cleanSource;
|
2015-01-16 02:40:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void WebGLShader::CompileShader() {
|
|
|
|
mValidator = nullptr;
|
|
|
|
mTranslationSuccessful = false;
|
|
|
|
mCompilationSuccessful = false;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
gl::GLContext* gl = mContext->gl;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
mValidator.reset(mContext->CreateShaderValidator(mType));
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-05-31 23:58:53 +03:00
|
|
|
static const bool kDumpShaders = PR_GetEnv("MOZ_WEBGL_DUMP_SHADERS");
|
|
|
|
if (MOZ_UNLIKELY(kDumpShaders)) {
|
|
|
|
printf_stderr("==== begin MOZ_WEBGL_DUMP_SHADERS ====\n");
|
|
|
|
PrintLongString(mCleanSource.BeginReading(), mCleanSource.Length());
|
|
|
|
}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
bool success;
|
|
|
|
if (mValidator) {
|
|
|
|
success = Translate(mCleanSource, mValidator.get(), &mValidationLog,
|
|
|
|
&mTranslatedSource);
|
2018-11-30 13:46:48 +03:00
|
|
|
} else {
|
2015-01-16 02:40:39 +03:00
|
|
|
success = TranslateWithoutValidation(mCleanSource, mContext->IsWebGL2(),
|
|
|
|
&mValidationLog, &mTranslatedSource);
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
|
|
|
|
2018-05-31 23:58:53 +03:00
|
|
|
if (MOZ_UNLIKELY(kDumpShaders)) {
|
|
|
|
printf_stderr("\n==== \\/ \\/ \\/ ====\n");
|
|
|
|
if (success) {
|
|
|
|
PrintLongString(mTranslatedSource.BeginReading(),
|
|
|
|
mTranslatedSource.Length());
|
2015-01-16 02:40:39 +03:00
|
|
|
} else {
|
2018-05-31 23:58:53 +03:00
|
|
|
printf_stderr("Validation failed:\n%s", mValidationLog.BeginReading());
|
|
|
|
}
|
|
|
|
printf_stderr("\n==== end ====\n");
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
2018-05-31 23:58:53 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
if (!success) return;
|
|
|
|
|
|
|
|
mTranslationSuccessful = true;
|
|
|
|
|
|
|
|
const char* const parts[] = {mTranslatedSource.BeginReading()};
|
|
|
|
gl->fShaderSource(mGLName, ArrayLength(parts), parts, nullptr);
|
|
|
|
|
|
|
|
gl->fCompileShader(mGLName);
|
|
|
|
|
|
|
|
GetCompilationStatusAndLog(gl, mGLName, &mCompilationSuccessful,
|
|
|
|
&mCompilationLog);
|
|
|
|
}
|
|
|
|
|
|
|
|
void WebGLShader::GetShaderInfoLog(nsAString* out) const {
|
|
|
|
const nsCString& log =
|
|
|
|
!mTranslationSuccessful ? mValidationLog : mCompilationLog;
|
|
|
|
CopyASCIItoUTF16(log, *out);
|
|
|
|
}
|
|
|
|
|
|
|
|
JS::Value WebGLShader::GetShaderParameter(GLenum pname) const {
|
|
|
|
switch (pname) {
|
|
|
|
case LOCAL_GL_SHADER_TYPE:
|
|
|
|
return JS::NumberValue(mType);
|
|
|
|
|
|
|
|
case LOCAL_GL_DELETE_STATUS:
|
|
|
|
return JS::BooleanValue(IsDeleteRequested());
|
|
|
|
|
|
|
|
case LOCAL_GL_COMPILE_STATUS:
|
|
|
|
return JS::BooleanValue(mCompilationSuccessful);
|
|
|
|
|
|
|
|
default:
|
|
|
|
mContext->ErrorInvalidEnumInfo("getShaderParameter: `pname`", pname);
|
|
|
|
return JS::NullValue();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void WebGLShader::GetShaderSource(nsAString* out) const {
|
|
|
|
out->SetIsVoid(false);
|
|
|
|
*out = mSource;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WebGLShader::GetShaderTranslatedSource(nsAString* out) const {
|
|
|
|
out->SetIsVoid(false);
|
|
|
|
CopyASCIItoUTF16(mTranslatedSource, *out);
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
bool WebGLShader::CanLinkTo(const WebGLShader* prev,
|
|
|
|
nsCString* const out_log) const {
|
|
|
|
if (!mValidator) return true;
|
|
|
|
|
|
|
|
return mValidator->CanLinkTo(prev->mValidator.get(), out_log);
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t WebGLShader::CalcNumSamplerUniforms() const {
|
|
|
|
if (mValidator) return mValidator->CalcNumSamplerUniforms();
|
|
|
|
|
|
|
|
// TODO
|
2015-10-24 07:35:16 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t WebGLShader::NumAttributes() const {
|
|
|
|
if (mValidator) return mValidator->NumAttributes();
|
|
|
|
|
|
|
|
// TODO
|
2015-01-16 02:40:39 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WebGLShader::BindAttribLocation(GLuint prog, const nsCString& userName,
|
|
|
|
GLuint index) const {
|
|
|
|
std::string userNameStr(userName.BeginReading());
|
|
|
|
|
|
|
|
const std::string* mappedNameStr = &userNameStr;
|
|
|
|
if (mValidator)
|
|
|
|
mValidator->FindAttribMappedNameByUserName(userNameStr, &mappedNameStr);
|
|
|
|
|
|
|
|
mContext->gl->fBindAttribLocation(prog, index, mappedNameStr->c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WebGLShader::FindAttribUserNameByMappedName(
|
2016-12-24 00:29:07 +03:00
|
|
|
const nsACString& mappedName, nsCString* const out_userName) const {
|
2015-01-16 02:40:39 +03:00
|
|
|
if (!mValidator) return false;
|
|
|
|
|
|
|
|
const std::string mappedNameStr(mappedName.BeginReading());
|
|
|
|
const std::string* userNameStr;
|
|
|
|
if (!mValidator->FindAttribUserNameByMappedName(mappedNameStr, &userNameStr))
|
|
|
|
return false;
|
|
|
|
|
2016-12-24 00:29:07 +03:00
|
|
|
*out_userName = userNameStr->c_str();
|
2015-01-16 02:40:39 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-11-14 06:27:17 +03:00
|
|
|
bool WebGLShader::FindVaryingByMappedName(const nsACString& mappedName,
|
|
|
|
nsCString* const out_userName,
|
|
|
|
bool* const out_isArray) const {
|
|
|
|
if (!mValidator) return false;
|
|
|
|
|
|
|
|
const std::string mappedNameStr(mappedName.BeginReading());
|
|
|
|
std::string userNameStr;
|
|
|
|
if (!mValidator->FindVaryingByMappedName(mappedNameStr, &userNameStr,
|
|
|
|
out_isArray))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
*out_userName = userNameStr.c_str();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
bool WebGLShader::FindUniformByMappedName(const nsACString& mappedName,
|
|
|
|
nsCString* const out_userName,
|
|
|
|
bool* const out_isArray) const {
|
|
|
|
if (!mValidator) return false;
|
|
|
|
|
|
|
|
const std::string mappedNameStr(mappedName.BeginReading(),
|
|
|
|
mappedName.Length());
|
|
|
|
std::string userNameStr;
|
|
|
|
if (!mValidator->FindUniformByMappedName(mappedNameStr, &userNameStr,
|
|
|
|
out_isArray))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
*out_userName = userNameStr.c_str();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-12-24 00:29:07 +03:00
|
|
|
bool WebGLShader::UnmapUniformBlockName(
|
|
|
|
const nsACString& baseMappedName, nsCString* const out_baseUserName) const {
|
|
|
|
if (!mValidator) {
|
|
|
|
*out_baseUserName = baseMappedName;
|
|
|
|
return true;
|
|
|
|
}
|
2015-11-03 19:02:29 +03:00
|
|
|
|
2016-12-24 00:29:07 +03:00
|
|
|
return mValidator->UnmapUniformBlockName(baseMappedName, out_baseUserName);
|
2015-03-18 06:30:52 +03:00
|
|
|
}
|
|
|
|
|
2016-09-10 07:02:54 +03:00
|
|
|
void WebGLShader::MapTransformFeedbackVaryings(
|
|
|
|
const std::vector<nsString>& varyings,
|
|
|
|
std::vector<std::string>* out_mappedVaryings) const {
|
2015-04-21 04:02:34 +03:00
|
|
|
MOZ_ASSERT(mType == LOCAL_GL_VERTEX_SHADER);
|
|
|
|
MOZ_ASSERT(out_mappedVaryings);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-09-10 07:02:54 +03:00
|
|
|
out_mappedVaryings->clear();
|
|
|
|
out_mappedVaryings->reserve(varyings.size());
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-09-10 07:02:54 +03:00
|
|
|
for (const auto& wideUserName : varyings) {
|
|
|
|
const NS_LossyConvertUTF16toASCII mozUserName(
|
|
|
|
wideUserName); // Don't validate here.
|
|
|
|
const std::string userName(mozUserName.BeginReading(),
|
|
|
|
mozUserName.Length());
|
|
|
|
const std::string* pMappedName = &userName;
|
|
|
|
if (mValidator) {
|
|
|
|
mValidator->FindVaryingMappedNameByUserName(userName, &pMappedName);
|
2015-04-21 04:02:34 +03:00
|
|
|
}
|
2016-09-10 07:02:54 +03:00
|
|
|
out_mappedVaryings->push_back(*pMappedName);
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
2015-04-21 04:02:34 +03:00
|
|
|
}
|
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Boilerplate
|
|
|
|
|
2015-07-15 03:37:28 +03:00
|
|
|
JSObject* WebGLShader::WrapObject(JSContext* js,
|
|
|
|
JS::Handle<JSObject*> givenProto) {
|
2018-06-26 00:20:54 +03:00
|
|
|
return dom::WebGLShader_Binding::Wrap(js, this, givenProto);
|
2012-12-03 17:10:23 +04:00
|
|
|
}
|
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
size_t WebGLShader::SizeOfIncludingThis(MallocSizeOf mallocSizeOf) const {
|
2015-01-16 02:40:39 +03:00
|
|
|
size_t validatorSize = mValidator ? mallocSizeOf(mValidator.get()) : 0;
|
2014-11-14 07:03:50 +03:00
|
|
|
return mallocSizeOf(this) +
|
|
|
|
mSource.SizeOfExcludingThisIfUnshared(mallocSizeOf) +
|
2015-01-16 02:40:39 +03:00
|
|
|
mCleanSource.SizeOfExcludingThisIfUnshared(mallocSizeOf) +
|
|
|
|
validatorSize +
|
|
|
|
mValidationLog.SizeOfExcludingThisIfUnshared(mallocSizeOf) +
|
|
|
|
mTranslatedSource.SizeOfExcludingThisIfUnshared(mallocSizeOf) +
|
|
|
|
mCompilationLog.SizeOfExcludingThisIfUnshared(mallocSizeOf);
|
2012-12-03 17:10:23 +04:00
|
|
|
}
|
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
void WebGLShader::Delete() {
|
|
|
|
gl::GLContext* gl = mContext->GL();
|
|
|
|
|
|
|
|
gl->fDeleteShader(mGLName);
|
|
|
|
|
|
|
|
LinkedListElement<WebGLShader>::removeFrom(mContext->mShaders);
|
2012-12-03 17:10:23 +04:00
|
|
|
}
|
|
|
|
|
2012-10-05 00:35:54 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WebGLShader)
|
|
|
|
|
2013-08-29 19:39:17 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WebGLShader, AddRef)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WebGLShader, Release)
|
2014-11-14 07:03:50 +03:00
|
|
|
|
|
|
|
} // namespace mozilla
|