当前位置: 首页>>代码示例>>C++>>正文


C++ checkf函数代码示例

本文整理汇总了C++中checkf函数的典型用法代码示例。如果您正苦于以下问题:C++ checkf函数的具体用法?C++ checkf怎么用?C++ checkf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了checkf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CrashTest

/**
 * Crash test
 */
int32 CrashTest(const TCHAR* CommandLine)
{
	FPlatformMisc::SetCrashHandler(NULL);
	FPlatformMisc::SetGracefulTerminationHandler();

	GEngineLoop.PreInit(CommandLine);
	UE_LOG(LogTestPAL, Display, TEXT("Running crash test (this should not exit)."));

	// try ensures first (each ensure fires just once)
	{
		for (int IdxEnsure = 0; IdxEnsure < 5; ++IdxEnsure)
		{
			FScopeLogTime EnsureLogTime(*FString::Printf(TEXT("Handled FIRST ensure() #%d times"), IdxEnsure), nullptr, FScopeLogTime::ScopeLog_Seconds);
			ensure(false);
		}
	}
	{
		for (int IdxEnsure = 0; IdxEnsure < 5; ++IdxEnsure)
		{
			FScopeLogTime EnsureLogTime(*FString::Printf(TEXT("Handled SECOND ensure() #%d times"), IdxEnsure), nullptr, FScopeLogTime::ScopeLog_Seconds);
			ensure(false);
		}
	}

	if (FParse::Param(CommandLine, TEXT("logfatal")))
	{
		UE_LOG(LogTestPAL, Fatal, TEXT("  LogFatal!"));
	}
	else if (FParse::Param(CommandLine, TEXT("check")))
	{
		checkf(false, TEXT("  checkf!"));
	}
	else
	{
		*(int *)0x10 = 0x11;
	}

	FEngineLoop::AppPreExit();
	FEngineLoop::AppExit();
	return 0;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:44,代码来源:Main.cpp

示例2: check

/**
 * Links a vertex shader and pixel shader into a program for use in rendering     
 * 
 * @param VertexShader	The vertex shader to link
 * @param PixelShader	The pixel shader to link
 */
void FSlateOpenGLShaderProgram::LinkShaders( const FSlateOpenGLVS& VertexShader, const FSlateOpenGLPS& PixelShader )
{
	// Should not link twice
	check( ProgramID == 0 );

	GLuint VertexShaderID = VertexShader.GetShaderID();
	GLuint PixelShaderID = PixelShader.GetShaderID();

	// Make sure the shaders have been created
	check( VertexShaderID && PixelShaderID );

	// Create a new program id and attach the shaders
	ProgramID = glCreateProgram();
	glAttachShader( ProgramID, VertexShaderID );
	glAttachShader( ProgramID, PixelShaderID );
	CHECK_GL_ERRORS;

	// Set up attribute locations for per vertex data
	glBindAttribLocation(ProgramID, 0, "InTexCoords");
	glBindAttribLocation(ProgramID, 1, "InPosition");
	glBindAttribLocation(ProgramID, 2, "InClipOrigin");
	glBindAttribLocation(ProgramID, 3, "InClipExtents");
	glBindAttribLocation(ProgramID, 4, "InColor");

	// Link the shaders
	glLinkProgram( ProgramID );
	CHECK_GL_ERRORS;

	// Check to see if linking succeeded
	GLint LinkStatus;
	glGetProgramiv( ProgramID, GL_LINK_STATUS, &LinkStatus );
	if( LinkStatus == GL_FALSE )
	{
		// Linking failed, display why.
		FString Log = GetGLSLProgramLog( ProgramID );

		checkf(false, TEXT("Failed to link GLSL program: %s"), *Log );
	}

	CHECK_GL_ERRORS;
}
开发者ID:didixp,项目名称:Ark-Dev-Kit,代码行数:47,代码来源:SlateOpenGLShaders.cpp

示例3: ProcessInputFromArchive

    void ProcessInputFromArchive(FArchive* InputFilePtr, TArray<FJobResult>& OutJobResults)
    {
        int32 NumBatches = 0;

        FArchive& InputFile = *InputFilePtr;
        int32 InputVersion;
        InputFile << InputVersion;
        checkf(ShaderCompileWorkerInputVersion == InputVersion, TEXT("Exiting due to ShaderCompilerWorker expecting input version %d, got %d instead! Did you forget to build ShaderCompilerWorker?"), ShaderCompileWorkerInputVersion, InputVersion);

        TMap<FString, uint16> ReceivedFormatVersionMap;
        InputFile << ReceivedFormatVersionMap;

        VerifyFormatVersions(ReceivedFormatVersionMap);

        InputFile << NumBatches;

        // Flush cache, to make sure we load the latest version of the input file.
        // (Otherwise quick changes to a shader file can result in the wrong output.)
        FlushShaderFileCache();

        for (int32 BatchIndex = 0; BatchIndex < NumBatches; BatchIndex++)
        {
            // Deserialize the job's inputs.
            FShaderCompilerInput CompilerInput;
            InputFile << CompilerInput;

            if (IsValidRef(CompilerInput.SharedEnvironment))
            {
                // Merge the shared environment into the per-shader environment before calling into the compile function
                CompilerInput.Environment.Merge(*CompilerInput.SharedEnvironment);
            }

            // Process the job.
            FShaderCompilerOutput CompilerOutput;
            ProcessCompilationJob(CompilerInput,CompilerOutput,WorkingDirectory);

            // Serialize the job's output.
            FJobResult& JobResult = *new(OutJobResults) FJobResult;
            JobResult.CompilerOutput = CompilerOutput;
        }
    }
开发者ID:colwalder,项目名称:unrealengine,代码行数:41,代码来源:ShaderCompileWorker.cpp

示例4: SerializeGlobalShaders

/** Serializes the global shader map to an archive. */
void SerializeGlobalShaders(FArchive& Ar, TShaderMap<FGlobalShaderType>* GlobalShaderMap)
{
	check(IsInGameThread());

	// Serialize the global shader map binary file tag.
	static const uint32 ReferenceTag = 0x47534D42;
	if (Ar.IsLoading())
	{
		// Initialize Tag to 0 as it won't be written to if the serialize fails (ie the global shader cache file is empty)
		uint32 Tag = 0;
		Ar << Tag;
		checkf(Tag == ReferenceTag, TEXT("Global shader map binary file is missing GSMB tag."));
	}
	else
	{
		uint32 Tag = ReferenceTag;
		Ar << Tag;
	}

	// Serialize the global shaders.
	GlobalShaderMap->SerializeInline(Ar, true, false);
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:23,代码来源:GlobalShader.cpp

示例5: switch

void FLinuxWindow::ReshapeWindow( int32 NewX, int32 NewY, int32 NewWidth, int32 NewHeight )
{
	switch( WindowMode )
	{
		// Fullscreen and WindowedFullscreen both use SDL_WINDOW_FULLSCREEN_DESKTOP now
		//  and code elsewhere handles the backbufer blit properly. This solves several
		//  problems that actual mode switches cause, and a GPU scales better than your
		//  cheap LCD display anyhow.
		case EWindowMode::Fullscreen:
		case EWindowMode::WindowedFullscreen:
		{
			SDL_SetWindowFullscreen( HWnd, 0 );
			SDL_SetWindowSize( HWnd, NewWidth, NewHeight );
			SDL_SetWindowFullscreen( HWnd, SDL_WINDOW_FULLSCREEN_DESKTOP );
			bWasFullscreen = true;
		}	break;

		case EWindowMode::Windowed:
		{
			if (Definition->HasOSWindowBorder)
			{
				// we are passed coordinates of a client area, so account for decorations
				checkf(bValidNativePropertiesCache, TEXT("Attempted to use border sizes too early, native properties aren't yet cached. Review the flow"));
				NewX -= LeftBorderWidth;
				NewY -= TopBorderHeight;
			}
			SDL_SetWindowPosition( HWnd, NewX, NewY );
			SDL_SetWindowSize( HWnd, NewWidth, NewHeight );

			bWasFullscreen = false;

		}	break;
	}

	RegionWidth   = NewWidth;
	RegionHeight  = NewHeight;
	VirtualWidth  = NewWidth;
	VirtualHeight = NewHeight;
}
开发者ID:magetron,项目名称:UnrealEngine4-mod,代码行数:39,代码来源:LinuxWindow.cpp

示例6: checkf

UPackage* FHierarchicalLODUtilities::CreateOrRetrieveLevelHLODPackage(ULevel* InLevel)
{
	checkf(InLevel != nullptr, TEXT("Invalid Level supplied"));

	UPackage* HLODPackage = nullptr;
	UPackage* LevelOuterMost = InLevel->GetOutermost();

	const FString PathName = FPackageName::GetLongPackagePath(LevelOuterMost->GetPathName());
	const FString BaseName = FPackageName::GetShortName(LevelOuterMost->GetPathName());
	const FString HLODLevelPackageName = FString::Printf(TEXT("%s/HLOD/%s_HLOD"), *PathName, *BaseName);

	HLODPackage = CreatePackage(NULL, *HLODLevelPackageName);
	HLODPackage->FullyLoad();
	HLODPackage->Modify();
	
	// Target level filename
	const FString HLODLevelFileName = FPackageName::LongPackageNameToFilename(HLODLevelPackageName);
	// This is a hack to avoid save file dialog when we will be saving HLOD map package
	HLODPackage->FileName = FName(*HLODLevelFileName);

	return HLODPackage;	
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:22,代码来源:HierarchicalLODUtilities.cpp

示例7: if

void FMovieSceneColorTrackInstance::SaveState(const TArray<TWeakObjectPtr<UObject>>& RuntimeObjects, IMovieScenePlayer& Player, FMovieSceneSequenceInstance& SequenceInstance)
{
	for (auto ObjectPtr : RuntimeObjects)
	{
		UObject* Object = ObjectPtr.Get();
		
		if( ColorType == EColorType::Slate )
		{
			if (InitSlateColorMap.Find(Object) == nullptr)
			{			
				FSlateColor ColorValue = PropertyBindings->GetCurrentValue<FSlateColor>(Object);
				InitSlateColorMap.Add(Object, ColorValue);
			}
		}
		else if( ColorType == EColorType::Linear )
		{
			if (InitLinearColorMap.Find(Object) == nullptr)
			{			
				UProperty* Property = PropertyBindings->GetProperty(Object);
				FLinearColor ColorValue = PropertyBindings->GetCurrentValue<FLinearColor>(Object);
				InitLinearColorMap.Add(Object, ColorValue);
			}
		}
		else if( ColorType == EColorType::Color )
		{
			if (InitLinearColorMap.Find(Object) == nullptr)
			{			
				UProperty* Property = PropertyBindings->GetProperty(Object);
				FColor ColorValue = PropertyBindings->GetCurrentValue<FColor>(Object);
				FLinearColor LinearColorValue = ColorValue;
				InitLinearColorMap.Add(Object, ColorValue);
			}
		}
		else 
		{
			checkf(0, TEXT("Invalid Color Type"));
		}
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:39,代码来源:MovieSceneColorTrackInstance.cpp

示例8: checkf

/** 
 * Retrieves AnimNotifies given a StartTime and a DeltaTime.
 * Time will be advanced and support looping if bAllowLooping is true.
 * Supports playing backwards (DeltaTime<0).
 * Returns notifies between StartTime (exclusive) and StartTime+DeltaTime (inclusive)
 */
void UAnimSequenceBase::GetAnimNotifies(const float& StartTime, const float& DeltaTime, const bool bAllowLooping, TArray<const FAnimNotifyEvent *> & OutActiveNotifies) const
{
	// Early out if we have no notifies
	if( (Notifies.Num() == 0) || (DeltaTime == 0.f) )
	{
		return;
	}

	bool const bPlayingBackwards = (DeltaTime < 0.f);
	float PreviousPosition = StartTime;
	float CurrentPosition = StartTime;
	float DesiredDeltaMove = DeltaTime;

	do 
	{
		// Disable looping here. Advance to desired position, or beginning / end of animation 
		const ETypeAdvanceAnim AdvanceType = FAnimationRuntime::AdvanceTime(false, DesiredDeltaMove, CurrentPosition, SequenceLength);

		// Verify position assumptions
		checkf(bPlayingBackwards ? (CurrentPosition <= PreviousPosition) : (CurrentPosition >= PreviousPosition), TEXT("in Animsequence %s"), *GetName());
		
		GetAnimNotifiesFromDeltaPositions(PreviousPosition, CurrentPosition, OutActiveNotifies);
	
		// If we've hit the end of the animation, and we're allowed to loop, keep going.
		if( (AdvanceType == ETAA_Finished) &&  bAllowLooping )
		{
			const float ActualDeltaMove = (CurrentPosition - PreviousPosition);
			DesiredDeltaMove -= ActualDeltaMove; 

			PreviousPosition = bPlayingBackwards ? SequenceLength : 0.f;
			CurrentPosition = PreviousPosition;
		}
		else
		{
			break;
		}
	} 
	while( true );
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:45,代码来源:AnimSequenceBase.cpp

示例9: checkf

void FPoseLinkBase::Initialize(const FAnimationInitializeContext& Context)
{
#if DO_CHECK
	checkf(!bProcessed, TEXT("Initialize already in progress, circular link for AnimInstance [%s] Blueprint [%s]"), \
		*Context.AnimInstanceProxy->GetAnimInstanceName(), *GetFullNameSafe(IAnimClassInterface::GetActualAnimClass(Context.AnimInstanceProxy->GetAnimClassInterface())));
	TGuardValue<bool> CircularGuard(bProcessed, true);
#endif

	AttemptRelink(Context);

#if ENABLE_ANIMGRAPH_TRAVERSAL_DEBUG
	InitializationCounter.SynchronizeWith(Context.AnimInstanceProxy->GetInitializationCounter());

	// Initialization will require update to be called before an evaluate.
	UpdateCounter.Reset();
#endif

	// Do standard initialization
	if (LinkedNode != NULL)
	{
		LinkedNode->Initialize(Context);
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:23,代码来源:AnimNodeBase.cpp

示例10: setup_sht

void setup_sht() {
    int nmaps = sht_nmaps;
    FILE *fd;
    printf("  Initializing (incl. FFTW plans)\n");
    /* Import FFTW plan if it exists */
    fd = fopen("fftw.wisdom", "r");
    if (fd != NULL) {
        fftw_import_wisdom_from_file(fd);
        fclose(fd);
    }

    sht_plan = wavemoth_plan_to_healpix(Nside, lmax, lmax, nmaps, N_threads, sht_input,
                                        sht_output, WAVEMOTH_MMAJOR, sht_flags,
                                        sht_resourcefile);
    checkf(sht_plan, "plan not created, nthreads=%d", N_threads);

    /* Export FFTW wisdom generated during planning */
    fd = fopen("fftw.wisdom", "w");
    if (fd != NULL) {
        fftw_export_wisdom_to_file(fd);
        fclose(fd);
    }
}
开发者ID:wgsproul,项目名称:wavemoth,代码行数:23,代码来源:shbench.c

示例11: checkf

FText FText::Format(const FText& Pattern, const FFormatOrderedArguments& Arguments)
{
	checkf(FInternationalization::Get().IsInitialized() == true, TEXT("FInternationalization is not initialized. An FText formatting method was likely used in static object initialization - this is not supported."));
	//SCOPE_CYCLE_COUNTER( STAT_TextFormat );

	struct FArgumentGetter
	{
		const FFormatOrderedArguments& Arguments;
		FArgumentGetter(const FFormatOrderedArguments& InArguments) : Arguments(InArguments) {}
		const FFormatArgumentValue* GetArgumentValue( const FString ArgumentName )
		{
			int32 ArgumentIndex = INDEX_NONE;
			if( ArgumentName.IsNumeric() )
			{
				ArgumentIndex = FCString::Atoi(*ArgumentName);
			}
			return ArgumentIndex != INDEX_NONE && ArgumentIndex < Arguments.Num() ? &(Arguments[ArgumentIndex]) : NULL;
		}
	};

	FArgumentGetter ArgumentGetter(Arguments);
	return FLegacyTextHelper::Format(Pattern, FGetArgumentValue::CreateRaw(&ArgumentGetter, &FArgumentGetter::GetArgumentValue));
}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:23,代码来源:LegacyText.cpp

示例12: switch

int FVorbisAudioInfo::Seek( uint32 offset, int whence )
{
	switch( whence )
	{
	case SEEK_SET:
		BufferOffset = offset;
		break;

	case SEEK_CUR:
		BufferOffset += offset;
		break;

	case SEEK_END:
		BufferOffset = SrcBufferDataSize - offset;
		break;

	default:
		checkf(false, TEXT("Uknown seek type"));
		break;
	}

	return( BufferOffset );
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:23,代码来源:VorbisAudioInfo.cpp

示例13: Name

FShaderType::FShaderType(
	const TCHAR* InName,
	const TCHAR* InSourceFilename,
	const TCHAR* InFunctionName,
	uint32 InFrequency,
	ConstructSerializedType InConstructSerializedRef,
	GetStreamOutElementsType InGetStreamOutElementsRef
	):
	Name(InName),
	TypeName(InName),
	SourceFilename(InSourceFilename),
	FunctionName(InFunctionName),
	Frequency(InFrequency),
	ConstructSerializedRef(InConstructSerializedRef),
	GetStreamOutElementsRef(InGetStreamOutElementsRef),
	GlobalListLink(this)
{
	for (int32 Platform = 0; Platform < SP_NumPlatforms; Platform++)
	{
		bCachedUniformBufferStructDeclarations[Platform] = false;
	}

	// This will trigger if an IMPLEMENT_SHADER_TYPE was in a module not loaded before InitializeShaderTypes
	// Shader types need to be implemented in modules that are loaded before that
	checkf(!bInitializedSerializationHistory, TEXT("Shader type was loaded after engine init, use ELoadingPhase::PostConfigInit on your module to cause it to load earlier."));

	//make sure the name is shorter than the maximum serializable length
	check(FCString::Strlen(InName) < NAME_SIZE);

	// register this shader type
	GlobalListLink.LinkHead(GetTypeList());
	GetNameToTypeMap().Add(TypeName, this);

	// Assign the shader type the next unassigned hash index.
	static uint32 NextHashIndex = 0;
	HashIndex = NextHashIndex++;
}
开发者ID:WasPedro,项目名称:UnrealEngine4.11-HairWorks,代码行数:37,代码来源:Shader.cpp

示例14: check

void FPhysXVehicleManager::RemoveVehicle( TWeakObjectPtr<UWheeledVehicleMovementComponent> Vehicle )
{
	check(Vehicle != NULL);
	check(Vehicle->PVehicle);

	PxVehicleWheels* PVehicle = Vehicle->PVehicle;

	int32 RemovedIndex = Vehicles.Find(Vehicle);

	Vehicles.Remove( Vehicle );
	PVehicles.Remove( PVehicle );

	delete[] PVehiclesWheelsStates[RemovedIndex].wheelQueryResults;
	PVehiclesWheelsStates.RemoveAt(RemovedIndex); // LOC_MOD double check this
	//PVehiclesWheelsStates.Remove(PVehiclesWheelsStates[RemovedIndex]);

	if ( PVehicle == TelemetryVehicle )
	{
		TelemetryVehicle = NULL;
	}

	switch( PVehicle->getVehicleType() )
	{
	case PxVehicleTypes::eDRIVE4W:
		((PxVehicleDrive4W*)PVehicle)->free();
		break;
	case PxVehicleTypes::eDRIVETANK:
		((PxVehicleDriveTank*)PVehicle)->free();
		break;
	case PxVehicleTypes::eNODRIVE:
		((PxVehicleNoDrive*)PVehicle)->free();
		break;
	default:
		checkf( 0, TEXT("Unsupported vehicle type"));
		break;
	}
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:37,代码来源:PhysXVehicleManager.cpp

示例15: switch

FSlateMaterialShaderPS* FSlateRHIRenderingPolicy::GetMaterialPixelShader( const FMaterial* Material, ESlateShader::Type ShaderType, ESlateDrawEffect::Type DrawEffects )
{
	const FMaterialShaderMap* MaterialShaderMap = Material->GetRenderingThreadShaderMap();

	const bool bDrawDisabled = (DrawEffects & ESlateDrawEffect::DisabledEffect) != 0;
	const bool bUseTextureAlpha = (DrawEffects & ESlateDrawEffect::IgnoreTextureAlpha) == 0;

	FShader* FoundShader = nullptr;
	switch (ShaderType)
	{
	case ESlateShader::Default:
		if (bDrawDisabled)
		{
			FoundShader = MaterialShaderMap->GetShader(&TSlateMaterialShaderPS<0, true>::StaticType);
		}
		else
		{
			FoundShader = MaterialShaderMap->GetShader(&TSlateMaterialShaderPS<0, false>::StaticType);
		}
		break;
	case ESlateShader::Border:
		if (bDrawDisabled)
		{
			FoundShader = MaterialShaderMap->GetShader(&TSlateMaterialShaderPS<1, true>::StaticType);
		}
		else
		{
			FoundShader = MaterialShaderMap->GetShader(&TSlateMaterialShaderPS<1, false>::StaticType);
		}
		break;
	default:
		checkf(false, TEXT("Unsupported Slate shader type for use with materials"));
		break;
	}

	return FoundShader ? (FSlateMaterialShaderPS*)FoundShader->GetShaderChecked() : nullptr;
}
开发者ID:xiangyuan,项目名称:Unreal4,代码行数:37,代码来源:SlateRHIRenderingPolicy.cpp


注:本文中的checkf函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。