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


C++ DevicePtr类代码示例

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


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

示例1: lock

BOOL OpenContext::GetConfigDescriptor(LPUKWD_GET_CONFIG_DESC_INFO lpConfigInfo, LPDWORD lpSize)
{
	MutexLocker lock(mMutex);
	DevicePtr dev (mDevice->GetDeviceList(), lpConfigInfo->lpDevice);
	if (!Validate(dev)) {
		SetLastError(ERROR_INVALID_HANDLE);
		return FALSE;
	}
	UserBuffer<LPVOID> descriptorBuf(UBA_WRITE, lpConfigInfo->lpDescriptorBuffer, lpConfigInfo->dwDescriptorBufferSize);
	if (!descriptorBuf.Valid()) {
		SetLastError(ERROR_NOT_ENOUGH_MEMORY);
		return FALSE;
	}
	BOOL status = FALSE;
	if (lpConfigInfo->dwConfigIndex == UKWD_ACTIVE_CONFIGURATION) {
		status = dev->GetActiveConfigDescriptor(descriptorBuf, lpSize);
	} else {
		status = dev->GetConfigDescriptor(lpConfigInfo->dwConfigIndex, descriptorBuf, lpSize);
	}
	if (!status) {
		ERROR_MSG((TEXT("USBKWrapperDrv!OpenContext::GetConfigDescriptor() - ")
			TEXT("failed to retrieve device 0x%08x config descriptor idx %d\r\n"),
			lpConfigInfo->lpDevice, lpConfigInfo->dwConfigIndex));
		return FALSE;
	}
	descriptorBuf.Flush();
	return TRUE;
}
开发者ID:CecilHarvey,项目名称:CEUSBKWrapper,代码行数:28,代码来源:OpenContext.cpp

示例2: Add

//added by Cristian.Guef
int NodesRepository::Add(const DevicePtr& node)
{
	if (!nodesByMAC.insert(NodesByMACT::value_type(node->Mac(), node)).second)
	{
		LOG_WARN("Same MAC:" << node->Mac().ToString() << "was detected (will be ignored)!");
		return 0;
	}
	return 1;
}
开发者ID:dndusdndus12,项目名称:ISA100.11a-Gateway-1,代码行数:10,代码来源:NodesRepository.cpp

示例3: lock

BOOL OpenContext::DetachKernelDriverForInterface(LPUKWD_INTERFACE_INFO lpInterfaceInfo)
{
	MutexLocker lock(mMutex);
	DevicePtr dev (mDevice->GetDeviceList(), lpInterfaceInfo->lpDevice);
	if (!Validate(dev)) {
		SetLastError(ERROR_INVALID_HANDLE);
		return FALSE;
	}
	return dev->DetachKernelDriverForInterface(lpInterfaceInfo->dwInterface);
}
开发者ID:dsdwew,项目名称:CEUSBKWrapper,代码行数:10,代码来源:OpenContext.cpp

示例4: recorder

StaticMesh::StaticMesh(DevicePtr dptr, const MeshData& mesh_data) :
		_triangle_buffer(dptr, mesh_data.triangles().size()),
		_vertex_buffer(dptr, mesh_data.vertices().size()),
		_indirect_data(mesh_data.triangles().size() * 3, 1),
		_radius(mesh_data.radius()) {

	CmdBufferRecorder recorder(dptr->create_disposable_cmd_buffer());
	Mapping::stage(_triangle_buffer, recorder, mesh_data.triangles().data());
	Mapping::stage(_vertex_buffer, recorder, mesh_data.vertices().data());
	dptr->graphic_queue().submit<SyncSubmit>(RecordedCmdBuffer(std::move(recorder)));
}
开发者ID:gan74,项目名称:Yave,代码行数:11,代码来源:StaticMesh.cpp

示例5: create_buffer

static vk::Buffer create_buffer(DevicePtr dptr, usize byte_size, vk::BufferUsageFlags usage) {
	y_debug_assert(byte_size);
	if(usage & vk::BufferUsageFlagBits::eUniformBuffer) {
		if(byte_size > dptr->vk_limits().maxUniformBufferRange) {
			y_fatal("Uniform buffer size exceeds maxUniformBufferRange (%).", dptr->vk_limits().maxUniformBufferRange);
		}
	}
	return dptr->vk_device().createBuffer(vk::BufferCreateInfo()
			.setSize(byte_size)
			.setUsage(usage)
			.setSharingMode(vk::SharingMode::eExclusive)
		);
}
开发者ID:gan74,项目名称:Yave,代码行数:13,代码来源:BufferBase.cpp

示例6: makeControll

PlayerBehavior::CONTROLL PlayerBehavior::makeControll( ) {
	PlayerBehavior::CONTROLL controll;

	if ( _controll ) {
		// 自分で動かす
		DevicePtr device = Device::getTask( );
		unsigned char button = device->getButton( );

		CameraPtr camera = Camera::getTask( );
		PlayerCameraPtr p_camera = std::dynamic_pointer_cast< PlayerCamera >( camera );
		Vector move_vec = p_camera->getConvertDeviceVec( );
		Character::STATUS status = _parent->getStatus( );
		move_vec = move_vec.normalize( ) * status.speed;//プレイヤーの進行ベクトル

		controll.move = move_vec;
		if ( button & BUTTON_D ) {
			controll.action = CONTROLL::DEATHBLOW;
		} else if ( button & BUTTON_A ) {
			controll.action = CONTROLL::ATTACK;
		} else {
			controll.action = CONTROLL::NONE;
		}	
	} else {
		// ネットから動かす
		ClientPtr client = Client::getTask( );
		CLIENTDATA data = client->getClientData( );

		Vector target;
		target.x = data.player[ _player_id ].x;
		target.y = data.player[ _player_id ].y;
		Vector vec = target - _parent->getPos( );
		Character::STATUS status = _parent->getStatus( );
		if ( vec.getLength( ) > status.speed * 2 ) {
			vec = vec.normalize( ) * status.speed;
			controll.move = vec;
		}
		switch ( data.player[ _player_id ].action ) {
		case ACTION_NONE:
			controll.action = CONTROLL::NONE;
			break;
		case ACTION_ATTACK:
			controll.action = CONTROLL::ATTACK;
			break;
		case ACTION_DEATHBLOW:
			controll.action = CONTROLL::MUSTDEATHBLOW;
			break;
		}

	}
	return controll;
}
开发者ID:tcagame,项目名称:Attraction2016,代码行数:51,代码来源:PlayerBehavior.cpp

示例7: Validate

// Checks that device is valid and is open
// by this context.
BOOL OpenContext::Validate(DevicePtr& device)
{
	if (!device.Valid())
		return FALSE;
	PtrArray<UsbDevice>::iterator it
		= mOpenDevices.find(device.Get());
	if (it == mOpenDevices.end()) {
	    WARN_MSG((TEXT("USBKWrapperDrv!OpenContext::Validate")
			TEXT(" - failed to find device in this context for identifier 0x%08x\r\n"),
			device->GetIdentifier()));
		return FALSE;
	} 
	return TRUE;
}
开发者ID:dsdwew,项目名称:CEUSBKWrapper,代码行数:16,代码来源:OpenContext.cpp

示例8: create_descriptor_set

static vk::DescriptorSet create_descriptor_set(DevicePtr dptr, vk::DescriptorPool pool, vk::DescriptorSetLayout layout) {
	return dptr->vk_device().allocateDescriptorSets(vk::DescriptorSetAllocateInfo()
			.setDescriptorPool(pool)
			.setDescriptorSetCount(1)
			.setPSetLayouts(&layout)
		).front();
}
开发者ID:gan74,项目名称:Yave,代码行数:7,代码来源:DescriptorSet.cpp

示例9: updateDeviceStates

void BodyStateViewImpl::updateDeviceStates(DevicePtr device, int rowIndex)
{
    if(currentBody){
        StateItem* item = static_cast<StateItem*>(stateTreeWidget.topLevelItem(rowIndex));
        int size = device->stateSize();
        buf.resize(size);
        device->writeState(&buf.front());
        int i;
        for(i=0; i < size; ++i){
            item->setText(i + 1, QString::number(buf[i], 'f', 2));
        }
        for(   ; i < item->lastNumValidColumns; ++i){
            item->setText(i + 1, "");
        }
        item->lastNumValidColumns = size;
    }
}
开发者ID:orikuma,项目名称:choreonoid,代码行数:17,代码来源:BodyStateView.cpp

示例10: selectDeviceAndBlock

//-----------------------------------------------------------------------------
GpuPtr Helper::getGpu(int index)
{
    // Check it against selection criteria.
    pair_int gpuBlock = selectDeviceAndBlock(index);
    if (-1 == gpuBlock.first) return GpuPtr();

    scoped_lock lock(mutex);

    // First check to see if this GPU device has been initialized.
    DevicePtr device;
    DevicelPtrMap::iterator dit = devPtrMap.find(gpuBlock.first);
    if (dit == devPtrMap.end())
    {
        device.reset(new Device(gpuBlock.first));
        // Double check to make sure our device is OK
        if (-1 == device->ID()) return GpuPtr();
        devPtrMap.insert(std::make_pair(gpuBlock.first, device));
    }
    else
    {
        device = dit->second;
        // Make sure we activate this per-thread.
        device->setDevice();
    }

    // Now that we have a device, get the block implementation handle.
    GpuPtr impl;
    GpuPtrMap::iterator it = gpuPtrMap.find(index);
    if (it == gpuPtrMap.end())
    {
        impl.reset(new Gpu(device));
        gpuPtrMap.insert(std::make_pair(index, impl));
    }
    else
    {
        impl = it->second;
    }

    if (!atExitRegistered)
    {
        atexit(Helper::destroy);
        atExitRegistered = true;
    }
    return impl;
}
开发者ID:chuckseberino,项目名称:CCT,代码行数:46,代码来源:CudaHelper.cpp

示例11: alloc_buffer

static std::tuple<vk::Buffer, DeviceMemory> alloc_buffer(DevicePtr dptr, usize buffer_size, vk::BufferUsageFlags usage, MemoryType type) {
	y_debug_assert(buffer_size);

	auto buffer = create_buffer(dptr, buffer_size, usage);
	auto memory = dptr->allocator().alloc(buffer, type);
	bind_buffer_memory(dptr, buffer, memory);

	return {buffer, std::move(memory)};
}
开发者ID:gan74,项目名称:Yave,代码行数:9,代码来源:BufferBase.cpp

示例12: CudaAssertError

DevicePtr<cuda::Transformation3D> Transformation3D::CopyToGpu(DevicePtr<cuda::Transformation3D> const gpu_ptr) const {

   gpu_ptr.Construct(fTranslation[0], fTranslation[1], fTranslation[2],
                     fRotation[0], fRotation[1], fRotation[2],
                     fRotation[3], fRotation[4], fRotation[5],
                     fRotation[6], fRotation[7], fRotation[8]);
   CudaAssertError();
   return gpu_ptr;
}
开发者ID:sawenzel,项目名称:VecGeom,代码行数:9,代码来源:Transformation3D.cpp

示例13: create_shader_module

static vk::ShaderModule create_shader_module(DevicePtr dptr, const SpirVData& data) {
	if(data.is_empty()) {
		return vk::ShaderModule();
	}
	return dptr->vk_device().createShaderModule(vk::ShaderModuleCreateInfo()
			.setCodeSize(data.size())
			.setPCode(data.data())
		);
}
开发者ID:gan74,项目名称:Yave,代码行数:9,代码来源:ShaderModuleBase.cpp

示例14: CudaAssertError

DevicePtr<cuda::LogicalVolume> LogicalVolume::CopyToGpu(
   DevicePtr<cuda::VUnplacedVolume> const unplaced_vol,
   DevicePtr<cuda::Vector<CudaDaughter_t>> daughters,
   DevicePtr<cuda::LogicalVolume> const gpu_ptr) const
{
   gpu_ptr.Construct( unplaced_vol, daughters );
   CudaAssertError();
   return gpu_ptr;
}
开发者ID:sawenzel,项目名称:VecGeom,代码行数:9,代码来源:LogicalVolume.cpp

示例15: TruncateBoxList

	void BoxClass::TruncateBoxList (Box dev)
	{
		STUB;
		return;
#if 0
		if (!boxList) return;

		if (boxList == dev) {
			boxList = NULL;
			return;
		}

		DevicePtr d = boxList ;
		while (d->GetNext() && d->GetNext() != dev) {
			d = d->GetNext();
		}
		if (d->GetNext()) {
			d -> SetNext(NULL);
		}
#endif
	}
开发者ID:BackupTheBerlios,项目名称:mutabor,代码行数:21,代码来源:Box.cpp


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