d3d11-Deferred_Context, wined3d-CSMT_Main: Fix data size calculation for block-based formats with unaligned size.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51172
This commit is contained in:
Zebediah Figura
2021-05-24 23:16:59 -05:00
parent 99d312740b
commit 69765f438b
2 changed files with 8 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
From 36509e9ab2c9bb0447eaa2d7b046826ec90fb0a5 Mon Sep 17 00:00:00 2001
From a9fd4b162802070ec3115c92f0a0d2fae6523d2e Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Fri, 14 May 2021 15:51:55 -0500
Subject: [PATCH] wined3d: Implement
@@ -12,7 +12,7 @@ Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
1 file changed, 33 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 20b2719fa9d..7be128f2ec4 100644
index 20b2719fa9d..20449024643 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -490,6 +490,7 @@ struct wined3d_cs_update_sub_resource
@@ -67,8 +67,8 @@ index 20b2719fa9d..7be128f2ec4 100644
+ const struct wined3d_format *format = resource->format;
+
+ data_size = (box->back - box->front - 1) * slice_pitch
+ + ((box->bottom - box->top) / format->block_height - 1) * row_pitch
+ + ((box->right - box->left) / format->block_width) * format->block_byte_count;
+ + ((box->bottom - box->top - 1) / format->block_height) * row_pitch
+ + ((box->right - box->left + format->block_width - 1) / format->block_width) * format->block_byte_count;
+ }
+
+ op = wined3d_device_context_require_space(context, sizeof(*op) + data_size, WINED3D_CS_QUEUE_DEFAULT);