\hypertarget{a01156}{\section{A\+C\+G\+:\+:Shader\+Cache Class Reference}
\label{a01156}\index{A\+C\+G\+::\+Shader\+Cache@{A\+C\+G\+::\+Shader\+Cache}}
}


Cache for shaders.  




{\ttfamily \#include $<$A\+C\+G/\+G\+L/\+Shader\+Cache.\+hh$>$}

\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{a00383}{Cache\+Entry}
\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{a01156_aadce86f7ac2ec6b5349dde376016aea2}{virtual \hyperlink{a01156_aadce86f7ac2ec6b5349dde376016aea2}{$\sim$\+Shader\+Cache} ()}\label{a01156_aadce86f7ac2ec6b5349dde376016aea2}

\begin{DoxyCompactList}\small\item\em Destructor. \end{DoxyCompactList}\item 
\hyperlink{a01020}{G\+L\+S\+L\+::\+Program} $\ast$ \hyperlink{a01156_af7e74e2c97dcea1fb3c482ea5d8560d0}{get\+Program} (const \hyperlink{a01158}{Shader\+Gen\+Desc} $\ast$\+\_\+desc, const std\+::vector$<$ unsigned int $>$ \&\+\_\+mods)
\begin{DoxyCompactList}\small\item\em Query a dynamically generated program from cache. \end{DoxyCompactList}\item 
\hyperlink{a01020}{G\+L\+S\+L\+::\+Program} $\ast$ \hyperlink{a01156_a7223713ed9b347138be08c3a60ae3328}{get\+Program} (const \hyperlink{a01158}{Shader\+Gen\+Desc} $\ast$\+\_\+desc, const std\+::vector$<$ unsigned int $>$ $\ast$\+\_\+mods)
\begin{DoxyCompactList}\small\item\em Query a dynamically generated program from cache. \end{DoxyCompactList}\item 
\hyperlink{a01020}{G\+L\+S\+L\+::\+Program} $\ast$ \hyperlink{a01156_a01c8eebff8445ebb64a3f071cd9d1eb9}{get\+Program} (const \hyperlink{a01158}{Shader\+Gen\+Desc} $\ast$\+\_\+desc)
\begin{DoxyCompactList}\small\item\em Query a dynamically generated program from cache. \end{DoxyCompactList}\item 
\hyperlink{a01020}{G\+L\+S\+L\+::\+Program} $\ast$ \hyperlink{a01156_a6dcc5a54720597b04d3e70f384011e64}{get\+Program} (const char $\ast$\+\_\+vertex\+Shader\+File, const char $\ast$\+\_\+tess\+Control\+Shader\+File, const char $\ast$\+\_\+tess\+Eval\+Shader\+File, const char $\ast$\+\_\+geometry\+Shader\+File, const char $\ast$\+\_\+fragment\+Shader\+File, Q\+String\+List $\ast$\+\_\+macros=0, bool \+\_\+verbose=true)
\begin{DoxyCompactList}\small\item\em Query a static shader program from cache. \end{DoxyCompactList}\item 
\hyperlink{a01020}{G\+L\+S\+L\+::\+Program} $\ast$ \hyperlink{a01156_af916c8cac769d1ead7422a96117f6ded}{get\+Program} (const char $\ast$\+\_\+vertex\+Shader\+File, const char $\ast$\+\_\+fragment\+Shader\+File, Q\+String\+List $\ast$\+\_\+macros=0, bool \+\_\+verbose=true)
\begin{DoxyCompactList}\small\item\em Query a static shader program from cache. \end{DoxyCompactList}\item 
\hyperlink{a01020}{G\+L\+S\+L\+::\+Program} $\ast$ \hyperlink{a01156_ad8324e15ad222ec4e417d13903872b7e}{get\+Compute\+Program} (const char $\ast$\+\_\+compute\+Shader\+File, Q\+String\+List $\ast$\+\_\+macros=0, bool \+\_\+verbose=true)
\begin{DoxyCompactList}\small\item\em Query a static compute shader program from cache. \end{DoxyCompactList}\item 
\hypertarget{a01156_a4e5cc32f58b8c07a0e637533525f1173}{void \hyperlink{a01156_a4e5cc32f58b8c07a0e637533525f1173}{clear\+Cache} ()}\label{a01156_a4e5cc32f58b8c07a0e637533525f1173}

\begin{DoxyCompactList}\small\item\em Delete all cached shaders. \end{DoxyCompactList}\item 
void \hyperlink{a01156_a64ef92586f1ffc80555369b9108607e0}{set\+Time\+Check} (bool \+\_\+on)
\begin{DoxyCompactList}\small\item\em enable or disable checking of the time step of each file \end{DoxyCompactList}\item 
\hypertarget{a01156_ad476efb8d4296dfe60a7d7bce2b1a0b1}{bool {\bfseries get\+Time\+Check} ()}\label{a01156_ad476efb8d4296dfe60a7d7bce2b1a0b1}

\item 
\hypertarget{a01156_aff4fb57be798f3a5317a79d52355b32c}{void \hyperlink{a01156_aff4fb57be798f3a5317a79d52355b32c}{set\+Debug\+Output\+Dir} (const char $\ast$\+\_\+output\+Dir)}\label{a01156_aff4fb57be798f3a5317a79d52355b32c}

\begin{DoxyCompactList}\small\item\em Enable debug output of generated shaders to specified directory. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static \hyperlink{a01156}{Shader\+Cache} $\ast$ \hyperlink{a01156_a25db1fcdf5081ab345e27732e0d07d56}{get\+Instance} ()
\begin{DoxyCompactList}\small\item\em Return instance of the \hyperlink{a01156}{Shader\+Cache} singleton. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Types}
\begin{DoxyCompactItemize}
\item 
\hypertarget{a01156_a6d2a936b05ff02eea6042f3bfab1e497}{typedef std\+::list$<$ std\+::pair\\*
$<$ \hyperlink{a00383}{Cache\+Entry}, \hyperlink{a01020}{G\+L\+S\+L\+::\+Program} $\ast$ $>$ $>$ {\bfseries Cache\+List}}\label{a01156_a6d2a936b05ff02eea6042f3bfab1e497}

\end{DoxyCompactItemize}
\subsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{a01156_af4e77facba083689e9bb1f3d3af7a122}{bool \hyperlink{a01156_af4e77facba083689e9bb1f3d3af7a122}{compare\+Time\+Stamp} (const \hyperlink{a00383}{Cache\+Entry} $\ast$\+\_\+a, const \hyperlink{a00383}{Cache\+Entry} $\ast$\+\_\+b)}\label{a01156_af4e77facba083689e9bb1f3d3af7a122}

\begin{DoxyCompactList}\small\item\em Returns true, if the shaders have the timestamp. \end{DoxyCompactList}\item 
\hypertarget{a01156_adbca08ba5b298d47e55c5bd946a858a5}{int \hyperlink{a01156_adbca08ba5b298d47e55c5bd946a858a5}{compare\+Shader\+Gen\+Descs} (const \hyperlink{a00383}{Cache\+Entry} $\ast$\+\_\+a, const \hyperlink{a00383}{Cache\+Entry} $\ast$\+\_\+b)}\label{a01156_adbca08ba5b298d47e55c5bd946a858a5}

\begin{DoxyCompactList}\small\item\em Returns true, if the shaders are not equal. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{a01156_a1bd3368572b93b0756a4dcd19b039ae1}{Cache\+List \hyperlink{a01156_a1bd3368572b93b0756a4dcd19b039ae1}{cache\+\_\+}}\label{a01156_a1bd3368572b93b0756a4dcd19b039ae1}

\begin{DoxyCompactList}\small\item\em cache containing dynamic shaders from \hyperlink{a01168}{Shader\+Prog\+Generator} \end{DoxyCompactList}\item 
\hypertarget{a01156_a9008513f4740ecc3a423f872da4345f6}{Cache\+List \hyperlink{a01156_a9008513f4740ecc3a423f872da4345f6}{cache\+Static\+\_\+}}\label{a01156_a9008513f4740ecc3a423f872da4345f6}

\begin{DoxyCompactList}\small\item\em cache containing static shaders loaded from files (separate from dynamic cache to reduce access time) \end{DoxyCompactList}\item 
\hypertarget{a01156_a37db4ba59c4ba61a2b782f3f2a198cdc}{Cache\+List \hyperlink{a01156_a37db4ba59c4ba61a2b782f3f2a198cdc}{cache\+Compute\+Shaders\+\_\+}}\label{a01156_a37db4ba59c4ba61a2b782f3f2a198cdc}

\begin{DoxyCompactList}\small\item\em cache for static compute shaders \end{DoxyCompactList}\item 
\hypertarget{a01156_ac6101e10d95ec057c3bfd6e16897ce87}{bool {\bfseries time\+Check\+\_\+}}\label{a01156_ac6101e10d95ec057c3bfd6e16897ce87}

\item 
\hypertarget{a01156_a95dafcd8cca7b2f5802e1326c2f25e19}{Q\+String \hyperlink{a01156_a95dafcd8cca7b2f5802e1326c2f25e19}{dbg\+Output\+Dir\+\_\+}}\label{a01156_a95dafcd8cca7b2f5802e1326c2f25e19}

\begin{DoxyCompactList}\small\item\em output directory for shaders in dynamic cache \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Cache for shaders. 

This class provides a cache for shaders. You can query a \hyperlink{a01020}{G\+L\+S\+L\+::\+Program} via get\+Program by specifying a \hyperlink{a01158}{Shader\+Gen\+Desc}. If the program has already been compiled, it is returned from the cache. Otherwise it will be compiled and linked, added to the cache and returned. This ensures, that the shader is not compiled and linked every time, it is used.

\begin{DoxyNote}{Note}
This class is a singleton 
\end{DoxyNote}


Definition at line 79 of file Shader\+Cache.\+hh.



\subsection{Member Function Documentation}
\hypertarget{a01156_ad8324e15ad222ec4e417d13903872b7e}{\index{A\+C\+G\+::\+Shader\+Cache@{A\+C\+G\+::\+Shader\+Cache}!get\+Compute\+Program@{get\+Compute\+Program}}
\index{get\+Compute\+Program@{get\+Compute\+Program}!A\+C\+G\+::\+Shader\+Cache@{A\+C\+G\+::\+Shader\+Cache}}
\subsubsection[{get\+Compute\+Program}]{\setlength{\rightskip}{0pt plus 5cm}{\bf G\+L\+S\+L\+::\+Program} $\ast$ A\+C\+G\+::\+Shader\+Cache\+::get\+Compute\+Program (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{\+\_\+compute\+Shader\+File, }
\item[{Q\+String\+List $\ast$}]{\+\_\+macros = {\ttfamily 0}, }
\item[{bool}]{\+\_\+verbose = {\ttfamily true}}
\end{DoxyParamCaption}
)}}\label{a01156_ad8324e15ad222ec4e417d13903872b7e}


Query a static compute shader program from cache. 

Can be used to load a shader and have external changes automatically applied by the timestamp watchdog. However, the program should be queried every time before using the program as it may have been deleted and recompiled in the meantime.


\begin{DoxyParams}{Parameters}
{\em \+\_\+compute\+Shader\+File} & relative (from shader directory) or absolute filename of vertex shader \\
\hline
{\em \+\_\+macros} & optional list of glsl preprocessor macros, which are added directly after the \#version directive (example\+: \char`\"{}\#define U\+S\+E\+\_\+\+M\+E\+T\+H\+O\+D 1\char`\"{}, \char`\"{}\#define M\+E\+T\+H\+O\+D\+\_\+\+P\+A\+R\+A\+M 0\char`\"{}...) \\
\hline
{\em \+\_\+verbose} & log or suppress error output \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The program (Either from cache or newly compiled and linked) 
\end{DoxyReturn}


Definition at line 447 of file Shader\+Cache.\+cc.

\hypertarget{a01156_a25db1fcdf5081ab345e27732e0d07d56}{\index{A\+C\+G\+::\+Shader\+Cache@{A\+C\+G\+::\+Shader\+Cache}!get\+Instance@{get\+Instance}}
\index{get\+Instance@{get\+Instance}!A\+C\+G\+::\+Shader\+Cache@{A\+C\+G\+::\+Shader\+Cache}}
\subsubsection[{get\+Instance}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Shader\+Cache} $\ast$ A\+C\+G\+::\+Shader\+Cache\+::get\+Instance (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{a01156_a25db1fcdf5081ab345e27732e0d07d56}


Return instance of the \hyperlink{a01156}{Shader\+Cache} singleton. 

\begin{DoxyReturn}{Returns}
Instance 
\end{DoxyReturn}


Definition at line 90 of file Shader\+Cache.\+cc.

\hypertarget{a01156_af7e74e2c97dcea1fb3c482ea5d8560d0}{\index{A\+C\+G\+::\+Shader\+Cache@{A\+C\+G\+::\+Shader\+Cache}!get\+Program@{get\+Program}}
\index{get\+Program@{get\+Program}!A\+C\+G\+::\+Shader\+Cache@{A\+C\+G\+::\+Shader\+Cache}}
\subsubsection[{get\+Program}]{\setlength{\rightskip}{0pt plus 5cm}{\bf G\+L\+S\+L\+::\+Program} $\ast$ A\+C\+G\+::\+Shader\+Cache\+::get\+Program (
\begin{DoxyParamCaption}
\item[{const {\bf Shader\+Gen\+Desc} $\ast$}]{\+\_\+desc, }
\item[{const std\+::vector$<$ unsigned int $>$ \&}]{\+\_\+mods}
\end{DoxyParamCaption}
)}}\label{a01156_af7e74e2c97dcea1fb3c482ea5d8560d0}


Query a dynamically generated program from cache. 


\begin{DoxyParams}{Parameters}
{\em \+\_\+desc} & Shader description \\
\hline
{\em \+\_\+mods} & Combination of active shader modifier ids \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The program (Either from cache or newly compiled and linked) 
\end{DoxyReturn}


Definition at line 108 of file Shader\+Cache.\+cc.

\hypertarget{a01156_a7223713ed9b347138be08c3a60ae3328}{\index{A\+C\+G\+::\+Shader\+Cache@{A\+C\+G\+::\+Shader\+Cache}!get\+Program@{get\+Program}}
\index{get\+Program@{get\+Program}!A\+C\+G\+::\+Shader\+Cache@{A\+C\+G\+::\+Shader\+Cache}}
\subsubsection[{get\+Program}]{\setlength{\rightskip}{0pt plus 5cm}{\bf G\+L\+S\+L\+::\+Program}$\ast$ A\+C\+G\+::\+Shader\+Cache\+::get\+Program (
\begin{DoxyParamCaption}
\item[{const {\bf Shader\+Gen\+Desc} $\ast$}]{\+\_\+desc, }
\item[{const std\+::vector$<$ unsigned int $>$ $\ast$}]{\+\_\+mods}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}}\label{a01156_a7223713ed9b347138be08c3a60ae3328}


Query a dynamically generated program from cache. 


\begin{DoxyParams}{Parameters}
{\em \+\_\+desc} & Shader description \\
\hline
{\em \+\_\+mods} & Combination of active shader modifier ids \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The program (Either from cache or newly compiled and linked) 
\end{DoxyReturn}


Definition at line 107 of file Shader\+Cache.\+hh.

\hypertarget{a01156_a01c8eebff8445ebb64a3f071cd9d1eb9}{\index{A\+C\+G\+::\+Shader\+Cache@{A\+C\+G\+::\+Shader\+Cache}!get\+Program@{get\+Program}}
\index{get\+Program@{get\+Program}!A\+C\+G\+::\+Shader\+Cache@{A\+C\+G\+::\+Shader\+Cache}}
\subsubsection[{get\+Program}]{\setlength{\rightskip}{0pt plus 5cm}{\bf G\+L\+S\+L\+::\+Program} $\ast$ A\+C\+G\+::\+Shader\+Cache\+::get\+Program (
\begin{DoxyParamCaption}
\item[{const {\bf Shader\+Gen\+Desc} $\ast$}]{\+\_\+desc}
\end{DoxyParamCaption}
)}}\label{a01156_a01c8eebff8445ebb64a3f071cd9d1eb9}


Query a dynamically generated program from cache. 


\begin{DoxyParams}{Parameters}
{\em \+\_\+desc} & Shader description \\
\hline
{\em \+\_\+mods} & Combination of active shader modifier ids \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The program (Either from cache or newly compiled and linked) 
\end{DoxyReturn}


Definition at line 97 of file Shader\+Cache.\+cc.

\hypertarget{a01156_a6dcc5a54720597b04d3e70f384011e64}{\index{A\+C\+G\+::\+Shader\+Cache@{A\+C\+G\+::\+Shader\+Cache}!get\+Program@{get\+Program}}
\index{get\+Program@{get\+Program}!A\+C\+G\+::\+Shader\+Cache@{A\+C\+G\+::\+Shader\+Cache}}
\subsubsection[{get\+Program}]{\setlength{\rightskip}{0pt plus 5cm}{\bf G\+L\+S\+L\+::\+Program} $\ast$ A\+C\+G\+::\+Shader\+Cache\+::get\+Program (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{\+\_\+vertex\+Shader\+File, }
\item[{const char $\ast$}]{\+\_\+tess\+Control\+Shader\+File, }
\item[{const char $\ast$}]{\+\_\+tess\+Eval\+Shader\+File, }
\item[{const char $\ast$}]{\+\_\+geometry\+Shader\+File, }
\item[{const char $\ast$}]{\+\_\+fragment\+Shader\+File, }
\item[{Q\+String\+List $\ast$}]{\+\_\+macros = {\ttfamily 0}, }
\item[{bool}]{\+\_\+verbose = {\ttfamily true}}
\end{DoxyParamCaption}
)}}\label{a01156_a6dcc5a54720597b04d3e70f384011e64}


Query a static shader program from cache. 

Can be used to load a shader and have external changes automatically applied by the timestamp watchdog. However, the program should be queried every time before using the program as it may have been deleted and recompiled in the meantime.


\begin{DoxyParams}{Parameters}
{\em \+\_\+vertex\+Shader\+File} & relative (from shader directory) or absolute filename of vertex shader \\
\hline
{\em \+\_\+tess\+Control\+Shader\+File} & relative (from shader directory) or absolute filename of tessellation control shader, null accepted \\
\hline
{\em \+\_\+tess\+Eval\+Shader\+File} & relative (from shader directory) or absolute filename of tessellation eval shader, null accepted \\
\hline
{\em \+\_\+geometry\+Shader\+File} & relative (from shader directory) or absolute filename of geometry shader, null accepted \\
\hline
{\em \+\_\+fragment\+Shader\+File} & relative (from shader directory) or absolute filename of fragment shader \\
\hline
{\em \+\_\+macros} & optional list of glsl preprocessor macros, which are added directly after the \#version directive (example\+: \char`\"{}\#define U\+S\+E\+\_\+\+M\+E\+T\+H\+O\+D 1\char`\"{}, \char`\"{}\#define M\+E\+T\+H\+O\+D\+\_\+\+P\+A\+R\+A\+M 0\char`\"{}...) \\
\hline
{\em \+\_\+verbose} & log or suppress error output \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The program (Either from cache or newly compiled and linked) 
\end{DoxyReturn}


Definition at line 288 of file Shader\+Cache.\+cc.

\hypertarget{a01156_af916c8cac769d1ead7422a96117f6ded}{\index{A\+C\+G\+::\+Shader\+Cache@{A\+C\+G\+::\+Shader\+Cache}!get\+Program@{get\+Program}}
\index{get\+Program@{get\+Program}!A\+C\+G\+::\+Shader\+Cache@{A\+C\+G\+::\+Shader\+Cache}}
\subsubsection[{get\+Program}]{\setlength{\rightskip}{0pt plus 5cm}{\bf G\+L\+S\+L\+::\+Program} $\ast$ A\+C\+G\+::\+Shader\+Cache\+::get\+Program (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{\+\_\+vertex\+Shader\+File, }
\item[{const char $\ast$}]{\+\_\+fragment\+Shader\+File, }
\item[{Q\+String\+List $\ast$}]{\+\_\+macros = {\ttfamily 0}, }
\item[{bool}]{\+\_\+verbose = {\ttfamily true}}
\end{DoxyParamCaption}
)}}\label{a01156_af916c8cac769d1ead7422a96117f6ded}


Query a static shader program from cache. 

Can be used to load a shader and have external changes automatically applied by the timestamp watchdog. However, the program should be queried every time before using the program as it may have been deleted and recompiled in the meantime.


\begin{DoxyParams}{Parameters}
{\em \+\_\+vertex\+Shader\+File} & relative (from shader directory) or absolute filename of vertex shader \\
\hline
{\em \+\_\+fragment\+Shader\+File} & relative (from shader directory) or absolute filename of fragment shader \\
\hline
{\em \+\_\+macros} & optional list of glsl preprocessor macros, which are added directly after the \#version directive (example\+: \char`\"{}\#define U\+S\+E\+\_\+\+M\+E\+T\+H\+O\+D 1\char`\"{}, \char`\"{}\#define M\+E\+T\+H\+O\+D\+\_\+\+P\+A\+R\+A\+M 0\char`\"{}...) \\
\hline
{\em \+\_\+verbose} & log or suppress error output \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The program (Either from cache or newly compiled and linked) 
\end{DoxyReturn}


Definition at line 442 of file Shader\+Cache.\+cc.

\hypertarget{a01156_a64ef92586f1ffc80555369b9108607e0}{\index{A\+C\+G\+::\+Shader\+Cache@{A\+C\+G\+::\+Shader\+Cache}!set\+Time\+Check@{set\+Time\+Check}}
\index{set\+Time\+Check@{set\+Time\+Check}!A\+C\+G\+::\+Shader\+Cache@{A\+C\+G\+::\+Shader\+Cache}}
\subsubsection[{set\+Time\+Check}]{\setlength{\rightskip}{0pt plus 5cm}void A\+C\+G\+::\+Shader\+Cache\+::set\+Time\+Check (
\begin{DoxyParamCaption}
\item[{bool}]{\+\_\+on}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}}\label{a01156_a64ef92586f1ffc80555369b9108607e0}


enable or disable checking of the time step of each file 



Definition at line 177 of file Shader\+Cache.\+hh.



The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
A\+C\+G/\+G\+L/Shader\+Cache.\+hh\item 
A\+C\+G/\+G\+L/Shader\+Cache.\+cc\end{DoxyCompactItemize}
