• Advertisement
Sign in to follow this  

[hlsl, MRT] why cant for(i..) color[i]=...?

This topic is 3969 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,I found hlsl in both 9 and 10 doesn't allow color addressing to the render target. Take hlsl 10 as example:
struct PS_OUTPUT
    float4 color[8] : SV_Target;
PS_OUTPUT ps(..)
   for(int i = 0; i < 8; ++i)
      o.color =  ..  //this will cause this error and exit the program: "warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll"
Why's that? If I want assign to color depending i, I have to work around like this:
if(i == 0)
  o.color[0] =..;
if(i == 1)
  o.color[1] =..;
Could anyone be kind to give some suggestions? Thanks! ps. I found this ppt good: directx10 porting performance and gotchas

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement