Closed Bug 721467 Opened 14 years ago Closed 14 years ago

Add a codepath to only use glTexImage2D instead of glTexSubImage2D when texture uploading in GLContext

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla13

People

(Reporter: gw280, Assigned: gw280)

References

Details

Attachments

(1 file, 3 obsolete files)

Some drivers don't do glTexSubImage2D very well. We should have a code path that avoids using that function in GLContext
Blocks: 619615
Attached patch use glTexImage2D (obsolete) — Splinter Review
Attachment #591894 - Flags: review?(bgirard)
Attachment #591894 - Flags: review?(bgirard) → review?(joe)
Attachment #591894 - Flags: review?(bgirard)
Comment on attachment 591894 [details] [diff] [review] use glTexImage2D Review of attachment 591894 [details] [diff] [review]: ----------------------------------------------------------------- LGTM. Make a couple of changes and you should be good to go! ::: gfx/gl/GLContext.cpp @@ +2076,5 @@ > + if (iterRect->x == 0 && > + iterRect->y == 0 && > + iterRect->width == aTextureSize.width && > + iterRect->height == aTextureSize.height) > + useTexSubImage2D = false; Add {} ::: gfx/gl/GLContext.h @@ +1214,5 @@ > GLuint& aTexture, > bool aOverwrite = false, > const nsIntPoint& aSrcPoint = nsIntPoint(0, 0), > + bool aPixelBuffer = false, > + const nsIntSize& aTextureSize = nsIntSize(0, 0)); I don't think it makes sense for aTextureSize to have a default value. It should just be added to the earlier, non-default parameters. Also, document the parameter.
Attachment #591894 - Flags: review?(joe) → review+
Comment on attachment 591894 [details] [diff] [review] use glTexImage2D Review of attachment 591894 [details] [diff] [review]: ----------------------------------------------------------------- Excellent patch! ::: gfx/gl/GLContext.cpp @@ +400,5 @@ > } > } > + > + glRendererString = (const char *)fGetString(LOCAL_GL_RENDERER); > + const char *rendererMatchStrings[RendererOther] = { The name implies string equality. It should be renamed to something like 'DoesSubStringMatch' @@ +2075,5 @@ > + // the entire texture > + if (iterRect->x == 0 && > + iterRect->y == 0 && > + iterRect->width == aTextureSize.width && > + iterRect->height == aTextureSize.height) I think we should do >=. I know with the call site this wont happen but let's make this function more generic and let it grows the texture if it needs to.
Attachment #591894 - Flags: review?(bgirard) → review+
Attached patch updated patch (obsolete) — Splinter Review
Attachment #591894 - Attachment is obsolete: true
Attachment #591921 - Flags: review?(joe)
Comment on attachment 591921 [details] [diff] [review] updated patch Review of attachment 591921 [details] [diff] [review]: ----------------------------------------------------------------- I checked the UploadSurfaceToTexture call sites, and the size arguments all look correct.
Attachment #591921 - Flags: review?(joe) → review+
Assignee: nobody → gwright
Target Milestone: --- → mozilla12
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Depends on: 722167
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
This removes the general optimisation that was causing bug 722167
Attachment #591921 - Attachment is obsolete: true
Attachment #592822 - Flags: review?(joe)
https://tbpl.mozilla.org/?tree=Try&rev=d338c6ebc498 New patched has been pushed to try. I've run a local build on my OS X box and confirmed it no longer causes gfx corruption.
Comment on attachment 592822 [details] [diff] [review] updated patch removing the glTexImage2D general case optimisation Review of attachment 592822 [details] [diff] [review]: ----------------------------------------------------------------- ::: gfx/gl/GLContext.cpp @@ +712,5 @@ > // determine the region the client will need to repaint > + if (!mGLContext->CanUploadSubTextures()) { > + aRegion = nsIntRect(nsIntPoint(0, 0), mSize); > + } else { > + GetUpdateRegion(aRegion); Reverse these two so we don't have a negation @@ +2012,5 @@ > // to the start of the data block. > if (!aPixelBuffer) { > data = imageSurface->Data(); > } > + Spaces on this line. @@ +2079,5 @@ > "Must be uploading to the origin when we don't have an existing texture"); > > + bool useTexSubImage2D = true; > + > + nsIntRect bounds = aDstRegion.GetBounds(); You can remove these two lines.
Attachment #592822 - Flags: review?(joe) → review+
Attached patch final patchSplinter Review
Final patch for committing
Attachment #592822 - Attachment is obsolete: true
Status: REOPENED → RESOLVED
Closed: 14 years ago14 years ago
Resolution: --- → FIXED
Target Milestone: mozilla12 → mozilla13
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: