Skip to content

Commit 9e0c0d0

Browse files
committed
Fixed error related to ImGui::Image and sampler creation. Note : The sampler bug was related to using a COMPARISON_FUNC_LESS while using a ANISOTROPIC filter, which caused errors while using the latest agility SDK. The Imgui::image bug was caused due to using CPU descriptor handles rather than GPU handles
1 parent c9d78b6 commit 9e0c0d0

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed

Helios/Source/Editor/Editor.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ namespace helios::editor
188188
graphicsDevice->getCbvSrvUavDescriptorHeap()->getDescriptorHandleFromIndex(
189189
material[i].albedoTexture.srvIndex);
190190

191-
ImGui::Image((ImTextureID)(albedoSrvHandle.cpuDescriptorHandle.ptr), ImVec2(60, 60));
191+
ImGui::Image((ImTextureID)(albedoSrvHandle.gpuDescriptorHandle.ptr), ImVec2(60, 60));
192192
}
193193

194194
ImGui::SliderFloat("Roughness Factor", &material[i].materialBufferData.roughnessFactor, 0.0f,
@@ -313,7 +313,7 @@ namespace helios::editor
313313
// deferredGBuffer.aoMetalRoughnessEmissiveRT.srvIndex);
314314

315315
ImGui::Begin("Albedo RT");
316-
ImGui::Image((ImTextureID)(albedoEmissiveDescriptorHandle.cpuDescriptorHandle.ptr),
316+
ImGui::Image((ImTextureID)(albedoEmissiveDescriptorHandle.gpuDescriptorHandle.ptr),
317317
ImGui::GetWindowViewport()->WorkSize);
318318
ImGui::End();
319319

@@ -341,7 +341,7 @@ namespace helios::editor
341341
shadowMappingPass.m_shadowDepthBuffer.srvIndex);
342342

343343
ImGui::Begin("Shadow Depth Map");
344-
ImGui::Image((ImTextureID)(srvDescriptorHandle.cpuDescriptorHandle.ptr), ImGui::GetWindowViewport()->WorkSize);
344+
ImGui::Image((ImTextureID)(srvDescriptorHandle.gpuDescriptorHandle.ptr), ImGui::GetWindowViewport()->WorkSize);
345345
ImGui::End();
346346

347347
ImGui::SliderFloat("Backoff distance", &shadowMappingPass.m_shadowBufferData.backOffDistance, 0.0f, 300.0f);
@@ -361,7 +361,7 @@ namespace helios::editor
361361
ssaoPass.m_blurSSAOTexture.srvIndex);
362362

363363
ImGui::Begin("SSAO Blur Texture");
364-
ImGui::Image((ImTextureID)(blurSSAOTextureSrvDescriptorHandle.cpuDescriptorHandle.ptr),
364+
ImGui::Image((ImTextureID)(blurSSAOTextureSrvDescriptorHandle.gpuDescriptorHandle.ptr),
365365
ImGui::GetWindowViewport()->WorkSize);
366366
ImGui::End();
367367

@@ -385,7 +385,7 @@ namespace helios::editor
385385
bloomPass.m_extractionTexture.srvIndex);
386386

387387
ImGui::Begin("Bloom Extract Texture");
388-
ImGui::Image((ImTextureID)(bloomExtractTextureSrvDescriptorHandle.cpuDescriptorHandle.ptr),
388+
ImGui::Image((ImTextureID)(bloomExtractTextureSrvDescriptorHandle.gpuDescriptorHandle.ptr),
389389
ImGui::GetMainViewport()->WorkSize);
390390
ImGui::End();
391391

@@ -397,7 +397,7 @@ namespace helios::editor
397397
bloomPass.m_bloomDownSampleTexture.srvIndex + bloomDownSampleMipIndex);
398398

399399
ImGui::Begin("Bloom Downsample Texture");
400-
ImGui::Image((ImTextureID)(bloomDownPassTextureSrvDescriptorHandle.cpuDescriptorHandle.ptr),
400+
ImGui::Image((ImTextureID)(bloomDownPassTextureSrvDescriptorHandle.gpuDescriptorHandle.ptr),
401401
ImGui::GetWindowViewport()->WorkSize);
402402
ImGui::End();
403403

@@ -409,7 +409,7 @@ namespace helios::editor
409409
bloomPass.m_bloomUpSampleTexture.srvIndex + bloomUpSampleMipIndex);
410410

411411
ImGui::Begin("Bloom UpSample Texture");
412-
ImGui::Image((ImTextureID)(bloomUpSampleTextureSrvDescriptorHandle.cpuDescriptorHandle.ptr),
412+
ImGui::Image((ImTextureID)(bloomUpSampleTextureSrvDescriptorHandle.gpuDescriptorHandle.ptr),
413413
ImGui::GetWindowViewport()->WorkSize);
414414
ImGui::End();
415415

@@ -436,7 +436,7 @@ namespace helios::editor
436436
graphicsDevice->getCbvSrvUavDescriptorHeap()->getDescriptorHandleFromIndex(renderTarget.srvIndex);
437437

438438
ImGui::Begin("View Port");
439-
ImGui::Image((ImTextureID)(rtvSrvHandle.cpuDescriptorHandle.ptr), ImGui::GetWindowViewport()->WorkSize);
439+
ImGui::Image((ImTextureID)(rtvSrvHandle.gpuDescriptorHandle.ptr), ImGui::GetWindowViewport()->WorkSize);
440440

441441
// Handling the drag-drop facility for GLTF models.
442442
if (ImGui::BeginDragDropTarget())

Helios/Source/Graphics/GraphicsDevice.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,8 @@ namespace helios::gfx
630630

631631
m_device->CreateSampler(&samplerCreationDesc.samplerDesc, samplerDescriptorHandle.cpuDescriptorHandle);
632632

633+
m_samplerDescriptorHeap->offsetCurrentHandle();
634+
633635
return sampler;
634636
}
635637

Helios/Source/Scene/Model.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ namespace helios::scene
521521
samplerCreationDesc.samplerDesc.MinLOD = 0.0f;
522522
samplerCreationDesc.samplerDesc.MipLODBias = 0.0f;
523523
samplerCreationDesc.samplerDesc.MaxAnisotropy = 16;
524-
samplerCreationDesc.samplerDesc.ComparisonFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL;
524+
samplerCreationDesc.samplerDesc.ComparisonFunc = D3D12_COMPARISON_FUNC_NEVER;
525525

526526
m_samplers[index++] = graphicsDevice->createSampler(samplerCreationDesc);
527527
}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ cmake --build Build --config Release
8484
Alternatively open the folder in Visual Studio's open folder mode.
8585
+ Run the `Setup.bat` file, which will install the DirectXAgility SDK and the DirectXShader Compiler. You will be asked to enter the build path, which was the same path you gave in cmake -S . -B 'BuildPath'. If you followed the commands above, BuildPath = Build.
8686

87+
NOTE : Since a preview version of Agility SDK is currently being used, you need to enable Developer Mode for the application to run.
88+
8789
# Controls
8890
+ WASD -> Move camera.
8991
+ Arrow keys -> Modify camera orientation.

imgui.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ DockSpace ID=0x8B93E3BD Window=0xA787BDB4 Pos=0,19 Size=1536,845 Split=X
274274
DockNode ID=0x0000000C Parent=0x00000001 SizeRef=239,243 Selected=0x39863C79
275275
DockNode ID=0x00000002 Parent=0x00000009 SizeRef=1035,845 Split=Y Selected=0x6EE523C4
276276
DockNode ID=0x00000005 Parent=0x00000002 SizeRef=1389,697 CentralNode=1 Selected=0x6EE523C4
277-
DockNode ID=0x00000006 Parent=0x00000002 SizeRef=1389,146 Selected=0x20E3C5EA
277+
DockNode ID=0x00000006 Parent=0x00000002 SizeRef=1389,146 Selected=0xBF096F38
278278
DockNode ID=0x0000000A Parent=0x8B93E3BD SizeRef=275,845 Split=Y Selected=0xBEC9F81A
279279
DockNode ID=0x00000007 Parent=0x0000000A SizeRef=194,418 Selected=0xBEC9F81A
280280
DockNode ID=0x00000008 Parent=0x0000000A SizeRef=194,425 Selected=0x8477D764

0 commit comments

Comments
 (0)