On 23 March 2016 at 15:06, Paul Gofman gofmanp@gmail.com wrote:
On 03/23/2016 04:37 PM, Henri Verbeet wrote:
Is this needed by an application? Luminance formats aren't supposed to be color-renderable according to the OpenGL spec, and that's why you're getting GL_INVALID_ENUM in query_internal_format(). Does NVIDIA have some extension that allows this?
This is somehow used with a Unity3D game. This makes it work flawlessly with Nvidia under Wine. Though I found later that the same works under Windows 7 with the similar Intel GPU (where Luminance is not allowed as render target according to my test), so apparently it might work without it somehow but I did not find yet what lets them get along without this format. With Nvidia under Windows 7 unity uses Directx 11 (actually it tries the same under Wine unless d3dx11.dll is disabled).
How does it fail exactly? Does it fail to create a render target, or does it just not like the result from CheckDeviceFormat()? Is there any chance it would be happy with some other format instead, like e.g. R8_UNORM? For what it's worth, I just checked on Windows, and both L8 and L16 seem to be supported as render targets on AMD as well.
I know that GL spec does not suppose luminance as render target, and I could not find any extension on Nvidia so far which is responsible for allowing that. It just allows it, and does not give an error for glGetInternalformativ.
I'd like to avoid rendering to GL_LUMINANCE8 if we can, but GL_R8 with appropriate swizzles may be an alternative. We'll need that to implement luminance formats for core profiles anyway, and Matteo has a patch for that. That patch doesn't enable WINED3DFMT_FLAG_RENDERTARGET on WINED3DFMT_L8_UNORM yet, but it should be easy to add.
I can change the whole test to use different values to have different red and green channels after blending. I am just not sure how can I guess "broken" values for D3DMT_L8, as I do not have any hardware which has D3DFMT_L8 supported as RT and POSTPIXELSHADER_BLENDING not supported.
In theory the values should simply be the same as with D3DRS_ALPHABLENDENABLE disabled.