d3dcoder / d3d12book

Sample code for the book "Introduction to 3D Game Programming with DirectX 12"
1.51k stars 583 forks source link

Wrong Number of Descriptors #32

Closed zixin96 closed 2 years ago

zixin96 commented 2 years ago

https://github.com/d3dcoder/d3d12book/blob/4cfd00afa59210a272f62caf0660478d18b9ffed/Chapter%2018%20Cube%20Mapping/CubeMap/CubeMapApp.cpp#L495

Since we have 4 textures in this demo, shouldn't the second descriptor table have 4 descriptors instead of 5?

PAMinerva commented 2 years ago

Actually, the second descriptor table should have 3 descriptors since the descriptor of the cube map is stored in the first descriptor table. So, the only remaining descriptors are the ones to the textures bricks2, tile and white1x1.

zixin96 commented 2 years ago

Thanks for the reply. I later found some more mismatches with regard to the number of descriptors, but it didn't affect the correctness of these demos. I guess we could just ignore them.

PAMinerva commented 2 years ago

Yep! We are ok as long as the shader code doesn't access the array of textures out of bounds and get the proper texture by using the index in the MaterialData related to the object you are drawing.