Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ShaderGenPrinterGLSL::printPixelShaderOutputStruct( Stream& stream, const MaterialFeatureData &featureData )
- {
- // Determine the number of output targets we need
- U32 numMRTs = 0;
- for (U32 i = 0; i < FEATUREMGR->getFeatureCount(); i++)
- {
- const FeatureInfo &info = FEATUREMGR->getAt(i);
- if (featureData.features.hasFeature(*info.type))
- numMRTs |= info.feature->getOutputTargets(featureData);
- }
- WRITESTR("layout(location = 0) out vec4 OUT_FragColor0;\r\n");
- for (U32 i = 1; i < 4; i++)
- {
- if (numMRTs & 1 << i) {
- WRITESTR(avar("layout(location = %d) out vec4 OUT_FragColor%d;\r\n", i, i));
- extraRTs[i - 1] = true;
- }
- }
- WRITESTR("\r\n");
- WRITESTR("\r\n");
- }
- void ShaderGenPrinterGLSL::printPixelShaderCloser( Stream& stream )
- {
- WRITESTR(" OUT_FragColor0 = col;\r\n");
- for (U32 i = 1; i < 4; i++)
- {
- if (extraRTs[i - 1])
- WRITESTR(avar(" OUT_FragColor%d = col%d;\r\n", i, i));
- }
- WRITESTR("}\r\n");
- }
- //In the header file
- class ShaderGenPrinterGLSL : public ShaderGenPrinter
- {
- bool extraRTs[3];
- public:
- ShaderGenPrinterGLSL() { for (int i = 0; i < 3; i++) extraRTs[i] = false; }
- // ShaderGenPrinter
- virtual void printShaderHeader(Stream& stream);
- virtual void printMainComment(Stream& stream);
- virtual void printVertexShaderCloser(Stream& stream);
- virtual void printPixelShaderOutputStruct(Stream& stream, const MaterialFeatureData &featureData);
- virtual void printPixelShaderCloser(Stream& stream);
- virtual void printLine(Stream& stream, const String& line);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement