GL: Create sRGB textures. D3D9: Enumerate sRGB textures.

This commit is contained in:
Branimir Karadžić 2015-05-05 16:34:13 -07:00
parent d4cde9cbfa
commit f3f302a20b
3 changed files with 17 additions and 2 deletions

View file

@ -1487,7 +1487,10 @@ BX_PRAGMA_DIAGNOSTIC_POP();
D3D11_RENDER_TARGET_VIEW_DESC desc;
desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
desc.Texture2D.MipSlice = 0;
desc.Format = (m_flags & BGFX_RESET_SRGB_BACKBUFFER) ? DXGI_FORMAT_R8G8B8A8_UNORM_SRGB : DXGI_FORMAT_R8G8B8A8_UNORM;
desc.Format = (m_flags & BGFX_RESET_SRGB_BACKBUFFER)
? DXGI_FORMAT_R8G8B8A8_UNORM_SRGB
: DXGI_FORMAT_R8G8B8A8_UNORM
;
DX_CHECK(m_device->CreateRenderTargetView(color, &desc, &m_backBufferColor) );
DX_RELEASE(color, 0);

View file

@ -531,6 +531,14 @@ namespace bgfx { namespace d3d9
, s_textureFormat[ii].m_fmt
) ) ? BGFX_CAPS_FORMAT_TEXTURE_COLOR : BGFX_CAPS_FORMAT_TEXTURE_NONE;
support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
, m_deviceType
, adapterFormat
, D3DUSAGE_QUERY_SRGBREAD
, D3DRTYPE_TEXTURE
, s_textureFormat[ii].m_fmt
) ) ? BGFX_CAPS_FORMAT_TEXTURE_COLOR_SRGB : BGFX_CAPS_FORMAT_TEXTURE_NONE;
support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
, m_deviceType
, adapterFormat

View file

@ -3567,10 +3567,14 @@ namespace bgfx { namespace gl
}
const bool computeWrite = 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE);
const bool srgb = 0 != (m_flags&BGFX_TEXTURE_SRGB);
target = GL_TEXTURE_CUBE_MAP == m_target ? GL_TEXTURE_CUBE_MAP_POSITIVE_X : m_target;
const GLenum internalFmt = s_textureFormat[m_textureFormat].m_internalFmt;
const GLenum internalFmt = srgb
? s_textureFormat[m_textureFormat].m_internalFmtSrgb
: s_textureFormat[m_textureFormat].m_internalFmt
;
const bool swizzle = true
&& TextureFormat::BGRA8 == m_requestedFormat