mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-03 04:24:41 +00:00
Updated direct3d12 renderer with HDR10 and SDR whitelevel support
This commit is contained in:
@@ -6,8 +6,6 @@ SamplerState theSampler : register(s0);
|
||||
|
||||
float4 main(PixelShaderInput input) : SV_TARGET
|
||||
{
|
||||
float4 Output;
|
||||
|
||||
float3 yuv;
|
||||
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
|
||||
yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;
|
||||
|
||||
@@ -6,8 +6,6 @@ SamplerState theSampler : register(s0);
|
||||
|
||||
float4 main(PixelShaderInput input) : SV_TARGET
|
||||
{
|
||||
float4 Output;
|
||||
|
||||
float3 yuv;
|
||||
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
|
||||
yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr;
|
||||
|
||||
@@ -7,8 +7,6 @@ SamplerState theSampler : register(s0);
|
||||
|
||||
float4 main(PixelShaderInput input) : SV_TARGET
|
||||
{
|
||||
float4 Output;
|
||||
|
||||
float3 yuv;
|
||||
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
|
||||
yuv.y = theTextureU.Sample(theSampler, input.tex).r;
|
||||
|
||||
@@ -380,6 +380,21 @@ static void D3D11_DestroyRenderer(SDL_Renderer *renderer)
|
||||
SDL_free(renderer);
|
||||
}
|
||||
|
||||
static void D3D11_UpdateHDRState(SDL_Renderer *renderer)
|
||||
{
|
||||
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
|
||||
|
||||
/* Using some placeholder values here... */
|
||||
data->HDR_enabled = SDL_TRUE;
|
||||
if (renderer->output_colorspace == SDL_COLORSPACE_SCRGB && data->HDR_enabled) {
|
||||
data->SDR_whitelevel = 200.0f;
|
||||
data->HDR_whitelevel = 400.0f;
|
||||
} else {
|
||||
data->SDR_whitelevel = 80.0f;
|
||||
data->HDR_whitelevel = 80.0f;
|
||||
}
|
||||
}
|
||||
|
||||
static D3D11_BLEND GetBlendFunc(SDL_BlendFactor factor)
|
||||
{
|
||||
switch (factor) {
|
||||
@@ -470,21 +485,6 @@ static ID3D11BlendState *D3D11_CreateBlendState(SDL_Renderer *renderer, SDL_Blen
|
||||
return blendState;
|
||||
}
|
||||
|
||||
static void D3D11_UpdateHDRState(SDL_Renderer *renderer)
|
||||
{
|
||||
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
|
||||
|
||||
/* Using some placeholder values here... */
|
||||
data->HDR_enabled = SDL_TRUE;
|
||||
if (renderer->output_colorspace == SDL_COLORSPACE_SCRGB && data->HDR_enabled) {
|
||||
data->SDR_whitelevel = 200.0f;
|
||||
data->HDR_whitelevel = 400.0f;
|
||||
} else {
|
||||
data->SDR_whitelevel = 80.0f;
|
||||
data->HDR_whitelevel = 80.0f;
|
||||
}
|
||||
}
|
||||
|
||||
/* Create resources that depend on the device. */
|
||||
static HRESULT D3D11_CreateDeviceResources(SDL_Renderer *renderer)
|
||||
{
|
||||
@@ -2222,7 +2222,6 @@ static int D3D11_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
||||
} else {
|
||||
constants.scRGB_output = 0.0f;
|
||||
}
|
||||
|
||||
constants.SDR_whitelevel = (float)rendererData->SDR_whitelevel;
|
||||
constants.HDR_whitelevel = (float)rendererData->HDR_whitelevel;
|
||||
constants.maxCLL = 400.0f;
|
||||
|
||||
Reference in New Issue
Block a user