mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 07:46:01 +00:00
fix(effects): keep upscaling and sharpening at panel size with frame generation on (#2728)
* fix(effects): keep upscaling and sharpening at panel size with frame generation on * fix(effects): stub sharpening query in the terminal callers probe
This commit is contained in:
1 parent
2f07e11ba0
commit
bf0260de61
5 files changed
+35
-3
No files matched your search
@@ -155,6 +155,10 @@ int vkp_effects_upscaling(void) {
|
|||||||
return spatial_mode(g_cur.scaling) && g_cur.scaling != 6;
|
return spatial_mode(g_cur.scaling) && g_cur.scaling != 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int vkp_effects_sharpening(void) {
|
||||||
|
return vkp_effects_upscaling() || cas_active(&g_cur);
|
||||||
|
}
|
||||||
|
|
||||||
int vkp_effects_postprocessing(void) {
|
int vkp_effects_postprocessing(void) {
|
||||||
vkp_effects_sync();
|
vkp_effects_sync();
|
||||||
return effect_count(&g_cur) > 0;
|
return effect_count(&g_cur) > 0;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ int vkp_effects_sync(void);
|
|||||||
int vkp_effects_active(void);
|
int vkp_effects_active(void);
|
||||||
|
|
||||||
int vkp_effects_upscaling(void);
|
int vkp_effects_upscaling(void);
|
||||||
|
int vkp_effects_sharpening(void);
|
||||||
int vkp_effects_postprocessing(void);
|
int vkp_effects_postprocessing(void);
|
||||||
|
|
||||||
VkFilter vkp_effects_blit_filter(void);
|
VkFilter vkp_effects_blit_filter(void);
|
||||||
|
|||||||
@@ -2179,7 +2179,7 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i
|
|||||||
VkImageLayout result_layout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
|
VkImageLayout result_layout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
|
||||||
if (fx) {
|
if (fx) {
|
||||||
int mapped_w = (int)(scene_w * g_map.kx + 0.5f), mapped_h = (int)(scene_h * g_map.ky + 0.5f);
|
int mapped_w = (int)(scene_w * g_map.kx + 0.5f), mapped_h = (int)(scene_h * g_map.ky + 0.5f);
|
||||||
if (fg) { mapped_w = scene_w; mapped_h = scene_h; }
|
if (fg && !vkp_effects_sharpening()) { mapped_w = scene_w; mapped_h = scene_h; }
|
||||||
vkp_effects_set_formats(scene_fmt, scene_fmt);
|
vkp_effects_set_formats(scene_fmt, scene_fmt);
|
||||||
result = vkp_effects_run(cmd, scene_img, input_w, input_h, mapped_w, mapped_h, &rw, &rh);
|
result = vkp_effects_run(cmd, scene_img, input_w, input_h, mapped_w, mapped_h, &rw, &rh);
|
||||||
effects_overlay_draws(cmd, result, rw, rh, scene_w, scene_h,
|
effects_overlay_draws(cmd, result, rw, rh, scene_w, scene_h,
|
||||||
|
|||||||
@@ -33,7 +33,9 @@ class EffectsSourceResolutionTest(unittest.TestCase):
|
|||||||
'static void effects_overlay_draws(',
|
'static void effects_overlay_draws(',
|
||||||
'static int render_impl(', 'static int pass_begin_impl('))
|
'static int render_impl(', 'static int pass_begin_impl('))
|
||||||
functions = (re.search(r'static int spatial_mode\([^\n]+', effects).group() + '\n' +
|
functions = (re.search(r'static int spatial_mode\([^\n]+', effects).group() + '\n' +
|
||||||
|
re.search(r'static int cas_active\([^\n]+', effects).group() + '\n' +
|
||||||
function(effects, 'int vkp_effects_upscaling(') +
|
function(effects, 'int vkp_effects_upscaling(') +
|
||||||
|
function(effects, 'int vkp_effects_sharpening(') +
|
||||||
function(effects, 'int vkp_effects_postprocessing(') + functions)
|
function(effects, 'int vkp_effects_postprocessing(') + functions)
|
||||||
image = source[source.index('struct vkp_image {'):source.index('\n};', source.index('struct vkp_image {')) + 3]
|
image = source[source.index('struct vkp_image {'):source.index('\n};', source.index('struct vkp_image {')) + 3]
|
||||||
draw = header[header.index('struct vkp_draw {'):header.index('\n};', header.index('struct vkp_draw {')) + 3]
|
draw = header[header.index('struct vkp_draw {'):header.index('\n};', header.index('struct vkp_draw {')) + 3]
|
||||||
@@ -101,6 +103,9 @@ class EffectsSourceResolutionTest(unittest.TestCase):
|
|||||||
def test_postprocessing_keeps_foreground_inside_the_effect_chain(self):
|
def test_postprocessing_keeps_foreground_inside_the_effect_chain(self):
|
||||||
self.check_case('postprocessing')
|
self.check_case('postprocessing')
|
||||||
|
|
||||||
|
def test_frame_generation_keeps_upscaling_and_sharpening_at_panel_size(self):
|
||||||
|
self.check_case('framegen-sharpening')
|
||||||
|
|
||||||
|
|
||||||
TYPES = r'''
|
TYPES = r'''
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
@@ -192,7 +197,8 @@ static struct vkp_img_slot g_hdrscene, g_fgscene;
|
|||||||
static struct { int active, rw, rh; VkImage result; } g_pass;
|
static struct { int active, rw, rh; VkImage result; } g_pass;
|
||||||
static struct { int64_t present_ns, present_max_ns; unsigned presents; } g_perf;
|
static struct { int64_t present_ns, present_max_ns; unsigned presents; } g_perf;
|
||||||
static int effects_active = 1, framegen, cardboard;
|
static int effects_active = 1, framegen, cardboard;
|
||||||
static struct { int scaling; } g_cur = {4};
|
struct fx_settings { int scaling, cas_on, cas_pct; };
|
||||||
|
static struct fx_settings g_cur = {4};
|
||||||
static int copy_count, effects_count, screen_count, hdr_count, fail_scene, fail_effects, postprocessing;
|
static int copy_count, effects_count, screen_count, hdr_count, fail_scene, fail_effects, postprocessing;
|
||||||
static int copied_w, copied_h, target_w, target_h;
|
static int copied_w, copied_h, target_w, target_h;
|
||||||
static int effects_w, effects_h, output_w, output_h, logical_w, logical_h;
|
static int effects_w, effects_h, output_w, output_h, logical_w, logical_h;
|
||||||
@@ -276,7 +282,7 @@ static struct vkp_draw fullscreen(void) {
|
|||||||
}
|
}
|
||||||
static void reset(void) {
|
static void reset(void) {
|
||||||
copy_count = effects_count = screen_count = hdr_count = barrier_count = 0;
|
copy_count = effects_count = screen_count = hdr_count = barrier_count = 0;
|
||||||
effects_active = 1; g_cur.scaling = 4;
|
effects_active = 1; g_cur = (struct fx_settings){4};
|
||||||
framegen = cardboard = fail_scene = fail_effects = postprocessing = g_plain_frame = 0;
|
framegen = cardboard = fail_scene = fail_effects = postprocessing = g_plain_frame = 0;
|
||||||
g_pass.active = 0; g_extent = (VkExtent2D){1920, 1080};
|
g_pass.active = 0; g_extent = (VkExtent2D){1920, 1080};
|
||||||
image.w = 1280; image.h = 720;
|
image.w = 1280; image.h = 720;
|
||||||
@@ -552,6 +558,25 @@ static void check_allocation(void) {
|
|||||||
assert(recorded_blits[1].dstOffsets[1].x == 1920 && recorded_blits[1].dstOffsets[1].y == 1080);
|
assert(recorded_blits[1].dstOffsets[1].x == 1920 && recorded_blits[1].dstOffsets[1].y == 1080);
|
||||||
assert(target_w == 1920 && target_h == 1080);
|
assert(target_w == 1920 && target_h == 1080);
|
||||||
}
|
}
|
||||||
|
static void check_framegen_output(int scaling, int cas, int grading, int panel) {
|
||||||
|
reset(); framegen = 1; postprocessing = grading;
|
||||||
|
g_cur = (struct fx_settings){scaling, cas, cas ? 60 : 0};
|
||||||
|
g_extent = (VkExtent2D){2880, 1620};
|
||||||
|
struct vkp_draw draw = fullscreen();
|
||||||
|
run_path(0, &draw, 1, NULL);
|
||||||
|
assert(effects_count == 1);
|
||||||
|
assert(output_w == (panel ? 2880 : 1920) && output_h == (panel ? 1620 : 1080));
|
||||||
|
}
|
||||||
|
static void check_framegen_sharpening(void) {
|
||||||
|
check_framegen_output(4, 0, 0, 1);
|
||||||
|
check_framegen_output(3, 0, 0, 1);
|
||||||
|
check_framegen_output(8, 0, 0, 1);
|
||||||
|
check_framegen_output(0, 1, 1, 1);
|
||||||
|
check_framegen_output(1, 1, 1, 1);
|
||||||
|
check_framegen_output(0, 0, 1, 0);
|
||||||
|
check_framegen_output(6, 0, 0, 0);
|
||||||
|
check_framegen_output(2, 0, 1, 0);
|
||||||
|
}
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
assert(argc == 2); reset();
|
assert(argc == 2); reset();
|
||||||
if (!strcmp(argv[1], "helper")) check_helper();
|
if (!strcmp(argv[1], "helper")) check_helper();
|
||||||
@@ -567,6 +592,7 @@ int main(int argc, char **argv) {
|
|||||||
else if (!strcmp(argv[1], "effect-failure")) check_effect_failure();
|
else if (!strcmp(argv[1], "effect-failure")) check_effect_failure();
|
||||||
else if (!strcmp(argv[1], "overlay-barriers")) check_overlay_barriers();
|
else if (!strcmp(argv[1], "overlay-barriers")) check_overlay_barriers();
|
||||||
else if (!strcmp(argv[1], "postprocessing")) check_postprocessing();
|
else if (!strcmp(argv[1], "postprocessing")) check_postprocessing();
|
||||||
|
else if (!strcmp(argv[1], "framegen-sharpening")) check_framegen_sharpening();
|
||||||
else assert(0);
|
else assert(0);
|
||||||
puts("PASS");
|
puts("PASS");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ PFN_vkGetInstanceProcAddr vk_loader_gipa(void) { return NULL; }
|
|||||||
void vkp_effects_bind_device(VkDevice d, VkPhysicalDevice p, const VkPhysicalDeviceMemoryProperties *m) {}
|
void vkp_effects_bind_device(VkDevice d, VkPhysicalDevice p, const VkPhysicalDeviceMemoryProperties *m) {}
|
||||||
int vkp_effects_active(void) { return 0; }
|
int vkp_effects_active(void) { return 0; }
|
||||||
int vkp_effects_upscaling(void) { return 0; }
|
int vkp_effects_upscaling(void) { return 0; }
|
||||||
|
int vkp_effects_sharpening(void) { return 0; }
|
||||||
int vkp_effects_postprocessing(void) { return 0; }
|
int vkp_effects_postprocessing(void) { return 0; }
|
||||||
VkFilter vkp_effects_blit_filter(void) { return VK_FILTER_NEAREST; }
|
VkFilter vkp_effects_blit_filter(void) { return VK_FILTER_NEAREST; }
|
||||||
void vkp_effects_set_formats(VkFormat a, VkFormat b) {}
|
void vkp_effects_set_formats(VkFormat a, VkFormat b) {}
|
||||||
|
|||||||
Reference in new issue
Block a user