本文整理汇总了C++中ContextPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ContextPtr类的具体用法?C++ ContextPtr怎么用?C++ ContextPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ContextPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: detachEGLImage
void detachEGLImage(unsigned int imageId)
{
ThreadInfo* thread = getThreadInfo();
ContextPtr ctx = thread->eglContext;
if (ctx.Ptr()) {
ctx->detachImage(imageId);
}
}
示例2: Context
ConstPathMatcherDataPtr ScenePlug::set( const IECore::InternedString &setName ) const
{
ContextPtr tmpContext = new Context( *Context::current(), Context::Borrowed );
tmpContext->set( setNameContextName, setName );
removeNonGlobalContextVariables( tmpContext.get() );
Context::Scope scopedContext( tmpContext.get() );
return setPlug()->getValue();
}
示例3: Context
IECore::MurmurHash ScenePlug::objectHash( const ScenePath &scenePath ) const
{
ContextPtr tmpContext = new Context( *Context::current(), Context::Borrowed );
tmpContext->set( scenePathContextName, scenePath );
Context::Scope scopedContext( tmpContext.get() );
return objectPlug()->hash();
}
示例4: Context
IECore::MurmurHash ImagePlug::channelDataHash( const std::string &channelName, const Imath::V2i &tile ) const
{
ContextPtr tmpContext = new Context( *Context::current(), Context::Borrowed );
tmpContext->set( ImagePlug::channelNameContextName, channelName );
tmpContext->set( ImagePlug::tileOriginContextName, tile );
Context::Scope scopedContext( tmpContext.get() );
return channelDataPlug()->hash();
}
示例5: eglGetCurrentContext
// Get the current rendering context.
EGLContext eglGetCurrentContext() {
EGL_API_ENTRY("");
ContextPtr context = GetContext();
if (context == NULL) {
return EGL_NO_CONTEXT;
}
return context->GetKey();
}
示例6: generateJSServerImp
void CodeGenerator::generateJSServerImp(const ContextPtr &cPtr)
{
string sFileName = TC_File::excludeFileExt(_sToPath + TC_File::extractFileName(cPtr->getFileName())) + "Imp.js";
if (TC_File::isFileExist(sFileName))
{
return ;
}
ostringstream str;
str << printHeaderRemark("Imp");
str << "\"use strict\";" << endl << endl;
vector<NamespacePtr> namespaces = cPtr->getNamespaces();
set<string> setNamespace;
for(size_t i = 0; i < namespaces.size(); i++)
{
if (setNamespace.count(namespaces[i]->getId()) != 0)
{
continue;
}
setNamespace.insert(namespaces[i]->getId());
str << "var " << namespaces[i]->getId() << " = require(\"./"
<< TC_File::excludeFileExt(TC_File::extractFileName(cPtr->getFileName())) << ".js\")."
<< namespaces[i]->getId() << ";" << endl;
str << "module.exports." << namespaces[i]->getId() << " = " << namespaces[i]->getId() << ";" << endl;
}
str << endl;
set<string> setInterface;
for(size_t i = 0; i < namespaces.size(); i++)
{
vector<InterfacePtr> & is = namespaces[i]->getAllInterfacePtr();
for (size_t ii = 0; ii < is.size(); ii++)
{
if (setInterface.count(namespaces[i]->getId() + "::" + is[ii]->getId()) != 0)
{
continue;
}
setInterface.insert(namespaces[i]->getId() + "::" + is[ii]->getId());
str << namespaces[i]->getId() << "." << is[ii]->getId() << "Imp.prototype.initialize = function () {" << endl;
INC_TAB;
str << TAB << "//TODO::" << endl;
DEL_TAB;
str << "};" << endl << endl;
}
}
for(size_t i = 0; i < namespaces.size(); i++)
{
str << generateJSServerImp(cPtr, namespaces[i]);
}
TC_File::makeDirRecursive(_sToPath, 0755);
makeUTF8File(sFileName, str.str());
}
示例7: hashMaskedOutput
void ImageReader::hashMaskedOutput( const Gaffer::ValuePlug *output, const Gaffer::Context *context, IECore::MurmurHash &h, bool alwaysClampToFrame ) const
{
ContextPtr maskedContext = NULL;
if( !computeFrameMask( context, maskedContext ) || alwaysClampToFrame )
{
Context::Scope scope( maskedContext.get() );
h = intermediateImagePlug()->getChild<ValuePlug>( output->getName() )->hash();
}
}
示例8: CreateCudaDeviceStream
ContextPtr CreateCudaDeviceStream(int argc, char** argv, bool printInfo) {
int ordinal = 0;
if(argc >= 2 && !sscanf(argv[1], "%d", &ordinal)) {
fprintf(stderr, "INVALID COMMAND LINE ARGUMENT - NOT A CUDA ORDINAL\n");
exit(0);
}
ContextPtr context = CreateCudaDeviceStream(ordinal);
if(printInfo) printf("%s", context->DeviceString().c_str());
return context;
}
示例9: Context
void ColorProcessor::hashColorData( const Gaffer::Context *context, IECore::MurmurHash &h ) const
{
ContextPtr tmpContext = new Context( *context, Context::Borrowed );
Context::Scope scopedContext( tmpContext.get() );
tmpContext->set( ImagePlug::channelNameContextName, string( "R" ) );
inPlug()->channelDataPlug()->hash( h );
tmpContext->set( ImagePlug::channelNameContextName, string( "G" ) );
inPlug()->channelDataPlug()->hash( h );
tmpContext->set( ImagePlug::channelNameContextName, string( "B" ) );
inPlug()->channelDataPlug()->hash( h );
}
示例10: Context
void ExecutableNode::executeSequence( const std::vector<float> &frames ) const
{
ContextPtr context = new Context( *Context::current(), Context::Borrowed );
Context::Scope scopedContext( context.get() );
for ( std::vector<float>::const_iterator it = frames.begin(); it != frames.end(); ++it )
{
context->setFrame( *it );
execute();
}
}
示例11: Calc
bool AnyQuantifier::Calc( ContextPtr context )
{
for (ValueSet::Iterator it = mValues->Begin(); it != mValues->End(); ++it)
{
context->PushParam(mIdentifier, *it);
bool result = mTerm->Calc(context);
context->PopParam(mIdentifier);
if (!result)
return false;
}
return true;
}
示例12: eglCreateContext
EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay display, EGLConfig config,
EGLContext share_context,
const EGLint *attrib_list) {
VALIDATE_DISPLAY_RETURN(display,EGL_NO_CONTEXT);
VALIDATE_CONFIG_RETURN(config,EGL_NO_CONTEXT);
GLESVersion version = GLES_1_1;
if(!EglValidate::noAttribs(attrib_list)) {
int i = 0;
while(attrib_list[i] != EGL_NONE) {
switch(attrib_list[i]) {
case EGL_CONTEXT_CLIENT_VERSION:
if(attrib_list[i+1] == 2) {
version = GLES_2_0;
} else {
version = GLES_1_1;
}
break;
default:
RETURN_ERROR(EGL_NO_CONTEXT,EGL_BAD_ATTRIBUTE);
}
i+=2;
}
}
const GLESiface* iface = g_eglInfo->getIface(version);
GLEScontext* glesCtx = NULL;
if(iface) {
glesCtx = iface->createGLESContext();
} else { // there is no interface for this gles version
RETURN_ERROR(EGL_NO_CONTEXT,EGL_BAD_ATTRIBUTE);
}
ContextPtr sharedCtxPtr;
if(share_context != EGL_NO_CONTEXT) {
sharedCtxPtr = dpy->getContext(share_context);
if(!sharedCtxPtr.Ptr()) {
RETURN_ERROR(EGL_NO_CONTEXT,EGL_BAD_CONTEXT);
}
}
EglOS::Context* globalSharedContext = dpy->getGlobalSharedContext();
EglOS::Context* nativeContext = dpy->nativeType()->createContext(
cfg->nativeFormat(), globalSharedContext);
if(nativeContext) {
ContextPtr ctx(new EglContext(dpy, nativeContext,sharedCtxPtr,cfg,glesCtx,version,dpy->getManager(version)));
return dpy->addContext(ctx);
} else {
iface->deleteGLESContext(glesCtx);
}
return EGL_NO_CONTEXT;
}
示例13: computeMaskedOutput
void ImageReader::computeMaskedOutput( Gaffer::ValuePlug *output, const Gaffer::Context *context, bool alwaysClampToFrame ) const
{
ContextPtr maskedContext = NULL;
bool blackOutside = computeFrameMask( context, maskedContext );
if( blackOutside && !alwaysClampToFrame )
{
output->setToDefault();
return;
}
Context::Scope scope( maskedContext.get() );
output->setFrom( intermediateImagePlug()->getChild<ValuePlug>( output->getName() ) );
}
示例14: alphaChannelPlug
void Unpremultiply::hashChannelData( const GafferImage::ImagePlug *output, const Gaffer::Context *context, IECore::MurmurHash &h ) const
{
std::string alphaChannel = alphaChannelPlug()->getValue();
ChannelDataProcessor::hashChannelData( output, context, h );
inPlug()->channelDataPlug()->hash( h );
ContextPtr tmpContext = new Context( *context, Context::Borrowed );
tmpContext->set( ImagePlug::channelNameContextName, alphaChannel );
Context::Scope scopedContext( tmpContext.get() );
inPlug()->channelDataPlug()->hash( h );
}
示例15: getThreadInfo
/************************** KHR IMAGE *************************************************************/
EglImage *attachEGLImage(unsigned int imageId)
{
ThreadInfo* thread = getThreadInfo();
EglDisplay* dpy = static_cast<EglDisplay*>(thread->eglDisplay);
ContextPtr ctx = thread->eglContext;
if (ctx.Ptr()) {
ImagePtr img = dpy->getImage(reinterpret_cast<EGLImageKHR>(imageId));
if(img.Ptr()) {
ctx->attachImage(imageId,img);
return img.Ptr();
}
}
return NULL;
}