CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/GPU/D3D11/TextureCacheD3D11.h
Views: 1401
// Copyright (c) 2017- PPSSPP Project.12// This program is free software: you can redistribute it and/or modify3// it under the terms of the GNU General Public License as published by4// the Free Software Foundation, version 2.0 or later versions.56// This program is distributed in the hope that it will be useful,7// but WITHOUT ANY WARRANTY; without even the implied warranty of8// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9// GNU General Public License 2.0 for more details.1011// A copy of the GPL 2.0 should have been included with the program.12// If not, see http://www.gnu.org/licenses/1314// Official git repository and contact information can be found at15// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.1617#pragma once1819#include "Common/CommonWindows.h"2021#include <d3d11.h>2223#include "GPU/GPU.h"24#include "GPU/GPUInterface.h"25#include "GPU/Common/TextureCacheCommon.h"2627struct VirtualFramebuffer;2829class FramebufferManagerD3D11;30class TextureShaderCache;31class ShaderManagerD3D11;3233class SamplerCacheD3D11 {34public:35SamplerCacheD3D11() {}36~SamplerCacheD3D11();37ID3D11SamplerState *GetOrCreateSampler(ID3D11Device *device, const SamplerCacheKey &key);3839private:40std::map<SamplerCacheKey, ID3D11SamplerState *> cache_;41};4243class TextureCacheD3D11 : public TextureCacheCommon {44public:45TextureCacheD3D11(Draw::DrawContext *draw, Draw2D *draw2D);46~TextureCacheD3D11();4748void SetFramebufferManager(FramebufferManagerD3D11 *fbManager);4950void ForgetLastTexture() override;5152bool GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level, bool *isFramebuffer) override;5354void DeviceLost() override { draw_ = nullptr; }55void DeviceRestore(Draw::DrawContext *draw) override { draw_ = draw; }5657protected:58void BindTexture(TexCacheEntry *entry) override;59void Unbind() override;60void ReleaseTexture(TexCacheEntry *entry, bool delete_them) override;61void BindAsClutTexture(Draw::Texture *tex, bool smooth) override;62void ApplySamplingParams(const SamplerCacheKey &key) override;63void *GetNativeTextureView(const TexCacheEntry *entry) override;6465private:66DXGI_FORMAT GetDestFormat(GETextureFormat format, GEPaletteFormat clutFormat) const;67void UpdateCurrentClut(GEPaletteFormat clutFormat, u32 clutBase, bool clutIndexIsSimple) override;6869void BuildTexture(TexCacheEntry *const entry) override;7071ID3D11Device *device_;72ID3D11DeviceContext *context_;7374ID3D11Resource *&DxTex(const TexCacheEntry *entry) {75return (ID3D11Resource *&)entry->texturePtr;76}77ID3D11ShaderResourceView *DxView(const TexCacheEntry *entry) {78return (ID3D11ShaderResourceView *)entry->textureView;79}8081SamplerCacheD3D11 samplerCache_;8283ID3D11ShaderResourceView *lastBoundTexture;84ID3D11Buffer *depalConstants_;85};8687DXGI_FORMAT GetClutDestFormatD3D11(GEPaletteFormat format);888990