/* * Copyright (C) 2007-2009 Gabest * http://www.gabest.org * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA. * http://www.gnu.org/copyleft/gpl.html * */ #pragma once #include "GSRenderer.h" #include "GSDevice11.h" class GSRendererCS : public GSRenderer { struct VSSelector { union { struct { uint32 tme:1; uint32 fst:1; }; uint32 key; }; operator uint32() {return key & 0x3;} VSSelector() : key(0) {} }; __aligned(struct, 32) VSConstantBuffer { GSVector4 VertexScale; GSVector4 VertexOffset; }; struct GSSelector { union { struct { uint32 iip:1; uint32 prim:2; }; uint32 key; }; operator uint32() {return key & 0x7;} GSSelector() : key(0) {} }; struct PSSelector { union { struct { uint32 fpsm:6; uint32 zpsm:6; }; uint32 key; }; operator uint32() {return key & 0x3ff;} PSSelector() : key(0) {} }; __aligned(struct, 32) PSConstantBuffer { uint32 fm; uint32 zm; }; CComPtr m_dss; CComPtr m_bs; CComPtr m_ss; CComPtr m_lb; CComPtr m_lb_uav; CComPtr m_lb_srv; CComPtr m_sob; CComPtr m_sob_uav; CComPtr m_sob_srv; CComPtr m_vm; //CComPtr m_vm; CComPtr m_vm_uav; uint32 m_vm_valid[16]; CComPtr m_pb; //CComPtr m_pb; hash_map m_vs; CComPtr m_vs_cb; hash_map > m_gs; CComPtr m_ps0; hash_map > m_ps1; CComPtr m_ps_cb; void Write(GSOffset* o, const GSVector4i& r); void Read(GSOffset* o, const GSVector4i& r, bool invalidate); struct OffsetBuffer { CComPtr row, col; CComPtr row_srv, col_srv; }; hash_map m_offset; bool GetOffsetBuffer(OffsetBuffer** fzbo); protected: GSTexture* m_texture[2]; uint8* m_output; bool CreateDevice(GSDevice* dev); void ResetDevice(); void VSync(int field); GSTexture* GetOutput(int i); void Draw(); void InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r); void InvalidateLocalMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool clut); public: GSRendererCS(); virtual ~GSRendererCS(); };