I inserted the code below into the simple_matmult sample code. It appears to work as I expect it to but I get these error messages when compiling (what's up?):
WARNING: ASSERT(GetResultSymbol().IsValid() + mDataTypeValue.IsValid() >= 1) failed
While processing <buffer>:66
In compiler at ResolveSymbols()[astdelayedlookup.cpp:139]
*mName = c
Message: unknown symbol
ERROR: ASSERT(errorCount==0) failed
While processing <buffer>:115
In compiler at CompileShaderToStream()[astroot.cpp:157]
errorCount = 1
Message: Unknown Symbols exist
Aborting...
kernel void scatter(float4 a[][], float4 b<>, float width, out float4 c[])
{
// Get the position in the stream of the current thread
float idx = (indexof(c)).x;
float2 apos = {idx % width, floor(idx / width) };
// Write out to the scatter buffer
c[idx] = a[apos] + b;
}
int main(int argc, char** argv)
{
...
float4 *input_a;
float4 *input_b;
float4 *output_c;
unsigned int W = 4;
unsigned int H = 4;
unsigned int WxH = W * H;
unsigned int i, j;
input_a = (float4 *)malloc( WxH * sizeof( float4 ) );
input_b = (float4 *)malloc( WxH * sizeof( float4 ) );
output_c = (float4 *)malloc( WxH * sizeof( float4 ) );
for ( j = 0; j < H; j++ )
for ( i = 0; i < W; i++ )
*((float4 *)(input_a + (j * W) + i )) = float4( (float)( (j * W) + i ), 0.0f, 0.0f, 0.0f );
for ( i = 0; i < WxH; i++ ) *( (float4 *)(input_b + i) ) = float4( 1.0f, 0.0f, 0.0f, 0.0f );
{
...
float4 in_A<H, W>;
float4 in_B<WxH>;
float4 out_C<WxH>;
...
streamRead(in_A, input_a);
streamRead(in_B, input_b);
scatter( in_A, in_B, (float)W, out_C );
streamWrite(out_C, output_c);
for ( i = 0; i < WxH; i++ ) fprintf( stderr, "%f\n", output_c[ i ].x );
...
}
...
}
BTW, if I compile just the code above (minus the ellipses), I get NO such error messages.
---jski