diff --git a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12converter-builder.cpp b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12converter-builder.cpp index 6d1e2555df..25797ae10b 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12converter-builder.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12converter-builder.cpp @@ -478,17 +478,17 @@ ConverterRootSignature::ConverterRootSignature (D3D_ROOT_SIGNATURE_VERSION /* VS root const, maybe updated */ vs_root_const_ = (UINT) param_list_v1_1.size (); - param.InitAsConstants (16, 0, 1, D3D12_SHADER_VISIBILITY_VERTEX); + param.InitAsConstants (16, 0, 0, D3D12_SHADER_VISIBILITY_VERTEX); param_list_v1_1.push_back (param); /* PS alpha constant value, maybe updated */ ps_root_const_ = (UINT) param_list_v1_1.size (); - param.InitAsConstants (1, 0, 0, D3D12_SHADER_VISIBILITY_PIXEL); + param.InitAsConstants (1, 1, 0, D3D12_SHADER_VISIBILITY_PIXEL); param_list_v1_1.push_back (param); /* PS CBV, this is static */ ps_cbv_ = (UINT) param_list_v1_1.size (); - param.InitAsConstantBufferView (1, 0, + param.InitAsConstantBufferView (2, 0, D3D12_ROOT_DESCRIPTOR_FLAG_DATA_STATIC_WHILE_SET_AT_EXECUTE, D3D12_SHADER_VISIBILITY_PIXEL); param_list_v1_1.push_back (param); @@ -522,12 +522,12 @@ ConverterRootSignature::ConverterRootSignature (D3D_ROOT_SIGNATURE_VERSION /* PS alpha constant value, maybe updated */ ps_root_const_ = (UINT) param_list_v1_0.size (); - param.InitAsConstants (1, 0, 0, D3D12_SHADER_VISIBILITY_PIXEL); + param.InitAsConstants (1, 1, 0, D3D12_SHADER_VISIBILITY_PIXEL); param_list_v1_0.push_back (param); /* PS CBV, this is static */ ps_cbv_ = (UINT) param_list_v1_0.size (); - param.InitAsConstantBufferView (1, 0, D3D12_SHADER_VISIBILITY_PIXEL); + param.InitAsConstantBufferView (2, 0, D3D12_SHADER_VISIBILITY_PIXEL); param_list_v1_0.push_back (param); CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC::Init_1_0 (desc, diff --git a/subprojects/gst-plugins-bad/sys/d3d12/hlsl/PSMain_converter.hlsl b/subprojects/gst-plugins-bad/sys/d3d12/hlsl/PSMain_converter.hlsl index cc02a61211..326bc7a435 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/hlsl/PSMain_converter.hlsl +++ b/subprojects/gst-plugins-bad/sys/d3d12/hlsl/PSMain_converter.hlsl @@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -cbuffer PsAlphaFactor : register(b0, space0) +cbuffer PsAlphaFactor : register(b1) { float alphaFactor; }; @@ -33,39 +33,22 @@ struct PSColorSpace float padding; }; -cbuffer PsConstBuffer : register(b1, space0) +cbuffer PsConstBuffer : register(b2) { PSColorSpace preCoeff; PSColorSpace postCoeff; PSColorSpace primariesCoeff; }; -#ifdef NUM_SRV_1 -Texture2D shaderTexture_0 : register(t0, space0); -#endif -#ifdef NUM_SRV_2 -Texture2D shaderTexture_0 : register(t0, space0); -Texture2D shaderTexture_1 : register(t1, space0); -#endif -#ifdef NUM_SRV_3 -Texture2D shaderTexture_0 : register(t0, space0); -Texture2D shaderTexture_1 : register(t1, space0); -Texture2D shaderTexture_2 : register(t2, space0); -#endif -#ifdef NUM_SRV_4 -Texture2D shaderTexture_0 : register(t0, space0); -Texture2D shaderTexture_1 : register(t1, space0); -Texture2D shaderTexture_2 : register(t2, space0); -Texture2D shaderTexture_3 : register(t3, space0); -#endif +Texture2D shaderTexture_0 : register(t0); +Texture2D shaderTexture_1 : register(t1); +Texture2D shaderTexture_2 : register(t2); +Texture2D shaderTexture_3 : register(t3); +Texture1D gammaDecLUT : register(t4); +Texture1D gammaEncLUT : register(t5); -SamplerState samplerState : register(s0, space0); - -#ifdef BUILD_LUT -Texture1D gammaDecLUT : register(t4, space0); -Texture1D gammaEncLUT : register(t5, space0); -SamplerState lutSamplerState : register(s1, space0); -#endif +SamplerState samplerState : register(s0); +SamplerState lutSamplerState : register(s1); struct PS_INPUT { @@ -133,7 +116,6 @@ interface ISampler float4 Execute (float2 uv); }; -#ifdef NUM_SRV_1 class SamplerRGBA : ISampler { float4 Execute (float2 uv) @@ -258,9 +240,7 @@ class SamplerGRAY : ISampler return sample; } }; -#endif -#ifdef NUM_SRV_2 class SamplerNV12 : ISampler { float4 Execute (float2 uv) @@ -284,9 +264,7 @@ class SamplerNV21 : ISampler return sample; } }; -#endif -#ifdef NUM_SRV_3 class SamplerI420 : ISampler { float4 Execute (float2 uv) @@ -399,9 +377,7 @@ class SamplerBGRP : ISampler return sample; } }; -#endif -#ifdef NUM_SRV_4 class SamplerGBRA : ISampler { float4 Execute (float2 uv) @@ -440,7 +416,6 @@ class SamplerGBRA_12 : ISampler return saturate (sample * 16.0); } }; -#endif interface IConverter { @@ -481,7 +456,6 @@ class ConverterSimple : IConverter } }; -#ifdef BUILD_LUT class ConverterGamma : IConverter { float4 Execute (float4 sample) @@ -540,7 +514,6 @@ class ConverterPrimary : IConverter return float4 (clamp (out_space, postCoeff.Min, postCoeff.Max), sample.a); } }; -#endif float UnormTo10bit (float sample) { diff --git a/subprojects/gst-plugins-bad/sys/d3d12/hlsl/PSMain_sample.hlsl b/subprojects/gst-plugins-bad/sys/d3d12/hlsl/PSMain_sample.hlsl index 0d2562cc14..e9340d926e 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/hlsl/PSMain_sample.hlsl +++ b/subprojects/gst-plugins-bad/sys/d3d12/hlsl/PSMain_sample.hlsl @@ -17,8 +17,8 @@ * Boston, MA 02110-1301, USA. */ -Texture2D shaderTexture : register(t0, space0); -SamplerState samplerState : register(s0, space0); +Texture2D shaderTexture : register(t0); +SamplerState samplerState : register(s0); struct PS_INPUT { diff --git a/subprojects/gst-plugins-bad/sys/d3d12/hlsl/PSMain_sample_premul.hlsl b/subprojects/gst-plugins-bad/sys/d3d12/hlsl/PSMain_sample_premul.hlsl index 38ecdffa96..0b9b0917af 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/hlsl/PSMain_sample_premul.hlsl +++ b/subprojects/gst-plugins-bad/sys/d3d12/hlsl/PSMain_sample_premul.hlsl @@ -17,8 +17,8 @@ * Boston, MA 02110-1301, USA. */ -Texture2D shaderTexture : register(t0, space0); -SamplerState samplerState : register(s0, space0); +Texture2D shaderTexture : register(t0); +SamplerState samplerState : register(s0); struct PS_INPUT { diff --git a/subprojects/gst-plugins-bad/sys/d3d12/hlsl/VSMain_converter.hlsl b/subprojects/gst-plugins-bad/sys/d3d12/hlsl/VSMain_converter.hlsl index 3f63803a6c..b2de1fbcb6 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/hlsl/VSMain_converter.hlsl +++ b/subprojects/gst-plugins-bad/sys/d3d12/hlsl/VSMain_converter.hlsl @@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -cbuffer VsConstBuffer : register(b0, space1) +cbuffer VsConstBuffer : register(b0) { matrix Transform; }; diff --git a/subprojects/gst-plugins-bad/sys/d3d12/hlsl/meson.build b/subprojects/gst-plugins-bad/sys/d3d12/hlsl/meson.build index 6b52dc408a..9c77fea939 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/hlsl/meson.build +++ b/subprojects/gst-plugins-bad/sys/d3d12/hlsl/meson.build @@ -90,16 +90,15 @@ foreach input_format : hlsl_conv_ps_input_formats compiled_shader = custom_target(header, input : hlsl_conv_ps_source, output : header, - command : [dxc, '/Fh', '@OUTPUT@', + command : [fxc, '/Fh', '@OUTPUT@', '/E', entry_point, - '/T', 'ps_6_0', + '/T', 'ps_5_0', '/D', 'OUTPUT_TYPE=@0@'.format(output_type), '/D', 'ENTRY_POINT=@0@'.format(entry_point), '/D', 'SAMPLER=Sampler@0@'.format(in_format), '/D', 'CONVERTER=Converter@0@'.format(conv), '/D', 'OUTPUT_BUILDER=Output@0@'.format(output_builder), - '/D', 'NUM_SRV_@0@=1'.format(num_srv), - '/all-resources-bound', + '/nologo', '@INPUT@']) hlsl_precompiled += [compiled_shader] endforeach @@ -110,17 +109,15 @@ foreach input_format : hlsl_conv_ps_input_formats compiled_shader = custom_target(header, input : hlsl_conv_ps_source, output : header, - command : [dxc, '/Fh', '@OUTPUT@', + command : [fxc, '/Fh', '@OUTPUT@', '/E', entry_point, - '/T', 'ps_6_0', + '/T', 'ps_5_0', '/D', 'OUTPUT_TYPE=@0@'.format(output_type), '/D', 'ENTRY_POINT=@0@'.format(entry_point), '/D', 'SAMPLER=Sampler@0@'.format(in_format), '/D', 'CONVERTER=Converter@0@'.format(conv), '/D', 'OUTPUT_BUILDER=Output@0@'.format(output_builder), - '/D', 'NUM_SRV_@0@=1'.format(num_srv), - '/D', 'BUILD_LUT=1', - '/all-resources-bound', + '/nologo', '@INPUT@']) hlsl_precompiled += [compiled_shader] endforeach @@ -140,18 +137,18 @@ generated_collection = custom_target(header_collection, hlsl_precompiled += generated_collection hlsl_sources = [ - ['VSMain_converter', 'vs_6_0'], - ['PSMain_sample', 'ps_6_0'], - ['PSMain_sample_premul', 'ps_6_0'], - ['VSMain_coord', 'vs_6_0'], - ['PSMain_color', 'ps_6_0'], - ['VSMain_color', 'vs_6_0'], - ['PSMain_snow', 'ps_6_0'], - ['PSMain_checker', 'ps_6_0'], - ['PSMain_checker_luma', 'ps_6_0'], - ['PSMain_checker_rgb', 'ps_6_0'], - ['PSMain_checker_vuya', 'ps_6_0'], - ['VSMain_pos', 'vs_6_0'], + ['VSMain_converter', 'vs_5_0'], + ['PSMain_sample', 'ps_5_0'], + ['PSMain_sample_premul', 'ps_5_0'], + ['VSMain_coord', 'vs_5_0'], + ['PSMain_color', 'ps_5_0'], + ['VSMain_color', 'vs_5_0'], + ['PSMain_snow', 'ps_5_0'], + ['PSMain_checker', 'ps_5_0'], + ['PSMain_checker_luma', 'ps_5_0'], + ['PSMain_checker_rgb', 'ps_5_0'], + ['PSMain_checker_vuya', 'ps_5_0'], + ['VSMain_pos', 'vs_5_0'], ] foreach shader : hlsl_sources @@ -161,10 +158,10 @@ foreach shader : hlsl_sources compiled_shader = custom_target(header, input : source, output : header, - command : [dxc, '/Fh', '@OUTPUT@', + command : [fxc, '/Fh', '@OUTPUT@', '/E', entry_point, '/T', shader.get(1), - '/all-resources-bound', + '/nologo', '@INPUT@']) hlsl_precompiled += [compiled_shader] endforeach diff --git a/subprojects/gst-plugins-bad/sys/d3d12/meson.build b/subprojects/gst-plugins-bad/sys/d3d12/meson.build index 0af0e36736..dbeb9d6777 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/meson.build +++ b/subprojects/gst-plugins-bad/sys/d3d12/meson.build @@ -75,10 +75,10 @@ dx_headers_dep = dependency('DirectX-Headers', version: '>= 1.611', allow_fallback: true, required: d3d12_option) -dxc = find_program('dxc', required : d3d12_option) +fxc = find_program('fxc', required : d3d12_option) if not gstdxva_dep.found() or not d3d12_lib.found() or not dxgi_lib.found() \ - or not dx_headers_dep.found() or not dxc.found() or not d2d_dep.found() \ + or not dx_headers_dep.found() or not fxc.found() or not d2d_dep.found() \ or not dwmapi_lib.found() if d3d12_option.enabled() error('The d3d12 was enabled explicitly, but required dependencies were not found.')