Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow creating a SurfaceTexture from a D3D11 texture #187

Merged

Conversation

@asajeffrey
Copy link
Member

asajeffrey commented Jun 15, 2020

For webxr layer management on UWP, life is simpler if we can get surfman to create a SurfaceTexture directly from a D3D11 texture. We can't go via a surface annoyingly, since we want the SurfaceTexture to be created directly from the EGL pbuffer, not going via eglCreatePbufferFromClientBuffer.

@asajeffrey
Copy link
Member Author

asajeffrey commented Jun 24, 2020

This is ready for review. cc @jdm @pcwalton

@asajeffrey asajeffrey marked this pull request as ready for review Jun 24, 2020
@asajeffrey asajeffrey mentioned this pull request Jun 24, 2020
&mut self,
context: &mut Context,
size: &Size2D<i32>,
texture: *mut d3d11::ID3D11Texture2D

This comment has been minimized.

@pcwalton

pcwalton Jun 24, 2020

Contributor

Should this be a COM pointer?

This comment has been minimized.

@pcwalton

pcwalton Jun 24, 2020

Contributor

If not, document the reference counting semantics in the documentation.

This comment has been minimized.

@asajeffrey

asajeffrey Jun 25, 2020

Author Member

Looks like I can't make it a COM pointer, since the use case is openxr, and https://docs.rs/openxr/0.12.2/x86_64-pc-windows-msvc/openxr/d3d/enum.D3D11.html exposes type SwapchainImage = *mut ID3D11Texture2D. I'll add a comment saying that it is up to the caller to ensure that texture is kept live.

This comment has been minimized.

@pcwalton

pcwalton Jun 25, 2020

Contributor

You could still have made it a COM pointer, because you can wrap raw pointers in COM pointers.

I don't think it's a good idea to subvert the COM IUnknown reference counting semantics by requiring the caller to ensure liveness. surfman should be maintaining reference counts itself.

This comment has been minimized.

@asajeffrey

asajeffrey Jun 25, 2020

Author Member

TIL about ComPtr::from_raw. I'll submit a PR for that.

@jdm
jdm approved these changes Jun 25, 2020
@asajeffrey
Copy link
Member Author

asajeffrey commented Jun 25, 2020

@bors-servo r=jdm

@bors-servo
Copy link
Contributor

bors-servo commented Jun 25, 2020

📌 Commit 511b3c5 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Jun 25, 2020

Testing commit 511b3c5 with merge e6791a3...

@bors-servo
Copy link
Contributor

bors-servo commented Jun 25, 2020

☀️ Test successful - checks-travis
Approved by: jdm
Pushing e6791a3 to master...

@bors-servo bors-servo merged commit e6791a3 into servo:master Jun 25, 2020
2 checks passed
2 checks passed
Travis CI - Pull Request Build Passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.