How to deal with render targets in wined3d

Stefan Dösinger stefan at
Sun Dec 10 16:53:32 CST 2006

The render target support in wined3d is a bit jerky. Basically we're dealing 
with 2 sorts of render targets: Offscreen textures and onscreen swapchains. 
Onscreen swapchains have their own drawable and glx context right now, for 
offscreen textures have that too, except if fbos are used.

The seperate context makes a problem. Due to that the render target change has 
to be performed before any other opengl states are set for drawprim, and it 
requires keeping track of multiple sets of gl states. The question is, do we 
need a seperate context?

Primary swapchain: essentially, no
Back buffer offscreen rendering: not really
PBuffer offscreen rendering: Yes? No?
FBO offscreen rendering: No
Secondary swapchain: Yes? No?

Technically a swapchain and offscreen render target would match a glx 
drawable. However, can we switch the drawable, but keep the context? Can we 
switch the drawable that the context is used on? What is better 
performance-wise? Switching a context's drawable, or switching context and 
drawable and applying all states that changed since the last use of that 

The main thing I'm concerned about are driver bugs. I know that the dri 
drivers keep track of per-drawable settings per context, what might other 
drivers do?

Another question is what do do about pbuffers. Pbuffers are pretty nasty. Are 
there any cards out there which have a working pbuffer support, but no fbo 
support? If we slightly modify the back buffer rendering we can render on 
auxiliary buffers instead of the pbuffer(If there are any cards out there 
supporting that).

My new state management can handle multiple contexts per device, it has to do 
that for multithreading. However, if we can do the render target stuff with 
only one context things will get MUCH easier.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :

More information about the wine-devel mailing list