davecamp / Render2Texture

A render to texture solution for the BlitzMax language
2 stars 2 forks source link

Support BlitzMax - DX9 and DX11 #16

Open GWRon opened 5 years ago

GWRon commented 5 years ago

in davecamp/srs.mod#4 you (@davecamp) wrote

Render2Texture was originally made with 'non NG' in mind so it should always work with 'non NG' without issues. @GWRon requested for SDL support for NG which means only SDL graphics drivers will work when Render2Texture is used with NG - I'll work more of this in order to get the Max2D DirectX drivers (D3D9 and D3D11) working too.

Which is why I open this issue to discuss this stuff and to increase the urge a bit :-)

GWRon commented 5 years ago

So the basic idea is: to have Render2Texture working all across the available drivers:

Means - if you do not use custom graphics drivers then you could just use it.

Maybe it would be a good idea to define the "Render2Texture" stuff already in brl.graphics (or the likes) so that all extending drivers have to incorporate the functionality (or to throw an error about being unsupported there). Both modules: legacy (read "maxmods") brl.mod and NG brl.mod are open source and ready for adjustments (especially if they only ADD functionality).

GWRon commented 4 years ago

Bump.

Is there a chance to get it working on NG dx9/11 and default openGL?

GWRon commented 4 years ago

I got DX9 working in NG and NG.SDL flavour. When doing a "change user" (Windows key + L) it looses the device and textures are gone.

This is why I added "Persist()" and "Valid()" methods with the first saving the GPU texture to the persistPixmap and in "OnDeviceLost()" it only tries to fetch a new pixmap if there is none existing yet. "Valid()" sets a flag if the image is no longer valid/ensured to be valid. That way you can simply create a new one in your app logic once you see it is no longer valid.

I also incorporated it right into Max2D (and its extensions) so that it runs "out of the box".

GWRon commented 4 years ago

I made some PR for brl.mod, pub.mod and sdl.mod months ago ... seems nobody is interested in trying it out (ok one did try and found it cumbersome to not having Timage as base for gpu and non-gpu images). So without much buzz, Brucey never merged it...

https://github.com/bmx-ng/brl.mod/pull/174

https://github.com/bmx-ng/pub.mod/pull/37

https://github.com/bmx-ng/sdl.mod/pull/26

For "live chats" (next to the classic issues here) you could join us on discord: https://discord.gg/udSSJkj