deargui-vpl/ref/virtools/Samples/Behaviors/Shader/Sources/ResumeMultiSampling.cpp

68 lines
1.7 KiB
C++

/////////////////////////////////////////////////////
/////////////////////////////////////////////////////
//
// ResumeMultiSampling
//
/////////////////////////////////////////////////////
/////////////////////////////////////////////////////
#include "stdafx.h"
#include "CKRasterizer.h"
CKERROR CreateResumeMultisamplingProto(CKBehaviorPrototype **);
int ResumeMultisampling(const CKBehaviorContext& behcontext);
CKObjectDeclaration *FillBehaviorResumeMultisampling()
{
CKObjectDeclaration *od = CreateCKObjectDeclaration("Resume Multisampling");
od->SetDescription("Force a multisampled framebuffer Resume until next SwapBuffer. Necessary for a StretchRect operation");
od->SetCategory("Shaders/General");
od->SetType(CKDLL_BEHAVIORPROTOTYPE);
od->SetGuid(CKGUID(0x2e46063c, 0x1dd90ff6));
od->SetAuthorGuid(CKGUID());
od->SetAuthorName("Virtools");
od->SetVersion(0x00010000);
od->SetCreationFunction(CreateResumeMultisamplingProto);
return od;
}
CKERROR CreateResumeMultisamplingProto(CKBehaviorPrototype **pproto)
{
CKBehaviorPrototype *proto = CreateCKBehaviorPrototype("Resume Multisampling");
if(!proto) return CKERR_OUTOFMEMORY;
proto->DeclareInput("In");
proto->DeclareOutput("Out");
proto->SetFlags(CK_BEHAVIORPROTOTYPE_NORMAL);
proto->SetFunction(ResumeMultisampling);
proto->SetBehaviorFlags(CKBEHAVIOR_TARGETABLE);
*pproto = proto;
return CK_OK;
}
int ResumeMultisampling(const CKBehaviorContext& behcontext)
{
CKBehavior* beh = behcontext.Behavior;
beh->ActivateInput(0,FALSE);
//
CKRasterizerContext* rsctx = behcontext.CurrentRenderContext->GetRasterizerContext();
if (!rsctx)
{
beh->ActivateOutput(0);
return CKBR_OK;
}
//
rsctx->ResumeMultisampling();
//
beh->ActivateOutput(0);
return CKBR_OK;
}