本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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)));
}
示例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)
);
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
}
示例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;
}
示例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)};
}
示例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;
}
示例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())
);
}
示例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;
}
示例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
}