MCPcopy Create free account
hub / github.com/LibreVR/Revive / CreateTextureSwapChain

Method CreateTextureSwapChain

Revive/CompositorBase.cpp:77–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77ovrResult CompositorBase::CreateTextureSwapChain(const ovrTextureSwapChainDesc* desc, ovrTextureSwapChain* out_TextureSwapChain)
78{
79#if MICROPROFILE_ENABLED
80 if (!m_ProfileTexture)
81 {
82 // Create the profiler render target texture.
83 m_ProfileTexture.reset(CreateTexture());
84 m_ProfileTexture->Init(ovrTexture_2D_External, PROFILE_WINDOW_WIDTH, PROFILE_WINDOW_HEIGHT, 1, 1, 1, OVR_FORMAT_R8G8B8A8_UNORM, ovrTextureMisc_None, ovrTextureBind_DX_RenderTarget);
85 g_ProfileManager.SetTexture(m_ProfileTexture.get());
86 }
87#endif
88
89 ovrTextureSwapChain swapChain = new ovrTextureSwapChainData(*desc);
90 swapChain->Identifier = m_ChainCount++;
91
92 if (desc->StaticImage)
93 swapChain->Length = 1;
94
95 for (int i = 0; i < swapChain->Length; i++)
96 {
97 TextureBase* texture = CreateTexture();
98 bool success = texture->Init(desc->Type, desc->Width, desc->Height, desc->MipLevels,
99 desc->SampleCount, desc->ArraySize, desc->Format, desc->MiscFlags, desc->BindFlags);
100 if (!success)
101 return ovrError_RuntimeException;
102 swapChain->Textures[i].reset(texture);
103 }
104
105 *out_TextureSwapChain = swapChain;
106 return ovrSuccess;
107}
108
109ovrResult CompositorBase::CreateMirrorTexture(const ovrMirrorTextureDesc* desc, ovrMirrorTexture* out_MirrorTexture)
110{

Callers 3

Calls 2

SetTextureMethod · 0.80
InitMethod · 0.45

Tested by

no test coverage detected