Skip to content

Commit 7f08ef0

Browse files
committed
fix: macos surface and shader destroy
1 parent 7e3a19b commit 7f08ef0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Sample/Rendering-BaseTexture/BaseTexture.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class BaseTexApp final : public Application {
6363
static constexpr size_t backBufferCount = 2;
6464

6565
void CreateDevice();
66+
void CreateSurface();
6667
void CompileAllShaders() const;
6768
void FetchShaderInstances();
6869
void CreateSwapChain();
@@ -104,8 +105,10 @@ void BaseTexApp::OnCreate()
104105
RenderThread::Get().Start();
105106
RenderWorkerThreads::Get().Start();
106107

108+
CreateDevice();
109+
CreateSurface();
110+
107111
RenderThread::Get().EmplaceTask([this]() -> void {
108-
CreateDevice();
109112
FetchShaderInstances();
110113
CreateSwapChain();
111114
CreateVertexAndIndexBuffer();
@@ -210,6 +213,7 @@ void BaseTexApp::OnDestroy()
210213
PipelineCache::Get(*device).Invalidate();
211214
BufferPool::Get(*device).Invalidate();
212215
TexturePool::Get(*device).Invalidate();
216+
ShaderMap::Get(*device).Invalidate();
213217
});
214218
RenderThread::Get().Flush();
215219

@@ -226,6 +230,11 @@ void BaseTexApp::CreateDevice()
226230
.AddQueueRequest(QueueRequestInfo(QueueType::graphics, 1)));
227231
}
228232

233+
void BaseTexApp::CreateSurface()
234+
{
235+
surface = device->CreateSurface(SurfaceCreateInfo(GetPlatformWindow()));
236+
}
237+
229238
void BaseTexApp::CompileAllShaders() const
230239
{
231240
ShaderCompileOptions options;

0 commit comments

Comments
 (0)