mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
b=619485; add WebGL info to about:support; r=jrmuizel,a=beltzner
This commit is contained in:
parent
5a5c544bbf
commit
dd83d0dfa6
@ -695,6 +695,33 @@ WebGLContext::GetContextAttributes(jsval *aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [noscript] DOMString mozGetUnderlyingParamString(in WebGLenum pname); */
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::MozGetUnderlyingParamString(PRUint32 pname, nsAString& retval)
|
||||
{
|
||||
retval.SetIsVoid(PR_TRUE);
|
||||
|
||||
MakeContextCurrent();
|
||||
|
||||
switch (pname) {
|
||||
case LOCAL_GL_VENDOR:
|
||||
case LOCAL_GL_RENDERER:
|
||||
case LOCAL_GL_VERSION:
|
||||
case LOCAL_GL_SHADING_LANGUAGE_VERSION:
|
||||
case LOCAL_GL_EXTENSIONS: {
|
||||
const char *s = (const char *) gl->fGetString(pname);
|
||||
retval.Assign(NS_ConvertASCIItoUTF16(nsDependentCString(s)));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// XPCOM goop
|
||||
//
|
||||
@ -830,31 +857,37 @@ NAME_NOT_SUPPORTED(WebGLFramebuffer)
|
||||
NAME_NOT_SUPPORTED(WebGLRenderbuffer)
|
||||
|
||||
/* [noscript] attribute WebGLint location; */
|
||||
NS_IMETHODIMP WebGLUniformLocation::GetLocation(WebGLint *aLocation)
|
||||
NS_IMETHODIMP
|
||||
WebGLUniformLocation::GetLocation(WebGLint *aLocation)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP WebGLUniformLocation::SetLocation(WebGLint aLocation)
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebGLUniformLocation::SetLocation(WebGLint aLocation)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute WebGLint size; */
|
||||
NS_IMETHODIMP WebGLActiveInfo::GetSize(WebGLint *aSize)
|
||||
NS_IMETHODIMP
|
||||
WebGLActiveInfo::GetSize(WebGLint *aSize)
|
||||
{
|
||||
*aSize = mSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute WebGLenum type; */
|
||||
NS_IMETHODIMP WebGLActiveInfo::GetType(WebGLenum *aType)
|
||||
NS_IMETHODIMP
|
||||
WebGLActiveInfo::GetType(WebGLenum *aType)
|
||||
{
|
||||
*aType = mType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute DOMString name; */
|
||||
NS_IMETHODIMP WebGLActiveInfo::GetName(nsAString & aName)
|
||||
NS_IMETHODIMP
|
||||
WebGLActiveInfo::GetName(nsAString & aName)
|
||||
{
|
||||
aName = mName;
|
||||
return NS_OK;
|
||||
|
@ -822,4 +822,9 @@ interface nsIDOMWebGLRenderingContext : nsISupports
|
||||
void vertexAttribPointer(in WebGLuint idx, in WebGLint size, in WebGLenum type, in WebGLboolean normalized, in WebGLsizei stride, in WebGLsizeiptr offset);
|
||||
|
||||
void viewport(in WebGLint x, in WebGLint y, in WebGLsizei width, in WebGLsizei height);
|
||||
|
||||
// get an underlying GL parameter, without any WebGL intervention.
|
||||
// Most useful for querying GL_VENDOR/GL_RENDERER for identifying
|
||||
// the underlying renderer to the user.
|
||||
[noscript] DOMString mozGetUnderlyingParamString(in WebGLenum pname);
|
||||
};
|
||||
|
@ -1,3 +1,4 @@
|
||||
# -*- Mode: js2; indent-tabs-mode: nil; js2-basic-offset: 2; -*-
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
@ -240,8 +241,18 @@ function populateGraphicsSection() {
|
||||
createElement("td", dwEnabled),
|
||||
]));
|
||||
|
||||
appendChildren(graphics_tbody, trGraphics);
|
||||
var webglrenderer;
|
||||
try {
|
||||
webglrenderer = gfxInfo.getWebGLParameter("full-renderer");
|
||||
} catch (e) {
|
||||
webglrenderer = "(WebGL unavailable)";
|
||||
}
|
||||
trGraphics.push(createParentElement("tr", [
|
||||
createHeader(bundle.GetStringFromName("webglRenderer")),
|
||||
createElement("td", webglrenderer)
|
||||
]));
|
||||
|
||||
appendChildren(graphics_tbody, trGraphics);
|
||||
} // end if (gfxInfo)
|
||||
|
||||
let windows = Services.ww.getWindowEnumerator();
|
||||
|
@ -23,3 +23,4 @@ adapterDrivers = Adapter Drivers
|
||||
adapterRAM = Adapter RAM
|
||||
driverVersion = Driver Version
|
||||
driverDate = Driver Date
|
||||
webglRenderer = WebGL Renderer
|
||||
|
@ -117,5 +117,12 @@ interface nsIGfxInfo : nsISupports
|
||||
* FEATURE_BLOCKED_DRIVER_VERSION, otherwise return an empty string.
|
||||
*/
|
||||
DOMString getFeatureSuggestedDriverVersion(in long aFeature);
|
||||
|
||||
/**
|
||||
* WebGL info; valid params are "full-renderer", "vendor", "renderer", "version",
|
||||
* "shading_language_version", "extensions". These return info from
|
||||
* underlying GL impl that's used to implement WebGL.
|
||||
*/
|
||||
DOMString getWebGLParameter(in DOMString aParam);
|
||||
};
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <OpenGL/CGLRenderers.h>
|
||||
|
||||
#include "GfxInfo.h"
|
||||
#include "GfxInfoWebGL.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
@ -234,3 +235,9 @@ GfxInfo::GetFeatureSuggestedDriverVersion(PRInt32 aFeature, nsAString& aSuggeste
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GfxInfo::GetWebGLParameter(const nsAString& aParam, nsAString& aResult)
|
||||
{
|
||||
return GfxInfoWebGL::GetWebGLParameter(aParam, aResult);
|
||||
}
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <windows.h>
|
||||
#include "gfxWindowsPlatform.h"
|
||||
#include "GfxInfo.h"
|
||||
#include "GfxInfoWebGL.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
@ -751,3 +752,9 @@ GfxInfo::GetFeatureSuggestedDriverVersion(PRInt32 aFeature, nsAString& aSuggeste
|
||||
PRInt32 i;
|
||||
return GetFeatureStatusImpl(aFeature, &i, aSuggestedDriverVersion);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GfxInfo::GetWebGLParameter(const nsAString& aParam, nsAString& aResult)
|
||||
{
|
||||
return GfxInfoWebGL::GetWebGLParameter(aParam, aResult);
|
||||
}
|
||||
|
101
widget/src/xpwidgets/GfxInfoWebGL.cpp
Normal file
101
widget/src/xpwidgets/GfxInfoWebGL.cpp
Normal file
@ -0,0 +1,101 @@
|
||||
/* vim: se cin sw=2 ts=2 et : */
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "GfxInfoWebGL.h"
|
||||
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "GLDefs.h"
|
||||
#include "nsIDOMWebGLRenderingContext.h"
|
||||
#include "nsICanvasRenderingContextInternal.h"
|
||||
|
||||
using namespace mozilla::widget;
|
||||
|
||||
nsresult
|
||||
GfxInfoWebGL::GetWebGLParameter(const nsAString& aParam, nsAString& aResult)
|
||||
{
|
||||
GLenum param;
|
||||
|
||||
if (aParam.EqualsLiteral("vendor")) param = LOCAL_GL_VENDOR;
|
||||
else if (aParam.EqualsLiteral("renderer")) param = LOCAL_GL_RENDERER;
|
||||
else if (aParam.EqualsLiteral("version")) param = LOCAL_GL_VERSION;
|
||||
else if (aParam.EqualsLiteral("shading_language_version")) param = LOCAL_GL_SHADING_LANGUAGE_VERSION;
|
||||
else if (aParam.EqualsLiteral("extensions")) param = LOCAL_GL_EXTENSIONS;
|
||||
else if (aParam.EqualsLiteral("full-renderer")) param = 0;
|
||||
else return NS_ERROR_INVALID_ARG;
|
||||
|
||||
nsCOMPtr<nsIDOMWebGLRenderingContext> webgl =
|
||||
do_CreateInstance("@mozilla.org/content/canvas-rendering-context;1?id=experimental-webgl");
|
||||
if (!webgl)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
nsCOMPtr<nsICanvasRenderingContextInternal> webglInternal =
|
||||
do_QueryInterface(webgl);
|
||||
if (!webglInternal)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
nsresult rv = webglInternal->SetDimensions(16, 16);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (param)
|
||||
return webgl->MozGetUnderlyingParamString(param, aResult);
|
||||
|
||||
// this is the "full renderer" string, which is vendor + renderer + version
|
||||
|
||||
nsAutoString str;
|
||||
|
||||
rv = webgl->MozGetUnderlyingParamString(LOCAL_GL_VENDOR, str);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
aResult.Append(str);
|
||||
aResult.AppendLiteral(" -- ");
|
||||
|
||||
rv = webgl->MozGetUnderlyingParamString(LOCAL_GL_RENDERER, str);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
aResult.Append(str);
|
||||
aResult.AppendLiteral(" -- ");
|
||||
|
||||
rv = webgl->MozGetUnderlyingParamString(LOCAL_GL_VERSION, str);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
aResult.Append(str);
|
||||
|
||||
return NS_OK;
|
||||
}
|
59
widget/src/xpwidgets/GfxInfoWebGL.h
Normal file
59
widget/src/xpwidgets/GfxInfoWebGL.h
Normal file
@ -0,0 +1,59 @@
|
||||
/* vim: se cin sw=2 ts=2 et : */
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __mozilla_widget_GfxInfoWebGL_h__
|
||||
#define __mozilla_widget_GfxInfoWebGL_h__
|
||||
|
||||
#include "nsString.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
class GfxInfoWebGL {
|
||||
public:
|
||||
static nsresult GetWebGLParameter(const nsAString& aParam, nsAString& aResult);
|
||||
|
||||
protected:
|
||||
GfxInfoWebGL() { }
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -68,6 +68,7 @@ CPPSRCS = \
|
||||
nsWidgetAtoms.cpp \
|
||||
nsIdleService.cpp \
|
||||
nsClipboardPrivacyHandler.cpp \
|
||||
GfxInfoWebGL.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_IPC
|
||||
|
Loading…
Reference in New Issue
Block a user