зеркало из https://github.com/mozilla/gecko-dev.git
Bug 598838 - Fix WebGL messages (were printing uninitialized values) - r=vladimir
This commit is contained in:
Родитель
bb4842b85a
Коммит
61db812395
|
@ -506,9 +506,8 @@ public:
|
|||
// console logging helpers
|
||||
static void LogMessage(const char *fmt, ...);
|
||||
static void LogMessage(const char *fmt, va_list ap);
|
||||
// if display is false, this won't actually do anything
|
||||
static void LogMessage(bool display, const char *fmt, ...);
|
||||
void LogMessageIfVerbose(const char *fmt, ...);
|
||||
void LogMessageIfVerbose(const char *fmt, va_list ap);
|
||||
|
||||
friend class WebGLTexture;
|
||||
};
|
||||
|
|
|
@ -2505,7 +2505,7 @@ WebGLContext::ReadPixels_base(WebGLint x, WebGLint y, WebGLsizei width, WebGLsiz
|
|||
WebGLenum format, WebGLenum type, void *data, PRUint32 byteLength)
|
||||
{
|
||||
if (HTMLCanvasElement()->IsWriteOnly() && !nsContentUtils::IsCallerTrustedForRead()) {
|
||||
LogMessage(mVerbose, "ReadPixels: Not allowed");
|
||||
LogMessageIfVerbose("ReadPixels: Not allowed");
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
|
|
|
@ -214,6 +214,8 @@ WebGLContext::LogMessage(const char *fmt, ...)
|
|||
void
|
||||
WebGLContext::LogMessage(const char *fmt, va_list ap)
|
||||
{
|
||||
if (!fmt) return;
|
||||
|
||||
char buf[1024];
|
||||
PR_vsnprintf(buf, 1024, fmt, ap);
|
||||
|
||||
|
@ -225,20 +227,6 @@ WebGLContext::LogMessage(const char *fmt, va_list ap)
|
|||
JS_ReportWarning(ccx, "WebGL: %s", buf);
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::LogMessage(bool display, const char *fmt, ...)
|
||||
{
|
||||
if (!display)
|
||||
return;
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
||||
LogMessage(fmt, ap);
|
||||
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::LogMessageIfVerbose(const char *fmt, ...)
|
||||
{
|
||||
|
@ -253,6 +241,15 @@ WebGLContext::LogMessageIfVerbose(const char *fmt, ...)
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::LogMessageIfVerbose(const char *fmt, va_list ap)
|
||||
{
|
||||
if (!mVerbose)
|
||||
return;
|
||||
|
||||
LogMessage(fmt, ap);
|
||||
}
|
||||
|
||||
nsresult
|
||||
WebGLContext::SynthesizeGLError(WebGLenum err)
|
||||
{
|
||||
|
@ -278,8 +275,7 @@ WebGLContext::SynthesizeGLError(WebGLenum err, const char *fmt, ...)
|
|||
{
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
if (fmt)
|
||||
LogMessage(mVerbose, fmt, va);
|
||||
LogMessageIfVerbose(fmt, va);
|
||||
va_end(va);
|
||||
|
||||
return SynthesizeGLError(err);
|
||||
|
@ -290,8 +286,7 @@ WebGLContext::ErrorInvalidEnum(const char *fmt, ...)
|
|||
{
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
if (fmt)
|
||||
LogMessage(mVerbose, fmt, va);
|
||||
LogMessageIfVerbose(fmt, va);
|
||||
va_end(va);
|
||||
|
||||
return SynthesizeGLError(LOCAL_GL_INVALID_ENUM);
|
||||
|
@ -302,8 +297,7 @@ WebGLContext::ErrorInvalidOperation(const char *fmt, ...)
|
|||
{
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
if (fmt)
|
||||
LogMessage(mVerbose, fmt, va);
|
||||
LogMessageIfVerbose(fmt, va);
|
||||
va_end(va);
|
||||
|
||||
return SynthesizeGLError(LOCAL_GL_INVALID_OPERATION);
|
||||
|
@ -314,8 +308,7 @@ WebGLContext::ErrorInvalidValue(const char *fmt, ...)
|
|||
{
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
if (fmt)
|
||||
LogMessage(mVerbose, fmt, va);
|
||||
LogMessageIfVerbose(fmt, va);
|
||||
va_end(va);
|
||||
|
||||
return SynthesizeGLError(LOCAL_GL_INVALID_VALUE);
|
||||
|
|
|
@ -111,7 +111,7 @@ WebGLContext::ValidateBuffers(PRUint32 count)
|
|||
continue;
|
||||
|
||||
if (vd.buf == nsnull) {
|
||||
LogMessage(mVerbose, "No VBO bound to enabled attrib index %d!", i);
|
||||
LogMessageIfVerbose("No VBO bound to enabled attrib index %d!", i);
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
@ -126,12 +126,12 @@ WebGLContext::ValidateBuffers(PRUint32 count)
|
|||
CheckedUint32(vd.componentSize()) * vd.size; // and the number of bytes needed for these components
|
||||
|
||||
if (!checked_needed.valid()) {
|
||||
LogMessage(mVerbose, "Integer overflow computing the size of bound vertex attrib buffer at index %d", i);
|
||||
LogMessageIfVerbose("Integer overflow computing the size of bound vertex attrib buffer at index %d", i);
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
if (vd.buf->ByteLength() < checked_needed.value()) {
|
||||
LogMessage(mVerbose, "VBO too small for bound attrib index %d: need at least %d bytes, but have only %d",
|
||||
LogMessageIfVerbose("VBO too small for bound attrib index %d: need at least %d bytes, but have only %d",
|
||||
i, checked_needed.value(), vd.buf->ByteLength());
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче