summaryrefslogtreecommitdiffstats
path: root/examples/gpu-printing
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-02-24 15:43:43 -0800
committerGitHub <noreply@github.com>2021-02-24 15:43:43 -0800
commit9b7a007c31072bc9aebd1134aa4f1bfd28a4c541 (patch)
treeb71a48eb30b3b09ab4e77e40dc1c68ecd854ef82 /examples/gpu-printing
parentd66b30729029bdb43892e05c9c80fd56ac95a24f (diff)
Explicit swapchain interface in `gfx`. (#1726)
* Explicit swapchain interface in `gfx`. * Correctly return nullptr when `IRenderer` creation failed. * Fix crashes on CUDA tests. * Cleanups.
Diffstat (limited to 'examples/gpu-printing')
-rw-r--r--examples/gpu-printing/main.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/examples/gpu-printing/main.cpp b/examples/gpu-printing/main.cpp
index 63b1939a6..4f79147f6 100644
--- a/examples/gpu-printing/main.cpp
+++ b/examples/gpu-printing/main.cpp
@@ -64,7 +64,6 @@ int gWindowWidth = 640;
int gWindowHeight = 480;
gfx::ApplicationContext* gAppContext;
-gfx::Window* gWindow;
ComPtr<gfx::IRenderer> gRenderer;
ComPtr<slang::ISession> gSlangSession;
@@ -112,17 +111,9 @@ ComPtr<gfx::IShaderProgram> loadComputeProgram(slang::IModule* slangModule, char
Result execute()
{
- WindowDesc windowDesc;
- windowDesc.title = "GPU Printing";
- windowDesc.width = gWindowWidth;
- windowDesc.height = gWindowHeight;
- gWindow = createWindow(windowDesc);
-
IRenderer::Desc rendererDesc;
rendererDesc.rendererType = gfx::RendererType::DirectX11;
- rendererDesc.width = gWindowWidth;
- rendererDesc.height = gWindowHeight;
- Result res = gfxCreateRenderer(&rendererDesc, getPlatformWindowHandle(gWindow), gRenderer.writeRef());
+ Result res = gfxCreateRenderer(&rendererDesc, gRenderer.writeRef());
if(SLANG_FAILED(res)) return res;
gSlangSession = createSlangSession(gRenderer);
@@ -157,7 +148,7 @@ Result execute()
// Once we have the descriptor set layout, we can allocate
// and fill in a descriptor set to hold our parameters.
//
- auto descriptorSet = gRenderer->createDescriptorSet(descriptorSetLayout);
+ auto descriptorSet = gRenderer->createDescriptorSet(descriptorSetLayout, IDescriptorSet::Flag::Transient);
if(!descriptorSet) return SLANG_FAIL;
// descriptorSet->setConstantBuffer(0, 0, gConstantBuffer);