mirror of https://github.com/PCSX2/pcsx2.git
GS: Convert texture format to enum
This commit is contained in:
parent
1d37ba47f4
commit
a4b8c33cf3
|
@ -135,7 +135,7 @@ void GSDevice::Present(GSTexture* sTex, GSTexture* dTex, const GSVector4& dRect,
|
|||
StretchRect(sTex, dTex, dRect, shader, m_linear_present);
|
||||
}
|
||||
|
||||
GSTexture* GSDevice::FetchSurface(GSTexture::Type type, int w, int h, int format)
|
||||
GSTexture* GSDevice::FetchSurface(GSTexture::Type type, int w, int h, GSTexture::Format format)
|
||||
{
|
||||
const GSVector2i size(w, h);
|
||||
|
||||
|
@ -223,36 +223,44 @@ void GSDevice::PurgePool()
|
|||
}
|
||||
}
|
||||
|
||||
GSTexture* GSDevice::CreateSparseRenderTarget(int w, int h, int format)
|
||||
GSTexture* GSDevice::CreateSparseRenderTarget(int w, int h, GSTexture::Format format)
|
||||
{
|
||||
return FetchSurface(HasColorSparse() ? GSTexture::Type::SparseRenderTarget : GSTexture::Type::RenderTarget, w, h, format);
|
||||
}
|
||||
|
||||
GSTexture* GSDevice::CreateSparseDepthStencil(int w, int h, int format)
|
||||
GSTexture* GSDevice::CreateSparseDepthStencil(int w, int h, GSTexture::Format format)
|
||||
{
|
||||
return FetchSurface(HasDepthSparse() ? GSTexture::Type::SparseDepthStencil : GSTexture::Type::DepthStencil, w, h, format);
|
||||
}
|
||||
|
||||
GSTexture* GSDevice::CreateRenderTarget(int w, int h, int format)
|
||||
GSTexture* GSDevice::CreateRenderTarget(int w, int h, GSTexture::Format format)
|
||||
{
|
||||
return FetchSurface(GSTexture::Type::RenderTarget, w, h, format);
|
||||
}
|
||||
|
||||
GSTexture* GSDevice::CreateDepthStencil(int w, int h, int format)
|
||||
GSTexture* GSDevice::CreateDepthStencil(int w, int h, GSTexture::Format format)
|
||||
{
|
||||
return FetchSurface(GSTexture::Type::DepthStencil, w, h, format);
|
||||
}
|
||||
|
||||
GSTexture* GSDevice::CreateTexture(int w, int h, int format)
|
||||
GSTexture* GSDevice::CreateTexture(int w, int h, GSTexture::Format format)
|
||||
{
|
||||
return FetchSurface(GSTexture::Type::Texture, w, h, format);
|
||||
}
|
||||
|
||||
GSTexture* GSDevice::CreateOffscreen(int w, int h, int format)
|
||||
GSTexture* GSDevice::CreateOffscreen(int w, int h, GSTexture::Format format)
|
||||
{
|
||||
return FetchSurface(GSTexture::Type::Offscreen, w, h, format);
|
||||
}
|
||||
|
||||
GSTexture::Format GSDevice::GetDefaultTextureFormat(GSTexture::Type type)
|
||||
{
|
||||
if (type == GSTexture::Type::DepthStencil || type == GSTexture::Type::SparseDepthStencil)
|
||||
return GSTexture::Format::DepthStencil;
|
||||
else
|
||||
return GSTexture::Format::Color;
|
||||
}
|
||||
|
||||
void GSDevice::StretchRect(GSTexture* sTex, GSTexture* dTex, const GSVector4& dRect, ShaderConvert shader, bool linear)
|
||||
{
|
||||
StretchRect(sTex, GSVector4(0, 0, 1, 1), dTex, dRect, shader, linear);
|
||||
|
@ -390,9 +398,10 @@ bool GSDevice::ResizeTexture(GSTexture** t, GSTexture::Type type, int w, int h)
|
|||
|
||||
if (t2 == NULL || t2->GetWidth() != w || t2->GetHeight() != h)
|
||||
{
|
||||
GSTexture::Format fmt = t2 ? t2->GetFormat() : GetDefaultTextureFormat(type);
|
||||
delete t2;
|
||||
|
||||
t2 = FetchSurface(type, w, h, 0);
|
||||
t2 = FetchSurface(type, w, h, fmt);
|
||||
|
||||
*t = t2;
|
||||
}
|
||||
|
|
|
@ -175,8 +175,8 @@ protected:
|
|||
unsigned int m_frame; // for ageing the pool
|
||||
bool m_linear_present;
|
||||
|
||||
virtual GSTexture* CreateSurface(GSTexture::Type type, int w, int h, int format) = 0;
|
||||
virtual GSTexture* FetchSurface(GSTexture::Type type, int w, int h, int format);
|
||||
virtual GSTexture* CreateSurface(GSTexture::Type type, int w, int h, GSTexture::Format format) = 0;
|
||||
virtual GSTexture* FetchSurface(GSTexture::Type type, int w, int h, GSTexture::Format format);
|
||||
|
||||
virtual void DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c) = 0;
|
||||
virtual void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset) = 0;
|
||||
|
@ -220,14 +220,15 @@ public:
|
|||
virtual void ClearDepth(GSTexture* t) {}
|
||||
virtual void ClearStencil(GSTexture* t, u8 c) {}
|
||||
|
||||
GSTexture* CreateSparseRenderTarget(int w, int h, int format = 0);
|
||||
GSTexture* CreateSparseDepthStencil(int w, int h, int format = 0);
|
||||
GSTexture* CreateRenderTarget(int w, int h, int format = 0);
|
||||
GSTexture* CreateDepthStencil(int w, int h, int format = 0);
|
||||
GSTexture* CreateTexture(int w, int h, int format = 0);
|
||||
GSTexture* CreateOffscreen(int w, int h, int format = 0);
|
||||
GSTexture* CreateSparseRenderTarget(int w, int h, GSTexture::Format format);
|
||||
GSTexture* CreateSparseDepthStencil(int w, int h, GSTexture::Format format);
|
||||
GSTexture* CreateRenderTarget(int w, int h, GSTexture::Format format);
|
||||
GSTexture* CreateDepthStencil(int w, int h, GSTexture::Format format);
|
||||
GSTexture* CreateTexture(int w, int h, GSTexture::Format format);
|
||||
GSTexture* CreateOffscreen(int w, int h, GSTexture::Format format);
|
||||
GSTexture::Format GetDefaultTextureFormat(GSTexture::Type type);
|
||||
|
||||
virtual GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format = 0, ShaderConvert ps_shader = ShaderConvert::COPY) { return NULL; }
|
||||
virtual GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, GSTexture::Format format, ShaderConvert ps_shader = ShaderConvert::COPY) { return NULL; }
|
||||
|
||||
virtual void CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r) {}
|
||||
virtual void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, ShaderConvert shader = ShaderConvert::COPY, bool linear = true) {}
|
||||
|
|
|
@ -512,7 +512,7 @@ void GSRenderer::VSync(int field)
|
|||
{
|
||||
GSVector2i size = m_capture.GetSize();
|
||||
|
||||
if (GSTexture* offscreen = m_dev->CopyOffscreen(current, GSVector4(0, 0, 1, 1), size.x, size.y))
|
||||
if (GSTexture* offscreen = m_dev->CopyOffscreen(current, GSVector4(0, 0, 1, 1), size.x, size.y, GSTexture::Format::Color))
|
||||
{
|
||||
GSTexture::GSMap m;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ GSTexture::GSTexture()
|
|||
, m_committed_size(0, 0)
|
||||
, m_gpu_page_size(0, 0)
|
||||
, m_type(Type::Invalid)
|
||||
, m_format(0)
|
||||
, m_format(Format::Invalid)
|
||||
, m_sparse(false)
|
||||
, last_frame_used(0)
|
||||
, LikelyOffset(false)
|
||||
|
|
|
@ -38,13 +38,26 @@ public:
|
|||
SparseDepthStencil,
|
||||
};
|
||||
|
||||
enum class Format
|
||||
{
|
||||
Invalid = 0, ///< Used for initialization
|
||||
Backbuffer, ///< For displaying to the screen
|
||||
Color, ///< Standard (RGBA8) color texture
|
||||
FloatColor, ///< Float-based color texture for colclip emulation (RGBA32F)
|
||||
DepthStencil, ///< Depth stencil texture
|
||||
UNorm8, ///< A8UNorm texture for paletted textures and the OSD font
|
||||
UInt16, ///< UInt16 texture for reading back 16-bit depth
|
||||
UInt32, ///< UInt32 texture for reading back 24 and 32-bit depth
|
||||
Int32, ///< Int32 texture for date emulation
|
||||
};
|
||||
|
||||
protected:
|
||||
GSVector2 m_scale;
|
||||
GSVector2i m_size;
|
||||
GSVector2i m_committed_size;
|
||||
GSVector2i m_gpu_page_size;
|
||||
Type m_type;
|
||||
int m_format;
|
||||
Format m_format;
|
||||
bool m_sparse;
|
||||
|
||||
public:
|
||||
|
@ -72,7 +85,7 @@ public:
|
|||
GSVector2i GetSize() const { return m_size; }
|
||||
|
||||
Type GetType() const { return m_type; }
|
||||
int GetFormat() const { return m_format; }
|
||||
Format GetFormat() const { return m_format; }
|
||||
|
||||
virtual void CommitPages(const GSVector2i& region, bool commit) {}
|
||||
void CommitRegion(const GSVector2i& region);
|
||||
|
|
|
@ -418,7 +418,7 @@ bool GSDevice11::Create(const WindowInfo& wi)
|
|||
const GSVector2i tex_font = m_osd.get_texture_font_size();
|
||||
|
||||
m_font = std::unique_ptr<GSTexture>(
|
||||
CreateSurface(GSTexture::Type::Texture, tex_font.x, tex_font.y, DXGI_FORMAT_R8_UNORM));
|
||||
CreateSurface(GSTexture::Type::Texture, tex_font.x, tex_font.y, GSTexture::Format::UNorm8));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -443,7 +443,7 @@ bool GSDevice11::Reset(int w, int h)
|
|||
return false;
|
||||
}
|
||||
|
||||
m_backbuffer = new GSTexture11(std::move(backbuffer));
|
||||
m_backbuffer = new GSTexture11(std::move(backbuffer), GSTexture::Format::Backbuffer);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -562,16 +562,32 @@ void GSDevice11::ClearStencil(GSTexture* t, u8 c)
|
|||
m_ctx->ClearDepthStencilView(*(GSTexture11*)t, D3D11_CLEAR_STENCIL, 0, c);
|
||||
}
|
||||
|
||||
GSTexture* GSDevice11::CreateSurface(GSTexture::Type type, int w, int h, int format)
|
||||
GSTexture* GSDevice11::CreateSurface(GSTexture::Type type, int w, int h, GSTexture::Format format)
|
||||
{
|
||||
D3D11_TEXTURE2D_DESC desc;
|
||||
|
||||
memset(&desc, 0, sizeof(desc));
|
||||
|
||||
DXGI_FORMAT dxformat;
|
||||
switch (format)
|
||||
{
|
||||
case GSTexture::Format::Color: dxformat = DXGI_FORMAT_R8G8B8A8_UNORM; break;
|
||||
case GSTexture::Format::FloatColor: dxformat = DXGI_FORMAT_R32G32B32A32_FLOAT; break;
|
||||
case GSTexture::Format::DepthStencil: dxformat = DXGI_FORMAT_R32G8X24_TYPELESS; break;
|
||||
case GSTexture::Format::UNorm8: dxformat = DXGI_FORMAT_A8_UNORM; break;
|
||||
case GSTexture::Format::UInt16: dxformat = DXGI_FORMAT_R16_UINT; break;
|
||||
case GSTexture::Format::UInt32: dxformat = DXGI_FORMAT_R32_UINT; break;
|
||||
case GSTexture::Format::Int32: dxformat = DXGI_FORMAT_R32_SINT; break;
|
||||
case GSTexture::Format::Invalid:
|
||||
case GSTexture::Format::Backbuffer:
|
||||
ASSERT(0);
|
||||
dxformat = DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
|
||||
// Texture limit for D3D10/11 min 1, max 8192 D3D10, max 16384 D3D11.
|
||||
desc.Width = std::max(1, std::min(w, m_d3d_texsize));
|
||||
desc.Height = std::max(1, std::min(h, m_d3d_texsize));
|
||||
desc.Format = (DXGI_FORMAT)format;
|
||||
desc.Format = dxformat;
|
||||
desc.MipLevels = 1;
|
||||
desc.ArraySize = 1;
|
||||
desc.SampleDesc.Count = 1;
|
||||
|
@ -580,7 +596,7 @@ GSTexture* GSDevice11::CreateSurface(GSTexture::Type type, int w, int h, int for
|
|||
|
||||
// mipmap = m_mipmap > 1 || m_filter != TriFiltering::None;
|
||||
const bool mipmap = m_mipmap > 1;
|
||||
const int layers = mipmap && format == DXGI_FORMAT_R8G8B8A8_UNORM ? (int)log2(std::max(w, h)) : 1;
|
||||
const int layers = mipmap && format == GSTexture::Format::Color ? (int)log2(std::max(w, h)) : 1;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
@ -607,7 +623,7 @@ GSTexture* GSDevice11::CreateSurface(GSTexture::Type type, int w, int h, int for
|
|||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
t = new GSTexture11(std::move(texture));
|
||||
t = new GSTexture11(std::move(texture), format);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
@ -627,24 +643,16 @@ GSTexture* GSDevice11::CreateSurface(GSTexture::Type type, int w, int h, int for
|
|||
return t;
|
||||
}
|
||||
|
||||
GSTexture* GSDevice11::FetchSurface(GSTexture::Type type, int w, int h, int format)
|
||||
GSTexture* GSDevice11::FetchSurface(GSTexture::Type type, int w, int h, GSTexture::Format format)
|
||||
{
|
||||
if (format == 0)
|
||||
format = (type == GSTexture::Type::DepthStencil || type == GSTexture::Type::SparseDepthStencil) ? DXGI_FORMAT_R32G8X24_TYPELESS : DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
|
||||
return __super::FetchSurface(type, w, h, format);
|
||||
}
|
||||
|
||||
GSTexture* GSDevice11::CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format, ShaderConvert ps_shader)
|
||||
GSTexture* GSDevice11::CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, GSTexture::Format format, ShaderConvert ps_shader)
|
||||
{
|
||||
GSTexture* dst = NULL;
|
||||
|
||||
if (format == 0)
|
||||
{
|
||||
format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
}
|
||||
|
||||
ASSERT(format == DXGI_FORMAT_R8G8B8A8_UNORM || format == DXGI_FORMAT_R16_UINT || format == DXGI_FORMAT_R32_UINT);
|
||||
ASSERT(format == GSTexture::Format::Color || format == GSTexture::Format::UInt16 || format == GSTexture::Format::UInt32);
|
||||
|
||||
if (GSTexture* rt = CreateRenderTarget(w, h, format))
|
||||
{
|
||||
|
|
|
@ -396,8 +396,8 @@ private:
|
|||
int m_mipmap;
|
||||
int m_d3d_texsize;
|
||||
|
||||
GSTexture* CreateSurface(GSTexture::Type type, int w, int h, int format) final;
|
||||
GSTexture* FetchSurface(GSTexture::Type type, int w, int h, int format) final;
|
||||
GSTexture* CreateSurface(GSTexture::Type type, int w, int h, GSTexture::Format format) final;
|
||||
GSTexture* FetchSurface(GSTexture::Type type, int w, int h, GSTexture::Format format) final;
|
||||
|
||||
void DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c) final;
|
||||
void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0) final;
|
||||
|
@ -542,7 +542,7 @@ public:
|
|||
void ClearDepth(GSTexture* t) final;
|
||||
void ClearStencil(GSTexture* t, u8 c) final;
|
||||
|
||||
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format = 0, ShaderConvert ps_shader = ShaderConvert::COPY) final;
|
||||
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, GSTexture::Format format, ShaderConvert ps_shader = ShaderConvert::COPY) final;
|
||||
|
||||
void CloneTexture(GSTexture* src, GSTexture** dest);
|
||||
|
||||
|
|
|
@ -890,7 +890,7 @@ void GSRendererDX11::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sou
|
|||
{
|
||||
const GSVector4 dRect(ComputeBoundingBox(rtscale, rtsize));
|
||||
const GSVector4 sRect = dRect / GSVector4(rtsize.x, rtsize.y).xyxy();
|
||||
hdr_rt = dev->CreateRenderTarget(rtsize.x, rtsize.y, DXGI_FORMAT_R32G32B32A32_FLOAT);
|
||||
hdr_rt = dev->CreateRenderTarget(rtsize.x, rtsize.y, GSTexture::Format::FloatColor);
|
||||
// Warning: StretchRect must be called before BeginScene otherwise
|
||||
// vertices will be overwritten. Trust me you don't want to do that.
|
||||
dev->StretchRect(rt, sRect, hdr_rt, dRect, ShaderConvert::COPY, false);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "GSTexture11.h"
|
||||
#include "GS/GSPng.h"
|
||||
|
||||
GSTexture11::GSTexture11(wil::com_ptr_nothrow<ID3D11Texture2D> texture)
|
||||
GSTexture11::GSTexture11(wil::com_ptr_nothrow<ID3D11Texture2D> texture, GSTexture::Format format)
|
||||
: m_texture(std::move(texture)), m_layer(0)
|
||||
{
|
||||
ASSERT(m_texture);
|
||||
|
@ -39,7 +39,7 @@ GSTexture11::GSTexture11(wil::com_ptr_nothrow<ID3D11Texture2D> texture)
|
|||
else if (m_desc.Usage == D3D11_USAGE_STAGING)
|
||||
m_type = Type::Offscreen;
|
||||
|
||||
m_format = (int)m_desc.Format;
|
||||
m_format = format;
|
||||
|
||||
m_max_layer = m_desc.MipLevels;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class GSTexture11 : public GSTexture
|
|||
int m_max_layer;
|
||||
|
||||
public:
|
||||
explicit GSTexture11(wil::com_ptr_nothrow<ID3D11Texture2D> texture);
|
||||
explicit GSTexture11(wil::com_ptr_nothrow<ID3D11Texture2D> texture, GSTexture::Format format);
|
||||
|
||||
bool Update(const GSVector4i& r, const void* data, int pitch, int layer = 0);
|
||||
bool Map(GSMap& m, const GSVector4i* r = NULL, int layer = 0);
|
||||
|
|
|
@ -32,31 +32,31 @@ void GSTextureCache11::Read(Target* t, const GSVector4i& r)
|
|||
|
||||
const GIFRegTEX0& TEX0 = t->m_TEX0;
|
||||
|
||||
DXGI_FORMAT format;
|
||||
GSTexture::Format format;
|
||||
ShaderConvert ps_shader;
|
||||
switch (TEX0.PSM)
|
||||
{
|
||||
case PSM_PSMCT32:
|
||||
case PSM_PSMCT24:
|
||||
format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
format = GSTexture::Format::Color;
|
||||
ps_shader = ShaderConvert::COPY;
|
||||
break;
|
||||
|
||||
case PSM_PSMCT16:
|
||||
case PSM_PSMCT16S:
|
||||
format = DXGI_FORMAT_R16_UINT;
|
||||
format = GSTexture::Format::UInt16;
|
||||
ps_shader = ShaderConvert::RGBA8_TO_16_BITS;
|
||||
break;
|
||||
|
||||
case PSM_PSMZ32:
|
||||
case PSM_PSMZ24:
|
||||
format = DXGI_FORMAT_R32_UINT;
|
||||
format = GSTexture::Format::UInt32;
|
||||
ps_shader = ShaderConvert::FLOAT32_TO_32_BITS;
|
||||
break;
|
||||
|
||||
case PSM_PSMZ16:
|
||||
case PSM_PSMZ16S:
|
||||
format = DXGI_FORMAT_R16_UINT;
|
||||
format = GSTexture::Format::UInt16;
|
||||
ps_shader = ShaderConvert::FLOAT32_TO_32_BITS;
|
||||
break;
|
||||
|
||||
|
@ -115,7 +115,7 @@ void GSTextureCache11::Read(Source* t, const GSVector4i& r)
|
|||
|
||||
const GIFRegTEX0& TEX0 = t->m_TEX0;
|
||||
|
||||
if (GSTexture* offscreen = m_renderer->m_dev->CreateOffscreen(r.width(), r.height()))
|
||||
if (GSTexture* offscreen = m_renderer->m_dev->CreateOffscreen(r.width(), r.height(), GSTexture::Format::Color))
|
||||
{
|
||||
m_renderer->m_dev->CopyRect(t->m_texture, offscreen, r);
|
||||
|
||||
|
|
|
@ -1905,7 +1905,7 @@ bool GSRendererHW::OI_BlitFMV(GSTextureCache::Target* _rt, GSTextureCache::Sourc
|
|||
// Do the blit. With a Copy mess to avoid issue with limited API (dx)
|
||||
// m_dev->StretchRect(tex->m_texture, sRect, tex->m_texture, dRect);
|
||||
const GSVector4i r_full(0, 0, tw, th);
|
||||
if (GSTexture* rt = m_dev->CreateRenderTarget(tw, th))
|
||||
if (GSTexture* rt = m_dev->CreateRenderTarget(tw, th, GSTexture::Format::Color))
|
||||
{
|
||||
m_dev->CopyRect(tex->m_texture, rt, r_full);
|
||||
|
||||
|
@ -2032,7 +2032,7 @@ bool GSRendererHW::OI_FFXII(GSTexture* rt, GSTexture* ds, GSTextureCache::Source
|
|||
|
||||
m_dev->Recycle(t->m_texture);
|
||||
|
||||
t->m_texture = m_dev->CreateTexture(512, 512);
|
||||
t->m_texture = m_dev->CreateTexture(512, 512, GSTexture::Format::Color);
|
||||
|
||||
t->m_texture->Update(GSVector4i(0, 0, 448, lines), video, 448 * 4);
|
||||
|
||||
|
|
|
@ -1301,7 +1301,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
|||
int h = (int)(scale.y * th);
|
||||
|
||||
GSTexture* sTex = dst->m_texture;
|
||||
GSTexture* dTex = m_renderer->m_dev->CreateRenderTarget(w, h);
|
||||
GSTexture* dTex = m_renderer->m_dev->CreateRenderTarget(w, h, GSTexture::Format::Color);
|
||||
|
||||
GSVector4i area(x, y, x + w, y + h);
|
||||
m_renderer->m_dev->CopyRect(sTex, dTex, area);
|
||||
|
@ -1333,7 +1333,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
|||
// So it could be tricky to put in the middle of the DrawPrims
|
||||
|
||||
// Texture is created to keep code compatibility
|
||||
GSTexture* dTex = m_renderer->m_dev->CreateRenderTarget(tw, th);
|
||||
GSTexture* dTex = m_renderer->m_dev->CreateRenderTarget(tw, th, GSTexture::Format::Color);
|
||||
|
||||
// Keep a trace of origin of the texture
|
||||
src->m_texture = dTex;
|
||||
|
@ -1504,7 +1504,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
|||
// Don't be fooled by the name. 'dst' is the old target (hence the input)
|
||||
// 'src' is the new texture cache entry (hence the output)
|
||||
GSTexture* sTex = dst->m_texture;
|
||||
GSTexture* dTex = m_renderer->m_dev->CreateRenderTarget(w, h);
|
||||
GSTexture* dTex = m_renderer->m_dev->CreateRenderTarget(w, h, GSTexture::Format::Color);
|
||||
src->m_texture = dTex;
|
||||
|
||||
// GH: by default (m_paltex == 0) GS converts texture to the 32 bit format
|
||||
|
@ -1609,12 +1609,12 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
|||
{
|
||||
if (m_paltex && psm.pal > 0)
|
||||
{
|
||||
src->m_texture = m_renderer->m_dev->CreateTexture(tw, th, Get8bitFormat());
|
||||
src->m_texture = m_renderer->m_dev->CreateTexture(tw, th, GSTexture::Format::UNorm8);
|
||||
AttachPaletteToSource(src, psm.pal, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
src->m_texture = m_renderer->m_dev->CreateTexture(tw, th);
|
||||
src->m_texture = m_renderer->m_dev->CreateTexture(tw, th, GSTexture::Format::Color);
|
||||
if (psm.pal > 0)
|
||||
{
|
||||
AttachPaletteToSource(src, psm.pal, false);
|
||||
|
@ -1641,13 +1641,13 @@ GSTextureCache::Target* GSTextureCache::CreateTarget(const GIFRegTEX0& TEX0, int
|
|||
|
||||
if (type == RenderTarget)
|
||||
{
|
||||
t->m_texture = m_renderer->m_dev->CreateSparseRenderTarget(w, h);
|
||||
t->m_texture = m_renderer->m_dev->CreateSparseRenderTarget(w, h, GSTexture::Format::Color);
|
||||
|
||||
t->m_used = true; // FIXME
|
||||
}
|
||||
else if (type == DepthStencil)
|
||||
{
|
||||
t->m_texture = m_renderer->m_dev->CreateSparseDepthStencil(w, h);
|
||||
t->m_texture = m_renderer->m_dev->CreateSparseDepthStencil(w, h, GSTexture::Format::DepthStencil);
|
||||
}
|
||||
|
||||
m_dst[type].push_front(t);
|
||||
|
@ -2067,7 +2067,7 @@ void GSTextureCache::Target::Update()
|
|||
TEXA.TA0 = 0;
|
||||
TEXA.TA1 = 0x80;
|
||||
|
||||
GSTexture* t = m_renderer->m_dev->CreateTexture(w, h);
|
||||
GSTexture* t = m_renderer->m_dev->CreateTexture(w, h, GSTexture::Format::Color);
|
||||
|
||||
GSOffset off = m_renderer->m_mem.GetOffset(m_TEX0.TBP0, m_TEX0.TBW, m_TEX0.PSM);
|
||||
|
||||
|
@ -2227,7 +2227,7 @@ void GSTextureCache::Palette::InitializeTexture()
|
|||
// sampling such texture are always normalized by 255.
|
||||
// This is because indexes are stored as normalized values of an RGBA texture (e.g. index 15 will be read as (15/255),
|
||||
// and therefore will read texel 15/255 * texture size).
|
||||
m_tex_palette = m_renderer->m_dev->CreateTexture(256, 1);
|
||||
m_tex_palette = m_renderer->m_dev->CreateTexture(256, 1, GSTexture::Format::Color);
|
||||
m_tex_palette->Update(GSVector4i(0, 0, m_pal, 1), m_clut, m_pal * sizeof(m_clut[0]));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ bool GSDeviceNull::Reset(int w, int h)
|
|||
return GSDevice::Reset(w, h);
|
||||
}
|
||||
|
||||
GSTexture* GSDeviceNull::CreateSurface(GSTexture::Type type, int w, int h, int format)
|
||||
GSTexture* GSDeviceNull::CreateSurface(GSTexture::Type type, int w, int h, GSTexture::Format format)
|
||||
{
|
||||
return new GSTextureNull(type, w, h, format);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
class GSDeviceNull : public GSDevice
|
||||
{
|
||||
private:
|
||||
GSTexture* CreateSurface(GSTexture::Type type, int w, int h, int format);
|
||||
GSTexture* CreateSurface(GSTexture::Type type, int w, int h, GSTexture::Format format);
|
||||
|
||||
void DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c) {}
|
||||
void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0) {}
|
||||
|
|
|
@ -21,7 +21,7 @@ GSTextureNull::GSTextureNull()
|
|||
memset(&m_desc, 0, sizeof(m_desc));
|
||||
}
|
||||
|
||||
GSTextureNull::GSTextureNull(Type type, int w, int h, int format)
|
||||
GSTextureNull::GSTextureNull(Type type, int w, int h, GSTexture::Format format)
|
||||
{
|
||||
m_desc.type = type;
|
||||
m_desc.w = w;
|
||||
|
|
|
@ -22,15 +22,16 @@ class GSTextureNull : public GSTexture
|
|||
struct
|
||||
{
|
||||
Type type;
|
||||
int w, h, format;
|
||||
Format format;
|
||||
int w, h;
|
||||
} m_desc;
|
||||
|
||||
public:
|
||||
GSTextureNull();
|
||||
GSTextureNull(Type type, int w, int h, int format);
|
||||
GSTextureNull(Type type, int w, int h, Format format);
|
||||
|
||||
Type GetType() const { return m_desc.type; }
|
||||
int GetFormat() const { return m_desc.format; }
|
||||
Format GetFormat() const { return m_desc.format; }
|
||||
|
||||
bool Update(const GSVector4i& r, const void* data, int pitch, int layer = 0) { return true; }
|
||||
bool Map(GSMap& m, const GSVector4i* r = NULL, int layer = 0) { return false; }
|
||||
|
|
|
@ -239,7 +239,7 @@ void GSDeviceOGL::GenerateProfilerData()
|
|||
}
|
||||
}
|
||||
|
||||
GSTexture* GSDeviceOGL::CreateSurface(GSTexture::Type type, int w, int h, int fmt)
|
||||
GSTexture* GSDeviceOGL::CreateSurface(GSTexture::Type type, int w, int h, GSTexture::Format fmt)
|
||||
{
|
||||
GL_PUSH("Create surface");
|
||||
|
||||
|
@ -272,11 +272,8 @@ GSTexture* GSDeviceOGL::CreateSurface(GSTexture::Type type, int w, int h, int fm
|
|||
return t;
|
||||
}
|
||||
|
||||
GSTexture* GSDeviceOGL::FetchSurface(GSTexture::Type type, int w, int h, int format)
|
||||
GSTexture* GSDeviceOGL::FetchSurface(GSTexture::Type type, int w, int h, GSTexture::Format format)
|
||||
{
|
||||
if (format == 0)
|
||||
format = (type == GSTexture::Type::DepthStencil || type == GSTexture::Type::SparseDepthStencil) ? GL_DEPTH32F_STENCIL8 : GL_RGBA8;
|
||||
|
||||
GSTexture* t = GSDevice::FetchSurface(type, w, h, format);
|
||||
|
||||
|
||||
|
@ -621,7 +618,7 @@ bool GSDeviceOGL::Create(const WindowInfo& wi)
|
|||
const GSVector2i tex_font = m_osd.get_texture_font_size();
|
||||
|
||||
m_font = std::unique_ptr<GSTexture>(
|
||||
new GSTextureOGL(GSTexture::Type::Texture, tex_font.x, tex_font.y, GL_R8, m_fbo_read, false)
|
||||
new GSTextureOGL(GSTexture::Type::Texture, tex_font.x, tex_font.y, GSTexture::Format::UNorm8, m_fbo_read, false)
|
||||
);
|
||||
|
||||
// ****************************************************************
|
||||
|
@ -686,7 +683,7 @@ bool GSDeviceOGL::Reset(int w, int h)
|
|||
// in the backbuffer
|
||||
m_gl_context->ResizeSurface(w, h);
|
||||
m_backbuffer = new GSTextureOGL(GSTexture::Type::Backbuffer, m_gl_context->GetSurfaceWidth(),
|
||||
m_gl_context->GetSurfaceHeight(), 0, m_fbo_read, false);
|
||||
m_gl_context->GetSurfaceHeight(), GSTexture::Format::Backbuffer, m_fbo_read, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -961,7 +958,7 @@ void GSDeviceOGL::InitPrimDateTexture(GSTexture* rt, const GSVector4i& area)
|
|||
|
||||
// Create a texture to avoid the useless clean@0
|
||||
if (m_date.t == NULL)
|
||||
m_date.t = CreateTexture(rtsize.x, rtsize.y, GL_R32I);
|
||||
m_date.t = CreateTexture(rtsize.x, rtsize.y, GSTexture::Format::Int32);
|
||||
|
||||
// Clean with the max signed value
|
||||
const int max_int = 0x7FFFFFFF;
|
||||
|
@ -1275,13 +1272,10 @@ void GSDeviceOGL::SelfShaderTest()
|
|||
}
|
||||
|
||||
// blit a texture into an offscreen buffer
|
||||
GSTexture* GSDeviceOGL::CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format, ShaderConvert ps_shader)
|
||||
GSTexture* GSDeviceOGL::CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, GSTexture::Format format, ShaderConvert ps_shader)
|
||||
{
|
||||
if (format == 0)
|
||||
format = GL_RGBA8;
|
||||
|
||||
ASSERT(src);
|
||||
ASSERT(format == GL_RGBA8 || format == GL_R16UI || format == GL_R32UI);
|
||||
ASSERT(format == GSTexture::Format::Color || format == GSTexture::Format::UInt16 || format == GSTexture::Format::UInt32);
|
||||
|
||||
GSTexture* dst = CreateOffscreen(w, h, format);
|
||||
|
||||
|
|
|
@ -559,8 +559,8 @@ private:
|
|||
|
||||
std::unique_ptr<GSTexture> m_font;
|
||||
|
||||
GSTexture* CreateSurface(GSTexture::Type type, int w, int h, int format) final;
|
||||
GSTexture* FetchSurface(GSTexture::Type type, int w, int h, int format) final;
|
||||
GSTexture* CreateSurface(GSTexture::Type type, int w, int h, GSTexture::Format format) final;
|
||||
GSTexture* FetchSurface(GSTexture::Type type, int w, int h, GSTexture::Format format) final;
|
||||
|
||||
void DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c) final;
|
||||
void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0) final;
|
||||
|
@ -605,7 +605,7 @@ public:
|
|||
void InitPrimDateTexture(GSTexture* rt, const GSVector4i& area);
|
||||
void RecycleDateTexture();
|
||||
|
||||
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format = 0, ShaderConvert ps_shader = ShaderConvert::COPY) final;
|
||||
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, GSTexture::Format format, ShaderConvert ps_shader = ShaderConvert::COPY) final;
|
||||
|
||||
void CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r) final;
|
||||
|
||||
|
|
|
@ -1424,7 +1424,7 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
|
|||
|
||||
if (m_ps_sel.hdr)
|
||||
{
|
||||
hdr_rt = dev->CreateRenderTarget(rtsize.x, rtsize.y, GL_RGBA32F);
|
||||
hdr_rt = dev->CreateRenderTarget(rtsize.x, rtsize.y, GSTexture::Format::FloatColor);
|
||||
dev->OMSetRenderTargets(hdr_rt, ds, &scissor);
|
||||
|
||||
// save blend state, since BlitRect destroys it
|
||||
|
|
|
@ -28,31 +28,31 @@ void GSTextureCacheOGL::Read(Target* t, const GSVector4i& r)
|
|||
|
||||
const GIFRegTEX0& TEX0 = t->m_TEX0;
|
||||
|
||||
GLuint fmt;
|
||||
GSTexture::Format fmt;
|
||||
ShaderConvert ps_shader;
|
||||
switch (TEX0.PSM)
|
||||
{
|
||||
case PSM_PSMCT32:
|
||||
case PSM_PSMCT24:
|
||||
fmt = GL_RGBA8;
|
||||
fmt = GSTexture::Format::Color;
|
||||
ps_shader = ShaderConvert::COPY;
|
||||
break;
|
||||
|
||||
case PSM_PSMCT16:
|
||||
case PSM_PSMCT16S:
|
||||
fmt = GL_R16UI;
|
||||
fmt = GSTexture::Format::UInt16;
|
||||
ps_shader = ShaderConvert::RGBA8_TO_16_BITS;
|
||||
break;
|
||||
|
||||
case PSM_PSMZ32:
|
||||
case PSM_PSMZ24:
|
||||
fmt = GL_R32UI;
|
||||
fmt = GSTexture::Format::UInt32;
|
||||
ps_shader = ShaderConvert::FLOAT32_TO_32_BITS;
|
||||
break;
|
||||
|
||||
case PSM_PSMZ16:
|
||||
case PSM_PSMZ16S:
|
||||
fmt = GL_R16UI;
|
||||
fmt = GSTexture::Format::UInt16;
|
||||
ps_shader = ShaderConvert::FLOAT32_TO_32_BITS;
|
||||
break;
|
||||
|
||||
|
@ -116,7 +116,7 @@ void GSTextureCacheOGL::Read(Source* t, const GSVector4i& r)
|
|||
// FIXME Create a get function to avoid the useless copy
|
||||
// Note: With openGL 4.5 you can use glGetTextureSubImage
|
||||
|
||||
if (GSTexture* offscreen = m_renderer->m_dev->CreateOffscreen(r.width(), r.height()))
|
||||
if (GSTexture* offscreen = m_renderer->m_dev->CreateOffscreen(r.width(), r.height(), GSTexture::Format::Color))
|
||||
{
|
||||
m_renderer->m_dev->CopyRect(t->m_texture, offscreen, r);
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ namespace PboPool
|
|||
}
|
||||
} // namespace PboPool
|
||||
|
||||
GSTextureOGL::GSTextureOGL(Type type, int w, int h, int format, GLuint fbo_read, bool mipmap)
|
||||
GSTextureOGL::GSTextureOGL(Type type, int w, int h, Format format, GLuint fbo_read, bool mipmap)
|
||||
: m_clean(false), m_generate_mipmap(true), m_local_buffer(nullptr), m_r_x(0), m_r_y(0), m_r_w(0), m_r_h(0), m_layer(0)
|
||||
{
|
||||
// OpenGL didn't like dimensions of size 0
|
||||
|
@ -173,77 +173,71 @@ GSTextureOGL::GSTextureOGL(Type type, int w, int h, int format, GLuint fbo_read,
|
|||
m_texture_id = 0;
|
||||
m_sparse = false;
|
||||
m_max_layer = 1;
|
||||
int gl_fmt = 0;
|
||||
|
||||
// Bunch of constant parameter
|
||||
switch (m_format)
|
||||
{
|
||||
// 1 Channel integer
|
||||
case GL_R32UI:
|
||||
case GL_R32I:
|
||||
// 1 Channel integer
|
||||
case Format::Int32:
|
||||
gl_fmt = GL_R32I;
|
||||
m_int_format = GL_RED_INTEGER;
|
||||
m_int_type = (m_format == GL_R32UI) ? GL_UNSIGNED_INT : GL_INT;
|
||||
m_int_type = GL_INT;
|
||||
m_int_shift = 2;
|
||||
break;
|
||||
case GL_R16UI:
|
||||
case Format::UInt32:
|
||||
gl_fmt = GL_R32UI;
|
||||
m_int_format = GL_RED_INTEGER;
|
||||
m_int_type = GL_UNSIGNED_INT;
|
||||
m_int_shift = 2;
|
||||
break;
|
||||
case Format::UInt16:
|
||||
gl_fmt = GL_R16UI;
|
||||
m_int_format = GL_RED_INTEGER;
|
||||
m_int_type = GL_UNSIGNED_SHORT;
|
||||
m_int_shift = 1;
|
||||
break;
|
||||
|
||||
// 1 Channel normalized
|
||||
case GL_R8:
|
||||
// 1 Channel normalized
|
||||
case Format::UNorm8:
|
||||
gl_fmt = GL_R8;
|
||||
m_int_format = GL_RED;
|
||||
m_int_type = GL_UNSIGNED_BYTE;
|
||||
m_int_shift = 0;
|
||||
break;
|
||||
|
||||
// 4 channel normalized
|
||||
case GL_RGBA16:
|
||||
m_int_format = GL_RGBA;
|
||||
m_int_type = GL_UNSIGNED_SHORT;
|
||||
m_int_shift = 3;
|
||||
break;
|
||||
case GL_RGBA8:
|
||||
// 4 channel normalized
|
||||
case Format::Color:
|
||||
gl_fmt = GL_RGBA8;
|
||||
m_int_format = GL_RGBA;
|
||||
m_int_type = GL_UNSIGNED_BYTE;
|
||||
m_int_shift = 2;
|
||||
break;
|
||||
|
||||
// 4 channel integer
|
||||
case GL_RGBA16I:
|
||||
case GL_RGBA16UI:
|
||||
m_int_format = GL_RGBA_INTEGER;
|
||||
m_int_type = (m_format == GL_R16UI) ? GL_UNSIGNED_SHORT : GL_SHORT;
|
||||
m_int_shift = 3;
|
||||
break;
|
||||
|
||||
// 4 channel float
|
||||
case GL_RGBA32F:
|
||||
// 4 channel float
|
||||
case Format::FloatColor:
|
||||
gl_fmt = GL_RGBA32F;
|
||||
m_int_format = GL_RGBA;
|
||||
m_int_type = GL_FLOAT;
|
||||
m_int_shift = 4;
|
||||
break;
|
||||
case GL_RGBA16F:
|
||||
m_int_format = GL_RGBA;
|
||||
m_int_type = GL_HALF_FLOAT;
|
||||
m_int_shift = 3;
|
||||
break;
|
||||
|
||||
// Depth buffer
|
||||
case GL_DEPTH32F_STENCIL8:
|
||||
// Depth buffer
|
||||
case Format::DepthStencil:
|
||||
gl_fmt = GL_DEPTH32F_STENCIL8;
|
||||
m_int_format = GL_DEPTH_STENCIL;
|
||||
m_int_type = GL_FLOAT_32_UNSIGNED_INT_24_8_REV;
|
||||
m_int_shift = 3; // 4 bytes for depth + 4 bytes for stencil by texels
|
||||
break;
|
||||
|
||||
// Backbuffer
|
||||
case 0:
|
||||
// Backbuffer
|
||||
case Format::Backbuffer:
|
||||
m_int_format = 0;
|
||||
m_int_type = 0;
|
||||
m_int_shift = 2; // 4 bytes by texels
|
||||
break;
|
||||
|
||||
default:
|
||||
case Format::Invalid:
|
||||
m_int_format = 0;
|
||||
m_int_type = 0;
|
||||
m_int_shift = 0;
|
||||
|
@ -260,7 +254,7 @@ GSTextureOGL::GSTextureOGL(Type type, int w, int h, int format, GLuint fbo_read,
|
|||
break;
|
||||
case Type::Texture:
|
||||
// Only 32 bits input texture will be supported for mipmap
|
||||
m_max_layer = mipmap && m_format == GL_RGBA8 ? (int)log2(std::max(w, h)) : 1;
|
||||
m_max_layer = mipmap && m_format == Format::Color ? (int)log2(std::max(w, h)) : 1;
|
||||
break;
|
||||
case Type::SparseRenderTarget:
|
||||
case Type::SparseDepthStencil:
|
||||
|
@ -272,41 +266,37 @@ GSTextureOGL::GSTextureOGL(Type type, int w, int h, int format, GLuint fbo_read,
|
|||
|
||||
switch (m_format)
|
||||
{
|
||||
case GL_R16UI:
|
||||
case GL_R8:
|
||||
case Format::UInt16:
|
||||
case Format::UNorm8:
|
||||
m_sparse &= GLLoader::found_compatible_GL_ARB_sparse_texture2;
|
||||
SetGpuPageSize(GSVector2i(255, 255));
|
||||
break;
|
||||
|
||||
case GL_R32UI:
|
||||
case GL_R32I:
|
||||
case GL_RGBA16:
|
||||
case GL_RGBA8:
|
||||
case GL_RGBA16I:
|
||||
case GL_RGBA16UI:
|
||||
case GL_RGBA16F:
|
||||
case 0:
|
||||
case Format::Color:
|
||||
case Format::UInt32:
|
||||
case Format::Int32:
|
||||
case Format::Backbuffer:
|
||||
m_sparse &= GLLoader::found_compatible_GL_ARB_sparse_texture2;
|
||||
SetGpuPageSize(GSVector2i(127, 127));
|
||||
break;
|
||||
|
||||
case GL_RGBA32F:
|
||||
case Format::FloatColor:
|
||||
m_sparse &= GLLoader::found_compatible_GL_ARB_sparse_texture2;
|
||||
SetGpuPageSize(GSVector2i(63, 63));
|
||||
break;
|
||||
|
||||
case GL_DEPTH32F_STENCIL8:
|
||||
case Format::DepthStencil:
|
||||
m_sparse &= GLLoader::found_compatible_sparse_depth;
|
||||
SetGpuPageSize(GSVector2i(127, 127));
|
||||
break;
|
||||
|
||||
default:
|
||||
case Format::Invalid:
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
// Create a gl object (texture isn't allocated here)
|
||||
glCreateTextures(GL_TEXTURE_2D, 1, &m_texture_id);
|
||||
if (m_format == GL_R8)
|
||||
if (m_format == Format::UNorm8)
|
||||
{
|
||||
// Emulate DX behavior, beside it avoid special code in shader to differentiate
|
||||
// palette texture from a GL_RGBA target or a GL_R texture.
|
||||
|
@ -341,7 +331,7 @@ GSTextureOGL::GSTextureOGL(Type type, int w, int h, int format, GLuint fbo_read,
|
|||
throw std::bad_alloc();
|
||||
}
|
||||
|
||||
glTextureStorage2D(m_texture_id, m_max_layer + GL_TEX_LEVEL_0, m_format, m_size.x, m_size.y);
|
||||
glTextureStorage2D(m_texture_id, m_max_layer + GL_TEX_LEVEL_0, gl_fmt, m_size.x, m_size.y);
|
||||
}
|
||||
|
||||
GSTextureOGL::~GSTextureOGL()
|
||||
|
@ -610,7 +600,7 @@ bool GSTextureOGL::Save(const std::string& fn)
|
|||
|
||||
fmt = GSPng::RGB_A_PNG;
|
||||
}
|
||||
else if (m_format == GL_R32I)
|
||||
else if (m_format == Format::Int32)
|
||||
{
|
||||
// Note: 4.5 function used for accurate DATE
|
||||
// barely used outside of dev and not sparse anyway
|
||||
|
@ -624,16 +614,16 @@ bool GSTextureOGL::Save(const std::string& fn)
|
|||
|
||||
glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_texture_id, 0);
|
||||
|
||||
if (m_format == GL_RGBA8)
|
||||
if (m_format == Format::Color)
|
||||
{
|
||||
glReadPixels(0, 0, m_committed_size.x, m_committed_size.y, GL_RGBA, GL_UNSIGNED_BYTE, image.get());
|
||||
}
|
||||
else if (m_format == GL_R16UI)
|
||||
else if (m_format == Format::UInt16)
|
||||
{
|
||||
glReadPixels(0, 0, m_committed_size.x, m_committed_size.y, GL_RED_INTEGER, GL_UNSIGNED_SHORT, image.get());
|
||||
fmt = GSPng::R16I_PNG;
|
||||
}
|
||||
else if (m_format == GL_R8)
|
||||
else if (m_format == Format::UNorm8)
|
||||
{
|
||||
fmt = GSPng::R8I_PNG;
|
||||
glReadPixels(0, 0, m_committed_size.x, m_committed_size.y, GL_RED, GL_UNSIGNED_BYTE, image.get());
|
||||
|
|
|
@ -60,7 +60,7 @@ private:
|
|||
u32 m_mem_usage;
|
||||
|
||||
public:
|
||||
explicit GSTextureOGL(Type type, int w, int h, int format, GLuint fbo_read, bool mipmap);
|
||||
explicit GSTextureOGL(Type type, int w, int h, Format format, GLuint fbo_read, bool mipmap);
|
||||
virtual ~GSTextureOGL();
|
||||
|
||||
bool Update(const GSVector4i& r, const void* data, int pitch, int layer = 0) final;
|
||||
|
|
|
@ -22,7 +22,7 @@ GSTextureSW::GSTextureSW(Type type, int width, int height)
|
|||
m_mapped.clear(std::memory_order_release);
|
||||
m_size = GSVector2i(width, height);
|
||||
m_type = type;
|
||||
m_format = 0;
|
||||
m_format = Format::Invalid;
|
||||
m_pitch = ((width << 2) + 31) & ~31;
|
||||
m_data = _aligned_malloc(m_pitch * height, 32);
|
||||
}
|
||||
|
|
|
@ -371,7 +371,7 @@ PS_OUTPUT ps_main19(PS_INPUT input)
|
|||
{
|
||||
PS_OUTPUT output;
|
||||
|
||||
output.c = input.c * float4(1.0, 1.0, 1.0, sample_c(input.t).r);
|
||||
output.c = input.c * float4(1.0, 1.0, 1.0, sample_c(input.t).a);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue