Closed Bug 867460 Opened 11 years ago Closed 11 years ago

remove notion of ShaderProgramTypes from gfx/gl

Categories

(Core :: Graphics: Layers, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: gal, Assigned: milan)

References

Details

Attachments

(1 file, 10 obsolete files)

83.33 KB, patch
BenWa
: review+
Details | Diff | Splinter Review
We want to move towards a dynamic shader pipeline, so having ShaderProgramTypes in gfx/gl is not useful.
Attached patch patch, works on macosx (obsolete) — Splinter Review
Assignee: nobody → gal
Attached patch and the right patch this time (obsolete) — Splinter Review
Attachment #743964 - Attachment is obsolete: true
Attachment #743966 - Flags: review?(bas)
review ping
I'll get to this by thursday.
review ping
Comment on attachment 743966 [details] [diff] [review]
and the right patch this time

Review of attachment 743966 [details] [diff] [review]:
-----------------------------------------------------------------

Sorry for the delay.

This is strictly an improvement in my opinion. There seem to be a lot of whitespace issues in this code but I don't think now is the right time to address them, we should though, sometime.
Attachment #743966 - Flags: review?(bas) → review+
Attached patch rebased (obsolete) — Splinter Review
This was complete hell to rebase. We have to accelerate reviews of patches to avoid this.
Milan, can you find someone to land this? I probably won't have time to watch the tree in case this bounces. This is blocking any progress on CSS filters, so it would be good to get this in. I tested this on mac (works). Thanks.
Assignee: gal → milan
Attachment #766455 - Attachment is obsolete: true
Attached patch another fix for B2G (obsolete) — Splinter Review
Kicked off another try run: https://tbpl.mozilla.org/?tree=Try&rev=08cb52371c17

This is probably ready to land.
Attachment #766517 - Attachment is obsolete: true
Depends on: 886315
(In reply to Andreas Gal :gal from comment #8)
> Milan, can you find someone to land this? I probably won't have time to
> watch the tree in case this bounces. This is blocking any progress on CSS
> filters, so it would be good to get this in. I tested this on mac (works).
> Thanks.

Will do.  Waiting for the try run in Comment 11 to finish.
Flags: needinfo?(milan)
Blocks: 886315
No longer depends on: 886315
(In reply to Andreas Gal :gal from comment #11)
> Created attachment 766649 [details] [diff] [review]
> another fix for B2G
> 
> Kicked off another try run:
> https://tbpl.mozilla.org/?tree=Try&rev=08cb52371c17
> 
> This is probably ready to land.

One more B2G issue left, pushed another to try: https://tbpl.mozilla.org/?tree=Try&rev=33480e49cd98
Attached patch fix another b2g issue (obsolete) — Splinter Review
Attachment #766649 - Attachment is obsolete: true
another try run for the b2g fix: https://tbpl.mozilla.org/?tree=Try&rev=712a99df82b2
Carrying Bas' r+ from attachment 743966 [details] [diff] [review].
Attachment #743966 - Attachment is obsolete: true
Attachment #766781 - Attachment is obsolete: true
Attachment #766828 - Flags: review+
(In reply to Milan Sreckovic [:milan] from comment #16)
> Created attachment 766828 [details] [diff] [review]
> Andreas' patch with the last B2G compile error fixed
> 
> Carrying Bas' r+ from attachment 743966 [details] [diff] [review].

Try run for this: https://tbpl.mozilla.org/?tree=Try&rev=33480e49cd98
Flags: needinfo?(milan)
Keywords: checkin-needed
Attachment #766828 - Flags: superreview?(joe)
Comment on attachment 766828 [details] [diff] [review]
Andreas' patch with the last B2G compile error fixed

Review of attachment 766828 [details] [diff] [review]:
-----------------------------------------------------------------

I do very much like this. I'd like it even more if ShaderProgramType was removed entirely instead of just moved to LayerManagerOGLProgram.h, but that's probably a task for bug 886315. Consider this my intent-approval!

Note for committing: Make sure the user is set to Andreas and not Milan!
Attachment #766828 - Flags: superreview?(joe) → superreview+
Carrying the r+ from Bas; superreview from Joe for the intent.
Attachment #766828 - Attachment is obsolete: true
Attachment #767221 - Flags: superreview?(joe)
Attachment #767221 - Flags: review+
Comment on attachment 767221 [details] [diff] [review]
Andreas' patch with the last B2G compile error fixed

Still agree with it as in comment 18 :)
Attachment #767221 - Flags: superreview?(joe) → superreview+
Correct, I have already deleted ShaderProgramType in my local repo. Patch this week hopefully.
Now that we have some hindsight to see exactly what this broke, the tally is:

* assertions on OS X 10.6 only, in mochitest-1, -3, -5, -other (-chrome and -a11y), and reftests and crashtests

* failures in every plugin reftest on opt and debug OS X 10.6, 10.7 and 10.8

* two unexpected passes in b2g reftest-6, in webgl-color-alpha-test.html
Depends on: 887094
Thanks for backing this out, and sorry for the bother.  We'll sort it out.
Comment on attachment 766781 [details] [diff] [review]
fix another b2g issue

Review of attachment 766781 [details] [diff] [review]:
-----------------------------------------------------------------

This is the actual patch, so I was commenting on it, even though it's tagged obsolete for different reasons.  I just wanted to check if we're losing some information, mostly on the 565 format, so if you have a chance, check the comments.

::: gfx/gl/GLContext.cpp
@@ +1462,5 @@
>      if (currentPackAlignment != 4) {
>          fPixelStorei(LOCAL_GL_PACK_ALIGNMENT, currentPackAlignment);
>      }
>  
> +    if (aFormat == FORMAT_R8G8B8A8 || aFormat == FORMAT_R8G8B8X8) {

Here we used to catch RGBALayerProgramType and RGBXLayerProgramType, and now we just catch the 8-bit per channel versions.  Is that OK?

@@ +2086,5 @@
>              break;
>          case gfxASurface::ImageFormatRGB16_565:
>              format = LOCAL_GL_RGB;
>              type = LOCAL_GL_UNSIGNED_SHORT_5_6_5;
> +            surfaceFormat = FORMAT_R5G6B5;

See the comment at 1466 - this format used to go into RGBALayerProgramType, so the test at 1466 would catch it, and we would swap R and B.  With this change, we won't have that swap for 565.  Is that OK?

Also, ImageFormatRGB16_565 used to go to RGBALayerProgamType, but now goes to RGBXLayerProgramType - is that OK?

::: gfx/gl/GLContextProviderCGL.mm
@@ +200,5 @@
>                                          SharedTextureHandle sharedHandle,
>                                          SharedHandleDetails& details)
>      {
>          details.mTarget = LOCAL_GL_TEXTURE_RECTANGLE_ARB;
> +        details.mTextureFormat = FORMAT_R8G8B8A8;

With this change, we will hit the R-B swap in GLContext.cpp on this format, where before we did not (because we weren't doing it for RGBRectLayerProgramType.)  Is this OK?

::: gfx/gl/GLContextProviderEGL.cpp
@@ +981,5 @@
>      case SharedHandleType::SurfaceTexture: {
>          SurfaceTextureWrapper* surfaceWrapper = reinterpret_cast<SurfaceTextureWrapper*>(wrapper);
>  
>          details.mTarget = LOCAL_GL_TEXTURE_EXTERNAL;
> +        details.mTextureFormat = FORMAT_R8G8B8A8;

Same thing - this will now do a R-B swap, before it didn't.  Good?
Lost somewhere the comment about LayerManagerOGLProgram.h - 565 used to go to RGBALayer..., now it goes to RGBXLayer... - this change is OK?
> > +    if (aFormat == FORMAT_R8G8B8A8 || aFormat == FORMAT_R8G8B8X8) {
> 
> Here we used to catch RGBALayerProgramType and RGBXLayerProgramType, and now
> we just catch the 8-bit per channel versions.  Is that OK?

Swapping the channels only works on 8-bit-per-color, so this should be ok.

> 
> See the comment at 1466 - this format used to go into RGBALayerProgramType,
> so the test at 1466 would catch it, and we would swap R and B.  With this
> change, we won't have that swap for 565.  Is that OK?

Again, I think RGB16 has no swap. But we will need a 2nd pair of eyes on here.

> 
> Also, ImageFormatRGB16_565 used to go to RGBALayerProgamType, but now goes
> to RGBXLayerProgramType - is that OK?

RGB has no alpha so I am not sure why this worked before.

> >      {
> >          details.mTarget = LOCAL_GL_TEXTURE_RECTANGLE_ARB;
> > +        details.mTextureFormat = FORMAT_R8G8B8A8;

This seems like a bug!

> >  
> >          details.mTarget = LOCAL_GL_TEXTURE_EXTERNAL;
> > +        details.mTextureFormat = FORMAT_R8G8B8A8;
> 
> Same thing - this will now do a R-B swap, before it didn't.  Good?

This too.
Blocks: 888311
(In reply to Andreas Gal :gal from comment #28)
...
> > See the comment at 1466 - this format used to go into RGBALayerProgramType,
> > so the test at 1466 would catch it, and we would swap R and B.  With this
> > change, we won't have that swap for 565.  Is that OK?
> 
> Again, I think RGB16 has no swap. But we will need a 2nd pair of eyes on
> here.

Second set of eyes (bjacob) confirms this.

> 
> > >      {
> > >          details.mTarget = LOCAL_GL_TEXTURE_RECTANGLE_ARB;
> > > +        details.mTextureFormat = FORMAT_R8G8B8A8;
> 
> This seems like a bug!
> 
> > >  
> > >          details.mTarget = LOCAL_GL_TEXTURE_EXTERNAL;
> > > +        details.mTextureFormat = FORMAT_R8G8B8A8;
> > 
> > Same thing - this will now do a R-B swap, before it didn't.  Good?
> 
> This too.

Will sort this out with BenWa.
Comment on attachment 767221 [details] [diff] [review]
Andreas' patch with the last B2G compile error fixed

Review of attachment 767221 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/gl/GLContextProviderCGL.mm
@@ +200,5 @@
>                                          SharedTextureHandle sharedHandle,
>                                          SharedHandleDetails& details)
>      {
>          details.mTarget = LOCAL_GL_TEXTURE_RECTANGLE_ARB;
> +        details.mTextureFormat = FORMAT_R8G8B8A8;

This seems to be a problem.  We lose the extra information, and infer RGBALayerProgramType from the format and YouTube trailers break. Likely the other plug-ins as well.
Attachment #767221 - Flags: superreview+
Attachment #767221 - Flags: review-
Attachment #767221 - Flags: review+
Attached patch Modified patch to pass try (obsolete) — Splinter Review
Use the surface format to figure out the program type, except in a couple of places where the extra target information is necessary to give us the external or rect program instead.
This is try run https://tbpl.mozilla.org/?tree=Try&rev=804b875443d3.  It has an unexpected pass on ARM B2G, webgl color alpha test. There is a place where we previously sent 565 to RGBA, and now to RGBX - would that explain the previous fail?
Attachment #767221 - Attachment is obsolete: true
Attachment #769487 - Flags: review?(gal)
Attachment #769487 - Flags: review?(bgirard)
This is not a patch to be applied, but collects the differences from the patch Andreas submitted to perhaps make the review easier.
Attachment #769491 - Flags: review-
Attachment #769487 - Attachment is patch: true
Attachment #769487 - Attachment mime type: text/x-pascal → text/plain
(In reply to Milan Sreckovic [:milan] from comment #31)
> Created attachment 769487 [details] [diff] [review]
> Modified patch to pass try
> 
> Use the surface format to figure out the program type, except in a couple of
> places where the extra target information is necessary to give us the
> external or rect program instead.
> This is try run https://tbpl.mozilla.org/?tree=Try&rev=804b875443d3.  It has
> an unexpected pass on ARM B2G, webgl color alpha test. There is a place
> where we previously sent 565 to RGBA, and now to RGBX - would that explain
> the previous fail?

Yes, this could cause this if we just weren't fuzzing the values correctly before.
(In reply to Jeff Gilbert [:jgilbert] from comment #33)
> (In reply to Milan Sreckovic [:milan] from comment #31)
> > Created attachment 769487 [details] [diff] [review]
> > Modified patch to pass try
> > 
> > Use the surface format to figure out the program type, except in a couple of
> > places where the extra target information is necessary to give us the
> > external or rect program instead.
> > This is try run https://tbpl.mozilla.org/?tree=Try&rev=804b875443d3.  It has
> > an unexpected pass on ARM B2G, webgl color alpha test. There is a place
> > where we previously sent 565 to RGBA, and now to RGBX - would that explain
> > the previous fail?
> 
> Yes, this could cause this if we just weren't fuzzing the values correctly
> before.

Thanks Jeff. I'll see if I can narrow it down, but it looks like we tagged these as failing with the streaming buffers, they ran before, so there shouldn't be too much opposition to them running again :)
Where possible, we should see if we can add a fuzz window instead of just marking it failing. A test *actually* failing is something which *needs* to be fixed, not ignored. (The only tests we should consider disabling are the ones for our non-default prefs, and even then, only with good reason)
So, we would open a separate bug (is there one?) to get these tests back to passing, potentially with fuzzing, then when this change keeps the tests passing, we're in good shape.  I like that.
(In reply to Milan Sreckovic [:milan] from comment #36)
> So, we would open a separate bug (is there one?) to get these tests back to
> passing, potentially with fuzzing, then when this change keeps the tests
> passing, we're in good shape.  I like that.

If they were already disabled, yes. If they start failing from new code, they strongly indicate that something is wrong, and should be fixed before landing the new code.
They got fuzzed in the streaming buffers patch for bug 716859, then disabled in bug 868892 because bug 868556 started the consistent failure, and that it's somehow related to bug 869011. It's a tangled web.

These started not failing from the new code, but let me find out what makes them pass.
The reftest that started inexplicably failing with bug 868556 (tracked in bug 868892) are passing again.
Attachment #769487 - Attachment is obsolete: true
Attachment #769487 - Flags: review?(gal)
Attachment #769487 - Flags: review?(bgirard)
Attachment #771416 - Flags: review?(bgirard)
Comment on attachment 769491 [details] [diff] [review]
For the reviewers - capture the difference from the obsolete patch.

Review of attachment 769491 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/layers/opengl/LayerManagerOGLProgram.h
@@ +73,5 @@
> +                                 gfx::SurfaceFormat aFormat)
> +{
> +  switch(aTarget) {
> +    case LOCAL_GL_TEXTURE_EXTERNAL:
> +      return RGBALayerExternalProgramType;

optional: We could throw in some asserts that the format matches RGBA for extra safety.
Comment on attachment 771416 [details] [diff] [review]
Modified patch to pass try

I looked at the changes to handle rect texture and it looks good.
Attachment #771416 - Flags: review?(bgirard) → review+
Attachment #769491 - Attachment is obsolete: true
No longer depends on: 887094
Keywords: checkin-needed
Thats for fixing up my mess here. I owe various people a beer at the next gfx work week.
https://hg.mozilla.org/mozilla-central/rev/55258de26ac3
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
(In reply to Benoit Girard (:BenWa) from comment #40)
> 
> ::: gfx/layers/opengl/LayerManagerOGLProgram.h
> @@ +73,5 @@
> > +                                 gfx::SurfaceFormat aFormat)
> > +{
> > +  switch(aTarget) {
> > +    case LOCAL_GL_TEXTURE_EXTERNAL:
> > +      return RGBALayerExternalProgramType;
> 
> optional: We could throw in some asserts that the format matches RGBA for
> extra safety.

Filed as bug 890929.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: