Comments (2)
Hi Kliaxe,
Thanks for your kind words, I'm glad you find it helpful 😃
Try removing g_padding from the struct...
struct FrameBuffer
{
Math::Matrix view;
Math::Matrix projection;
Math::Matrix projection_ortho;
Math::Matrix view_projection;
Math::Matrix view_projection_inv;
Math::Matrix view_projection_ortho;
Math::Matrix view_projection_unjittered;
...
float ssr_enabled;
float shadow_resolution;
float ssao_scale;
float white_balance;
};
... and from the cbuffer
cbuffer FrameBuffer : register(b0)
{
matrix g_view;
matrix g_projection;
matrix g_projectionOrtho;
matrix g_viewProjection;
matrix g_viewProjectionInv;
matrix g_viewProjectionOrtho;
matrix g_viewProjectionUnjittered;
...
float g_ssr_enabled;
float g_shadow_resolution;
float g_ssao_scale;
float g_white_balance;
};
It should work now.
This is because HLSL has some packing/alignment rules for constant buffers (16-byte boundaries), detailed here.
On top of that, the compiler can choose to add padding to something like a struct, introducing a potential scenario where what you map from the CPU, is different from what the GPU expects.
So it's a good idea to explicitly/manually ensure correct padding both on the CPU and the GPU.
I hope this helps 👍
from spartanengine.
Hello, thank you for the quick answer! Yes, that definitely did the trick!
I'm now closing this issue as the problem has been solved.
from spartanengine.
Related Issues (20)
- Wiki documentation
- Improve screen space subsurface scattering for vegetation HOT 1
- Stair navigation in the Doom default world with the physics-based camera
- Ray traced reflections
- Ray traced shadows
- Eye adaptation
- Skeletal animation
- Dynamic resolution scaling HOT 1
- Switch to bindless HOT 2
- Complete D3D12 backend
- Occlusion culling HOT 1
- Crash on Choosing World from World Selection Dialog Box HOT 10
- Improve of editor design/style using imgui
- vulkan destory problem. HOT 4
- Can't open the sponza scene HOT 1
- Vulkan_SwapChain Resize Window has a problem, is made fence wait timeout. so need reset m_sync_index = std::numeric_limits<uint32_t>::max(); HOT 2
- Bug: opening a world crashes the engine HOT 2
- Create Volume Component
- Fix point light shadow mapping HOT 1
- Git: Clean up .git folder to reduce repo size HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spartanengine.