summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorTryTwo <taolas@gmail.com>2025-08-12 21:32:31 -0700
committerTryTwo <taolas@gmail.com>2025-08-12 23:43:55 -0700
commit6b683517dc832312df82bf89a0b4cf129084b090 (patch)
tree2e0430934a20c994593be90b8f59a2a30f337c06 /Source
parente6ed939952f108aeaedc2763b391f2471203305e (diff)
Fix bugs related to AbstractStagingTextures that perform an Upload (write to existing texture). This code path had probably never been used before.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/VideoBackends/D3D/DXTexture.cpp6
-rw-r--r--Source/Core/VideoBackends/OGL/OGLTexture.cpp2
2 files changed, 5 insertions, 3 deletions
diff --git a/Source/Core/VideoBackends/D3D/DXTexture.cpp b/Source/Core/VideoBackends/D3D/DXTexture.cpp
index 9015ede81c..eac31fd64d 100644
--- a/Source/Core/VideoBackends/D3D/DXTexture.cpp
+++ b/Source/Core/VideoBackends/D3D/DXTexture.cpp
@@ -211,6 +211,7 @@ std::unique_ptr<DXStagingTexture> DXStagingTexture::Create(StagingTextureType ty
{
D3D11_USAGE usage;
UINT cpu_flags;
+ UINT bind_flags = 0;
if (type == StagingTextureType::Readback)
{
usage = D3D11_USAGE_STAGING;
@@ -220,6 +221,7 @@ std::unique_ptr<DXStagingTexture> DXStagingTexture::Create(StagingTextureType ty
{
usage = D3D11_USAGE_DYNAMIC;
cpu_flags = D3D11_CPU_ACCESS_WRITE;
+ bind_flags = D3D11_BIND_SHADER_RESOURCE;
}
else
{
@@ -228,7 +230,7 @@ std::unique_ptr<DXStagingTexture> DXStagingTexture::Create(StagingTextureType ty
}
CD3D11_TEXTURE2D_DESC desc(D3DCommon::GetDXGIFormatForAbstractFormat(config.format, false),
- config.width, config.height, 1, 1, 0, usage, cpu_flags);
+ config.width, config.height, 1, 1, bind_flags, usage, cpu_flags);
ComPtr<ID3D11Texture2D> texture;
HRESULT hr = D3D::device->CreateTexture2D(&desc, nullptr, texture.GetAddressOf());
@@ -317,7 +319,7 @@ bool DXStagingTexture::Map()
if (m_type == StagingTextureType::Readback)
map_type = D3D11_MAP_READ;
else if (m_type == StagingTextureType::Upload)
- map_type = D3D11_MAP_WRITE;
+ map_type = D3D11_MAP_WRITE_DISCARD;
else
map_type = D3D11_MAP_READ_WRITE;
diff --git a/Source/Core/VideoBackends/OGL/OGLTexture.cpp b/Source/Core/VideoBackends/OGL/OGLTexture.cpp
index 45f23abcd6..0d7c78d0bd 100644
--- a/Source/Core/VideoBackends/OGL/OGLTexture.cpp
+++ b/Source/Core/VideoBackends/OGL/OGLTexture.cpp
@@ -593,7 +593,7 @@ void OGLStagingTexture::CopyToTexture(const MathUtil::Rectangle<int>& src_rect,
glTexSubImage3D(target, 0, dst_rect.left, dst_rect.top, dst_layer, dst_rect.GetWidth(),
dst_rect.GetHeight(), 1, GetGLFormatForTextureFormat(dst->GetFormat()),
GetGLTypeForTextureFormat(dst->GetFormat()), reinterpret_cast<void*>(src_offset));
-
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
// If we support buffer storage, create a fence for synchronization.