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/Directx9/DrawEngineDX9.h
Views: 1401
// Copyright (c) 2012- 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 <d3d9.h>20#include <wrl/client.h>2122#include "Common/Data/Collections/Hashmaps.h"23#include "GPU/GPUState.h"24#include "GPU/Common/GPUDebugInterface.h"25#include "GPU/Common/IndexGenerator.h"26#include "GPU/Common/VertexDecoderCommon.h"27#include "GPU/Common/DrawEngineCommon.h"28#include "GPU/Common/GPUStateUtils.h"29#include "GPU/MiscTypes.h"3031struct DecVtxFormat;32struct UVScale;3334class VSShader;35class ShaderManagerDX9;36class TextureCacheDX9;37class FramebufferManagerDX9;3839class TessellationDataTransferDX9 : public TessellationDataTransfer {40public:41TessellationDataTransferDX9() {}42~TessellationDataTransferDX9() {}43void SendDataToShader(const SimpleVertex *const *points, int size_u, int size_v, u32 vertType, const Spline::Weight2D &weights) override;44};4546// Handles transform, lighting and drawing.47class DrawEngineDX9 : public DrawEngineCommon {48public:49DrawEngineDX9(Draw::DrawContext *draw);50~DrawEngineDX9();5152void DeviceLost() override { draw_ = nullptr; }53void DeviceRestore(Draw::DrawContext *draw) override { draw_ = draw; }5455void SetShaderManager(ShaderManagerDX9 *shaderManager) {56shaderManager_ = shaderManager;57}58void SetTextureCache(TextureCacheDX9 *textureCache) {59textureCache_ = textureCache;60}61void SetFramebufferManager(FramebufferManagerDX9 *fbManager) {62framebufferManager_ = fbManager;63}64void InitDeviceObjects();65void DestroyDeviceObjects();6667void BeginFrame();6869// So that this can be inlined70void Flush() {71if (!numDrawVerts_)72return;73DoFlush();74}7576void FinishDeferred() {77if (!numDrawVerts_)78return;79DecodeVerts(decoded_);80}8182void DispatchFlush() override {83if (!numDrawVerts_)84return;85Flush();86}8788protected:89// Not currently supported.90bool UpdateUseHWTessellation(bool enable) const override { return false; }9192private:93void Invalidate(InvalidationCallbackFlags flags);94void DoFlush();9596void ApplyDrawState(int prim);97void ApplyDrawStateLate();9899HRESULT SetupDecFmtForDraw(const DecVtxFormat &decFmt, u32 pspFmt, IDirect3DVertexDeclaration9 **ppVertexDeclaration);100101LPDIRECT3DDEVICE9 device_ = nullptr;102Draw::DrawContext *draw_;103104DenseHashMap<u32, Microsoft::WRL::ComPtr<IDirect3DVertexDeclaration9>> vertexDeclMap_;105106// SimpleVertex107Microsoft::WRL::ComPtr<IDirect3DVertexDeclaration9> transformedVertexDecl_;108109// Other110ShaderManagerDX9 *shaderManager_ = nullptr;111TextureCacheDX9 *textureCache_ = nullptr;112FramebufferManagerDX9 *framebufferManager_ = nullptr;113114// Hardware tessellation115TessellationDataTransferDX9 *tessDataTransferDX9;116117FBOTexState fboTexBindState_ = FBO_TEX_NONE;118119int lastRenderStepId_ = -1;120121bool fboTexNeedsBind_ = false;122};123124125