mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 968374 - Implement WEBGL_debug_shaders. r=bjacob
This commit is contained in:
parent
c52788043c
commit
57f9c5bee8
@ -367,6 +367,7 @@ public:
|
||||
void GetShaderInfoLog(WebGLShader *shader, nsACString& retval);
|
||||
void GetShaderInfoLog(WebGLShader *shader, nsAString& retval);
|
||||
void GetShaderSource(WebGLShader *shader, nsAString& retval);
|
||||
void GetShaderTranslatedSource(WebGLShader *shader, nsAString& retval);
|
||||
JS::Value GetTexParameter(GLenum target, GLenum pname);
|
||||
JS::Value GetTexParameter(JSContext * /* unused */, GLenum target,
|
||||
GLenum pname) {
|
||||
@ -906,6 +907,7 @@ protected:
|
||||
WEBGL_compressed_texture_pvrtc,
|
||||
WEBGL_compressed_texture_s3tc,
|
||||
WEBGL_debug_renderer_info,
|
||||
WEBGL_debug_shaders,
|
||||
WEBGL_depth_texture,
|
||||
WEBGL_lose_context,
|
||||
WEBGL_draw_buffers,
|
||||
|
@ -29,6 +29,7 @@ static const char *sExtensionNames[] = {
|
||||
"WEBGL_compressed_texture_pvrtc",
|
||||
"WEBGL_compressed_texture_s3tc",
|
||||
"WEBGL_debug_renderer_info",
|
||||
"WEBGL_debug_shaders",
|
||||
"WEBGL_depth_texture",
|
||||
"WEBGL_lose_context",
|
||||
"WEBGL_draw_buffers",
|
||||
@ -68,6 +69,8 @@ bool WebGLContext::IsExtensionSupported(JSContext *cx, WebGLExtensionID ext) con
|
||||
switch (ext) {
|
||||
case WEBGL_debug_renderer_info:
|
||||
return true;
|
||||
case WEBGL_debug_shaders:
|
||||
return true;
|
||||
default:
|
||||
// For warnings-as-errors.
|
||||
break;
|
||||
@ -259,6 +262,9 @@ WebGLContext::EnableExtension(WebGLExtensionID ext)
|
||||
case WEBGL_debug_renderer_info:
|
||||
obj = new WebGLExtensionDebugRendererInfo(this);
|
||||
break;
|
||||
case WEBGL_debug_shaders:
|
||||
obj = new WebGLExtensionDebugShaders(this);
|
||||
break;
|
||||
case WEBGL_depth_texture:
|
||||
obj = new WebGLExtensionDepthTexture(this);
|
||||
break;
|
||||
|
@ -3306,6 +3306,8 @@ WebGLContext::CompileShader(WebGLShader *shader)
|
||||
translatedSrc.SetLength(len);
|
||||
ShGetObjectCode(compiler, translatedSrc.BeginWriting());
|
||||
|
||||
CopyASCIItoUTF16(translatedSrc, shader->mTranslatedSource);
|
||||
|
||||
const char *ts = translatedSrc.get();
|
||||
|
||||
#ifdef WEBGL2_BYPASS_ANGLE
|
||||
@ -3324,6 +3326,8 @@ WebGLContext::CompileShader(WebGLShader *shader)
|
||||
// that's really bad, as that means we can't be 100% conformant. We should work towards always
|
||||
// using ANGLE identifier mapping.
|
||||
gl->fShaderSource(shadername, 1, &s, nullptr);
|
||||
|
||||
CopyASCIItoUTF16(s, shader->mTranslatedSource);
|
||||
}
|
||||
|
||||
shader->SetTranslationSuccess();
|
||||
@ -3617,8 +3621,7 @@ WebGLContext::GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype)
|
||||
void
|
||||
WebGLContext::GetShaderSource(WebGLShader *shader, nsAString& retval)
|
||||
{
|
||||
if (IsContextLost())
|
||||
{
|
||||
if (IsContextLost()) {
|
||||
retval.SetIsVoid(true);
|
||||
return;
|
||||
}
|
||||
@ -3651,6 +3654,20 @@ WebGLContext::ShaderSource(WebGLShader *shader, const nsAString& source)
|
||||
shader->SetNeedsTranslation();
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::GetShaderTranslatedSource(WebGLShader *shader, nsAString& retval)
|
||||
{
|
||||
if (IsContextLost()) {
|
||||
retval.SetIsVoid(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ValidateObject("getShaderTranslatedSource: shader", shader))
|
||||
return;
|
||||
|
||||
retval.Assign(shader->TranslatedSource());
|
||||
}
|
||||
|
||||
GLenum WebGLContext::CheckedTexImage2D(GLenum target,
|
||||
GLint level,
|
||||
GLenum internalFormat,
|
||||
|
36
content/canvas/src/WebGLExtensionDebugShaders.cpp
Normal file
36
content/canvas/src/WebGLExtensionDebugShaders.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionDebugShaders::WebGLExtensionDebugShaders(WebGLContext* context)
|
||||
: WebGLExtensionBase(context)
|
||||
{
|
||||
}
|
||||
|
||||
WebGLExtensionDebugShaders::~WebGLExtensionDebugShaders()
|
||||
{
|
||||
}
|
||||
|
||||
/* If no source has been defined, compileShader() has not been called,
|
||||
* or the translation has failed for shader, an empty string is
|
||||
* returned; otherwise, return the translated source.
|
||||
*/
|
||||
void
|
||||
WebGLExtensionDebugShaders::GetTranslatedShaderSource(WebGLShader* shader,
|
||||
nsAString& retval)
|
||||
{
|
||||
mContext->GetShaderTranslatedSource(shader, retval);
|
||||
|
||||
if (retval.IsVoid()) {
|
||||
CopyASCIItoUTF16("", retval);
|
||||
}
|
||||
}
|
||||
|
||||
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionDebugShaders)
|
@ -76,6 +76,18 @@ public:
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
class WebGLExtensionDebugShaders
|
||||
: public WebGLExtensionBase
|
||||
{
|
||||
public:
|
||||
WebGLExtensionDebugShaders(WebGLContext*);
|
||||
virtual ~WebGLExtensionDebugShaders();
|
||||
|
||||
void GetTranslatedShaderSource(WebGLShader* shader, nsAString& retval);
|
||||
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
class WebGLExtensionDepthTexture
|
||||
: public WebGLExtensionBase
|
||||
{
|
||||
|
@ -72,6 +72,8 @@ public:
|
||||
|
||||
const nsCString& TranslationLog() const { return mTranslationLog; }
|
||||
|
||||
const nsString& TranslatedSource() const { return mTranslatedSource; }
|
||||
|
||||
WebGLContext *GetParentObject() const {
|
||||
return Context();
|
||||
}
|
||||
@ -87,6 +89,7 @@ protected:
|
||||
GLuint mGLName;
|
||||
GLenum mType;
|
||||
nsString mSource;
|
||||
nsString mTranslatedSource;
|
||||
nsCString mTranslationLog; // The translation log should contain only ASCII characters
|
||||
bool mNeedsTranslation;
|
||||
nsTArray<WebGLMappedIdentifier> mAttributes;
|
||||
|
@ -48,6 +48,7 @@ if CONFIG['MOZ_WEBGL']:
|
||||
'WebGLExtensionCompressedTexturePVRTC.cpp',
|
||||
'WebGLExtensionCompressedTextureS3TC.cpp',
|
||||
'WebGLExtensionDebugRendererInfo.cpp',
|
||||
'WebGLExtensionDebugShaders.cpp',
|
||||
'WebGLExtensionDepthTexture.cpp',
|
||||
'WebGLExtensionDrawBuffers.cpp',
|
||||
'WebGLExtensionElementIndexUint.cpp',
|
||||
|
@ -1370,6 +1370,11 @@ DOMInterfaces = {
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLExtensionDebugShaders': {
|
||||
'nativeType': 'mozilla::WebGLExtensionDebugShaders',
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLExtensionElementIndexUint': {
|
||||
'nativeType': 'mozilla::WebGLExtensionElementIndexUint',
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
|
@ -805,6 +805,12 @@ interface WebGLExtensionDebugRendererInfo
|
||||
const GLenum UNMASKED_RENDERER_WEBGL = 0x9246;
|
||||
};
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface WebGLExtensionDebugShaders
|
||||
{
|
||||
DOMString getTranslatedShaderSource(WebGLShader? shader);
|
||||
};
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface WebGLExtensionDepthTexture
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user