|
|
@@ -1077,6 +1077,8 @@ namespace bgfx { namespace d3d9
|
|
|
DX_CHECK(m_device->SetRenderTarget(ii, NULL) );
|
|
|
}
|
|
|
DX_CHECK(m_device->SetDepthStencilSurface(m_backBufferDepthStencil) );
|
|
|
+
|
|
|
+ DX_CHECK(m_device->SetRenderState(D3DRS_SRGBWRITEENABLE, 0 != (m_flags & BGFX_RESET_SRGB_BACKBUFFER) ));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -1098,6 +1100,8 @@ namespace bgfx { namespace d3d9
|
|
|
|
|
|
IDirect3DSurface9* depthStencil = frameBuffer.m_depthStencil;
|
|
|
DX_CHECK(m_device->SetDepthStencilSurface(NULL != depthStencil ? depthStencil : m_backBufferDepthStencil) );
|
|
|
+
|
|
|
+ DX_CHECK(m_device->SetRenderState(D3DRS_SRGBWRITEENABLE, FALSE) );
|
|
|
}
|
|
|
|
|
|
m_fbh = _fbh;
|
|
|
@@ -1288,7 +1292,7 @@ namespace bgfx { namespace d3d9
|
|
|
|
|
|
void setSamplerState(uint8_t _stage, uint32_t _flags, bool _vertex = false)
|
|
|
{
|
|
|
- const uint32_t flags = _flags&( (~BGFX_TEXTURE_RESERVED_MASK) | BGFX_TEXTURE_SAMPLER_BITS_MASK);
|
|
|
+ const uint32_t flags = _flags&( (~BGFX_TEXTURE_RESERVED_MASK) | BGFX_TEXTURE_SAMPLER_BITS_MASK | BGFX_TEXTURE_SRGB);
|
|
|
BX_CHECK(_stage < BX_COUNTOF(m_samplerFlags), "");
|
|
|
if (m_samplerFlags[_stage][_vertex] != flags)
|
|
|
{
|
|
|
@@ -1310,6 +1314,7 @@ namespace bgfx { namespace d3d9
|
|
|
DX_CHECK(device->SetSamplerState(stage, D3DSAMP_MAGFILTER, magFilter) );
|
|
|
DX_CHECK(device->SetSamplerState(stage, D3DSAMP_MIPFILTER, mipFilter) );
|
|
|
DX_CHECK(device->SetSamplerState(stage, D3DSAMP_MAXANISOTROPY, m_maxAnisotropy) );
|
|
|
+ DX_CHECK(device->SetSamplerState(stage, D3DSAMP_SRGBTEXTURE, 0 != (flags & BGFX_TEXTURE_SRGB)) );
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -2423,6 +2428,11 @@ namespace bgfx { namespace d3d9
|
|
|
createTexture(textureWidth, textureHeight, numMips);
|
|
|
}
|
|
|
|
|
|
+ if (imageContainer.m_srgb)
|
|
|
+ {
|
|
|
+ m_flags |= BGFX_TEXTURE_SRGB;
|
|
|
+ }
|
|
|
+
|
|
|
BX_TRACE("Texture %3d: %s (requested: %s), %dx%d%s%s."
|
|
|
, this - s_renderD3D9->m_textures
|
|
|
, getName( (TextureFormat::Enum)m_textureFormat)
|