Reload of shaders working!
This commit is contained in:
@@ -202,6 +202,30 @@ void JulietApplication::Update()
|
||||
{
|
||||
// We need to wait for the gpu to be idle to recreate our graphics pipelines
|
||||
WaitUntilGPUIsIdle(GraphicsDevice);
|
||||
|
||||
#if ALLOW_SHADER_HOT_RELOAD
|
||||
String entryPoint = WrapString("main");
|
||||
ShaderCreateInfo shaderCI = {};
|
||||
shaderCI.EntryPoint = entryPoint;
|
||||
String shaderPath = WrapString("../../../Assets/compiled/Triangle.vert.dxil");
|
||||
shaderCI.Stage = ShaderStage::Vertex;
|
||||
Shader* vertexShader = CreateShader(GraphicsDevice, shaderPath, shaderCI);
|
||||
|
||||
shaderPath = WrapString("../../../Assets/compiled/SolidColor.frag.dxil");
|
||||
shaderCI.Stage = ShaderStage::Fragment;
|
||||
Shader* fragmentShader = CreateShader(GraphicsDevice, shaderPath, shaderCI);
|
||||
|
||||
UpdateGraphicsPipelineShaders(GraphicsDevice, GraphicsPipeline, vertexShader, fragmentShader);
|
||||
|
||||
if (vertexShader)
|
||||
{
|
||||
DestroyShader(GraphicsDevice, vertexShader);
|
||||
}
|
||||
if (fragmentShader)
|
||||
{
|
||||
DestroyShader(GraphicsDevice, fragmentShader);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Draw here for now
|
||||
|
||||
Reference in New Issue
Block a user