Tag Info

Hot answers tagged


Out of curiosity (and peace of the mind...) I wondered how DirectX decides which attribute from a struct corresponds to the right variable inside an HLSL cbuffer-register(x) (apart from the order/type they are declared with). Purely through memory layout. You give D3D a pointer to a chunk of memory which you claim to be organized in a certain ...


Non-array struct members for constant buffers in HLSL are packed on four byte offsets, as many as it can into 16-byte vectors. If a member would straddle a vector boundary, it starts a new vector. You cannot achieve this with just an alignment and pack directive, you need to have explicit padding in your CPU-side structure to emulate the CB layout rules. ...


Use several constant buffers and group variables together based on how often they change. If your variables are fairly static ( or just huge ) you may be better off converting values into a texture and extracting them in the shader.


There are additional alignment and layout rules for constant buffers. The float3 probably needs padding on the CPU side to get the right stride. Roughly paraphrased, things need to be on 16-byte boundaries.


There's three members of a D3D11_MAPPED_SUBRESOURCE: a pointer to the beginning of the data; the number of bytes from the beginning of one row of data to the next row of data; the number of bytes from the beginning of one depth slice of data to the next depth slice of data. As none of these members communicate anything about the actual extents of a row ...


If I am understanding the question correctly, you just want the delta mouse when you are in relative mode. According to the docs, https://directxtk.codeplex.com/wikipage?title=Mouse&referringTitle=Home#Absolute%20vs.%20Relative%20Mouse%20position When you query the state of the mouse, the x and y coordinates return the delta. Note, because you ...


My assumption based on my experiences with shader reflection in DX11 is that it's mapped by name. If you check out the DX11 shader reflection API you'll see that there is a D3D11_SHADER_VARIABLE_DESC struct that you can rip from the shader. Notice the LPCSTR for the name of the variable. OpenGL also handles variable mapping by name. Of course the best way ...


VSSetConstantBuffers stands for VertexShaderSetConstantBuffers. Hence you also got PSSetConstantBuffers for the pixel shader.


The question is what pixel format are you converting your JPG and PNG images to for the DDS, and with what tool? Many of the older tools, including the legacy DirectX SDK texture tool, will default to using a 24bpp format D3DFMT_R8G8B8. The problem with this format is that there is no DXGI format that is 24bpp. The DDSTextureLoader in DirectX Tool Kit is ...

Only top voted, non community-wiki answers of a minimum length are eligible