mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 05:59:10 +00:00
d3d12: Use D3D12_FILTER_MIN_MAG_MIP_LINEAR filter by default
... instead of D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT, since we supports mipmap texture now. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7555>
This commit is contained in:
parent
8550ed5888
commit
51e1834e81
4 changed files with 14 additions and 10 deletions
|
@ -55,6 +55,8 @@ gst_d3d12_converter_sampler_filter_get_type (void)
|
||||||
"D3D12_FILTER_MIN_LINEAR_MAG_MIP_POINT", "min-linear-mag-mip-point"},
|
"D3D12_FILTER_MIN_LINEAR_MAG_MIP_POINT", "min-linear-mag-mip-point"},
|
||||||
{D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT,
|
{D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT,
|
||||||
"D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT", "min-mag-linear-mip-point"},
|
"D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT", "min-mag-linear-mip-point"},
|
||||||
|
{D3D12_FILTER_MIN_MAG_MIP_LINEAR,
|
||||||
|
"D3D12_FILTER_MIN_MAG_MIP_LINEAR", "min-mag-mip-linear"},
|
||||||
{D3D12_FILTER_ANISOTROPIC, "D3D12_FILTER_ANISOTROPIC", "anisotropic"},
|
{D3D12_FILTER_ANISOTROPIC, "D3D12_FILTER_ANISOTROPIC", "anisotropic"},
|
||||||
{0, nullptr, nullptr},
|
{0, nullptr, nullptr},
|
||||||
};
|
};
|
||||||
|
@ -95,6 +97,7 @@ using namespace DirectX;
|
||||||
|
|
||||||
#define GAMMA_LUT_SIZE 4096
|
#define GAMMA_LUT_SIZE 4096
|
||||||
#define DEFAULT_BUFFER_COUNT 2
|
#define DEFAULT_BUFFER_COUNT 2
|
||||||
|
#define DEFAULT_SAMPLER_FILTER D3D12_FILTER_MIN_MAG_MIP_LINEAR
|
||||||
static const WORD g_indices[6] = { 0, 1, 2, 3, 0, 2 };
|
static const WORD g_indices[6] = { 0, 1, 2, 3, 0, 2 };
|
||||||
|
|
||||||
struct PSColorSpace
|
struct PSColorSpace
|
||||||
|
@ -321,7 +324,7 @@ struct _GstD3D12ConverterPrivate
|
||||||
GST_D3D12_CONVERTER_ALPHA_MODE_UNSPECIFIED;
|
GST_D3D12_CONVERTER_ALPHA_MODE_UNSPECIFIED;
|
||||||
GstD3D12ConverterAlphaMode dst_alpha_mode =
|
GstD3D12ConverterAlphaMode dst_alpha_mode =
|
||||||
GST_D3D12_CONVERTER_ALPHA_MODE_UNSPECIFIED;
|
GST_D3D12_CONVERTER_ALPHA_MODE_UNSPECIFIED;
|
||||||
D3D12_FILTER sampler_filter = D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT;
|
D3D12_FILTER sampler_filter = DEFAULT_SAMPLER_FILTER;
|
||||||
};
|
};
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
|
@ -392,7 +395,7 @@ gst_d3d12_converter_class_init (GstD3D12ConverterClass * klass)
|
||||||
g_object_class_install_property (object_class, PROP_SAMPLER_FILTER,
|
g_object_class_install_property (object_class, PROP_SAMPLER_FILTER,
|
||||||
g_param_spec_enum ("sampler-filter", "Sampler Filter",
|
g_param_spec_enum ("sampler-filter", "Sampler Filter",
|
||||||
"Sampler Filter", GST_TYPE_D3D12_CONVERTER_SAMPLER_FILTER,
|
"Sampler Filter", GST_TYPE_D3D12_CONVERTER_SAMPLER_FILTER,
|
||||||
D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT, param_flags));
|
DEFAULT_SAMPLER_FILTER, param_flags));
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_d3d12_converter_debug,
|
GST_DEBUG_CATEGORY_INIT (gst_d3d12_converter_debug,
|
||||||
"d3d12converter", 0, "d3d12converter");
|
"d3d12converter", 0, "d3d12converter");
|
||||||
|
@ -710,10 +713,9 @@ gst_d3d12_converter_create_sampler (GstD3D12Converter * self,
|
||||||
GetCPUDescriptorHandleForHeapStart (sampler_heap),
|
GetCPUDescriptorHandleForHeapStart (sampler_heap),
|
||||||
D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER);
|
D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER);
|
||||||
|
|
||||||
if (filter != D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT) {
|
if (filter != DEFAULT_SAMPLER_FILTER) {
|
||||||
hr = gst_d3d12_device_get_sampler_state (self->device,
|
hr = gst_d3d12_device_get_sampler_state (self->device,
|
||||||
D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT,
|
DEFAULT_SAMPLER_FILTER, sampler_heap.ReleaseAndGetAddressOf ());
|
||||||
sampler_heap.ReleaseAndGetAddressOf ());
|
|
||||||
|
|
||||||
if (!gst_d3d12_result (hr, self->device)) {
|
if (!gst_d3d12_result (hr, self->device)) {
|
||||||
GST_ERROR_OBJECT (self, "Couldn't create sampler heap");
|
GST_ERROR_OBJECT (self, "Couldn't create sampler heap");
|
||||||
|
@ -775,8 +777,8 @@ gst_d3d12_converter_setup_resource (GstD3D12Converter * self,
|
||||||
|
|
||||||
if (!gst_d3d12_converter_create_sampler (self, sampler_filter,
|
if (!gst_d3d12_converter_create_sampler (self, sampler_filter,
|
||||||
&priv->sampler_heap)) {
|
&priv->sampler_heap)) {
|
||||||
if (sampler_filter != D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT) {
|
if (sampler_filter != DEFAULT_SAMPLER_FILTER) {
|
||||||
sampler_filter = D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT;
|
sampler_filter = DEFAULT_SAMPLER_FILTER;
|
||||||
if (!gst_d3d12_converter_create_sampler (self, sampler_filter,
|
if (!gst_d3d12_converter_create_sampler (self, sampler_filter,
|
||||||
&priv->sampler_heap)) {
|
&priv->sampler_heap)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1884,7 +1886,7 @@ gst_d3d12_converter_new (GstD3D12Device * device, GstD3D12CommandQueue * queue,
|
||||||
GstD3D12Format out_d3d12_format;
|
GstD3D12Format out_d3d12_format;
|
||||||
gboolean allow_gamma = FALSE;
|
gboolean allow_gamma = FALSE;
|
||||||
gboolean allow_primaries = FALSE;
|
gboolean allow_primaries = FALSE;
|
||||||
D3D12_FILTER sampler_filter = D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT;
|
D3D12_FILTER sampler_filter = DEFAULT_SAMPLER_FILTER;
|
||||||
GstVideoInfo matrix_in_info;
|
GstVideoInfo matrix_in_info;
|
||||||
GstVideoInfo matrix_out_info;
|
GstVideoInfo matrix_out_info;
|
||||||
guint sample_count = 1;
|
guint sample_count = 1;
|
||||||
|
|
|
@ -62,9 +62,10 @@ G_BEGIN_DECLS
|
||||||
* @D3D12_FILTER_MIN_MAG_MIP_POINT
|
* @D3D12_FILTER_MIN_MAG_MIP_POINT
|
||||||
* @D3D12_FILTER_MIN_LINEAR_MAG_MIP_POINT
|
* @D3D12_FILTER_MIN_LINEAR_MAG_MIP_POINT
|
||||||
* @D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT
|
* @D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT
|
||||||
|
* @D3D12_FILTER_MIN_MAG_MIP_LINEAR
|
||||||
* @D3D12_FILTER_ANISOTROPIC
|
* @D3D12_FILTER_ANISOTROPIC
|
||||||
*
|
*
|
||||||
* Default is #D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT.
|
* Default is #D3D12_FILTER_MIN_MAG_MIP_LINEAR.
|
||||||
*
|
*
|
||||||
* Since: 1.26
|
* Since: 1.26
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2175,6 +2175,7 @@ gst_d3d12_device_get_sampler_state (GstD3D12Device * device,
|
||||||
case D3D12_FILTER_MIN_MAG_MIP_POINT:
|
case D3D12_FILTER_MIN_MAG_MIP_POINT:
|
||||||
case D3D12_FILTER_MIN_LINEAR_MAG_MIP_POINT:
|
case D3D12_FILTER_MIN_LINEAR_MAG_MIP_POINT:
|
||||||
case D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT:
|
case D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT:
|
||||||
|
case D3D12_FILTER_MIN_MAG_MIP_LINEAR:
|
||||||
break;
|
break;
|
||||||
case D3D12_FILTER_ANISOTROPIC:
|
case D3D12_FILTER_ANISOTROPIC:
|
||||||
max_anisotropy = 16;
|
max_anisotropy = 16;
|
||||||
|
|
|
@ -77,7 +77,7 @@ struct SamplingMethodMap
|
||||||
|
|
||||||
static const SamplingMethodMap sampling_method_map[] = {
|
static const SamplingMethodMap sampling_method_map[] = {
|
||||||
{GST_D3D12_SAMPLING_METHOD_NEAREST, D3D12_FILTER_MIN_MAG_MIP_POINT},
|
{GST_D3D12_SAMPLING_METHOD_NEAREST, D3D12_FILTER_MIN_MAG_MIP_POINT},
|
||||||
{GST_D3D12_SAMPLING_METHOD_BILINEAR, D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT},
|
{GST_D3D12_SAMPLING_METHOD_BILINEAR, D3D12_FILTER_MIN_MAG_MIP_LINEAR},
|
||||||
{GST_D3D12_SAMPLING_METHOD_LINEAR_MINIFICATION,
|
{GST_D3D12_SAMPLING_METHOD_LINEAR_MINIFICATION,
|
||||||
D3D12_FILTER_MIN_LINEAR_MAG_MIP_POINT},
|
D3D12_FILTER_MIN_LINEAR_MAG_MIP_POINT},
|
||||||
{GST_D3D12_SAMPLING_METHOD_ANISOTROPIC, D3D12_FILTER_ANISOTROPIC},
|
{GST_D3D12_SAMPLING_METHOD_ANISOTROPIC, D3D12_FILTER_ANISOTROPIC},
|
||||||
|
|
Loading…
Reference in a new issue