Пример #1
0
void D3DPostProcessor::PostProcessEFB(const TargetRectangle& src_rect, const TargetSize& src_size)
{
	// Apply normal post-process process, but to the EFB buffers.
	// Uses the current viewport as the "visible" region to post-process.
	// In D3D, the viewport rectangle must fit within the render target.
	TargetRectangle target_rect;
	TargetSize target_size(src_size.width, src_size.height);
	target_rect.left = src_rect.left >= 0 ? src_rect.left : 0;
	target_rect.top = src_rect.top >= 0 ? src_rect.top : 0;
	target_rect.right = src_rect.right <= src_size.width ? src_rect.right : src_size.width;
	target_rect.bottom = src_rect.bottom <= src_size.height ? src_rect.bottom : src_size.height;

	// Source and target textures, if MSAA is enabled, this needs to be resolved
	D3DTexture2D* color_texture = FramebufferManager::GetResolvedEFBColorTexture();
	D3DTexture2D* depth_texture = nullptr;
	if (m_requires_depth_buffer)
	{
		depth_texture = FramebufferManager::GetResolvedEFBDepthTexture();
	}

	// Invoke post process process
	PostProcess(nullptr, nullptr, nullptr,
		target_rect, target_size, reinterpret_cast<uintptr_t>(color_texture),
		target_rect, target_size, reinterpret_cast<uintptr_t>(depth_texture));

	// Copy back to EFB buffer when multisampling is enabled
	if (g_ActiveConfig.iMultisamples > 1)
		CopyTexture(target_rect, reinterpret_cast<uintptr_t>(FramebufferManager::GetEFBColorTexture()), target_rect, reinterpret_cast<uintptr_t>(color_texture), target_size, -1, false, true);

	g_renderer->RestoreAPIState();
}
Пример #2
0
CTexture *			CTexDict::CombineTextures(uint32 new_texture_checksum, CTexture *p_texture1, CTexture *p_texture2, bool palette_gen)
{
	CTexture *p_new_texture = CopyTexture(new_texture_checksum, p_texture1);

	if (p_new_texture)
	{
		p_new_texture->CombineTextures(p_texture2, palette_gen);
	} else {
		Dbg_Error("Could not create new CTexture for CombineTexture of %x", new_texture_checksum);
	}

	return p_new_texture;
}
Пример #3
0
ovrTextureSwapChain1_3 renderChain(ovrSession1_3 session, ovrSwapTextureSet* ts)
{
	ovrTextureSwapChainWrapper* chainwrapper = getChain(session, ts);

	int currentIndex = 0;
	ovr_GetTextureSwapChainCurrentIndex1_3(session, chainwrapper->swapChain, &currentIndex);

	CopyTexture(chainwrapper->pContext, chainwrapper->textures[currentIndex], &ts->Textures[ts->CurrentIndex]);	
	
	ovr_CommitTextureSwapChain1_3(session, chainwrapper->swapChain);

	return chainwrapper->swapChain;
}
Пример #4
0
	/// <summary>
	/// Generates mipmaps if the specified texture has the levels to accommodate them.
	/// </summary>
	/// <param name="src">The DirectX texture to apply mipmaps to.</param>
	/// <param name="njs_texture">The Dremcast texture to receive the DirectX texture.</param>
	static void __fastcall GenerateMipmaps_c(IDirect3DTexture8* src, NJS_TEXMEMLIST* njs_texture)
	{
		if (src == nullptr || njs_texture == nullptr)
			return;

		if (blacklisted || src->GetLevelCount() > 1)
			goto ABORT;

#ifndef PALLETIZED_MIPMAPS
		Uint32 format = njs_texture->texinfo.texsurface.PixelFormat;

		if (format == NJD_PIXELFORMAT_PALETTIZED_4BPP || format == NJD_PIXELFORMAT_PALETTIZED_8BPP)
			goto ABORT;
#endif

		HRESULT result;

		D3DSURFACE_DESC info;
		result = src->GetLevelDesc(0, &info);
		if (!SUCCEEDED(result))
			goto ABORT;

		IDirect3DTexture8* dest;
		result = Direct3D_Device->CreateTexture(info.Width, info.Height, 0, info.Usage, info.Format, info.Pool, &dest);
		if (!SUCCEEDED(result))
			goto ABORT;

		result = CopyTexture(dest, src, info.Height);
		if (!SUCCEEDED(result))
			goto ABORT;

		result = D3DXFilterTexture(dest, nullptr, D3DX_DEFAULT, D3DX_DEFAULT);
		if (!SUCCEEDED(result))
		{
			PrintDebug("Mipmap generation failed with error code 0x%08X\n", result);
			dest->Release();
			goto ABORT;
		}

		src->Release();
		SetSurface(dest, &njs_texture->texinfo.texsurface);
		return;

	ABORT:
		SetSurface(src, &njs_texture->texinfo.texsurface);
		return;
	}