mirror of
https://github.com/libretro/parallel-dc.git
synced 2026-11-10 03:11:26 -10:00
A Color Format core option hands the frontend 30-bit HDR10 or 64-bit scRGB instead of the 24-bit picture, on Vulkan, Direct3D 11 and Direct3D 12 and every renderer of each, through the libretro HDR API (the pixel formats, GET_DISPLAY_METADATA, GET_HDR_METADATA). The picture is placed at the frontend's paper white and mapped onto the display through a Display Transform (beetle-psx's, vendored in rend/hdr/: Reinhard knee by default, which keeps everything below paper white as it was, ACES, ACES 2.0, AgX, PBR Neutral, GT, Hable and others), with optional HDR Expansion. At 24-bit, or when the frontend refuses, none of it runs and the picture is the same to the byte. On Vulkan the encode is the last subpass of the frame's render pass on the rasterizers and one draw on the compute renderer and CPU framebuffers, recorded into the frame's own submission (after the chip's write-out on a frame that has one); on Direct3D 11 and 12 it is one draw in the frame's context or command list, from one shared DXBC blob (tools/rend/kernels_dxbc.sh update-hdr). Nothing is copied and no submission or wait is added. ACES 2.0 (Full)'s cube is baked off the frame by a worker thread handed its jobs through atomics and an eventcount, without locks. tools/vulkan/vk_hdr.sh runs every Vulkan renderer at each Color Format and judges the pictures; tools/hdr/d3d_hdr.sh does the same with the Windows build on Direct3D 11 under wine; tools/vulkan/hdr_hlsl.sh and tools/hdr/hdr_d3d.sh hold the HLSL, and the Direct3D 11 and 12 encoders under wine, to the GLSL over every curve and setting; tools/hdr/hdr_cube.sh holds the worker's cube to the cube baked in place, under TSan and ASan/UBSan. All of them run in the Vulkan negotiation workflow.
43 lines
1.4 KiB
C++
43 lines
1.4 KiB
C++
/*
|
|
* Created on: Oct 3, 2019
|
|
|
|
Copyright 2019 flyinghead
|
|
|
|
This file is part of Flycast.
|
|
|
|
Flycast is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
Flycast is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with Flycast. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
#include "vulkan.h"
|
|
#include "vulkan_context.h"
|
|
#include "shaders.h"
|
|
#include "rend/sorter.h"
|
|
#define RASTER_SPV_WORDS
|
|
#include "raster_spv.inc"
|
|
|
|
// (both cast: on 32-bit x86, whose x87 keeps floats wider, the literal is
|
|
// otherwise compared at the wider precision)
|
|
static_assert((float)PREPASS_ALPHA_MIN == (float)PREPASS_ALPHA_MIN_GLSL, "the prepass's alpha, in shaders/prepass.frag (pso_key.h)");
|
|
|
|
const u32 *RasterSpvWords(RasterSpv id, size_t *size)
|
|
{
|
|
*size = raster_spv_size[id];
|
|
return raster_spv[id];
|
|
}
|
|
|
|
vk::UniqueShaderModule MakeRasterModule(RasterSpv id)
|
|
{
|
|
return VulkanContext::Instance()->GetDevice().createShaderModuleUnique(
|
|
vk::ShaderModuleCreateInfo(vk::ShaderModuleCreateFlags(), raster_spv_size[id], raster_spv[id]));
|
|
}
|