Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(687)

Issue 5472055: Implement EGL_ANGLE_image_d3d_texture_2d_share_handle and GL_OES_EGL_image.

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 4 months ago by apatrick1
Modified:
12 years, 3 months ago
Reviewers:
dgkoch, nicolas, John Bauman
CC:
angleproject-review_googlegroups.com
Base URL:
http://angleproject.googlecode.com/svn/trunk/
Visibility:
Public.

Patch Set 1 #

Total comments: 3

Patch Set 2 : '' #

Total comments: 34

Patch Set 3 : '' #

Patch Set 4 : '' #

Total comments: 38

Patch Set 5 : '' #

Patch Set 6 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1509 lines, -443 lines) Patch
M include/EGL/eglext.h View 1 2 3 4 1 chunk +13 lines, -0 lines 0 comments Download
M src/build_angle.gyp View 1 2 3 4 2 chunks +3 lines, -0 lines 0 comments Download
M src/libEGL/Config.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M src/libEGL/Display.h View 1 2 3 4 5 4 chunks +10 lines, -0 lines 0 comments Download
M src/libEGL/Display.cpp View 1 2 3 4 9 chunks +143 lines, -1 line 0 comments Download
A src/libEGL/Image.h View 1 2 3 4 1 chunk +107 lines, -0 lines 0 comments Download
A src/libEGL/Image.cpp View 1 2 3 4 1 chunk +233 lines, -0 lines 0 comments Download
M src/libEGL/libEGL.cpp View 1 2 3 4 3 chunks +77 lines, -0 lines 0 comments Download
M src/libEGL/libEGL.vcproj View 1 2 3 4 1 chunk +447 lines, -431 lines 0 comments Download
M src/libGLESv2/Context.h View 1 2 3 4 4 chunks +4 lines, -0 lines 0 comments Download
M src/libGLESv2/Context.cpp View 1 2 3 4 7 chunks +51 lines, -0 lines 0 comments Download
M src/libGLESv2/Program.cpp View 1 2 3 4 7 chunks +13 lines, -5 lines 0 comments Download
M src/libGLESv2/ResourceManager.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M src/libGLESv2/ResourceManager.cpp View 1 2 3 4 1 chunk +4 lines, -0 lines 0 comments Download
M src/libGLESv2/Shader.cpp View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M src/libGLESv2/Texture.h View 1 2 3 4 4 chunks +79 lines, -5 lines 0 comments Download
M src/libGLESv2/Texture.cpp View 1 2 3 4 4 chunks +270 lines, -0 lines 0 comments Download
M src/libGLESv2/libGLESv2.cpp View 1 2 3 4 8 chunks +49 lines, -0 lines 0 comments Download
M src/libGLESv2/utilities.cpp View 1 2 3 4 3 chunks +3 lines, -0 lines 0 comments Download

Messages

Total messages: 15
apatrick1
Hi Daniel, This is not ready for a full review. I was wondering if you ...
12 years, 4 months ago (2011-12-09 23:31:07 UTC) #1
John Bauman
I'd recommend testing to make sure that the timing is what you want. It's possible ...
12 years, 4 months ago (2011-12-09 23:36:02 UTC) #2
apatrick1
Daniel, Any thoughts on the general approach here, before I spend time implementing this properly? ...
12 years, 4 months ago (2011-12-19 21:49:19 UTC) #3
dgkoch
Sorry for the delay. Overall I like this approach much better than the previous ones. ...
12 years, 4 months ago (2011-12-21 01:59:50 UTC) #4
apatrick1
Thanks Daniel, I'll go ahead and get this working then.... Al
12 years, 4 months ago (2011-12-21 02:01:50 UTC) #5
apatrick1
I uploaded another patch. Thanks.
12 years, 3 months ago (2012-01-06 02:05:16 UTC) #6
dgkoch
This is coming along, although I've spotted a number of issues. The biggest is that ...
12 years, 3 months ago (2012-01-10 21:48:18 UTC) #7
apatrick1
Thanks. I addressed some but not all of the issues. You should probably hold off ...
12 years, 3 months ago (2012-01-10 23:38:34 UTC) #8
dgkoch
http://codereview.appspot.com/5472055/diff/8001/src/libEGL/Config.h File src/libEGL/Config.h (right): http://codereview.appspot.com/5472055/diff/8001/src/libEGL/Config.h#newcode16 src/libEGL/Config.h:16: #include <EGL/eglext.h> strange! http://codereview.appspot.com/5472055/diff/8001/src/libEGL/Display.cpp File src/libEGL/Display.cpp (right): http://codereview.appspot.com/5472055/diff/8001/src/libEGL/Display.cpp#newcode762 src/libEGL/Display.cpp:762: ...
12 years, 3 months ago (2012-01-11 14:00:37 UTC) #9
dgkoch
On 2012/01/10 23:38:34, apatrick1 wrote: > Thanks. I addressed some but not all of the ...
12 years, 3 months ago (2012-01-11 14:07:28 UTC) #10
apatrick1
Daniel, I implemented GL_EGL_image_external and I think it's workable. I split the EGL side of ...
12 years, 3 months ago (2012-01-14 00:54:48 UTC) #11
dgkoch
http://codereview.appspot.com/5472055/diff/21001/include/EGL/eglext.h File include/EGL/eglext.h (right): http://codereview.appspot.com/5472055/diff/21001/include/EGL/eglext.h#newcode355 include/EGL/eglext.h:355: #define EGL_D3D_SURFACE_ANGLE 0x3206 Once this is finalized, you'll have ...
12 years, 3 months ago (2012-01-16 17:22:01 UTC) #12
dgkoch
On 2012/01/14 00:54:48, apatrick1 wrote: > Daniel, > > I implemented GL_EGL_image_external and I think ...
12 years, 3 months ago (2012-01-16 17:26:27 UTC) #13
apatrick1
On 2012/01/16 17:26:27, dgkoch wrote: > > I allowed all formats that the display reports ...
12 years, 3 months ago (2012-01-23 21:35:48 UTC) #14
apatrick1
12 years, 3 months ago (2012-01-25 00:08:02 UTC) #15
Sorry, forgot to upload replies.

http://codereview.appspot.com/5472055/diff/21001/include/EGL/eglext.h
File include/EGL/eglext.h (right):

http://codereview.appspot.com/5472055/diff/21001/include/EGL/eglext.h#newcode355
include/EGL/eglext.h:355: #define EGL_D3D_SURFACE_ANGLE	0x3206
On 2012/01/16 17:22:01, dgkoch wrote:
> Once this is finalized, you'll have to talk to me to get the official enum
> value(s) allocated.

Will do.

http://codereview.appspot.com/5472055/diff/21001/src/libEGL/Display.cpp
File src/libEGL/Display.cpp (right):

http://codereview.appspot.com/5472055/diff/21001/src/libEGL/Display.cpp#newco...
src/libEGL/Display.cpp:744: case EGL_IMAGE_WIDTH_ANGLE:
On 2012/01/16 17:22:01, dgkoch wrote:
> you really only want most of these attribs to only be valid for
> EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE

Done.

http://codereview.appspot.com/5472055/diff/21001/src/libEGL/Display.cpp#newco...
src/libEGL/Display.cpp:824: (*image)->reset();
On 2012/01/16 17:22:01, dgkoch wrote:
> these images still won't recover..

I put in a best effort attempt to restore these images. It assumes that the
external device has not been lost. I think in practice, the application should
destroy all EGLImages associated with its lost devices before expecting ANGLE to
be able to recover. I can put something along those lines in the spec.

http://codereview.appspot.com/5472055/diff/21001/src/libEGL/Image.cpp
File src/libEGL/Image.cpp (right):

http://codereview.appspot.com/5472055/diff/21001/src/libEGL/Image.cpp#newcode99
src/libEGL/Image.cpp:99: Image *ImageD3DSurface::create(Display *display,
IDirect3DSurface9 *sourceSurface, const ImageAttribs &attribs)
On 2012/01/16 17:22:01, dgkoch wrote:
> is attribs really needed?

Not anymore.

http://codereview.appspot.com/5472055/diff/21001/src/libEGL/Image.cpp#newcode105
src/libEGL/Image.cpp:105: return error(EGL_BAD_ACCESS,
static_cast<Image*>(NULL));
On 2012/01/16 17:22:01, dgkoch wrote:
> BAD_ACCESS doesn't seem like the most appropriate error.

Done.

http://codereview.appspot.com/5472055/diff/21001/src/libEGL/Image.cpp#newcode113
src/libEGL/Image.cpp:113: if (display->canTextureFromFormat(desc.Format))
On 2012/01/16 17:22:01, dgkoch wrote:
> canTextureFromFormat / canConvertFormat: are reporting what *our* device can
do.
>  This seems irrelevant since as far as I can tell the conversion (if any)
would
> happen on the source (external) device.

I think we want to use the internal device to determine whether ANGLE can use a
particular format for texturing and the external device to determine whether the
conversion is possible.

http://codereview.appspot.com/5472055/diff/21001/src/libEGL/Image.cpp#newcode139
src/libEGL/Image.cpp:139: return error(EGL_BAD_PARAMETER,
static_cast<Image*>(NULL));
On 2012/01/16 17:22:01, dgkoch wrote:
> leaking the sourceDevice here. Can be fixed by moving the release from below
up
> to above the FAILED check

I simplified this by using a smart pointer for D3D objects.

http://codereview.appspot.com/5472055/diff/21001/src/libEGL/Image.cpp#newcode145
src/libEGL/Image.cpp:145: sourceDeviceEx->CreateQuery(D3DQUERYTYPE_EVENT,
&sourceQuery);
On 2012/01/16 17:22:01, dgkoch wrote:
> This could fail...

Added a comment noting this.

http://codereview.appspot.com/5472055/diff/21001/src/libEGL/Image.cpp#newcode168
src/libEGL/Image.cpp:168: result = sourceTexture->GetSurfaceLevel(0,
&targetSurface);
On 2012/01/16 17:22:01, dgkoch wrote:
> shouldn't this be targetTexture?  or should targetSurface be called something
> else?  This is all a bit convoluted/confusing...

Two things. It's not a good distinction. I renamed source to external and target
to internal. Second, this is a bug. The only reason it worked was because
D3DXLoadSurfaceFromSurface is smart enough to recognize that two surfaces belong
to different devices and somehow make it work, maybe a readback.

http://codereview.appspot.com/5472055/diff/21001/src/libEGL/Image.cpp#newcode175
src/libEGL/Image.cpp:175: if (attribs.preserve)
On 2012/01/16 17:22:01, dgkoch wrote:
> I don't this is the correct use of the preserve attribute.  It indicates if
the
> contents in the *original* client buffer are preserved.  I don't think we'll
> ever muck with those

It was an optimization to remove a redundant and potentially expensive surface
copy in the event the caller does not expect the surface to be preserved. I
think the right thing to do though is to defer the first copy to
EGLImageTargetTexture2DOES.

http://codereview.appspot.com/5472055/diff/21001/src/libEGL/Image.cpp#newcode234
src/libEGL/Image.cpp:234: D3DXLoadSurfaceFromSurface(mTargetSurface, NULL, NULL,
mSourceSurface, NULL, NULL, D3DX_FILTER_NONE, 0);
On 2012/01/16 17:22:01, dgkoch wrote:
> wouldn't StretchRect be better / more relevant to the canConvert/TextureFormat
> checks?

D3DXLoadSurfaceFromSurface does a StretchRect behind the scenes. I confirmed it
calls it. My idea was that it can also handle external surfaces that would not
work with StretchRect, like those in the system memory pool.

http://codereview.appspot.com/5472055/diff/21001/src/libEGL/Image.cpp#newcode270
src/libEGL/Image.cpp:270: mSourceTexture = sourceTexture;
On 2012/01/16 17:22:01, dgkoch wrote:
> do you need mSourceTexture?

No. Done.

http://codereview.appspot.com/5472055/diff/21001/src/libEGL/Image.h
File src/libEGL/Image.h (right):

http://codereview.appspot.com/5472055/diff/21001/src/libEGL/Image.h#newcode46
src/libEGL/Image.h:46: virtual void release();
On 2012/01/16 17:22:01, dgkoch wrote:
> can you make Image a RefCountObject for the reference tracking?

Done.

http://codereview.appspot.com/5472055/diff/21001/src/libEGL/Image.h#newcode48
src/libEGL/Image.h:48: virtual void reset() = 0;
On 2012/01/16 17:22:01, dgkoch wrote:
> reset seems like a poor name since it only really releases stuff.

Renamed to releaseResources so as not to conflict with
RefCountObject::release().

http://codereview.appspot.com/5472055/diff/21001/src/libGLESv2/Context.cpp
File src/libGLESv2/Context.cpp (right):

http://codereview.appspot.com/5472055/diff/21001/src/libGLESv2/Context.cpp#ne...
src/libGLESv2/Context.cpp:1050: if (oldTexture != newTexture)
On 2012/01/16 17:22:01, dgkoch wrote:
> if "bound" forces a refresh from the external image, don't you actually want a
> rebind of the same texture to do something?

It was my interpretation of:

        "Binding (or re-binding if
        already bound) an external texture by calling BindTexture after all
        modifications are complete guarantees that sampling done in future
        draw calls will return values corresponding to the values in the
        buffer at or after the time that BindTexture is called."

But I think you're right.

http://codereview.appspot.com/5472055/diff/21001/src/libGLESv2/Context.cpp#ne...
src/libGLESv2/Context.cpp:3445: mExtensionString += "GL_OES_EGL_image_external
";
On 2012/01/16 17:22:01, dgkoch wrote:
> presumably this should only be on d3d9ex devices?

Done.

http://codereview.appspot.com/5472055/diff/21001/src/libGLESv2/Texture.cpp
File src/libGLESv2/Texture.cpp (right):

http://codereview.appspot.com/5472055/diff/21001/src/libGLESv2/Texture.cpp#ne...
src/libGLESv2/Texture.cpp:2506: texture->Release();
Actually I think the error is here. Image::getTexture does not AddRef.

http://codereview.appspot.com/5472055/diff/21001/src/libGLESv2/Texture.h
File src/libGLESv2/Texture.h (right):

http://codereview.appspot.com/5472055/diff/21001/src/libGLESv2/Texture.h#newc...
src/libGLESv2/Texture.h:350: egl::Image *mEGLImage;
On 2012/01/16 17:22:01, dgkoch wrote:
> if the egl::Image is a RefCountObject you could use a BindingPointer here.

Done.

http://codereview.appspot.com/5472055/diff/21001/src/libGLESv2/utilities.cpp
File src/libGLESv2/utilities.cpp (right):

http://codereview.appspot.com/5472055/diff/21001/src/libGLESv2/utilities.cpp#...
src/libGLESv2/utilities.cpp:334: bool IsInternalTextureTarget(GLenum target)
On 2012/01/16 17:22:01, dgkoch wrote:
> it might be nice to do this change as a separate patch first.

Already landed.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b