• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ErrorCheck函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ErrorCheck

int Player::openSong(std::string songName)
{
	//close current song if there is currently one loaded
	if (m_songLoaded)
	{
		(void) ErrorCheck(m_channel->stop());
		(void) ErrorCheck(m_song->release());
	}

	//Open the song as a stream
	m_result = m_system->createStream(songName.c_str(), FMOD_DEFAULT, 0, &m_song);
	m_error = ErrorCheck(m_result);

	if (!m_error)
	{
		//assign a channel to the song and play it upon open
		m_result = m_system->playSound(m_song, NULL, false, &m_channel);
		m_error = ErrorCheck(m_result);
	}

	//check for errors and return accordingly
	if (m_error)
	{
		m_songLoaded = false;
		return OPEN_FAILURE;
	}
	else
	{
		m_channel->setLoopCount(0);
		m_songLoaded = true;
		return OPEN_SUCCESS;
	}
}
开发者ID:davidruble,项目名称:SAMV,代码行数:33,代码来源:player.cpp


示例2: return

	void FMOD_System::CreateSounds( const SoundFilenameMap& soundFilenames )
	{
		auto isPresent = [=]( const std::string& key ) -> bool
		{
			return ( soundFilenames.find( key ) != soundFilenames.end() ) ? true : false;
		};

		if( isPresent( "bgmusic" ) )
		{
			ErrorCheck( system->createStream( soundFilenames.at("bgmusic").c_str(), FMOD_LOOP_NORMAL | FMOD_CREATESTREAM,
				nullptr, &bgmusic ) );
			bgmusic->setDefaults( 44100, 0.025f, 0.f, 128 );
		}
		if( isPresent( "jet" ) )
		{
			ErrorCheck( system->createSound( soundFilenames.at( "jet" ).c_str(), FMOD_3D, nullptr, &jet ) );
			jet->setDefaults( 44100, 0.75f, 0.f, 128 );
		}
		if( isPresent( "vent" ) )
		{
			ErrorCheck( system->createSound( soundFilenames.at( "vent" ).c_str(), FMOD_3D | FMOD_LOOP_NORMAL,
				nullptr, &ventSound ) );
			ventSound->setDefaults( 44100, 0.3f, 0.f, 128 );
		}
		if( isPresent( "collision" ) )
		{
			ErrorCheck( system->createSound( soundFilenames.at( "collision" ).c_str(), FMOD_3D, nullptr, &collision ) );
			collision->setDefaults( 44100, 5.f, 0.f, 128 );
		}
		if( isPresent( "roll" ) )
		{
			ErrorCheck( system->createSound( soundFilenames.at( "roll" ).c_str(), FMOD_3D, nullptr, &roll ) );
			roll->setDefaults( 44100, 2.f, 0.f, 128 );
		}
	}
开发者ID:gemini14,项目名称:AirBall,代码行数:35,代码来源:SoundSystem.cpp


示例3: GetSearchInt

// This function prompts user to input searchInt based on search type
int GetSearchInt(int& choice)
{
	int searchInt;	// IN & OUT & CALC - int to searched, input
					// 					 by user
	searchInt = 0;  // Initialize searchInt to 0

	// Will prompt user to input searchInt based on menu choice
	switch(choice)
	{
	case YEARSEARCH:
		cout << "\nWhich year are you looking for? ";
		searchInt = ErrorCheck(1878, 3000);
		cout << "\nSearching for the year " << searchInt << endl;
		break;
	case RATINGSEARCH:
		cout << "\nWhich rating are you looking for? ";
		searchInt = ErrorCheck(0, 9);
		cout << "\nSearching for the rating " << searchInt << endl;
		break;
	default:
		cout << "\nYou shouldn't have done that.\n";
		break;
	}

	// Returns int to be searched
	return searchInt;
}
开发者ID:chellybear,项目名称:Searching-Linked-Lists,代码行数:28,代码来源:GetSearchInt.cpp


示例4:

bool AudioSystem::Load2DSound(const string& filepath, FMOD::Sound** sound){
	FMOD_RESULT result = m_system->createSound(filepath.c_str(), FMOD_2D, 0, &*sound);
	if (!ErrorCheck(result)) return false;
	result = (*sound)->setMode(FMOD_LOOP_OFF);
	if (!ErrorCheck(result)) return false;
	return true;
}
开发者ID:Fliuhuo,项目名称:Game-Engine,代码行数:7,代码来源:AudioSource.cpp


示例5: ErrorCheck

void Renderer::createBuffer(VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags memory_properties, VkBuffer & buffer, VkDeviceMemory & buffer_memory) {
	VkBufferCreateInfo buffer_create_info{};
	buffer_create_info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
	buffer_create_info.size = size;
	buffer_create_info.usage = usage;
	buffer_create_info.sharingMode = VK_SHARING_MODE_EXCLUSIVE;

	ErrorCheck(vkCreateBuffer(_device, &buffer_create_info, nullptr, &buffer));

	VkMemoryRequirements mem_requirements{};
	vkGetBufferMemoryRequirements(_device, buffer, &mem_requirements);

	uint32_t type_filter = mem_requirements.memoryTypeBits;
	uint32_t memory_type;

	for (uint32_t i = 0; i < _gpu_memory_properties.memoryTypeCount; i++) {
		if ((type_filter & (1 << i)) && (_gpu_memory_properties.memoryTypes[i].propertyFlags & memory_properties) == memory_properties) {
			memory_type = i;
			break;
		}
	}

	VkMemoryAllocateInfo memory_allocate_info{};
	memory_allocate_info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
	memory_allocate_info.allocationSize = mem_requirements.size;
	memory_allocate_info.memoryTypeIndex = memory_type;

	ErrorCheck(vkAllocateMemory(_device, &memory_allocate_info, nullptr, &buffer_memory));
	ErrorCheck(vkBindBufferMemory(_device, buffer, buffer_memory, 0));
}
开发者ID:danielgrimshaw,项目名称:VulkanTest,代码行数:30,代码来源:Renderer.cpp


示例6: ErrorCheck

int SoundManager::Play3D(string Name, SoundType Type, XMFLOAT3 Position, bool Loop)
{
    if(!Exists(Name))
    {
        DebugScreen::GetInstance()->AddLogMessage("Sound: \"" + Name + "\" does not exist.", Red);
        return -1;
    }

    if(Loop)
        gSoundIterator->second.second->setMode(FMOD_LOOP_NORMAL);

    ErrorCheck(gSystem->playSound(FMOD_CHANNEL_FREE, gSoundIterator->second.second, true, &gChannel));

    ErrorCheck(gChannel->setPaused(false));

    switch(Type)
    {
    case Song:
        gChannel->setVolume( gMusicVolume * gMasterVolume );
        break;

    case SFX:
        gChannel->setVolume( gEffectVolume * gMasterVolume );
        break;
    }

    FMOD_VECTOR	tVelocity	=	{0, 0, 0};
    gResult	=	gChannel->set3DAttributes(&gListenerPosition, &tVelocity);
    ErrorCheck(gResult);

    gPlayingSounds->push_back(new PlayingSound(PSIndex( gUniqueIndex, Name ), PSEntry( Type, gChannel )));
    ++gUniqueIndex;

    return gUniqueIndex - 1;
}
开发者ID:CarlRapp,项目名称:CodenameGamma,代码行数:35,代码来源:SoundManager.cpp


示例7: ErrorCheck

void Window::_InitSwapchainImages()
{
	_swapchain_images.resize( _swapchain_image_count );
	_swapchain_image_views.resize( _swapchain_image_count );

	ErrorCheck( vkGetSwapchainImagesKHR( _renderer->GetVulkanDevice(), _swapchain, &_swapchain_image_count, _swapchain_images.data() ) );

	for( uint32_t i=0; i < _swapchain_image_count; ++i ) {
		VkImageViewCreateInfo image_view_create_info {};
		image_view_create_info.sType				= VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
		image_view_create_info.image				= _swapchain_images[ i ];
		image_view_create_info.viewType				= VK_IMAGE_VIEW_TYPE_2D;
		image_view_create_info.format				= _surface_format.format;
		image_view_create_info.components.r			= VK_COMPONENT_SWIZZLE_IDENTITY;
		image_view_create_info.components.g			= VK_COMPONENT_SWIZZLE_IDENTITY;
		image_view_create_info.components.b			= VK_COMPONENT_SWIZZLE_IDENTITY;
		image_view_create_info.components.a			= VK_COMPONENT_SWIZZLE_IDENTITY;
		image_view_create_info.subresourceRange.aspectMask			= VK_IMAGE_ASPECT_COLOR_BIT;
		image_view_create_info.subresourceRange.baseMipLevel		= 0;
		image_view_create_info.subresourceRange.levelCount			= 1;
		image_view_create_info.subresourceRange.baseArrayLayer		= 0;
		image_view_create_info.subresourceRange.layerCount			= 1;

		ErrorCheck( vkCreateImageView( _renderer->GetVulkanDevice(), &image_view_create_info, nullptr, &_swapchain_image_views[ i ] ) );
	}
}
开发者ID:piaoasd123,项目名称:VulkanTest,代码行数:26,代码来源:Window.cpp


示例8: sync_MergeFromPilot_fast

/***********************************************************************
 *
 * Function:    sync_MergeFromPilot_fast
 *
 * Summary:     er, fast merge from Palm to desktop
 *
 * Parameters:  None
 *
 * Returns:     0 if success, nonzero otherwise
 *
 ***********************************************************************/
static int
sync_MergeFromPilot_fast(SyncHandler * sh, int dbhandle,
			 RecordModifier rec_mod)
{
	int 	result = 0;
	PilotRecord *precord 	= sync_NewPilotRecord(DLP_BUF_SIZE);
	DesktopRecord *drecord 	= NULL;
	RecordQueue rq 		= { 0, NULL };
	pi_buffer_t *recbuf = pi_buffer_new(DLP_BUF_SIZE);
	
	while (dlp_ReadNextModifiedRec(sh->sd, dbhandle, recbuf,
				       &precord->recID, NULL,
				       &precord->flags,
				       &precord->catID) >= 0) {
		int count = rq.count;
		precord->len = recbuf->used;
		if (precord->len > DLP_BUF_SIZE)
			precord->len = DLP_BUF_SIZE;
		memcpy(precord->buffer, recbuf->data, precord->len);
		ErrorCheck(sh->Match(sh, precord, &drecord));
		ErrorCheck(sync_record
			   (sh, dbhandle, drecord, precord, &rq, rec_mod));

		if (drecord && rq.count == count)
			ErrorCheck(sh->FreeMatch(sh, drecord));
	}
	pi_buffer_free(recbuf);
	sync_FreePilotRecord(precord);

	result = sync_MergeFromPilot_process(sh, dbhandle, &rq, rec_mod);

	return result;
}
开发者ID:jichu4n,项目名称:pilot-link,代码行数:44,代码来源:sync.c


示例9: ErrorCheck

void AudioSystem::Play3DSound(FMOD::Sound* sound, const FMOD_VECTOR& position, FMOD::Channel** channel){
	FMOD_RESULT result = m_system->playSound(FMOD_CHANNEL_FREE, sound, true, &*channel);
	ErrorCheck(result);
	result = (*channel)->set3DAttributes(&position, 0);
	ErrorCheck(result);
	result = (*channel)->setPaused(false);
	ErrorCheck(result);
}
开发者ID:Fliuhuo,项目名称:Game-Engine,代码行数:8,代码来源:AudioSource.cpp


示例10: m_channel

	AudioClip::AudioClip(const string& filename, bool streamed)
		: m_channel(0), m_playing(false), m_paused(false), m_looping(false), m_volume(1.0f)
	{
		if (!streamed)
			ErrorCheck(Audio::AudioSystem().createSound(filename.c_str(), FMOD_DEFAULT, 0, &m_sound));
		else
			ErrorCheck(Audio::AudioSystem().createStream(filename.c_str(), FMOD_DEFAULT, 0, &m_sound));
	}
开发者ID:Ossadtchii,项目名称:PIXEL2D,代码行数:8,代码来源:AudioClip.cpp


示例11: ErrorCheck

void										Summerface::AddWindow								(const std::string& aName, SummerfaceWindow_Ptr aWindow)
{
	ErrorCheck(aWindow, "Summerface::AddWindow: Window is not a valid pointer. [Name: %s]", aName.c_str());
	ErrorCheck(Windows.find(aName) == Windows.end(), "Summerface::AddWindow: Window with name is already present. [Name: %s]", aName.c_str());

	Windows[aName] = aWindow;
	aWindow->SetInterface(shared_from_this(), aName);
	ActiveWindow = aName;
}
开发者ID:cdenix,项目名称:psmame,代码行数:9,代码来源:Summerface.cpp


示例12: Trace

  bool AudioFMOD::Load(FMOD::Studio::Bank*& bank, const std::string & path)
  {
    Trace("Loading '" + path + "'");
    // Load the bank into the sound system
    if (!ErrorCheck(System->loadBankFile(path.c_str(), FMOD_STUDIO_LOAD_BANK_NORMAL, &bank)))
      return false;

    // Now that the bank is finished loading, load its sample data
    ErrorCheck(bank->loadSampleData());
    return true;
  }
开发者ID:Azurelol,项目名称:Samples,代码行数:11,代码来源:AudioFMOD_Add.cpp


示例13: Trace

 void AudioFMOD::Initialize()
 {
   Trace("Initializing Low Level and Studio system objects... ");
   // Create the Low Level System
   ErrorCheck(FMOD::System_Create(&System.LowLevel));
   // Create the Studio System
   ErrorCheck(System->create(&System.Studio));
   // Set FMOD low level studio pointer
   ErrorCheck(System->getLowLevelSystem(&System.LowLevel));
   // Initialize it
   unsigned maxChannels = 36;
   ErrorCheck(System->initialize(maxChannels, FMOD_STUDIO_INIT_NORMAL, FMOD_INIT_NORMAL, nullptr));
 }
开发者ID:Azurelol,项目名称:Samples,代码行数:13,代码来源:AudioFMOD.cpp


示例14: clGetPlatformInfo

void OpenCLBase::GetPlatformInfo(cl_platform_id id) {
	// 
	size_t length;
	cl_int errorCode;

	errorCode = clGetPlatformInfo(id, CL_PLATFORM_PROFILE, 0, NULL, &length);
	ErrorCheck("clGetPlatformInfo", errorCode);

	char* param = reinterpret_cast<char*>(malloc(length * sizeof(char)));
	errorCode = clGetPlatformInfo(id, CL_PLATFORM_PROFILE, length, param, NULL);
	ErrorCheck("clGetPlatformInfo", errorCode);
		
	cout << param << endl;

	free(param);
}
开发者ID:GreatAS,项目名称:OpenCLSample,代码行数:16,代码来源:OpenCLBase.cpp


示例15: findSupportedFormat

void Renderer::_InitRenderPass() {
	VkAttachmentDescription color_attachment {};
	color_attachment.format = _window->getSurfaceFormat().format;
	color_attachment.samples = VK_SAMPLE_COUNT_1_BIT;
	color_attachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
	color_attachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
	color_attachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
	color_attachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
	color_attachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
	color_attachment.finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;

	VkAttachmentDescription depth_attachment {};
	depth_attachment.format = findSupportedFormat(
		{ VK_FORMAT_D32_SFLOAT, VK_FORMAT_D32_SFLOAT_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT },
		VK_IMAGE_TILING_OPTIMAL,
		VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT
	);
	depth_attachment.samples = VK_SAMPLE_COUNT_1_BIT;
	depth_attachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
	depth_attachment.storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
	depth_attachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
	depth_attachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
	depth_attachment.initialLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
	depth_attachment.finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;

	VkAttachmentReference color_attachment_reference {};
	color_attachment_reference.attachment = 0;
	color_attachment_reference.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;

	VkAttachmentReference depth_attachment_reference {};
	depth_attachment_reference.attachment = 1;
	depth_attachment_reference.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;

	VkSubpassDescription subpass{};
	subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
	subpass.colorAttachmentCount = 1;
	subpass.pColorAttachments = &color_attachment_reference;
	subpass.pDepthStencilAttachment = &depth_attachment_reference;

	VkSubpassDependency dependency {};
	dependency.srcSubpass = VK_SUBPASS_EXTERNAL;
	dependency.dstSubpass = 0;
	dependency.srcStageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
	dependency.srcAccessMask = VK_ACCESS_MEMORY_READ_BIT;
	dependency.dstStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
	dependency.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;

	std::array<VkAttachmentDescription, 2> attachments = { color_attachment, depth_attachment };

	VkRenderPassCreateInfo render_pass_create_info {};
	render_pass_create_info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
	render_pass_create_info.attachmentCount = (uint32_t)attachments.size();
	render_pass_create_info.pAttachments = attachments.data();
	render_pass_create_info.subpassCount = 1;
	render_pass_create_info.pSubpasses = &subpass;
	render_pass_create_info.dependencyCount = 1;
	render_pass_create_info.pDependencies = &dependency;

	ErrorCheck(vkCreateRenderPass(_device, &render_pass_create_info, nullptr, &_render_pass));
}
开发者ID:danielgrimshaw,项目名称:VulkanTest,代码行数:60,代码来源:Renderer.cpp


示例16: ErrorCheck

	// Start playing a song
	FMOD::Channel *Song::Start(bool paused)
	{
		// Channel volume will be set to 1.0f (max) automatically
		ErrorCheck(engine->FMOD()->playSound(FMOD_CHANNEL_FREE, resource.get(), true, &channel));

		// Add to channel group (for master volume)
		if (channelGroup)
			channel->setChannelGroup(channelGroup);

		// Songs repeat forever by default
		channel->setLoopCount(-1);
		channel->setMode(FMOD_LOOP_NORMAL);

		// Flush buffer to ensure loop logic is executed
		channel->setPosition(0, FMOD_TIMEUNIT_MS);

		// Set paused or not as applicable
		if (!paused)
			channel->setPaused(paused);

		// Cancel any fade that was previously applied
		fade = false;

		return channel;
	}
开发者ID:AnnaKitKatBar,项目名称:seeSound,代码行数:26,代码来源:SimpleFMOD.cpp


示例17: System_Create

void SoundManager::Init( )
{
	//FMOD 초기화 
	//FMOD 함수는 모두 결과값을 리턴한다. 따라서 에러체크가 가능하다.
	r = System_Create( &m_pFmod );
	ErrorCheck( r );

	r = m_pFmod->init( MAX_SOUND_COUNT, FMOD_INIT_NORMAL, NULL );
	ErrorCheck( r );
	m_volume = 0.5f;

	for (int i = 0; i < MAX_SOUND_COUNT; i++)
	{
		m_pCh[i]->setVolume( m_volume );
	}
}
开发者ID:garamKwon,项目名称:ContagionCity,代码行数:16,代码来源:SoundManager.cpp


示例18: Packetize

/*
FUNCTION: Packetize
DATE: 11/30/2015
REVISIONS: v2 - adjusted checksum
DESIGNER: Thomas & Allen & Dylan
PROGRAMMER: Thomas & Allen & Dylan
INTERFACE: void Packetize(CHAR *buf, CHAR *packet)
			CHAR *buf : raw character to read from
			CHAR *packet : character array to store the packet in
RETURNS: void

NOTES: packet should be large enough to hold a packet (516 bytes)
		Performs the checksum calculations
*/
void Packetize(CHAR *buf, CHAR *packet) {
	int i, j=4;
	DWORD sum = 0;
	for (i = 0; i < 512; i++) {
		packet[i] = 0;
	}
	packet[0] = SOH;
	//TODO: make this check which sync bit to write
	packet[1] = SYNC_0;
	// zero the 2 checksum bytes
	packet[2] = 0;
	packet[3] = 0;
	// copy until end of file (character read is 0 or 512 bytes read)
	for (i = 0; buf[i] != 0 && i < DATALENGTH;) {
		packet[j++] = buf[i++];

	} 
	// insert EOT if  it's not a full packet
	if (i < 512) {
		packet[j] = EOT;
	}
	// calculate checksum
	for (i = 0; i < j; i++) {
		sum += packet[i];
	}
	// retrieve the most significant byte and convert to char
	// packet[2] = sum & 0xff;
	packet[2] = (sum & 0x0000ff00) /256;
	// repeat for least significant byte
	packet[3] = (sum & 0x000000ff);
	// check the packet locally for errors
	OutputDebugString(ErrorCheck(packet) ? "Checksum reversed\n" : "Checksum failed\n");
 }
开发者ID:dmblake,项目名称:comp3980asn4,代码行数:47,代码来源:Protocol.cpp


示例19: glBindFramebuffer

void ae3d::GfxDevice::SetRenderTarget( RenderTexture* target, unsigned cubeMapFace )
{
    if (target != nullptr && target->GetFBO() == GfxDeviceGlobal::cachedFBO && cubeMapFace == 0)
    {
        return;
    }
    if (target == nullptr && GfxDeviceGlobal::cachedFBO == GfxDeviceGlobal::systemFBO)
    {
        return;
    }

    const GLuint fbo = target != nullptr ? target->GetFBO() : GfxDeviceGlobal::systemFBO;
    glBindFramebuffer( GL_FRAMEBUFFER, fbo );
    GfxDeviceGlobal::cachedFBO = fbo;

    if (target && target->IsCube())
    {
        const unsigned glCubeMapFace = GL_TEXTURE_CUBE_MAP_POSITIVE_X + cubeMapFace;
        System::Assert( glCubeMapFace >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && glCubeMapFace <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, "Invalid cube map face." );
        glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, glCubeMapFace, target->GetID(), 0 );
    }
    
    if (target != nullptr)
    {
        glViewport( 0, 0, target->GetWidth(), target->GetHeight() );
    }
    else
    {
        ae3d::System::Assert( GfxDeviceGlobal::backBufferWidth > 0, "invalid backbuffer dimension" );
        glViewport( 0, 0, GfxDeviceGlobal::backBufferWidth, GfxDeviceGlobal::backBufferHeight );
    }

    ErrorCheckFBO();
    ErrorCheck( "SetRenderTarget end" );
}
开发者ID:Dandarawy,项目名称:aether3d,代码行数:35,代码来源:GfxDeviceGL45.cpp


示例20: _hsaAgent

//-------------------------------------------------------------------------------------------------
UnpinnedCopyEngine::UnpinnedCopyEngine(hsa_agent_t hsaAgent, hsa_agent_t cpuAgent, size_t bufferSize, int numBuffers, 
                                       bool isLargeBar, int thresholdH2DDirectStaging, 
                                       int thresholdH2DStagingPinInPlace, int thresholdD2H) :
    _hsaAgent(hsaAgent),
    _cpuAgent(cpuAgent),
    _bufferSize(bufferSize),
    _numBuffers(numBuffers > _max_buffers ? _max_buffers : numBuffers),
    _isLargeBar(isLargeBar),
    _hipH2DTransferThresholdDirectOrStaging(thresholdH2DDirectStaging),
    _hipH2DTransferThresholdStagingOrPininplace(thresholdH2DStagingPinInPlace),
    _hipD2HTransferThreshold(thresholdD2H)
{
    hsa_amd_memory_pool_t sys_pool;
    hsa_status_t err = hsa_amd_agent_iterate_memory_pools(_cpuAgent, findGlobalPool, &sys_pool);

    // Generate a packed C-style array of agents, for use below with hsa_amd_agents_allow_access
    std::vector<hsa_agent_t> agents;
    err = hsa_iterate_agents(&find_gpu, &agents);
    ErrorCheck(err);
    hsa_agent_t * agentBlock = new hsa_agent_t[agents.size()];
    int i=0;
    for (auto iter=agents.begin(); iter!= agents.end(); iter++) {
        agentBlock[i++] = *iter;
        assert (i<=agents.size());
    };

    ErrorCheck(err);
    for (int i=0; i<_numBuffers; i++) {
        // TODO - experiment with alignment here.
        err = hsa_amd_memory_pool_allocate(sys_pool, _bufferSize, 0, (void**)(&_pinnedStagingBuffer[i]));
        ErrorCheck(err);

        if ((err != HSA_STATUS_SUCCESS) || (_pinnedStagingBuffer[i] == NULL)) {
            THROW_ERROR(hipErrorMemoryAllocation, err);
        }

        // Allow access from every agent:
        // This is used in peer-to-peer copies, since we use the buffers to copy from different agents.
        // TODO - may want to review this algorithm for NUMA locality - it might be faster to use staging buffer closer to devices?
        err = hsa_amd_agents_allow_access(agents.size(), agentBlock, NULL, _pinnedStagingBuffer[i]);
        ErrorCheck(err);

        hsa_signal_create(0, 0, NULL, &_completionSignal[i]);
        hsa_signal_create(0, 0, NULL, &_completionSignal2[i]);
    }

};
开发者ID:jvesely,项目名称:hcc,代码行数:48,代码来源:unpinned_copy_engine.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ErrorF函数代码示例发布时间:2022-05-30
下一篇:
C++ Endpoint_IsOUTReceived函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap