Jump to content
  • Advertisement
Sign in to follow this  
yk_cadcg

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

This topic is 4054 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(..)
{
   PS_OUTPUT o;
   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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!