Tag Info

Hot answers tagged

7

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 ...


4

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. ...


3

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.


2

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.


1

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 ...


1

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 ...


1

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 ...


1

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


1

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