PDA

View Full Version : LogicOp, LogicOpEnable, RenderTargetWriteMaskr in FBO attachments



jurgus
01-08-2016, 11:36 AM
"On the wave on bringing closer DirectX and OpenGL can be added ability like in D3D11_RENDER_TARGET_BLEND_DESC1 parameters like LogicOp, LogicOpEnable, RenderTargetWriteMask.
per color attachment in FBO?
Something like in GL_EXT_draw_buffers2, but for FBO ?
Implementation in OpenGL drivers should not be difficult because the same functionality must be in DirectX 11 driver.

Best regards,
Jurgus

Alfonse Reinheart
02-29-2016, 10:19 AM
Color write masks are already per-attachment (https://www.opengl.org/wiki/Color_Mask).

jurgus
06-07-2016, 02:18 PM
So only LogicOp, LogicOpEnable are missing not mush work for greater compability with DirectX

mhagain
06-07-2016, 04:00 PM
Actually in D3D11 we have (source: https://msdn.microsoft.com/en-us/library/windows/desktop/hh404435%28v=vs.85%29.aspx)
When you set the LogicOpEnable member of the first element of the RenderTarget array (RenderTarget[0]) to TRUE, you must also set the BlendEnable member of RenderTarget[0] to FALSE, and the IndependentBlendEnable member of this D3D11_BLEND_DESC1 to FALSE. This reflects the limitation in hardware that you can't mix logic operations with blending across multiple render targets, and that when you use a logic operation, you must apply the same logic operation to all render targets.
So no, the functionality to have independent per-rendertarget logic op is not in D3D 11 drivers, and missing this functionality is not an issue for OpenGL.

Alfonse Reinheart
06-07-2016, 04:00 PM
It should be noted that Vulkan also doesn't permit logicOps to be enabled per attachment.

[edit] And D3D 12 has that same annotation on the analogous structure (https://msdn.microsoft.com/en-us/library/windows/desktop/dn770339(v=vs.85).aspx).

mhagain
06-07-2016, 04:13 PM
Also that in both cases the D3D documentation notes it as a "limitation in hardware".

This is clearly "chalk one up for OpenGL" because the API is considerable clearer; in D3D it looks as though you can do it if you just look at the structs, the documentation that says you can't is in one place but not the other, and the struct members controlling it seem to be in the wrong struct (surely with the "when you use a logic operation, you must apply the same logic operation to all render targets" restriction in place, LogicOpEnable and LogicOp should be in D3D11_BLEND_DESC1/D3D12_BLEND_DESC rather than D3D11_RENDER_TARGET_BLEND_DESC1/D3D12_RENDER_TARGET_BLEND_DESC?)

Alfonse Reinheart
06-07-2016, 04:19 PM
This is clearly "chalk one up for OpenGL" because the API is considerable clearer;

And Vulkan, BTW.

However, it's only cleaner until hardware improves to incorporate the feature. Then D3D looks cleaner.

Of course in Vulkan, that's easily changed with a couple of new struct definitions. Then the API is clean again.