Skip to content

Instantly share code, notes, and snippets.

@aras-p
Created December 19, 2011 09:21
Show Gist options
  • Save aras-p/1496270 to your computer and use it in GitHub Desktop.
Save aras-p/1496270 to your computer and use it in GitHub Desktop.
light keywords
void Light::SetLightKeyword()
{
// OK, "2 at 1"
printf_console ("LightMasks: %x at 1\n", (UInt32)(kLightKeywordMasks[1]&0xFFFFFFFF));
// BAD, 0
printf_console ("LightMasks: %x at m_KeywordMode (%i)\n", (UInt32)(kLightKeywordMasks[m_KeywordMode]&0xFFFFFFFF), m_KeywordMode);
// BAD, 0
printf_console ("LightMasks: %x at (int)m_KeywordMode (%i)\n", (UInt32)(kLightKeywordMasks[(int)m_KeywordMode]&0xFFFFFFFF), m_KeywordMode);
int idx = m_KeywordMode;
// BAD, 0
printf_console ("LightMasks: %x at idx (%i)\n", (UInt32)(kLightKeywordMasks[idx]&0xFFFFFFFF), idx);
UInt64 mask = g_ShaderKeywords.GetMask();
printf_console ("Light KW: type %d mask %x\n", m_Type,
(UInt32)(mask&0xFFFFFFFF));
mask &= ~kAllLightKeywordsMask;
printf_console ("Light KW: mask %x (anded with %x)\n",
(UInt32)(mask&0xFFFFFFFF), (UInt32)((~kAllLightKeywordsMask)&0xFFFFFFFF));
mask |= kLightKeywordMasks[m_KeywordMode];
printf_console ("Light KW: mask %x (ored with %x at index %i)\n",
(UInt32)(mask&0xFFFFFFFF), (UInt32)(kLightKeywordMasks[m_KeywordMode]&0xFFFFFFFF), m_KeywordMode);
g_ShaderKeywords.SetMask (mask);
printf_console ("Light KW: mask %x\n",
g_ShaderKeywords.GetMask());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment