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


C++ DeviceInterface类代码示例

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


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

示例1: createImage

Image::Image (const DeviceInterface&	vk,
			  const VkDevice			device,
			  Allocator&				allocator,
			  const VkImageCreateInfo&	imageCreateInfo,
			  const MemoryRequirement	memoryRequirement)
{
	m_image = createImage(vk, device, &imageCreateInfo);
	m_allocation = allocator.allocate(getImageMemoryRequirements(vk, device, *m_image), memoryRequirement);
	VK_CHECK(vk.bindImageMemory(device, *m_image, m_allocation->getMemory(), m_allocation->getOffset()));
}
开发者ID:chadversary,项目名称:deqp,代码行数:10,代码来源:vktImageTestsUtil.cpp

示例2: createBuffer

Buffer::Buffer (const DeviceInterface&		vk,
				const VkDevice				device,
				Allocator&					allocator,
				const VkBufferCreateInfo&	bufferCreateInfo,
				const MemoryRequirement		memoryRequirement)
{
	m_buffer = createBuffer(vk, device, &bufferCreateInfo);
	m_allocation = allocator.allocate(getBufferMemoryRequirements(vk, device, *m_buffer), memoryRequirement);
	VK_CHECK(vk.bindBufferMemory(device, *m_buffer, m_allocation->getMemory(), m_allocation->getOffset()));
}
开发者ID:chadversary,项目名称:deqp,代码行数:10,代码来源:vktImageTestsUtil.cpp

示例3: getSwapchainImages

std::vector<VkImage> getSwapchainImages (const DeviceInterface&			vkd,
										 VkDevice						device,
										 VkSwapchainKHR					swapchain)
{
	deUint32	numImages	= 0;

	VK_CHECK(vkd.getSwapchainImagesKHR(device, swapchain, &numImages, DE_NULL));

	if (numImages > 0)
	{
		std::vector<VkImage>	images	(numImages);

		VK_CHECK(vkd.getSwapchainImagesKHR(device, swapchain, &numImages, &images[0]));

		return images;
	}
	else
		return std::vector<VkImage>();
}
开发者ID:jekstrand,项目名称:Vulkan-CTS,代码行数:19,代码来源:vkWsiUtil.cpp

示例4: beginCommandBuffer

void beginCommandBuffer (const DeviceInterface& vk, const VkCommandBuffer commandBuffer)
{
	const VkCommandBufferBeginInfo commandBufBeginParams =
	{
		VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,	// VkStructureType					sType;
		DE_NULL,										// const void*						pNext;
		0u,												// VkCommandBufferUsageFlags		flags;
		(const VkCommandBufferInheritanceInfo*)DE_NULL,
	};
	VK_CHECK(vk.beginCommandBuffer(commandBuffer, &commandBufBeginParams));
}
开发者ID:chadversary,项目名称:deqp,代码行数:11,代码来源:vktImageTestsUtil.cpp

示例5: invalidateMappedMemoryRange

void invalidateMappedMemoryRange (const DeviceInterface& vkd, VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size)
{
	const VkMappedMemoryRange	range	=
	{
		VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
		DE_NULL,
		memory,
		offset,
		size
	};

	VK_CHECK(vkd.invalidateMappedMemoryRanges(device, 1u, &range));
}
开发者ID:jekstrand,项目名称:Vulkan-CTS,代码行数:13,代码来源:vkMemUtil.cpp

示例6: deviceNameColumnData

QVariant deviceNameColumnData(const Device::Node& node, DeviceInterface& dev, int role)
{
    static const QFont italicFont{[] () { QFont f; f.setItalic(true); return f; }()};

    using namespace iscore;

    switch(role)
    {
        case Qt::DisplayRole:
        case Qt::EditRole:
            return node.get<DeviceSettings>().name;
        case Qt::FontRole:
        {
            if(!dev.connected())
                return italicFont;
        }
        default:
            return {};
    }
}
开发者ID:Sciss,项目名称:i-score,代码行数:20,代码来源:NodeDisplayMethods.cpp

示例7: bindImagePlaneMemory

void bindImagePlaneMemory (const DeviceInterface&	vkd,
						   VkDevice					device,
						   VkImage					image,
						   VkDeviceMemory			memory,
						   VkDeviceSize				memoryOffset,
						   VkImageAspectFlagBits	planeAspect)
{
	const VkBindImagePlaneMemoryInfo	planeInfo	=
	{
		VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO_KHR,
		DE_NULL,
		planeAspect
	};
	const VkBindImageMemoryInfo			coreInfo	=
	{
		VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR,
		&planeInfo,
		image,
		memory,
		memoryOffset,
	};

	VK_CHECK(vkd.bindImageMemory2(device, 1u, &coreInfo));
}
开发者ID:jekstrand,项目名称:Vulkan-CTS,代码行数:24,代码来源:vkMemUtil.cpp

示例8: endCommandBuffer

void endCommandBuffer (const DeviceInterface& vk, const VkCommandBuffer commandBuffer)
{
	VK_CHECK(vk.endCommandBuffer(commandBuffer));
}
开发者ID:chadversary,项目名称:deqp,代码行数:4,代码来源:vktImageTestsUtil.cpp

示例9: sizeof

cl_int MemObject::init()
{
    // Get the device list of the context
    DeviceInterface **devices = 0;
    cl_int rs;

    rs = ((Context *)parent())->info(CL_CONTEXT_NUM_DEVICES,
                                     sizeof(unsigned int),
                                     &p_num_devices, 0);

    if (rs != CL_SUCCESS)
        return rs;

    p_devices_to_allocate = p_num_devices;
    devices = (DeviceInterface **)std::malloc(p_num_devices *
                                        sizeof(DeviceInterface *));

    if (!devices)
        return CL_OUT_OF_HOST_MEMORY;

    rs = ((Context *)parent())->info(CL_CONTEXT_DEVICES,
                                     p_num_devices * sizeof(DeviceInterface *),
                                     devices, 0);

    if (rs != CL_SUCCESS)
    {
        std::free((void *)devices);
        return rs;
    }

    // Allocate a table of DeviceBuffers
    p_devicebuffers = (DeviceBuffer **)std::malloc(p_num_devices *
                                             sizeof(DeviceBuffer *));

    if (!p_devicebuffers)
    {
        std::free((void *)devices);
        return CL_OUT_OF_HOST_MEMORY;
    }

    // If we have more than one device, the allocation on the devices is
    // defered to first use, so host_ptr can become invalid. So, copy it in
    // a RAM location and keep it. Also, set a flag telling CPU devices that
    // they don't need to reallocate and re-copy host_ptr
    if (p_num_devices > 1 && (p_flags & CL_MEM_COPY_HOST_PTR))
    {
        void *tmp_hostptr = std::malloc(size());

        if (!tmp_hostptr)
        {
            std::free((void *)devices);
            return CL_OUT_OF_HOST_MEMORY;
        }

        std::memcpy(tmp_hostptr, p_host_ptr, size());

        p_host_ptr = tmp_hostptr;
        // Now, the client application can safely std::free() its host_ptr
    }

    // Create a DeviceBuffer for each device
    unsigned int failed_devices = 0;

    for (unsigned int i=0; i<p_num_devices; ++i)
    {
        DeviceInterface *device = devices[i];

        rs = CL_SUCCESS;
        p_devicebuffers[i] = device->createDeviceBuffer(this, &rs);

        if (rs != CL_SUCCESS)
        {
            p_devicebuffers[i] = 0;
            failed_devices++;
        }
    }

    if (failed_devices == p_num_devices)
    {
        // Each device found a reason to reject the buffer, so it's invalid
        std::free((void *)devices);
        return rs;
    }

    std::free((void *)devices);
    devices = 0;

    // If we have only one device, already allocate the buffer
    if (p_num_devices == 1)
    {
        if (!p_devicebuffers[0]->allocate())
            return CL_MEM_OBJECT_ALLOCATION_FAILURE;
    }

    return CL_SUCCESS;
}
开发者ID:jakebolewski,项目名称:clover,代码行数:96,代码来源:memobject.cpp

示例10: printDeviceNotificationLine

/**
 * @private
 */
void printDeviceNotificationLine(OutputStream* outputStream, unsigned char header, Device* device) {
    DeviceInterface* deviceInterface = device->deviceInterface;

    int argumentLength = deviceInterface->deviceGetInterface(header, DEVICE_MODE_NOTIFY, true);
    printMethodOrNotificationMetaData(outputStream, deviceInterface, header, argumentLength, 0, true);
}
开发者ID:svanacker,项目名称:cen-electronic,代码行数:9,代码来源:deviceUsage.c

示例11: all


//.........这里部分代码省略.........
		for(unsigned int i=0;i<envPath.length();i++)
		{
			if (envPath[i] == '\\'){
				envPath.insert(i,1,'\\');
				i++;
			}
		}
	
		plgsPath = envPath;
	
		plgsPath.append("\\\\plugins.csv");
		plugins.open(plgsPath.c_str(),ios::out | ios::binary);
	}

	if(plugins.fail())
	{
		cout << "Error opening:"<< plgsPath << endl;
		MessageBox(NULL,plgsPath.c_str(),"Ambient Library - Error", MB_OK);
		errorMessage = DEVICE_ERROR_OPEN_DRIVER_LIST ;
	}else
	{
		while(plugins.good()){

			getline(plugins,line);
			all.append(line);
		}
	}
	plugins.close();

	// parse the file
	//MessageBox(NULL,all.c_str(), "MUH", MB_OK);
	std::vector<std::string> devs = Utils::StringSplit(all,";");
	
	// now we know which drivers to load, because the number after every dll specifies which ones we are going to load

	// after loading the dll, query it and save which effects it can handle

	for(unsigned int i=0;i<devs.size();i+=2){
	
		if(atoi(devs[i+1].c_str()) == LOAD_DRIVER)
		{
			
			wchar_t *libText;
			std::string pt = envPath;
			pt.append("\\\\plugins\\\\");
			
			
			pt.append(devs[i].c_str());
			
			libText = new wchar_t[strlen(pt.c_str())+1];
			memset(libText,0,strlen(pt.c_str())+1);
			MultiByteToWideChar(CP_ACP,NULL,pt.c_str(),-1,libText,strlen(pt.c_str())+1);
			
			drv = LoadLibrary(pt.c_str());
			delete []libText;
		
			if(drv != NULL){
				
				// dll got loaded properly

				// get our entrypoint
				InitDeviceDriverPtr = (ctor_b_InitDeviceDriver) GetProcAddress(drv,"ctor_b_InitDeviceDriver");

				if (NULL != InitDeviceDriverPtr)
				{
					// add the driver to our list
					DeviceInterface *devI = InitDeviceDriverPtr(disableFateTime);	

					ptr<std::vector<int>> vec;				// we are responsible for the vector ...

					vec = new std::vector<int>();			

					devI->getSupportedSensoryEffects(vec);

					devices.insert(pair<DeviceInterface *,ptr<std::vector<int>>>(devI,vec));
					// now we have our driver loaded
			    	cout << "Loaded device driver successfuly!"<< endl;
					
					loadedPlugins.push_back(drv);
					
				}else{
					std::string error_msg;
					error_msg.append("Error at loading driver: ");
					error_msg.append(devs[i].c_str());
					MessageBox(NULL, error_msg.c_str(), "Ambient Library - Error", MB_OK);
					cout << "Error at loading driver: "<< devs[i].c_str() << endl;
					errorMessage = DEVICE_ERROR_LOADING_DRIVERS;
					FreeLibrary(drv);
				}

			}else{
				cout << "No such device driver could be found: " << devs[i].c_str() << endl;
			}

		}else{

			//MessageBox(NULL, devs[i].c_str(), "Not Loading..", MB_OK);
		}
	}
}
开发者ID:dazedsheep,项目名称:AmbientLib,代码行数:101,代码来源:DeviceContext.cpp

示例12: bindBufferDedicated

MovePtr<Allocation> bindBufferDedicated (const InstanceInterface& vki, const DeviceInterface& vkd, const VkPhysicalDevice physDevice, const VkDevice device, const VkBuffer buffer, const MemoryRequirement requirement)
{
	MovePtr<Allocation> alloc(allocateDedicated(vki, vkd, physDevice, device, buffer, requirement));
	VK_CHECK(vkd.bindBufferMemory(device, buffer, alloc->getMemory(), alloc->getOffset()));
	return alloc;
}
开发者ID:jekstrand,项目名称:Vulkan-CTS,代码行数:6,代码来源:vktPipelineMakeUtil.cpp

示例13: bindBuffer

MovePtr<Allocation> bindBuffer (const DeviceInterface& vk, const VkDevice device, Allocator& allocator, const VkBuffer buffer, const MemoryRequirement requirement)
{
	MovePtr<Allocation> alloc(allocator.allocate(getBufferMemoryRequirements(vk, device, buffer), requirement));
	VK_CHECK(vk.bindBufferMemory(device, buffer, alloc->getMemory(), alloc->getOffset()));
	return alloc;
}
开发者ID:jekstrand,项目名称:Vulkan-CTS,代码行数:6,代码来源:vktPipelineMakeUtil.cpp

示例14: bindImage

MovePtr<Allocation> bindImage (const DeviceInterface& vk, const VkDevice device, Allocator& allocator, const VkImage image, const MemoryRequirement requirement)
{
	MovePtr<Allocation> alloc = allocator.allocate(getImageMemoryRequirements(vk, device, image), requirement);
	VK_CHECK(vk.bindImageMemory(device, image, alloc->getMemory(), alloc->getOffset()));
	return alloc;
}
开发者ID:jekstrand,项目名称:Vulkan-CTS,代码行数:6,代码来源:vktPipelineMakeUtil.cpp

示例15: void

/*
 * Native kernel
 */
NativeKernelEvent::NativeKernelEvent(CommandQueue *parent,
                                     void (*user_func)(void *),
                                     void *args,
                                     size_t cb_args,
                                     cl_uint num_mem_objects,
                                     const MemObject **mem_list,
                                     const void **args_mem_loc,
                                     cl_uint num_events_in_wait_list,
                                     const Event **event_wait_list,
                                     cl_int *errcode_ret)
: Event (parent, Queued, num_events_in_wait_list, event_wait_list, errcode_ret),
  p_user_func((void *)user_func), p_args(0)
{
    if (*errcode_ret != CL_SUCCESS) return;

    // Parameters sanity
    if (!user_func)
    {
        *errcode_ret = CL_INVALID_VALUE;
        return;
    }

    if (!args && (cb_args || num_mem_objects))
    {
        *errcode_ret = CL_INVALID_VALUE;
        return;
    }

    if (args && !cb_args)
    {
        *errcode_ret = CL_INVALID_VALUE;
        return;
    }

    if (num_mem_objects && (!mem_list || !args_mem_loc))
    {
        *errcode_ret = CL_INVALID_VALUE;
        return;
    }

    if (!num_mem_objects && (mem_list || args_mem_loc))
    {
        *errcode_ret = CL_INVALID_VALUE;
        return;
    }

    // Check that the device can execute a native kernel
    DeviceInterface *device;
    cl_device_exec_capabilities caps;

    *errcode_ret = parent->info(CL_QUEUE_DEVICE, sizeof(DeviceInterface *),
                                &device, 0);

    if (*errcode_ret != CL_SUCCESS)
        return;

    *errcode_ret = device->info(CL_DEVICE_EXECUTION_CAPABILITIES,
                                sizeof(cl_device_exec_capabilities), &caps, 0);

    if (*errcode_ret != CL_SUCCESS)
        return;

    if ((caps & CL_EXEC_NATIVE_KERNEL) == 0)
    {
        *errcode_ret = CL_INVALID_OPERATION;
        return;
    }

    // Copy the arguments in a new list
    if (cb_args)
    {
        p_args = std::malloc(cb_args);

        if (!p_args)
        {
            *errcode_ret = CL_OUT_OF_HOST_MEMORY;
            return;
        }

        std::memcpy((void *)p_args, (void *)args, cb_args);

        // Replace memory objects with global pointers
        for (cl_uint i=0; i<num_mem_objects; ++i)
        {
            const MemObject *buffer = mem_list[i];
            const char *loc = (const char *)args_mem_loc[i];

            if (!buffer)
            {
                *errcode_ret = CL_INVALID_MEM_OBJECT;
                return;
            }

            // We need to do relocation : loc is in args, we need it in p_args
            size_t delta = (char *)p_args - (char *)args;
            loc += delta;

//.........这里部分代码省略.........
开发者ID:grubbymits,项目名称:esdg-opencl,代码行数:101,代码来源:events.cpp


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