Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- a/src/vulkan/overlay-layer/overlay.cpp 2022/01/23 15:01:00 1.1
- +++ b/src/vulkan/overlay-layer/overlay.cpp 2022/01/23 15:32:42
- @@ -1170,6 +1170,7 @@
- return NULL;
- struct device_data *device_data = data->device;
- + struct overlay_params *overlay_params = &data->device->instance->params;
- struct overlay_draw *draw = get_overlay_draw(data);
- device_data->vtable.ResetCommandBuffer(draw->command_buffer, 0);
- @@ -1291,8 +1292,8 @@
- * is typically (0,0) for single viewport apps.
- */
- float scale[2];
- - scale[0] = 2.0f / draw_data->DisplaySize.x;
- - scale[1] = 2.0f / draw_data->DisplaySize.y;
- + scale[0] = overlay_params->scale * overlay_params->scale_x * 2.0f / draw_data->DisplaySize.x;
- + scale[1] = overlay_params->scale * overlay_params->scale_y * 2.0f / draw_data->DisplaySize.y;
- float translate[2];
- translate[0] = -1.0f - draw_data->DisplayPos.x * scale[0];
- translate[1] = -1.0f - draw_data->DisplayPos.y * scale[1];
- @@ -1318,8 +1319,8 @@
- VkRect2D scissor;
- scissor.offset.x = (int32_t)(pcmd->ClipRect.x - display_pos.x) > 0 ? (int32_t)(pcmd->ClipRect.x - display_pos.x) : 0;
- scissor.offset.y = (int32_t)(pcmd->ClipRect.y - display_pos.y) > 0 ? (int32_t)(pcmd->ClipRect.y - display_pos.y) : 0;
- - scissor.extent.width = (uint32_t)(pcmd->ClipRect.z - pcmd->ClipRect.x);
- - scissor.extent.height = (uint32_t)(pcmd->ClipRect.w - pcmd->ClipRect.y + 1); // FIXME: Why +1 here?
- + scissor.extent.width = (uint32_t)(overlay_params->scale * overlay_params->scale_x * pcmd->ClipRect.z - pcmd->ClipRect.x);
- + scissor.extent.height = (uint32_t)(overlay_params->scale * overlay_params->scale_y * pcmd->ClipRect.w - pcmd->ClipRect.y + 1); // FIXME: Why +1 here?
- device_data->vtable.CmdSetScissor(draw->command_buffer, 0, 1, &scissor);
- // Draw
- --- a/src/vulkan/overlay-layer/overlay_params.c 2022/01/23 15:06:59 1.1
- +++ b/src/vulkan/overlay-layer/overlay_params.c 2022/01/23 15:32:00
- @@ -87,6 +87,15 @@
- #define parse_width(s) parse_unsigned(s)
- #define parse_height(s) parse_unsigned(s)
- +static float
- +parse_float(const char *str) {
- + return strtof(str, NULL);
- +}
- +
- +#define parse_scale(s) parse_float(s)
- +#define parse_scale_x(s) parse_float(s)
- +#define parse_scale_y(s) parse_float(s)
- +
- static bool
- parse_help(const char *str)
- {
- @@ -103,6 +111,9 @@
- fprintf(stderr, "\toutput_file=/path/to/output.txt\n");
- fprintf(stderr, "\twidth=width-in-pixels\n");
- fprintf(stderr, "\theight=height-in-pixels\n");
- + fprintf(stderr, "\tscale=scale\n");
- + fprintf(stderr, "\tscale_x=scale\n");
- + fprintf(stderr, "\tscale_y=scale\n");
- return true;
- }
- @@ -170,6 +181,9 @@
- params->fps_sampling_period = 500000; /* 500ms */
- params->width = params->height = 300;
- params->control = -1;
- + params->scale = 1.0f;
- + params->scale_x = 1.0f;
- + params->scale_y = 1.0f;
- if (!env)
- return;
- --- a/src/vulkan/overlay-layer/overlay_params.h 2022/01/23 15:06:59 1.1
- +++ b/src/vulkan/overlay-layer/overlay_params.h 2022/01/23 15:19:07
- @@ -72,6 +72,9 @@
- OVERLAY_PARAM_CUSTOM(height) \
- OVERLAY_PARAM_CUSTOM(no_display) \
- OVERLAY_PARAM_CUSTOM(control) \
- + OVERLAY_PARAM_CUSTOM(scale) \
- + OVERLAY_PARAM_CUSTOM(scale_x) \
- + OVERLAY_PARAM_CUSTOM(scale_y) \
- OVERLAY_PARAM_CUSTOM(help)
- enum overlay_param_position {
- @@ -100,6 +103,9 @@
- bool no_display;
- unsigned width;
- unsigned height;
- + float scale;
- + float scale_x;
- + float scale_y;
- };
- const extern char *overlay_param_names[];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement