Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 05 May 2012
Online Last Active Today, 11:19 AM

Topics I've Started

Slow shader compile time when using large arrays.

28 November 2014 - 06:42 AM

I am getting awfully slow shader compilation times when using large arrays either in cbuffer or tbuffer formats. Simple test case where vertex is transformed by matrix from array using instanceId is enough to trigger this bug.

Compile times with different array size are:

n = 128     -> 0.008s

n = 1024   -> 0.621s

n =  65536 -> 62.34s

tbuffer TransformsTextureBuffer  : register(t0) { float4x4 u_transforms[1024];  } 

struct VS_INPUT
	float3	position	: SV_Position;
	uint instanceID		: SV_InstanceID;

struct PS_INPUT
	float4	position	: SV_Position;

PS_INPUT main (VS_INPUT input)
	PS_INPUT output = (PS_INPUT)0;
	output.position = mul(u_transforms[input.instanceID], float4(input.position, 1.0));
	return output;

Can any one repeat this problem? Is this know behavior? Is there know solutions?


Shader version is vs_5_0.