Remove static gs lib (#254)

* GS 'plugin' no longer a static lib - move to pcsx2/GS

* Linux is case-sensitive, so ensure file is properly referenced
This commit is contained in:
LibretroAdmin 2023-01-12 16:03:00 +01:00 committed by GitHub
parent a2e0895f2e
commit aa9232052a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
114 changed files with 1984 additions and 2012 deletions

View File

@ -51,8 +51,3 @@ endif()
# make pcsx2
add_subdirectory(pcsx2)
# make plugins
if(EXISTS "${CMAKE_SOURCE_DIR}/plugins")
add_subdirectory(plugins)
endif()

View File

@ -58,43 +58,4 @@ typedef struct _keyEvent
u32 evt;
} keyEvent;
///////////////////////////////////////////////////////////////////////
// key values:
/* key values must be OS dependant:
win32: the VK_XXX will be used (WinUser)
linux: the XK_XXX will be used (XFree86)
*/
#ifdef __cplusplus
extern "C" {
#endif
/* GS plugin API */
// basic funcs
s32 CALLBACK GSinit(void);
s32 CALLBACK GSopen2(u32 flags, u8* basemem);
void CALLBACK GSclose(void);
void CALLBACK GSshutdown(void);
void CALLBACK GSvsync(int field);
void CALLBACK GSgifTransfer(const u8 *pMem, u32 addr);
void CALLBACK GSgifTransfer1(u8 *pMem, u32 addr);
void CALLBACK GSgifTransfer2(u8 *pMem, u32 size);
void CALLBACK GSgifTransfer3(u8 *pMem, u32 size);
void CALLBACK GSgifSoftReset(u32 mask);
void CALLBACK GSInitAndReadFIFO(u8 *mem, int qwc);
// extended funcs
void CALLBACK GSsetGameCRC(int crc, int gameoptions);
void CALLBACK GSreset(void);
s32 CALLBACK GSfreeze(int mode, freezeData *data);
#ifdef __cplusplus
} // End extern "C"
#endif
#endif /* __PS2EDEFS_H__ */

View File

@ -1,9 +1,3 @@
if (openSUSE)
# openSUSE don't install wx in a standard library system
# path. Let's bypass the dynamic linker and hardcode the path.
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
endif()
# Check that people use the good file
if(NOT TOP_CMAKE_WAS_SOURCED)
message(FATAL_ERROR "
@ -20,6 +14,24 @@ set(CommonFlags
-Werror=date-time
)
if (NOT MSVC)
set(CommonFlags
-Wno-unknown-pragmas
-Wno-parentheses
-Wunused-variable # __dummy variable need to be investigated
)
endif()
# The next two need to be looked at, but spam really badly in gcc 8.
# Largely class alignment in GSDevice.h and memcpy in GSVector*.h.
if(GCC_VERSION VERSION_EQUAL "8.0" OR GCC_VERSION VERSION_GREATER "8.0")
set(CommonFlags
${CommonFlags}
-Wno-class-memaccess
-Wno-packed-not-aligned
)
endif()
if ("${PGO}" STREQUAL "generate")
set(pcsx2FinalFlags -fprofile-generate)
elseif("${PGO}" STREQUAL "use")
@ -196,8 +208,8 @@ set(pcsx2CDVDHeaders
CDVD/zlib_indexed.h
)
# SPU2 sources
set(pcsx2SPU2Sources
# SPU2 sources
set(pcsx2SPU2Sources
SPU2/ADSR.cpp
SPU2/DplIIdecoder.cpp
SPU2/Dma.cpp
@ -208,7 +220,7 @@ set(pcsx2CDVDHeaders
SPU2/Reverb.cpp
SPU2/spu2freeze.cpp
SPU2/spu2sys.cpp
)
)
# SPU2 headers
set(pcsx2SPU2Headers
@ -220,6 +232,134 @@ set(pcsx2SPU2Headers
SPU2/SndOut.h
)
# GS sources
set(pcsx2GSSources
GS/GS.cpp
GS/GSBlock.cpp
GS/GSClut.cpp
GS/GSCodeBuffer.cpp
GS/GSCrc.cpp
GS/GSDrawingContext.cpp
GS/GSLocalMemory.cpp
GS/GSState.cpp
GS/GSTables.cpp
GS/GSUtil.cpp
GS/GSVector.cpp
GS/Renderers/Common/GSDevice.cpp
GS/Renderers/Common/GSDirtyRect.cpp
GS/Renderers/Common/GSRenderer.cpp
GS/Renderers/Common/GSTexture.cpp
GS/Renderers/Common/GSVertexTrace.cpp
GS/Renderers/HW/GSHwHack.cpp
GS/Renderers/HW/GSRendererHW.cpp
GS/Renderers/HW/GSTextureCache.cpp
GS/Renderers/SW/GSDrawScanline.cpp
GS/Renderers/SW/GSDrawScanlineCodeGenerator.cpp
GS/Renderers/SW/GSDrawScanlineCodeGenerator.x64.cpp
GS/Renderers/SW/GSDrawScanlineCodeGenerator.x64.avx.cpp
GS/Renderers/SW/GSDrawScanlineCodeGenerator.x64.avx2.cpp
GS/Renderers/SW/GSDrawScanlineCodeGenerator.x86.cpp
GS/Renderers/SW/GSDrawScanlineCodeGenerator.x86.avx.cpp
GS/Renderers/SW/GSDrawScanlineCodeGenerator.x86.avx2.cpp
GS/Renderers/SW/GSRasterizer.cpp
GS/Renderers/SW/GSRendererSW.cpp
GS/Renderers/SW/GSSetupPrimCodeGenerator.cpp
GS/Renderers/SW/GSSetupPrimCodeGenerator.x64.cpp
GS/Renderers/SW/GSSetupPrimCodeGenerator.x64.avx.cpp
GS/Renderers/SW/GSSetupPrimCodeGenerator.x64.avx2.cpp
GS/Renderers/SW/GSSetupPrimCodeGenerator.x86.cpp
GS/Renderers/SW/GSSetupPrimCodeGenerator.x86.avx.cpp
GS/Renderers/SW/GSSetupPrimCodeGenerator.x86.avx2.cpp
GS/Renderers/SW/GSTextureCacheSW.cpp
GS/Renderers/SW/GSTextureSW.cpp
GS/Renderers/SW/GSVertexSW.cpp
GS/Renderers/OpenGL/GLLoader.cpp
GS/Renderers/OpenGL/GLState.cpp
GS/Renderers/OpenGL/GSDeviceOGL.cpp
GS/Renderers/OpenGL/GSRendererOGL.cpp
GS/Renderers/OpenGL/GSShaderOGL.cpp
GS/Renderers/OpenGL/GSTextureCacheOGL.cpp
GS/Renderers/OpenGL/GSTextureOGL.cpp
)
# GS headers
set(pcsx2GSHeaders
GS/GSAlignedClass.h
GS/GSBlock.h
GS/GSClut.h
GS/GSCodeBuffer.h
GS/GSCrc.h
GS/GSDrawingContext.h
GS/GSDrawingEnvironment.h
GS/GS.h
GS/GSFuncs.h
GS/GSLocalMemory.h
GS/GSState.h
GS/GSTables.h
GS/GSUtil.h
GS/GSVector.h
GS/stdafx.h
GS/Renderers/Common/GSDevice.h
GS/Renderers/Common/GSDirtyRect.h
GS/Renderers/Common/GSFastList.h
GS/Renderers/Common/GSFunctionMap.h
GS/Renderers/Common/GSRenderer.h
GS/Renderers/Common/GSTexture.h
GS/Renderers/Common/GSVertex.h
GS/Renderers/Common/GSVertexTrace.h
GS/Renderers/HW/GSRendererHW.h
GS/Renderers/HW/GSTextureCache.h
GS/Renderers/HW/GSVertexHW.h
GS/Renderers/SW/GSDrawScanlineCodeGenerator.h
GS/Renderers/SW/GSDrawScanline.h
GS/Renderers/SW/GSRasterizer.h
GS/Renderers/SW/GSRendererSW.h
GS/Renderers/SW/GSScanlineEnvironment.h
GS/Renderers/SW/GSSetupPrimCodeGenerator.h
GS/Renderers/SW/GSTextureCacheSW.h
GS/Renderers/SW/GSTextureSW.h
GS/Renderers/SW/GSVertexSW.h
GS/Renderers/OpenGL/GLLoader.h
GS/Renderers/OpenGL/GLState.h
GS/Renderers/OpenGL/GSDeviceOGL.h
GS/Renderers/OpenGL/GSRendererOGL.h
GS/Renderers/OpenGL/GSShaderOGL.h
GS/Renderers/OpenGL/GSTextureCacheOGL.h
GS/Renderers/OpenGL/GSTextureOGL.h
GS/Renderers/OpenGL/GSUniformBufferOGL.h
GS/Renderers/OpenGL/GSVertexArrayOGL.h
GS/xbyak/xbyak.h
GS/xbyak/xbyak_mnemonic.h
GS/xbyak/xbyak_util.h
)
if(Windows)
LIST(APPEND pcsx2GSSources
GS/Renderers/DX11/GSDevice11.cpp
GS/Renderers/DX11/GSRendererDX11.cpp
GS/Renderers/DX11/GSTexture11.cpp
GS/Renderers/DX11/GSTextureCache11.cpp
GS/Renderers/DX11/GSTextureFX11.cpp
)
LIST(APPEND pcsx2GSHeaders
GS/Renderers/DX11/GSDevice11.h
GS/Renderers/DX11/GSRendererDX11.h
GS/Renderers/DX11/GSTexture11.h
GS/Renderers/DX11/GSTextureCache11.h
)
endif()
set(GS_LIBRARIES
${OPENGL_LIBRARIES}
${LIBC_LIBRARIES}
)
if(MSVC)
set(GS_LIBRARIES ${GS_LIBRARIES} d3dcompiler d3d11 dxgi dxguid winmm strmiids opengl32 comsuppw comctl32)
add_definitions(/wd4456 /wd4458 /wd4996 /wd4995 /wd4324 /wd4100 /wd4101 /wd4201 /wd4556 /wd4127 /wd4512)
endif()
# PAD sources
set(pcsx2PADSources
PAD/PAD.cpp
@ -497,6 +637,8 @@ set(pcsx2x86Headers
${pcsx2USBHeaders}
${pcsx2SPU2Sources}
${pcsx2SPU2Headers}
${pcsx2GSSources}
${pcsx2GSHeaders}
${pcsx2DebugToolsSources}
${pcsx2GuiSources}
${pcsx2GuiHeaders}
@ -532,13 +674,14 @@ set(pcsx2FinalLibs
Utilities
x86emitter
${wxWidgets_LIBRARIES}
${GS_LIBRARIES}
${ZLIB_LIBRARIES}
${AIO_LIBRARIES}
${GCOV_LIBRARIES}
${Platform_Libs}
)
set(pcsx2FinalLibs GS ${pcsx2FinalLibs})
set(pcsx2FinalLibs ${pcsx2FinalLibs})
if(MSVC)
set(pcsx2FinalSources ${pcsx2FinalSources})
endif()

View File

@ -56,7 +56,7 @@ GSVector4i GSClientRect(void)
return GSVector4i(0, 0, internal_res.x, internal_res.y);
}
EXPORT_C_(int) GSinit(void)
int GSinit(void)
{
// Vector instructions must be avoided when initialising GS since PCSX2
// can crash if the CPU does not support the instruction set.
@ -86,7 +86,7 @@ EXPORT_C_(int) GSinit(void)
return 0;
}
EXPORT_C GSshutdown(void)
void GSshutdown(void)
{
delete s_gs;
s_gs = nullptr;
@ -95,7 +95,7 @@ EXPORT_C GSshutdown(void)
is_d3d = false;
}
EXPORT_C GSclose(void)
void GSclose(void)
{
if(s_gs == NULL) return;
@ -817,7 +817,7 @@ void GSUpdateOptions(void)
}
EXPORT_C_(int) GSopen2(u32 flags, u8 *basemem)
int GSopen2(u32 flags, u8 *basemem)
{
const bool toggle_state = !!(flags & 4);
@ -863,48 +863,49 @@ EXPORT_C_(int) GSopen2(u32 flags, u8 *basemem)
return _GSopen(m_current_renderer_type, -1, basemem);
}
EXPORT_C GSreset()
void GSreset(void)
{
s_gs->Reset();
}
EXPORT_C GSgifSoftReset(u32 mask)
void GSgifSoftReset(u32 mask)
{
s_gs->SoftReset(mask);
}
EXPORT_C GSInitAndReadFIFO(u8* mem, u32 size)
void GSInitAndReadFIFO(u8* mem, u32 size)
{
s_gs->InitAndReadFIFO(mem, size);
}
EXPORT_C GSgifTransfer(const u8* mem, u32 size)
void GSgifTransfer(const u8* mem, u32 size)
{
s_gs->Transfer<3>(mem, size);
}
EXPORT_C GSgifTransfer1(u8* mem, u32 addr)
void GSgifTransfer1(u8* mem, u32 addr)
{
s_gs->Transfer<0>(const_cast<u8*>(mem) + addr, (0x4000 - addr) / 16);
}
EXPORT_C GSgifTransfer2(u8* mem, u32 size)
void GSgifTransfer2(u8* mem, u32 size)
{
s_gs->Transfer<1>(const_cast<u8*>(mem), size);
}
EXPORT_C GSgifTransfer3(u8* mem, u32 size)
void GSgifTransfer3(u8* mem, u32 size)
{
s_gs->Transfer<2>(const_cast<u8*>(mem), size);
}
EXPORT_C GSvsync(int field)
void GSvsync(int field)
{
s_gs->VSync(field);
}
EXPORT_C_(int) GSfreeze(int mode, GSFreezeData* data)
int GSfreeze(int mode, void *_data)
{
GSFreezeData* data = (GSFreezeData*)_data;
switch (mode)
{
case FREEZE_SAVE:
@ -918,7 +919,7 @@ EXPORT_C_(int) GSfreeze(int mode, GSFreezeData* data)
return 0;
}
EXPORT_C GSsetGameCRC(u32 crc, int options)
void GSsetGameCRC(u32 crc, int options)
{
s_gs->SetGameCRC(crc, options);
}

20
pcsx2/GS/GSFuncs.h Normal file
View File

@ -0,0 +1,20 @@
#pragma once
#include "Pcsx2Types.h"
int GSinit(void);
int GSopen2(u32 flags, u8 *basemem);
void GSclose(void);
void GSshutdown(void);
void GSvsync(int field);
void GSgifTransfer(const u8* mem, u32 size);
void GSgifTransfer1(u8* mem, u32 addr);
void GSgifTransfer2(u8* mem, u32 size);
void GSgifTransfer3(u8* mem, u32 size);
void GSgifSoftReset(u32 mask);
void GSInitAndReadFIFO(u8* mem, u32 size);
void GSsetGameCRC(u32 crc, int options);
void GSreset(void);
int GSfreeze(int mode, void *_data);

View File

@ -0,0 +1,39 @@
/*
* 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 "../../GSLocalMemory.h"
#include "../../GSVector.h"
#include "../../xbyak/xbyak_util.h"
class GSCodeGenerator : public Xbyak::CodeGenerator
{
protected:
Xbyak::util::Cpu m_cpu;
public:
GSCodeGenerator(void* code, size_t maxsize)
: Xbyak::CodeGenerator(maxsize, code)
{
}
};

View File

@ -24,7 +24,7 @@
#include "Pcsx2Types.h"
#include "Utilities/ScopedAlloc.h"
#include "stdafx.h"
#include "../../stdafx.h"
template <class T>
struct Element {

View File

@ -22,8 +22,8 @@
#include "Pcsx2Types.h"
#include "GSVertexTrace.h"
#include "GSUtil.h"
#include "GSState.h"
#include "../../GSUtil.h"
#include "../../GSState.h"
GSVector4 GSVertexTrace::s_minmax;

View File

@ -1,162 +1,162 @@
/*
* 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
*
*/
#include "Pcsx2Types.h"
#include "GSTexture11.h"
GSTexture11::GSTexture11(ID3D11Texture2D* texture)
: m_texture(texture), m_layer(0)
{
m_texture->GetDevice(&m_dev);
m_texture->GetDesc(&m_desc);
m_dev->GetImmediateContext(&m_ctx);
m_size.x = (int)m_desc.Width;
m_size.y = (int)m_desc.Height;
if(m_desc.BindFlags & D3D11_BIND_RENDER_TARGET) m_type = RenderTarget;
else if(m_desc.BindFlags & D3D11_BIND_DEPTH_STENCIL) m_type = DepthStencil;
else if(m_desc.BindFlags & D3D11_BIND_SHADER_RESOURCE) m_type = Texture;
else if(m_desc.Usage == D3D11_USAGE_STAGING) m_type = Offscreen;
m_format = (int)m_desc.Format;
m_max_layer = m_desc.MipLevels;
}
bool GSTexture11::Update(const GSVector4i& r, const void* data, int pitch, int layer)
{
if(layer >= m_max_layer)
return true;
if(m_dev && m_texture)
{
D3D11_BOX box = { (UINT)r.left, (UINT)r.top, 0U, (UINT)r.right, (UINT)r.bottom, 1U };
UINT subresource = layer; // MipSlice + (ArraySlice * MipLevels).
m_ctx->UpdateSubresource(m_texture, subresource, &box, data, pitch, 0);
return true;
}
return false;
}
bool GSTexture11::Map(GSMap& m, const GSVector4i* r, int layer)
{
if(r != NULL)
return false;
if(layer >= m_max_layer)
return false;
if(m_texture && m_desc.Usage == D3D11_USAGE_STAGING)
{
D3D11_MAPPED_SUBRESOURCE map;
UINT subresource = layer;
if(SUCCEEDED(m_ctx->Map(m_texture, subresource, D3D11_MAP_READ_WRITE, 0, &map)))
{
m.bits = (u8*)map.pData;
m.pitch = (int)map.RowPitch;
m_layer = layer;
return true;
}
}
return false;
}
void GSTexture11::Unmap()
{
if(m_texture)
{
UINT subresource = m_layer;
m_ctx->Unmap(m_texture, subresource);
}
}
GSTexture11::operator ID3D11Texture2D*()
{
return m_texture;
}
GSTexture11::operator ID3D11ShaderResourceView*()
{
if(!m_srv && m_dev && m_texture)
{
if(m_desc.Format == DXGI_FORMAT_R32G8X24_TYPELESS)
{
D3D11_SHADER_RESOURCE_VIEW_DESC srvd = {};
srvd.Format = DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS;
srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
srvd.Texture2D.MipLevels = 1;
m_dev->CreateShaderResourceView(m_texture, &srvd, &m_srv);
}
else
{
m_dev->CreateShaderResourceView(m_texture, NULL, &m_srv);
}
}
return m_srv;
}
GSTexture11::operator ID3D11RenderTargetView*()
{
if(!m_rtv && m_dev && m_texture)
m_dev->CreateRenderTargetView(m_texture, NULL, &m_rtv);
return m_rtv;
}
GSTexture11::operator ID3D11DepthStencilView*()
{
if(!m_dsv && m_dev && m_texture)
{
if(m_desc.Format == DXGI_FORMAT_R32G8X24_TYPELESS)
{
D3D11_DEPTH_STENCIL_VIEW_DESC dsvd = {};
dsvd.Format = DXGI_FORMAT_D32_FLOAT_S8X24_UINT;
dsvd.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
m_dev->CreateDepthStencilView(m_texture, &dsvd, &m_dsv);
}
else
{
m_dev->CreateDepthStencilView(m_texture, NULL, &m_dsv);
}
}
return m_dsv;
}
bool GSTexture11::Equal(GSTexture11* tex)
{
return tex && m_texture == tex->m_texture;
}
/*
* 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
*
*/
#include "Pcsx2Types.h"
#include "GSTexture11.h"
GSTexture11::GSTexture11(ID3D11Texture2D* texture)
: m_texture(texture), m_layer(0)
{
m_texture->GetDevice(&m_dev);
m_texture->GetDesc(&m_desc);
m_dev->GetImmediateContext(&m_ctx);
m_size.x = (int)m_desc.Width;
m_size.y = (int)m_desc.Height;
if(m_desc.BindFlags & D3D11_BIND_RENDER_TARGET) m_type = RenderTarget;
else if(m_desc.BindFlags & D3D11_BIND_DEPTH_STENCIL) m_type = DepthStencil;
else if(m_desc.BindFlags & D3D11_BIND_SHADER_RESOURCE) m_type = Texture;
else if(m_desc.Usage == D3D11_USAGE_STAGING) m_type = Offscreen;
m_format = (int)m_desc.Format;
m_max_layer = m_desc.MipLevels;
}
bool GSTexture11::Update(const GSVector4i& r, const void* data, int pitch, int layer)
{
if(layer >= m_max_layer)
return true;
if(m_dev && m_texture)
{
D3D11_BOX box = { (UINT)r.left, (UINT)r.top, 0U, (UINT)r.right, (UINT)r.bottom, 1U };
UINT subresource = layer; // MipSlice + (ArraySlice * MipLevels).
m_ctx->UpdateSubresource(m_texture, subresource, &box, data, pitch, 0);
return true;
}
return false;
}
bool GSTexture11::Map(GSMap& m, const GSVector4i* r, int layer)
{
if(r != NULL)
return false;
if(layer >= m_max_layer)
return false;
if(m_texture && m_desc.Usage == D3D11_USAGE_STAGING)
{
D3D11_MAPPED_SUBRESOURCE map;
UINT subresource = layer;
if(SUCCEEDED(m_ctx->Map(m_texture, subresource, D3D11_MAP_READ_WRITE, 0, &map)))
{
m.bits = (u8*)map.pData;
m.pitch = (int)map.RowPitch;
m_layer = layer;
return true;
}
}
return false;
}
void GSTexture11::Unmap()
{
if(m_texture)
{
UINT subresource = m_layer;
m_ctx->Unmap(m_texture, subresource);
}
}
GSTexture11::operator ID3D11Texture2D*()
{
return m_texture;
}
GSTexture11::operator ID3D11ShaderResourceView*()
{
if(!m_srv && m_dev && m_texture)
{
if(m_desc.Format == DXGI_FORMAT_R32G8X24_TYPELESS)
{
D3D11_SHADER_RESOURCE_VIEW_DESC srvd = {};
srvd.Format = DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS;
srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
srvd.Texture2D.MipLevels = 1;
m_dev->CreateShaderResourceView(m_texture, &srvd, &m_srv);
}
else
{
m_dev->CreateShaderResourceView(m_texture, NULL, &m_srv);
}
}
return m_srv;
}
GSTexture11::operator ID3D11RenderTargetView*()
{
if(!m_rtv && m_dev && m_texture)
m_dev->CreateRenderTargetView(m_texture, NULL, &m_rtv);
return m_rtv;
}
GSTexture11::operator ID3D11DepthStencilView*()
{
if(!m_dsv && m_dev && m_texture)
{
if(m_desc.Format == DXGI_FORMAT_R32G8X24_TYPELESS)
{
D3D11_DEPTH_STENCIL_VIEW_DESC dsvd = {};
dsvd.Format = DXGI_FORMAT_D32_FLOAT_S8X24_UINT;
dsvd.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
m_dev->CreateDepthStencilView(m_texture, &dsvd, &m_dsv);
}
else
{
m_dev->CreateDepthStencilView(m_texture, NULL, &m_dsv);
}
}
return m_dsv;
}
bool GSTexture11::Equal(GSTexture11* tex)
{
return tex && m_texture == tex->m_texture;
}

Some files were not shown because too many files have changed in this diff Show More