[require] shader model >= 4.0 shader model < 6.0 [sampler 0] filter linear linear linear address clamp clamp clamp [sampler 1] filter linear linear linear address clamp clamp clamp [sampler 2] filter linear linear linear address clamp clamp clamp [sampler 3] filter linear linear linear address clamp clamp clamp [sampler 4] filter linear linear linear address clamp clamp clamp [sampler 5] filter linear linear linear address clamp clamp clamp [sampler 6] filter linear linear linear address clamp clamp clamp [srv 0] size (2d, 1, 1) 0.0 0.0 0.0 1.0 [srv 1] size (2d, 1, 1) 1.0 1.0 1.0 1.0 [srv 2] size (2d, 1, 1) 2.0 2.0 2.0 1.0 [srv 3] size (2d, 1, 1) 3.0 3.0 3.0 1.0 [srv 4] size (2d, 1, 1) 4.0 4.0 4.0 1.0 [srv 5] size (2d, 1, 1) 5.0 5.0 5.0 1.0 [srv 6] size (2d, 1, 1) 6.0 6.0 6.0 1.0 [srv 7] size (2d, 1, 1) 7.0 7.0 7.0 1.0 [srv 8] size (2d, 1, 1) 8.0 8.0 8.0 1.0 [srv 9] size (2d, 1, 1) 9.0 9.0 9.0 1.0 % Regarding resource allocation ordering in SM4, textures go in this order: % 1. Textures created from SM1-style samples, in decreasing "bind count". % In case there is a tie in the "bind count", the order is given by the order of appearance of % the tex1D/tex2D/tex3D/texCube calls that create them. % 2. Regular textures in order of declaration. % % Note that the "bind count" should not be confused with the "allocation size". % % The "bind count" appears in the RDEF table ("Count" row), and is determined by the last field % actually used. % The "allocation size" for textures affects the starting register id for the next resource in the % table, and may be larger than the "bind count". [require] shader model >= 4.0 shader model < 6.0 options: backcompat [pixel shader] // Name Type Format Dim HLSL Bind Count // ------------------------------ ---------- ------- ----------- -------------- ------ // sam_arr_10 sampler NA NA s0 1 // sam_arr_01 sampler NA NA s1 2 // sam_arr_11 sampler NA NA s3 2 // samA sampler NA NA s5 1 // samB sampler NA NA s6 1 // sam_arr_11 texture float4 2d t0 2 // sam_arr_01 texture float4 2d t2 2 // samB texture float4 2d t4 1 // sam_arr_10 texture float4 2d t5 1 // samA texture float4 2d t6 1 // tex texture float4 2d t7 1 // texs texture float4 2d t8 2 Texture2D tex; Texture2D texs[2]; sampler samA; sampler samB; sampler sam_arr_10[2]; sampler sam_arr_01[2]; sampler sam_arr_11[2]; float4 main() : sv_target { float4 f = 0, g = 0, h = 0, res; f += 100 * tex2D(samB, float2(0, 0)); f += 10 * tex2D(sam_arr_10[0], float2(0, 0)); f += 1 * tex2D(sam_arr_11[0], float2(0, 0)); g += 100 * tex2D(sam_arr_11[1], float2(0, 0)); g += 10 * tex2D(sam_arr_01[1], float2(0, 0)); g += 1 * texs[1].Load(int3(0, 0, 0)); h += 100 * texs[0].Load(int3(0, 0, 0)); h += 10 * tex.Load(int3(0, 0, 0)); h += 1 * tex2D(samA, float2(0, 0)); res.x = f.x; res.y = g.x; res.z = h.x; res.w = f.w + g.w + h.w; return res; } [test] todo(msl) draw quad probe (0, 0) rgba (450, 139, 876, 333) % Same as the first test, but inverting the declaration order. % Regarding textures, only the allocation of those that are not created from samplers is affected. [pixel shader] // Name Type Format Dim HLSL Bind Count // ------------------------------ ---------- ------- ----------- -------------- ------ // sam_arr_11 sampler NA NA s0 2 // sam_arr_01 sampler NA NA s2 2 // sam_arr_10 sampler NA NA s4 1 // samB sampler NA NA s5 1 // samA sampler NA NA s6 1 // sam_arr_11 texture float4 2d t0 2 // sam_arr_01 texture float4 2d t2 2 // samB texture float4 2d t4 1 // sam_arr_10 texture float4 2d t5 1 // samA texture float4 2d t6 1 // texs texture float4 2d t7 2 // tex texture float4 2d t9 1 sampler sam_arr_11[2]; sampler sam_arr_01[2]; sampler sam_arr_10[2]; sampler samB; sampler samA; Texture2D texs[2]; Texture2D tex; float4 main() : sv_target { float4 f = 0, g = 0, h = 0, res; f += 100 * tex2D(samB, float2(0, 0)); f += 10 * tex2D(sam_arr_10[0], float2(0, 0)); f += 1 * tex2D(sam_arr_11[0], float2(0, 0)); g += 100 * tex2D(sam_arr_11[1], float2(0, 0)); g += 10 * tex2D(sam_arr_01[1], float2(0, 0)); g += 1 * texs[1].Load(int3(0, 0, 0)); h += 100 * texs[0].Load(int3(0, 0, 0)); h += 10 * tex.Load(int3(0, 0, 0)); h += 1 * tex2D(samA, float2(0, 0)); res.x = f.x; res.y = g.x; res.z = h.x; res.w = f.w + g.w + h.w; return res; } [test] todo(msl) draw quad probe (0, 0) rgba (450, 138, 796, 333) % Same as the first test, but inverting the resource loads order. % Regarding textures, only the allocation of those that are created from samplers is affected. [pixel shader] // Name Type Format Dim HLSL Bind Count // ------------------------------ ---------- ------- ----------- -------------- ------ // sam_arr_10 sampler NA NA s0 1 // sam_arr_01 sampler NA NA s1 2 // sam_arr_11 sampler NA NA s3 2 // samA sampler NA NA s5 1 // samB sampler NA NA s6 1 // sam_arr_01 texture float4 2d t0 2 // sam_arr_11 texture float4 2d t2 2 // samA texture float4 2d t4 1 // sam_arr_10 texture float4 2d t5 1 // samB texture float4 2d t6 1 // tex texture float4 2d t7 1 // texs texture float4 2d t8 2 Texture2D tex; Texture2D texs[2]; sampler samA; sampler samB; sampler sam_arr_10[2]; sampler sam_arr_01[2]; sampler sam_arr_11[2]; float4 main() : sv_target { float4 f = 0, g = 0, h = 0, res; f += 100 * tex2D(samA, float2(0, 0)); f += 10 * tex.Load(int3(0, 0, 0)); f += 1 * texs[0].Load(int3(0, 0, 0)); g += 100 * texs[1].Load(int3(0, 0, 0)); g += 10 * tex2D(sam_arr_01[1], float2(0, 0)); g += 1 * tex2D(sam_arr_11[1], float2(0, 0)); h += 100 * tex2D(sam_arr_11[0], float2(0, 0)); h += 10 * tex2D(sam_arr_10[0], float2(0, 0)); h += 1 * tex2D(samB, float2(0, 0)); res.x = f.x; res.y = g.x; res.z = h.x; res.w = f.w + g.w + h.w; return res; } [test] todo(msl) draw quad probe (0, 0) rgba (478, 913, 256, 333) % We can conclude that for declared texture arrays, if they are used, the "allocation size" is the % whole array. % On the other hand, for textures generated from samplers. the "allocation size" is the "bind count". [pixel shader] // Name Type Format Dim HLSL Bind Count // ------------------------------ ---------- ------- ----------- -------------- ------ // sam_arr sampler NA NA s0 2 // sam sampler NA NA s2 1 // sam_arr texture float4 2d t0 2 // texs texture float4 2d t2 1 // tex texture float4 2d t5 1 sampler sam; Texture2D texs[3]; sampler sam_arr[3]; Texture2D tex; float4 main() : sv_target { float4 res = 0; res += 100 * texs[0].Sample(sam, float2(0, 0)); res += 10 * tex2D(sam_arr[1], float2(0, 0)); res += 1 * tex.Sample(sam, float2(0, 0)); return res; } [test] todo(msl) draw quad probe (0, 0) rgba (215, 215, 215, 111) % Test that textures created from SM1-style samples allocation order is in decreasing "bind count". [pixel shader] // Name Type Format Dim HLSL Bind Count // ------------------------------ ---------- ------- ----------- -------------- ------ // tex_100 sampler NA NA s0 1 // tex_010 sampler NA NA s1 2 // tex_001 sampler NA NA s3 3 // tex_001 texture float4 2d t0 3 // tex_010 texture float4 2d t3 2 // tex_100 texture float4 2d t5 1 sampler tex_100[3]; sampler tex_010[3]; sampler tex_001[3]; float4 main() : sv_target { float4 res; res.x = tex2D(tex_100[0], float2(0, 0)).x; res.y = tex2D(tex_010[1], float2(0, 0)).x; res.z = tex2D(tex_001[2], float2(0, 0)).x; res.w = 0; return res; } [test] todo(msl) draw quad probe (0, 0) rgba (5, 4, 2, 0)