Tag Info

Hot answers tagged

2

The compiler won't always put the ".xyz" of a hlsl variable into ".xyz" of a register, if that's what you're referring to - sometimes it will move between .xyz, .xyw, .yzw, or even between components in separate registers, depending on if it's some intermediate calculation value or not and how much register pressure there is. As far as I'm aware there's no ...


1

COLOR0 is DX9. Since you're dealing with DX11 (ps_5_0) you need to replace COLOR0 with SV_Target.


1

It turns out that an effect passed to SpriteBatch.Begin must follow specific conventions: Texture2D<float4> Texture : register(t0); // SpriteBatch expects that default texture sampler parameter will have name 'TextureSampler' sampler TextureSampler : register(s0); // SpriteBatch expects that default vertex transform parameter will have name ...


1

You can't rewrite that loop so that it can't be unrolled. GPUs do not in general support a varying number of attributes to be passed between stages. You can, however, eliminate the loop entirely. Just pass vPosWS to the fragment shader, and do the loop there. Then the unrolling will actually be helpful. Bonus: You don't waste an absurd amount of bandwidth ...


1

I do it like this, so no divide in the PS. Vertex Shader code follows: struct VertextoPixel { float4 pos : SV_POSITION; float2 tex : TEXCOORD0; }; VertextoPixel main(uint vI : SV_VERTEXID) { float2 inTex = float2(vI%2,vI%4/2); VertextoPixel Out = (VertextoPixel)0; ...


1

The key step that you're missing is the implicit slot assignment that occurs when you compile a shader. When you compile an HLSL shader that contains a bindable object (be it a Texture2D, RWStructuredBuffer, or cbuffer), each object must be assigned a slot number. This corresponds to the UINT StartSlot parameter to e.g. VSSetConstantBuffers. You can ...


1

You don't specify what rendering method you want to use. Standard rasterisation of a 3D mesh? Or do you have a volume representation of the model and your renderer uses that directly? If you render a volume, check this: http://http.developer.nvidia.com/GPUGems/gpugems_ch39.html especially 39.2. The effect in the picture you provide is mainly subsurface ...


1

I'm a newb to DirectX myself, but from what I've read, in HLSL, this: Texture textures[3]; Will actually be compiled like this: Texture textures0; Texture textures1; Texture textures2; So indexing into the array won't work.



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