-
Notifications
You must be signed in to change notification settings - Fork 2
sample using accelerated renderer in offscreen environment #2
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
base: main
Are you sure you want to change the base?
Conversation
amaitland
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR 👍 Very cool.
Few comments inline, I think changing the way the cleanup is handled is probably worth actioning.
Doesn't look like the browser would handle any sort of resize, is that correct?
|
|
||
| public D3D11Renderer(int windowWidth, int windowHeight) | ||
| { | ||
| Cef.ShutdownStarted += (_, _) => Destroy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given D3D11Renderer appears create an instance per ChromiumWebBrowser instance would it be better if this class implemented IDisposable and was disposed with the ChromiumWebBrowser instance? (Should be able to override Dispose on the OffscreenBrowser class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good point. I'll change this right away
| # JetBrains Rider | ||
| *.sln.iml | ||
| /CefSharp.WinForms.Direct3D.Example/obj.netcore | ||
| .idea/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a rider folder containing project specific settings files, it's not mandatory since I simply can avoid to commit that folder. It was just to make it easier when committing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick response, should be fine to leave.
| var windowInfo = new WindowInfo {WindowlessRenderingEnabled = true, Width = width, Height = height}; | ||
| windowInfo.SharedTextureEnabled = true; | ||
| windowInfo.SetAsWindowless(IntPtr.Zero); | ||
| CreateBrowser(windowInfo, cefBrowserSettings); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just as a general comment I don't recommend calling CreateBrowser in the constructor (was probably a mistake that it ever did). Makes it very difficult to reliably attach event handlers, due to the browser being created async, it's possible to attach them after the browser has been created.
For the example it's probably fine, just pointing it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing that out!
You mean for the ResizeWindow method that I wrote in the D3DRenderer class? I wrote that just to show how you can do that if needed. If you think that it's a bit confusing I'll remove it to make it as simple as possible |
If you were to change the |
As of now I didn't put any resizing in the code, but the |
No description provided.