mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-08-17 17:32:09 +08:00
Make sure the PQ shader will output the input value before using the simple shader
Note that we don't account for vertex color here. If HDR10 content needs to be tinted by vertex color, it can't use the simple shader. I'm assuming that the use case for this will be video content which generally won't use vertex color and this optimization is fine.
This commit is contained in:
@@ -2286,14 +2286,9 @@ static D3D11_Shader SelectShader(SDL_Renderer *renderer, const D3D11_PixelShader
|
||||
{
|
||||
if (shader_constants) {
|
||||
if (renderer->current_colorspace == SDL_COLORSPACE_HDR10) {
|
||||
float SDR_white_point;
|
||||
if (renderer->target) {
|
||||
SDR_white_point = renderer->target->SDR_white_point;
|
||||
} else {
|
||||
SDR_white_point = renderer->SDR_white_point;
|
||||
}
|
||||
if (shader_constants->input_type == INPUTTYPE_HDR10 &&
|
||||
shader_constants->color_scale == SDR_white_point) {
|
||||
shader_constants->tonemap_method == 0.0f &&
|
||||
(shader_constants->sdr_white_point / SCRGB_NITS) == shader_constants->color_scale) {
|
||||
// Do a simple 1-1 copy
|
||||
return SHADER_RGB_SIMPLE;
|
||||
} else {
|
||||
|
||||
@@ -2746,14 +2746,9 @@ static D3D12_Shader SelectShader(SDL_Renderer *renderer, const D3D12_PixelShader
|
||||
{
|
||||
if (shader_constants) {
|
||||
if (renderer->current_colorspace == SDL_COLORSPACE_HDR10) {
|
||||
float SDR_white_point;
|
||||
if (renderer->target) {
|
||||
SDR_white_point = renderer->target->SDR_white_point;
|
||||
} else {
|
||||
SDR_white_point = renderer->SDR_white_point;
|
||||
}
|
||||
if (shader_constants->input_type == INPUTTYPE_HDR10 &&
|
||||
shader_constants->color_scale == SDR_white_point) {
|
||||
shader_constants->tonemap_method == 0.0f &&
|
||||
(shader_constants->sdr_white_point / SCRGB_NITS) == shader_constants->color_scale) {
|
||||
// Do a simple 1-1 copy
|
||||
return SHADER_RGB_SIMPLE;
|
||||
} else {
|
||||
|
||||
@@ -3558,14 +3558,9 @@ static VULKAN_Shader SelectShader(SDL_Renderer *renderer, const VULKAN_PixelShad
|
||||
{
|
||||
if (shader_constants) {
|
||||
if (renderer->current_colorspace == SDL_COLORSPACE_HDR10) {
|
||||
float SDR_white_point;
|
||||
if (renderer->target) {
|
||||
SDR_white_point = renderer->target->SDR_white_point;
|
||||
} else {
|
||||
SDR_white_point = renderer->SDR_white_point;
|
||||
}
|
||||
if (shader_constants->input_type == INPUTTYPE_HDR10 &&
|
||||
shader_constants->color_scale == SDR_white_point) {
|
||||
shader_constants->tonemap_method == 0.0f &&
|
||||
(shader_constants->sdr_white_point / SCRGB_NITS) == shader_constants->color_scale) {
|
||||
// Do a simple 1-1 copy
|
||||
return SHADER_RGB_SIMPLE;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user