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


C++ TexturePtr::getImplementation方法代码示例

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


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

示例1: operator

	Error operator()(GlState&)
	{
		TextureImpl::copy(m_src->getImplementation(),
			m_srcSurf,
			m_dest->getImplementation(),
			m_destSurf);
		return ErrorCode::NONE;
	}
开发者ID:Al1a123,项目名称:anki-3d-engine,代码行数:8,代码来源:CommandBuffer.cpp

示例2: generateMipmaps

//==============================================================================
void CommandBufferImpl::generateMipmaps(
	TexturePtr tex, U depth, U face, U layer)
{
	commandCommon();
	const TextureImpl& impl = tex->getImplementation();
	ANKI_ASSERT(impl.m_type != TextureType::_3D && "Not design for that ATM");

	U mipCount = computeMaxMipmapCount(impl.m_width, impl.m_height);

	for(U i = 0; i < mipCount - 1; ++i)
	{
		// Transition source
		if(i > 0)
		{
			VkImageSubresourceRange range;
			impl.computeSubResourceRange(
				TextureSurfaceInfo(i, depth, face, layer), range);

			setImageBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT,
				VK_ACCESS_TRANSFER_WRITE_BIT,
				VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
				VK_PIPELINE_STAGE_TRANSFER_BIT,
				VK_ACCESS_TRANSFER_READ_BIT,
				VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
				impl.m_imageHandle,
				range);
		}

		// Transition destination
		{
			VkImageSubresourceRange range;
			impl.computeSubResourceRange(
				TextureSurfaceInfo(i + 1, depth, face, layer), range);

			setImageBarrier(VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT,
				0,
				VK_IMAGE_LAYOUT_UNDEFINED,
				VK_PIPELINE_STAGE_TRANSFER_BIT,
				VK_ACCESS_TRANSFER_WRITE_BIT,
				VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
				impl.m_imageHandle,
				range);
		}

		// Setup the blit struct
		I32 srcWidth = impl.m_width >> i;
		I32 srcHeight = impl.m_height >> i;

		I32 dstWidth = impl.m_width >> i;
		I32 dstHeight = impl.m_height >> i;

		ANKI_ASSERT(
			srcWidth > 0 && srcHeight > 0 && dstWidth > 0 && dstHeight > 0);

		VkImageBlit blit;
		blit.srcSubresource.aspectMask = impl.m_aspect;
		blit.srcSubresource.baseArrayLayer = layer;
		blit.srcSubresource.layerCount = 1;
		blit.srcSubresource.mipLevel = i;
		blit.srcOffsets[0] = {0, 0, 0};
		blit.srcOffsets[1] = {srcWidth, srcHeight, 1};

		blit.dstSubresource.aspectMask = impl.m_aspect;
		blit.dstSubresource.baseArrayLayer = layer;
		blit.dstSubresource.layerCount = 1;
		blit.dstSubresource.mipLevel = i + 1;
		blit.dstOffsets[0] = {0, 0, 0};
		blit.dstOffsets[1] = {dstWidth, dstHeight, 1};

		vkCmdBlitImage(m_handle,
			impl.m_imageHandle,
			VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
			impl.m_imageHandle,
			VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
			1,
			&blit,
			VK_FILTER_LINEAR);
	}

	// Hold the reference
	m_texList.pushBack(m_alloc, tex);
}
开发者ID:Al1a123,项目名称:anki-3d-engine,代码行数:83,代码来源:CommandBufferImpl.cpp


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