Hi,

I noticed that some of my A8-shaders, which deal with animated sprites, behave different under A7 -- or in other words: they work in A7 as one could assume and need extra overhead in A8.

In the A8-version I always got coordinates for the whole texture. That means, if I returned just the color * alpha, I stretched -all frames- on the texture surface. After some experimenting, I used the following construction in my vertex shader:

Code:
VS_OUT VS (VS_IN In)
{
   VS_OUT Out = (VS_OUT)0;

   // If this an animated sprite we have to transform coordinates
   if (vecSkill1.x > 0)
   {
      // Set to first frame
      Out.Tex = mul(In.Tex, matTexture);

      // Shift by frame number
      float4 width = mul(float4(1,0,0,0), matTexture);
      Out.Tex.x += vecSkill1.y * width;
   }
   else // Everything else (default)
   {
      Out.Tex.xy = In.Tex.xy;
   }
   
   (...) // Do some other stuff

   return(Out);
}



I wasted two material skills for the flag if this is an animated sprite and another one for which frame it is. I didn't knew if this is right or wrong, but hey, it worked laugh

Now, when checking if they work with A7, I encountered that something went wrong. After some trial and error I recognized that I can simply do

Code:
Out.Tex.xy = In.Tex.xy;



without that matTexture-related instructions. I used a compiler switch to detect if this is A8 or A7 and set a float to see if this is A8, so that I can branch into this extra code-section (or better said: to leave it, if it is A7):

Code:
// A7 compatibility mode
#ifndef wait_for_my
   #define PP_SSAO_A7_COMPAT
   float ppSsaoIsA8 = 0; // For shaders
#else
   float ppSsaoIsA8 = 1; // For shaders
#endif



So, you might ask "what is the point? It works for him!"

Well, if you accidently changed this behaviour while migrating to A8, please fix it, because it saves me lots of overhead and additional shader cycles ;-)

Last edited by HeelX; 11/07/10 22:51.