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


C++ GetResID函数代码示例

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


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

示例1: SERIALISE_ELEMENT

bool WrappedVulkan::Serialise_vkCreateFence(
			Serialiser*                                 localSerialiser,
			VkDevice                                    device,
			const VkFenceCreateInfo*                    pCreateInfo,
			const VkAllocationCallbacks*                pAllocator,
			VkFence*                                    pFence)
{
	SERIALISE_ELEMENT(ResourceId, devId, GetResID(device));
	SERIALISE_ELEMENT(VkFenceCreateInfo, info, *pCreateInfo);
	SERIALISE_ELEMENT(ResourceId, id, GetResID(*pFence));

	if(m_State == READING)
	{
		device = GetResourceManager()->GetLiveHandle<VkDevice>(devId);
		VkFence fence = VK_NULL_HANDLE;

		VkResult ret = ObjDisp(device)->CreateFence(Unwrap(device), &info, NULL, &fence);

		if(ret != VK_SUCCESS)
		{
			RDCERR("Failed on resource serialise-creation, VkResult: 0x%08x", ret);
		}
		else
		{
			ResourceId live = GetResourceManager()->WrapResource(Unwrap(device), fence);
			GetResourceManager()->AddLiveResource(id, fence);
		}
	}

	return true;
}
开发者ID:poppolopoppo,项目名称:renderdoc,代码行数:31,代码来源:vk_sync_funcs.cpp

示例2: SERIALISE_ELEMENT

bool WrappedVulkan::Serialise_vkGetDeviceQueue(Serialiser *localSerialiser, VkDevice device,
                                               uint32_t queueFamilyIndex, uint32_t queueIndex,
                                               VkQueue *pQueue)
{
  SERIALISE_ELEMENT(ResourceId, devId, GetResID(device));
  SERIALISE_ELEMENT(uint32_t, familyIdx, m_SupportedQueueFamily);
  SERIALISE_ELEMENT(uint32_t, idx, queueIndex);
  SERIALISE_ELEMENT(ResourceId, queueId, GetResID(*pQueue));

  if(m_State == READING)
  {
    device = GetResourceManager()->GetLiveHandle<VkDevice>(devId);

    VkQueue queue;
    ObjDisp(device)->GetDeviceQueue(Unwrap(device), familyIdx, idx, &queue);

    GetResourceManager()->WrapResource(Unwrap(device), queue);
    GetResourceManager()->AddLiveResource(queueId, queue);

    if(familyIdx == m_QueueFamilyIdx)
    {
      m_Queue = queue;

      // we can now submit any cmds that were queued (e.g. from creating debug
      // manager on vkCreateDevice)
      SubmitCmds();
    }
  }

  return true;
}
开发者ID:Anteru,项目名称:renderdoc,代码行数:31,代码来源:vk_queue_funcs.cpp

示例3: SERIALISE_ELEMENT

bool WrappedVulkan::Serialise_vkGetSwapchainImagesKHR(
		Serialiser*                              localSerialiser,
		VkDevice                                 device,
		VkSwapchainKHR                           swapchain,
		uint32_t*                                pCount,
		VkImage*                                 pSwapchainImages)
{
	SERIALISE_ELEMENT(ResourceId, devId, GetResID(device));
	SERIALISE_ELEMENT(ResourceId, swapId, GetResID(swapchain));
	SERIALISE_ELEMENT(uint32_t, idx, *pCount);
	SERIALISE_ELEMENT(ResourceId, id, GetResID(*pSwapchainImages));

	if(m_State == READING)
	{
		// use original ID because we don't create a live version of the swapchain
		auto &swapInfo = m_CreationInfo.m_SwapChain[swapId];

		RDCASSERT(idx < swapInfo.images.size(), idx, swapInfo.images.size());
		GetResourceManager()->AddLiveResource(id, swapInfo.images[idx].im);

		m_CreationInfo.m_Image[GetResID(swapInfo.images[idx].im)] = m_CreationInfo.m_Image[swapId];
	}

	return true;
}
开发者ID:Althar93,项目名称:renderdoc,代码行数:25,代码来源:vk_wsi_funcs.cpp

示例4: SERIALISE_ELEMENT

bool WrappedVulkan::Serialise_vkAllocateMemory(
			Serialiser*                                 localSerialiser,
			VkDevice                                    device,
			const VkMemoryAllocateInfo*                 pAllocateInfo,
			const VkAllocationCallbacks*                pAllocator,
			VkDeviceMemory*                             pMemory)
{
	SERIALISE_ELEMENT(ResourceId, devId, GetResID(device));
	SERIALISE_ELEMENT(VkMemoryAllocateInfo, info, *pAllocateInfo);
	SERIALISE_ELEMENT(ResourceId, id, GetResID(*pMemory));

	if(m_State == READING)
	{
		VkDeviceMemory mem = VK_NULL_HANDLE;

		device = GetResourceManager()->GetLiveHandle<VkDevice>(devId);

		// serialised memory type index is non-remapped, so we remap now.
		// PORTABILITY may need to re-write info to change memory type index to the
		// appropriate index on replay
		info.memoryTypeIndex = m_PhysicalDeviceData.memIdxMap[info.memoryTypeIndex];

		VkResult ret = ObjDisp(device)->AllocateMemory(Unwrap(device), &info, NULL, &mem);
		
		if(ret != VK_SUCCESS)
		{
			RDCERR("Failed on resource serialise-creation, VkResult: 0x%08x", ret);
		}
		else
		{
			ResourceId live = GetResourceManager()->WrapResource(Unwrap(device), mem);
			GetResourceManager()->AddLiveResource(id, mem);

			m_CreationInfo.m_Memory[live].Init(GetResourceManager(), m_CreationInfo, &info);

			// create a buffer with the whole memory range bound, for copying to and from
			// conveniently (for initial state data)
			VkBuffer buf = VK_NULL_HANDLE;

			VkBufferCreateInfo bufInfo = {
				VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, NULL, 0,
				info.allocationSize, VK_BUFFER_USAGE_TRANSFER_SRC_BIT|VK_BUFFER_USAGE_TRANSFER_DST_BIT,
			};

			ret = ObjDisp(device)->CreateBuffer(Unwrap(device), &bufInfo, NULL, &buf);
			RDCASSERTEQUAL(ret, VK_SUCCESS);

			ResourceId bufid = GetResourceManager()->WrapResource(Unwrap(device), buf);

			ObjDisp(device)->BindBufferMemory(Unwrap(device), Unwrap(buf), Unwrap(mem), 0);
			
			// register as a live-only resource, so it is cleaned up properly
			GetResourceManager()->AddLiveResource(bufid, buf);

			m_CreationInfo.m_Memory[live].wholeMemBuf = buf;
		}
	}

	return true;
}
开发者ID:281627166,项目名称:renderdoc,代码行数:60,代码来源:vk_resource_funcs.cpp

示例5: DescriptorFromPortableHandle

vector<ResourceId> D3D12RenderState::GetRTVIDs() const
{
  vector<ResourceId> ret;

  if(rtSingle)
  {
    if(!rts.empty())
    {
      const D3D12Descriptor *descs = DescriptorFromPortableHandle(GetResourceManager(), rts[0]);

      for(UINT i = 0; i < rts.size(); i++)
      {
        RDCASSERT(descs[i].GetType() == D3D12Descriptor::TypeRTV);
        ret.push_back(GetResID(descs[i].nonsamp.resource));
      }
    }
  }
  else
  {
    for(UINT i = 0; i < rts.size(); i++)
    {
      WrappedID3D12DescriptorHeap *heap =
          GetResourceManager()->GetLiveAs<WrappedID3D12DescriptorHeap>(rts[0].heap);

      const D3D12Descriptor &desc = heap->GetDescriptors()[rts[i].index];

      RDCASSERT(desc.GetType() == D3D12Descriptor::TypeRTV);
      ret.push_back(GetResID(desc.nonsamp.resource));
    }
  }

  return ret;
}
开发者ID:Nexuapex,项目名称:renderdoc,代码行数:33,代码来源:d3d12_state.cpp

示例6: SCOPED_LOCK

VkResult WrappedVulkan::vkFlushMappedMemoryRanges(
			VkDevice                                    device,
			uint32_t                                    memRangeCount,
			const VkMappedMemoryRange*                  pMemRanges)
{
	if(m_State >= WRITING)
	{
		bool capframe = false;
		{
			SCOPED_LOCK(m_CapTransitionLock);
			capframe = (m_State == WRITING_CAPFRAME);
		}

		for(uint32_t i = 0; i < memRangeCount; i++)
		{
			ResourceId memid = GetResID(pMemRanges[i].memory);
			
			MemMapState *state = GetRecord(pMemRanges[i].memory)->memMapState;
			state->mapFlushed = true;

			if(state->mappedPtr == NULL)
			{
				RDCERR("Flushing memory that isn't currently mapped");
				continue;
			}

			if(capframe)
			{
				CACHE_THREAD_SERIALISER();

				SCOPED_SERIALISE_CONTEXT(FLUSH_MEM);
				Serialise_vkFlushMappedMemoryRanges(localSerialiser, device, 1, pMemRanges + i);

				m_FrameCaptureRecord->AddChunk(scope.Get());
				GetResourceManager()->MarkResourceFrameReferenced(GetResID(pMemRanges[i].memory), eFrameRef_Write);
			}
			else
			{
				GetResourceManager()->MarkDirtyResource(memid);
			}
		}
	}
	
	VkMappedMemoryRange *unwrapped = GetTempArray<VkMappedMemoryRange>(memRangeCount);
	for(uint32_t i=0; i < memRangeCount; i++)
	{
		unwrapped[i] = pMemRanges[i];
		unwrapped[i].memory = Unwrap(unwrapped[i].memory);
	}

	VkResult ret = ObjDisp(device)->FlushMappedMemoryRanges(Unwrap(device), memRangeCount, unwrapped);

	return ret;
}
开发者ID:281627166,项目名称:renderdoc,代码行数:54,代码来源:vk_resource_funcs.cpp

示例7: SERIALISE_ELEMENT

bool WrappedVulkan::Serialise_vkCreateGraphicsPipelines(
    Serialiser *localSerialiser, VkDevice device, VkPipelineCache pipelineCache, uint32_t count,
    const VkGraphicsPipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator,
    VkPipeline *pPipelines)
{
  SERIALISE_ELEMENT(ResourceId, devId, GetResID(device));
  SERIALISE_ELEMENT(ResourceId, cacheId, GetResID(pipelineCache));
  SERIALISE_ELEMENT(VkGraphicsPipelineCreateInfo, info, *pCreateInfos);
  SERIALISE_ELEMENT(ResourceId, id, GetResID(*pPipelines));

  if(m_State == READING)
  {
    VkPipeline pipe = VK_NULL_HANDLE;

    device = GetResourceManager()->GetLiveHandle<VkDevice>(devId);
    // don't use pipeline caches on replay
    pipelineCache =
        VK_NULL_HANDLE;    // GetResourceManager()->GetLiveHandle<VkPipelineCache>(cacheId);

    VkResult ret = ObjDisp(device)->CreateGraphicsPipelines(Unwrap(device), Unwrap(pipelineCache),
                                                            1, &info, NULL, &pipe);

    if(ret != VK_SUCCESS)
    {
      RDCERR("Failed on resource serialise-creation, VkResult: 0x%08x", ret);
    }
    else
    {
      ResourceId live;

      if(GetResourceManager()->HasWrapper(ToTypedHandle(pipe)))
      {
        live = GetResourceManager()->GetNonDispWrapper(pipe)->id;

        // destroy this instance of the duplicate, as we must have matching create/destroy
        // calls and there won't be a wrapped resource hanging around to destroy this one.
        ObjDisp(device)->DestroyPipeline(Unwrap(device), pipe, NULL);

        // whenever the new ID is requested, return the old ID, via replacements.
        GetResourceManager()->ReplaceResource(id, GetResourceManager()->GetOriginalID(live));
      }
      else
      {
        live = GetResourceManager()->WrapResource(Unwrap(device), pipe);
        GetResourceManager()->AddLiveResource(id, pipe);

        m_CreationInfo.m_Pipeline[live].Init(GetResourceManager(), m_CreationInfo, &info);
      }
    }
  }

  return true;
}
开发者ID:AJ92,项目名称:renderdoc,代码行数:53,代码来源:vk_shader_funcs.cpp

示例8: SERIALISE_ELEMENT

bool WrappedVulkan::Serialise_vkCreateDescriptorSetLayout(
    Serialiser*                                 localSerialiser,
    VkDevice                                    device,
    const VkDescriptorSetLayoutCreateInfo*      pCreateInfo,
    const VkAllocationCallbacks*                pAllocator,
    VkDescriptorSetLayout*                      pSetLayout)
{
    SERIALISE_ELEMENT(ResourceId, devId, GetResID(device));
    SERIALISE_ELEMENT(VkDescriptorSetLayoutCreateInfo, info, *pCreateInfo);
    SERIALISE_ELEMENT(ResourceId, id, GetResID(*pSetLayout));

    if(m_State == READING)
    {
        VkDescriptorSetLayout layout = VK_NULL_HANDLE;

        device = GetResourceManager()->GetLiveHandle<VkDevice>(devId);

        VkResult ret = ObjDisp(device)->CreateDescriptorSetLayout(Unwrap(device), &info, NULL, &layout);

        if(ret != VK_SUCCESS)
        {
            RDCERR("Failed on resource serialise-creation, VkResult: 0x%08x", ret);
        }
        else
        {
            ResourceId live;

            if(GetResourceManager()->HasWrapper(ToTypedHandle(layout)))
            {
                live = GetResourceManager()->GetNonDispWrapper(layout)->id;

                // destroy this instance of the duplicate, as we must have matching create/destroy
                // calls and there won't be a wrapped resource hanging around to destroy this one.
                ObjDisp(device)->DestroyDescriptorSetLayout(Unwrap(device), layout, NULL);

                // whenever the new ID is requested, return the old ID, via replacements.
                GetResourceManager()->ReplaceResource(id, GetResourceManager()->GetOriginalID(live));
            }
            else
            {
                live = GetResourceManager()->WrapResource(Unwrap(device), layout);
                GetResourceManager()->AddLiveResource(id, layout);

                m_CreationInfo.m_DescSetLayout[live].Init(GetResourceManager(), m_CreationInfo, &info);
            }
        }
    }

    return true;
}
开发者ID:Zorro666,项目名称:renderdoc,代码行数:50,代码来源:vk_descriptor_funcs.cpp

示例9: GetRecord

VkResult WrappedVulkan::vkBindBufferMemory(
    VkDevice                                    device,
    VkBuffer                                    buffer,
    VkDeviceMemory                              mem,
    VkDeviceSize                                memOffset)
{
	VkResourceRecord *record = GetRecord(buffer);

	if(m_State >= WRITING)
	{
		Chunk *chunk = NULL;

		{
			CACHE_THREAD_SERIALISER();
		
			SCOPED_SERIALISE_CONTEXT(BIND_BUFFER_MEM);
			Serialise_vkBindBufferMemory(localSerialiser, device, buffer, mem, memOffset);

			chunk = scope.Get();
		}
	
		// memory object bindings are immutable and must happen before creation or use,
		// so this can always go into the record, even if a resource is created and bound
		// to memory mid-frame
		record->AddChunk(chunk);

		record->AddParent(GetRecord(mem));
		record->baseResource = GetResID(mem);
	}

	return ObjDisp(device)->BindBufferMemory(Unwrap(device), Unwrap(buffer), Unwrap(mem), memOffset);
}
开发者ID:281627166,项目名称:renderdoc,代码行数:32,代码来源:vk_resource_funcs.cpp

示例10: SERIALISE_ELEMENT

bool WrappedVulkan::Serialise_vkCmdSetDepthBounds(Serialiser *localSerialiser,
                                                  VkCommandBuffer cmdBuffer, float minDepthBounds,
                                                  float maxDepthBounds)
{
  SERIALISE_ELEMENT(ResourceId, cmdid, GetResID(cmdBuffer));
  SERIALISE_ELEMENT(float, mind, minDepthBounds);
  SERIALISE_ELEMENT(float, maxd, maxDepthBounds);

  Serialise_DebugMessages(localSerialiser, false);

  if(m_State < WRITING)
    m_LastCmdBufferID = cmdid;

  if(m_State == EXECUTING)
  {
    if(ShouldRerecordCmd(cmdid) && InRerecordRange(cmdid))
    {
      cmdBuffer = RerecordCmdBuf(cmdid);
      ObjDisp(cmdBuffer)->CmdSetDepthBounds(Unwrap(cmdBuffer), mind, maxd);
      m_RenderState.mindepth = mind;
      m_RenderState.maxdepth = maxd;
    }
  }
  else if(m_State == READING)
  {
    cmdBuffer = GetResourceManager()->GetLiveHandle<VkCommandBuffer>(cmdid);

    ObjDisp(cmdBuffer)->CmdSetDepthBounds(Unwrap(cmdBuffer), mind, maxd);
  }

  return true;
}
开发者ID:DrChat,项目名称:renderdoc,代码行数:32,代码来源:vk_dynamic_funcs.cpp

示例11: SERIALISE_ELEMENT

bool WrappedID3D12Device::Serialise_CreateCommandSignature(const D3D12_COMMAND_SIGNATURE_DESC *pDesc,
                                                           ID3D12RootSignature *pRootSignature,
                                                           REFIID riid, void **ppvCommandSignature)
{
  SERIALISE_ELEMENT(D3D12_COMMAND_SIGNATURE_DESC, desc, *pDesc);
  SERIALISE_ELEMENT(ResourceId, RootSig, GetResID(pRootSignature));
  SERIALISE_ELEMENT(IID, guid, riid);
  SERIALISE_ELEMENT(ResourceId, CommandSig,
                    ((WrappedID3D12CommandSignature *)*ppvCommandSignature)->GetResourceID());

  if(m_State == READING)
  {
    pRootSignature = NULL;
    if(RootSig != ResourceId())
      pRootSignature = GetResourceManager()->GetLiveAs<ID3D12RootSignature>(RootSig);

    ID3D12CommandSignature *ret = NULL;
    HRESULT hr = m_pDevice->CreateCommandSignature(&desc, pRootSignature, guid, (void **)&ret);

    if(FAILED(hr))
    {
      RDCERR("Failed on resource serialise-creation, HRESULT: 0x%08x", hr);
    }
    else
    {
      ret = new WrappedID3D12CommandSignature(ret, this);

      GetResourceManager()->AddLiveResource(CommandSig, ret);
    }
  }

  return true;
}
开发者ID:Anteru,项目名称:renderdoc,代码行数:33,代码来源:d3d12_device_wrap.cpp

示例12: GetResID

void VulkanCreationInfo::BufferView::Init(VulkanResourceManager *resourceMan,
                                          VulkanCreationInfo &info,
                                          const VkBufferViewCreateInfo *pCreateInfo)
{
  buffer = GetResID(pCreateInfo->buffer);
  offset = pCreateInfo->offset;
  size = pCreateInfo->range;
}
开发者ID:cgmb,项目名称:renderdoc,代码行数:8,代码来源:vk_info.cpp

示例13: RDCERR

void VulkanResourceManager::MarkSparseMapReferenced(SparseMapping *sparse)
{
  if(sparse == NULL)
  {
    RDCERR("Unexpected NULL sparse mapping");
    return;
  }

  for(size_t i = 0; i < sparse->opaquemappings.size(); i++)
    MarkResourceFrameReferenced(GetResID(sparse->opaquemappings[i].memory), eFrameRef_Read);

  for(int a = 0; a < NUM_VK_IMAGE_ASPECTS; a++)
    for(VkDeviceSize i = 0;
        sparse->pages[a] &&
        i < VkDeviceSize(sparse->imgdim.width * sparse->imgdim.height * sparse->imgdim.depth);
        i++)
      MarkResourceFrameReferenced(GetResID(sparse->pages[a][i].first), eFrameRef_Read);
}
开发者ID:kvark,项目名称:renderdoc,代码行数:18,代码来源:vk_manager.cpp

示例14: SCOPED_LOCK

// needs to be separate so we don't erase from m_ImageLayouts in other destroy functions
void WrappedVulkan::vkDestroyImage(VkDevice device, VkImage obj, const VkAllocationCallbacks* pAllocator)
{
	{
		SCOPED_LOCK(m_ImageLayoutsLock);
		m_ImageLayouts.erase(GetResID(obj));
	}
	VkImage unwrappedObj = Unwrap(obj);
	GetResourceManager()->ReleaseWrappedResource(obj, true);
	return ObjDisp(device)->DestroyImage(Unwrap(device), unwrappedObj, pAllocator);
}
开发者ID:Althar93,项目名称:renderdoc,代码行数:11,代码来源:vk_misc_funcs.cpp

示例15: ObjDisp

VkResult WrappedVulkan::vkMapMemory(
			VkDevice                                    device,
			VkDeviceMemory                              mem,
			VkDeviceSize                                offset,
			VkDeviceSize                                size,
			VkMemoryMapFlags                            flags,
			void**                                      ppData)
{
	void *realData = NULL;
	VkResult ret = ObjDisp(device)->MapMemory(Unwrap(device), Unwrap(mem), offset, size, flags, &realData);

	if(ret == VK_SUCCESS && realData)
	{
		ResourceId id = GetResID(mem);

		if(m_State >= WRITING)
		{
			VkResourceRecord *memrecord = GetRecord(mem);

			// must have map state, only non host visible memories have no map
			// state, and they can't be mapped!
			RDCASSERT(memrecord->memMapState);
			MemMapState &state = *memrecord->memMapState;

			// ensure size is valid
			RDCASSERT(size == VK_WHOLE_SIZE || (size > 0 && size <= memrecord->Length));

			state.mappedPtr = (byte *)realData;
			state.refData = NULL;

			state.mapOffset = offset;
			state.mapSize = size == VK_WHOLE_SIZE ? memrecord->Length : size;
			state.mapFlushed = false;

			*ppData = realData;

			if(state.mapCoherent)
			{
				SCOPED_LOCK(m_CoherentMapsLock);
				m_CoherentMaps.push_back(memrecord);
			}
		}
		else
		{
			*ppData = realData;
		}
	}
	else
	{
		*ppData = NULL;
	}

	return ret;
}
开发者ID:281627166,项目名称:renderdoc,代码行数:54,代码来源:vk_resource_funcs.cpp


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