Closed Bug 592103 Opened 15 years ago Closed 15 years ago

return null for invalid uniform locations

Categories

(Core :: Graphics: CanvasWebGL, defect)

x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- beta5+

People

(Reporter: vlad, Assigned: vlad)

Details

Attachments

(1 file)

GL returns -1 when a uniform doesn't exist; we should be returning null. Currently we end up creating a new uniform object for this, oops :)
Attachment #470617 - Flags: review?(bjacob)
Comment on attachment 470617 [details] [diff] [review] return null uniforms correctly ># HG changeset patch ># Parent 23189f13f77eb1fb3c31319463f79840b34e1f48 >diff --git a/content/canvas/src/WebGLContextGL.cpp b/content/canvas/src/WebGLContextGL.cpp >--- a/content/canvas/src/WebGLContextGL.cpp >+++ b/content/canvas/src/WebGLContextGL.cpp >@@ -104,16 +104,21 @@ NS_IMETHODIMP WebGLContext::name(t1 a1, > MakeContextCurrent(); gl->f##glname(a1,a2,a3,a4,a5,a6); return NS_OK; \ > } > >-already_AddRefed<WebGLUniformLocation> WebGLProgram::GetUniformLocationObject(GLint glLocation) >+already_AddRefed<WebGLUniformLocation> >+WebGLProgram::GetUniformLocationObject(GLint glLocation) > { > WebGLUniformLocation *existingLocationObject; > if (mMapUniformLocations.Get(glLocation, &existingLocationObject)) { > return existingLocationObject; >- } else { >- nsRefPtr<WebGLUniformLocation> loc = new WebGLUniformLocation(mContext, this, glLocation); >- mMapUniformLocations.Put(glLocation, loc); >- return loc.forget(); > } >+ >+ if (loc < 0) { This looks like it should be glLocation. Looks good other than that.
Attachment #470617 - Flags: review?(bjacob) → review+
Status: NEW → RESOLVED
blocking2.0: --- → beta5+
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: