Last active
August 29, 2015 13:59
-
-
Save Neill3d/10544781 to your computer and use it in GitHub Desktop.
nvFX - how to directly override shader in pass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nvFX::IShader *shdPtr = fx_EffectMaterial->findShader( "SomeShader2" ); | |
if (shdPtr) | |
{ | |
// lets override current shader in the first pass of specified technique | |
fx_pass = fx_TechMaterial->getPass(0); | |
fx_pass->invalidate(); | |
// Nnnn 1 - directly override shaders | |
nvFX::IPassEx *fx_passEx = fx_pass->getExInterface(); | |
nvFX::IPassState *fx_state = fx_passEx->findState("CustomState"); | |
if (fx_state) | |
{ | |
nvFX::IPassStateEx *fx_stateEx = fx_state->getExInterface(); | |
fx_stateEx->setShaders( nvFX::IPassState::TFragmentShader, &shdPtr, 1 ); | |
} | |
// validate | |
fx_pass->validate(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace States < programTarget="CustomState"; > | |
{ | |
GLSLShader global SomeShader1 | |
{ | |
... | |
} | |
GLSLShader global SomeShader2 | |
{ | |
... | |
} | |
} | |
Technique t0 | |
{ | |
Pass p0 | |
{ | |
RasterizationState = rasterStateFill; | |
VertexProgram = All::VS; | |
FragmentProgram = All::PS; | |
FragmentProgram<"CustomState"> = SomeShader1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment