249 VkDescriptorSet desc_sets[] = {
259 vkCmdBindDescriptorSets(cmd_buf, VK_PIPELINE_BIND_POINT_COMPUTE,
262 vkCmdDispatch(cmd_buf,
270 .size = VK_WHOLE_SIZE,
271 .srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT,
272 .dstAccessMask = VK_ACCESS_SHADER_READ_BIT
279 vkCmdBindDescriptorSets(cmd_buf, VK_PIPELINE_BIND_POINT_COMPUTE,
297 float slope_blur_sigma =
Cvar_Get(
"tm_slope_blur_sigma",
"6.0", 0)->value;
298 float push_constants_tm2_curve[16] = {
308 float gaussian_sum = 0.0;
309 for (
int i = 0; i < 14; ++i)
311 float kernel_value = exp(-i * i / (2.0 * slope_blur_sigma * slope_blur_sigma));
312 gaussian_sum += kernel_value * (i == 0 ? 1 : 2);
313 push_constants_tm2_curve[i + 2] = kernel_value;
317 for (
int i = 0; i < 14; ++i) {
318 push_constants_tm2_curve[i + 2] /= gaussian_sum;
322 VK_SHADER_STAGE_COMPUTE_BIT, 0,
sizeof(push_constants_tm2_curve), push_constants_tm2_curve);
324 vkCmdDispatch(cmd_buf, 1, 1, 1);
329 .size = VK_WHOLE_SIZE,
330 .srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT,
331 .dstAccessMask = VK_ACCESS_SHADER_READ_BIT
339 vkCmdBindDescriptorSets(cmd_buf, VK_PIPELINE_BIND_POINT_COMPUTE,
364 float knee_start =
Cvar_Get(
"tm_knee_start",
"0.9", 0)->value;
366 float knee_white_point =
Cvar_Get(
"tm_white_point",
"10.0", 0)->value;
374 float knee_w = (knee_start*(knee_start - 2.0) + knee_white_point) / (knee_white_point - 1.0);
375 float knee_a = -knee_start * knee_start;
376 float knee_b = knee_w - 2.0*knee_start;
378 float push_constants_tm2_apply[3] = {
385 VK_SHADER_STAGE_COMPUTE_BIT, 0,
sizeof(push_constants_tm2_apply), push_constants_tm2_apply);
387 vkCmdDispatch(cmd_buf,