Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The very first thing that comes in my head:</p> <p>All hardware that supports compute shaders (equal to almost all DirectX 10 and higher) also supports <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ff471453%28v=vs.85%29.aspx" rel="nofollow">ByteAddressBuffer</a>s and most of it supports <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ff471514%28v=vs.85%29.aspx" rel="nofollow">StructuredBuffer</a>s. So you can bind your arrays as <code>SRV</code>s and have random access to any of its elements in shaders.</p> <p>Something like this (not tested, just pseudocode):</p> <pre><code>// Indices passed as vertex buffer to shader // Think of them as of "references" to real data struct VS_INPUT { uint posidx; uint noridx; uint texidx; } // The real vertex data // You pass it as structured buffers (similar to textures) StructuredBuffer&lt;float3&gt; pos : register (t0); StructuredBuffer&lt;float3&gt; nor : register (t1); StructuredBuffer&lt;float2&gt; tex : register (t2); VS_OUTPUT main(VS_INPUT indices) { // in shader you read data for current vertex float3 pos = pos[indices.posidx]; float3 nor = nor[indices.noridx]; float2 tex = tex[indices.texidx]; // here you do something } </code></pre> <p>Let's call that "compute shader approach". You must use DirectX 11 API. </p> <p>Also you can bind your indices in same fashion and do some magic in shaders. In this case you need to find out current index id. Probably you can take it from SV_VertexId.</p> <p>And probably you can workaround these buffers and bind data somehow else ( DirectX 9 compatible texture sampling! O_o ).</p> <p>Hope it helps!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload