Skip to content

Commit b86bf02

Browse files
committed
[Vk] pass Vulkan windows through validateSampleDescription, fixed "Validation Error: [ VUID-VkImageCreateInfo-samples-02258 ] | MessageID = 0x5fccc613 | vkCreateImage(): pCreateInfo->samples (VK_SAMPLE_COUNT_2_BIT) is not supported by format VK_FORMAT_R8G8B8A8_SRGB"
1 parent 1287dbb commit b86bf02

17 files changed

Lines changed: 77 additions & 118 deletions

OgreMain/include/OgreRenderSystem.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,16 +316,15 @@ namespace Ogre
316316
See TextureFlags::TextureFlags.
317317
Relevant flags are:
318318
NotTexture
319+
RenderToTexture
319320
Uav
320-
@param depthTextureFlags
321-
Only used if format is a colour pixel format.
322-
Same as textureFlags, but for associated depth buffer if format.
321+
RenderWindowSpecific
323322
@return
324323
Supported sample description for requested FSAA mode, with graceful downgrading.
325324
*/
326325
virtual SampleDescription validateSampleDescription( const SampleDescription &sampleDesc,
327-
PixelFormatGpu format, uint32 textureFlags,
328-
uint32 depthTextureFlags );
326+
PixelFormatGpu format,
327+
uint32 textureFlags );
329328

330329
/** Creates a new rendering window.
331330
@remarks

OgreMain/src/OgreRenderSystem.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -811,8 +811,7 @@ namespace Ogre
811811
//-----------------------------------------------------------------------
812812
SampleDescription RenderSystem::validateSampleDescription( const SampleDescription &sampleDesc,
813813
PixelFormatGpu format,
814-
uint32 textureFlags,
815-
uint32 depthTextureFlags )
814+
uint32 textureFlags )
816815
{
817816
SampleDescription retVal( sampleDesc.getMaxSamples(), sampleDesc.getMsaaPattern() );
818817
return retVal;

OgreMain/src/OgreTextureGpu.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -450,13 +450,9 @@ namespace Ogre
450450
uint32 msaaTextureFlags = TextureFlags::NotTexture;
451451
if( hasMsaaExplicitResolves() )
452452
msaaTextureFlags = mTextureFlags;
453-
uint32 depthFormatTextureFlags = 0u;
454-
if( !getPreferDepthTexture() )
455-
depthFormatTextureFlags = TextureFlags::NotTexture;
456453

457454
mSampleDescription = mTextureManager->getRenderSystem()->validateSampleDescription(
458-
mRequestedSampleDescription, mPixelFormat, msaaTextureFlags,
459-
depthFormatTextureFlags );
455+
mRequestedSampleDescription, mPixelFormat, msaaTextureFlags );
460456
}
461457
if( !( mSampleDescription == mRequestedSampleDescription ) )
462458
notifyAllListenersTextureChanged( TextureGpuListener::FsaaSettingAlteredByApi, 0 );

RenderSystems/Direct3D11/include/OgreD3D11RenderSystem.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,8 @@ namespace Ogre
334334
void postExtraThreadsStarted() override;
335335

336336
SampleDescription validateSampleDescription( const SampleDescription &sampleDesc,
337-
PixelFormatGpu format, uint32 textureFlags,
338-
uint32 depthTextureFlags ) override;
337+
PixelFormatGpu format,
338+
uint32 textureFlags ) override;
339339

340340
/// @copydoc RenderSystem::getDisplayMonitorCount
341341
unsigned int getDisplayMonitorCount() const override;

RenderSystems/Direct3D11/src/OgreD3D11RenderSystem.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3707,8 +3707,7 @@ namespace Ogre
37073707
//---------------------------------------------------------------------
37083708
SampleDescription D3D11RenderSystem::validateSampleDescription( const SampleDescription &sampleDesc,
37093709
PixelFormatGpu format,
3710-
uint32 textureFlags,
3711-
uint32 depthTextureFlags )
3710+
uint32 textureFlags )
37123711
{
37133712
OGRE_UNUSED_VAR( textureFlags );
37143713
OGRE_UNUSED_VAR( depthTextureFlags );

RenderSystems/Direct3D11/src/OgreD3D11Window.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,9 @@ namespace Ogre
336336
if( mUseFlipMode )
337337
{
338338
// swapchain is not multisampled in flip sequential mode, so we reuse it
339-
// D3D11 doesn't care about texture flags, so we leave them as 0.
340-
mSampleDescription = mRenderSystem->validateSampleDescription( mRequestedSampleDescription,
341-
_getRenderFormat(), 0u, 0u );
339+
mSampleDescription = mRenderSystem->validateSampleDescription(
340+
mRequestedSampleDescription, _getRenderFormat(),
341+
TextureFlags::NotTexture | TextureFlags::RenderWindowSpecific );
342342
}
343343
else
344344
{

RenderSystems/Direct3D11/src/Windowing/WIN32/OgreD3D11WindowHwnd.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ namespace Ogre
158158
//-----------------------------------------------------------------------------------
159159
HRESULT D3D11WindowHwnd::_createSwapChainImpl()
160160
{
161-
// D3D11 doesn't care about texture flags, so we leave them as 0.
162-
mSampleDescription = mRenderSystem->validateSampleDescription( mRequestedSampleDescription,
163-
_getRenderFormat(), 0u, 0u );
161+
mSampleDescription = mRenderSystem->validateSampleDescription(
162+
mRequestedSampleDescription, _getRenderFormat(),
163+
TextureFlags::NotTexture | TextureFlags::RenderWindowSpecific );
164164
HRESULT hr;
165165

166166
// Create swap chain

RenderSystems/Direct3D11/src/Windowing/WIN32/OgreD3D11WindowWinRT.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ namespace Ogre
118118
{
119119
# if !__OGRE_WINRT_PHONE
120120
mSampleDescription = mRenderSystem->validateSampleDescription(
121-
mRequestedSampleDescription, _getRenderFormat(), TextureFlags::NotTexture,
122-
TextureFlags::NotTexture );
121+
mRequestedSampleDescription, _getRenderFormat(),
122+
TextureFlags::NotTexture | TextureFlags::RenderWindowSpecific );
123123
# endif
124124
DXGI_SWAP_CHAIN_DESC1 desc = {};
125125
desc.Width = 0; // Use automatic sizing.
@@ -276,8 +276,8 @@ namespace Ogre
276276
{
277277
# if !__OGRE_WINRT_PHONE
278278
mSampleDescription = mRenderSystem->validateSampleDescription(
279-
mRequestedSampleDescription, _getRenderFormat(), TextureFlags::NotTexture,
280-
TextureFlags::NotTexture );
279+
mRequestedSampleDescription, _getRenderFormat(),
280+
TextureFlags::NotTexture | TextureFlags::RenderWindowSpecific );
281281
# endif
282282

283283
int widthPx = std::max( 1, (int)floorf( mRequestedWidth * mCompositionScale.Width + 0.5f ) );

RenderSystems/Metal/include/OgreMetalRenderSystem.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ namespace Ogre
297297
unsigned int getDisplayMonitorCount() const override { return 1; }
298298

299299
SampleDescription validateSampleDescription( const SampleDescription &sampleDesc,
300-
PixelFormatGpu format, uint32 textureFlags,
301-
uint32 depthTextureFlags ) override;
300+
PixelFormatGpu format,
301+
uint32 textureFlags ) override;
302302

303303
const PixelFormatToShaderType *getPixelFormatToShaderType() const override;
304304

RenderSystems/Metal/src/OgreMetalRenderSystem.mm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,7 @@ of this software and associated documentation files (the "Software"), to deal
240240
//-------------------------------------------------------------------------
241241
SampleDescription MetalRenderSystem::validateSampleDescription( const SampleDescription &sampleDesc,
242242
PixelFormatGpu format,
243-
uint32 textureFlags,
244-
uint32 depthTextureFlags )
243+
uint32 textureFlags )
245244
{
246245
uint8 samples = sampleDesc.getMaxSamples();
247246
if( @available( iOS 9.0, * ) )

0 commit comments

Comments
 (0)