summaryrefslogtreecommitdiffstats
path: root/examples/hello-world
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-02-04 13:50:51 -0800
committerGitHub <noreply@github.com>2021-02-04 13:50:51 -0800
commitc40f10b704b8bd5a744cc9b3964344585436b1ac (patch)
tree1c9608f3cc32949d88fe04f3512cd3147fc3fe1f /examples/hello-world
parent7f266f1ea7a51213069282296a905650fd405c3f (diff)
[gfx] Shader-object driven shader compilation. (#1688)
Diffstat (limited to 'examples/hello-world')
-rw-r--r--examples/hello-world/main.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/examples/hello-world/main.cpp b/examples/hello-world/main.cpp
index e8e3c45e0..91c9c0627 100644
--- a/examples/hello-world/main.cpp
+++ b/examples/hello-world/main.cpp
@@ -240,14 +240,12 @@ Slang::Result initialize()
// A future version of this example may support multiple
// platforms/APIs.
//
- gfxGetCreateFunc(gfx::RendererType::DirectX11)(gRenderer.writeRef());
- IRenderer::Desc rendererDesc;
+ IRenderer::Desc rendererDesc = {};
+ rendererDesc.rendererType = gfx::RendererType::DirectX11;
rendererDesc.width = gWindowWidth;
rendererDesc.height = gWindowHeight;
- {
- gfx::Result res = gRenderer->initialize(rendererDesc, getPlatformWindowHandle(gWindow));
- if(SLANG_FAILED(res)) return res;
- }
+ gfx::Result res = gfxCreateRenderer(&rendererDesc, getPlatformWindowHandle(gWindow), gRenderer.writeRef());
+ if(SLANG_FAILED(res)) return res;
// Now we will create objects needed to configur the "input assembler"
// (IA) stage of the D3D pipeline.
@@ -414,7 +412,7 @@ void renderFrame()
// PSO, binding our root shader object to it (which references
// the `Uniforms` buffer that will filled in above).
//
- gRenderer->setPipelineState(PipelineType::Graphics, gPipelineState);
+ gRenderer->setPipelineState(gPipelineState);
gRenderer->bindRootShaderObject(PipelineType::Graphics, gRootObject);
// We also need to set up a few pieces of fixed-function pipeline