[vlc-commits] direct3d: remove Texture2DArray from the shader
Steve Lhomme
git at videolan.org
Thu Feb 18 06:46:05 UTC 2021
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Feb 15 10:30:15 2021 +0100| [ddf67a901b19ed06e3a278e6708f8ec7c859a0be] | committer: Steve Lhomme
direct3d: remove Texture2DArray from the shader
It works by just using Texture2D with the proper resource view. We don't use a
texture index anyway.
And rename D3D11_CompilePixelShader to D3D11_CompilePixelShaderBlob for
consistency.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ddf67a901b19ed06e3a278e6708f8ec7c859a0be
---
modules/video_output/win32/d3d11_shaders.c | 5 ++---
modules/video_output/win32/d3d11_shaders.h | 9 ++++-----
modules/video_output/win32/d3d_dynamic_shader.c | 13 +++++--------
modules/video_output/win32/d3d_dynamic_shader.h | 1 -
modules/video_output/win32/direct3d11.c | 4 ++--
5 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/modules/video_output/win32/d3d11_shaders.c b/modules/video_output/win32/d3d11_shaders.c
index 152e54982c..be41c60923 100644
--- a/modules/video_output/win32/d3d11_shaders.c
+++ b/modules/video_output/win32/d3d11_shaders.c
@@ -39,15 +39,14 @@
#include "d3d11_shaders.h"
#include "d3d_dynamic_shader.h"
-HRESULT (D3D11_CompilePixelShader)(vlc_object_t *o, const d3d_shader_compiler_t *compiler,
+HRESULT (D3D11_CompilePixelShaderBlob)(vlc_object_t *o, const d3d_shader_compiler_t *compiler,
d3d11_device_t *d3d_dev,
- bool texture_array,
const display_info_t *display,
video_transfer_func_t transfer,
video_color_primaries_t primaries, bool src_full_range,
d3d11_quad_t *quad, d3d_shader_blob pPSBlob[DXGI_MAX_RENDER_TARGET])
{
- return D3D_CompilePixelShader(o, compiler, d3d_dev->feature_level, texture_array,
+ return D3D_CompilePixelShader(o, compiler, d3d_dev->feature_level,
display, transfer, primaries,
src_full_range, quad->generic.textureFormat, pPSBlob);
}
diff --git a/modules/video_output/win32/d3d11_shaders.h b/modules/video_output/win32/d3d11_shaders.h
index 7cd3e93e05..57984a7215 100644
--- a/modules/video_output/win32/d3d11_shaders.h
+++ b/modules/video_output/win32/d3d11_shaders.h
@@ -53,14 +53,13 @@ typedef struct
VS_PROJECTION_CONST vConstants;
} d3d11_quad_t;
-HRESULT D3D11_CompilePixelShader(vlc_object_t *, const d3d_shader_compiler_t *,
- d3d11_device_t *, bool texture_array,
- const display_info_t *,
+HRESULT D3D11_CompilePixelShaderBlob(vlc_object_t *, const d3d_shader_compiler_t *,
+ d3d11_device_t *, const display_info_t *,
video_transfer_func_t, video_color_primaries_t,
bool src_full_range,
d3d11_quad_t *, d3d_shader_blob pPSBlob[DXGI_MAX_RENDER_TARGET]);
-#define D3D11_CompilePixelShader(a,b,c,d,e,f,g,h,i,j) \
- D3D11_CompilePixelShader(VLC_OBJECT(a),b,c,d,e,f,g,h,i,j)
+#define D3D11_CompilePixelShaderBlob(a,b,c,d,e,f,g,h,i) \
+ D3D11_CompilePixelShaderBlob(VLC_OBJECT(a),b,c,d,e,f,g,h,i)
HRESULT D3D11_SetQuadPixelShader(vlc_object_t *, d3d11_device_t *,
bool sharp,
d3d11_quad_t *quad, d3d_shader_blob pPSBlob[DXGI_MAX_RENDER_TARGET]);
diff --git a/modules/video_output/win32/d3d_dynamic_shader.c b/modules/video_output/win32/d3d_dynamic_shader.c
index f2a674fabc..28c4cf8829 100644
--- a/modules/video_output/win32/d3d_dynamic_shader.c
+++ b/modules/video_output/win32/d3d_dynamic_shader.c
@@ -46,7 +46,7 @@ static const char globPixelShaderDefault[] = "\
float BoundaryX;\n\
float BoundaryY;\n\
};\n\
- Texture2D%s shaderTexture[4];\n\
+ Texture2D shaderTexture[4];\n\
SamplerState normalSampler : register(s0);\n\
SamplerState borderSampler : register(s1);\n\
\n\
@@ -104,9 +104,8 @@ const float ST2084_c3 = (2392.0 / 4096.0) * 32.0;\n\
%s;\n\
}\n\
\n\
- inline float4 sampleTexture(SamplerState samplerState, float2 uv) {\n\
+ inline float4 sampleTexture(SamplerState samplerState, float2 coords) {\n\
float4 sample;\n\
- float3 coords = float3(uv, 0);\n\
%s /* sampling routine in sample */\n\
return sample;\n\
}\n\
@@ -259,7 +258,6 @@ static HRESULT CompileShader(vlc_object_t *obj, const d3d_shader_compiler_t *com
static HRESULT CompilePixelShaderBlob(vlc_object_t *o, const d3d_shader_compiler_t *compiler,
D3D_FEATURE_LEVEL feature_level,
- bool texture_array,
const char *psz_sampler,
const char *psz_src_to_linear,
const char *psz_primaries_transform,
@@ -269,7 +267,7 @@ static HRESULT CompilePixelShaderBlob(vlc_object_t *o, const d3d_shader_compiler
d3d_shader_blob *pPSBlob)
{
char *shader;
- int allocated = asprintf(&shader, globPixelShaderDefault, texture_array ? "Array" : "",
+ int allocated = asprintf(&shader, globPixelShaderDefault,
psz_src_to_linear, psz_linear_to_display,
psz_primaries_transform, psz_tone_mapping,
psz_adjust_range, psz_move_planes, psz_sampler);
@@ -299,7 +297,6 @@ static HRESULT CompilePixelShaderBlob(vlc_object_t *o, const d3d_shader_compiler
HRESULT (D3D_CompilePixelShader)(vlc_object_t *o, const d3d_shader_compiler_t *compiler,
D3D_FEATURE_LEVEL feature_level,
- bool texture_array,
const display_info_t *display,
video_transfer_func_t transfer,
video_color_primaries_t primaries, bool src_full_range,
@@ -636,7 +633,7 @@ HRESULT (D3D_CompilePixelShader)(vlc_object_t *o, const d3d_shader_compiler_t *c
}
HRESULT hr;
- hr = CompilePixelShaderBlob(o, compiler, feature_level, texture_array,
+ hr = CompilePixelShaderBlob(o, compiler, feature_level,
psz_sampler[0],
psz_src_to_linear,
psz_primaries_transform,
@@ -645,7 +642,7 @@ HRESULT (D3D_CompilePixelShader)(vlc_object_t *o, const d3d_shader_compiler_t *c
psz_adjust_range, DEFAULT_NOOP, &pPSBlob[0]);
if (SUCCEEDED(hr) && psz_sampler[1])
{
- hr = CompilePixelShaderBlob(o, compiler, feature_level, texture_array,
+ hr = CompilePixelShaderBlob(o, compiler, feature_level,
psz_sampler[1],
psz_src_to_linear,
psz_primaries_transform,
diff --git a/modules/video_output/win32/d3d_dynamic_shader.h b/modules/video_output/win32/d3d_dynamic_shader.h
index 4431de7555..57606b4d42 100644
--- a/modules/video_output/win32/d3d_dynamic_shader.h
+++ b/modules/video_output/win32/d3d_dynamic_shader.h
@@ -34,7 +34,6 @@ void D3D_ReleaseShaderCompiler(d3d_shader_compiler_t *);
HRESULT D3D_CompilePixelShader(vlc_object_t *, const d3d_shader_compiler_t *,
D3D_FEATURE_LEVEL,
- bool texture_array,
const display_info_t *,
video_transfer_func_t,
video_color_primaries_t, bool src_full_range,
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 0fe64e0959..f7dbf765f7 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1036,7 +1036,7 @@ static int Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
BogusZeroCopy(vd) || !is_d3d11_opaque(fmt->i_chroma);
d3d_shader_blob pPSBlob[DXGI_MAX_RENDER_TARGET] = { 0 };
- hr = D3D11_CompilePixelShader(vd, &sys->shaders, sys->d3d_dev, !sys->legacy_shader,
+ hr = D3D11_CompilePixelShaderBlob(vd, &sys->shaders, sys->d3d_dev,
&sys->display, fmt->transfer, fmt->primaries,
fmt->color_range == COLOR_RANGE_FULL,
&sys->picQuad, pPSBlob);
@@ -1185,7 +1185,7 @@ static int Direct3D11CreateGenericResources(vout_display_t *vd)
if (sys->regionQuad.generic.textureFormat != NULL)
{
d3d_shader_blob pPSBlob[DXGI_MAX_RENDER_TARGET] = { 0 };
- hr = D3D11_CompilePixelShader(vd, &sys->shaders, sys->d3d_dev, false,
+ hr = D3D11_CompilePixelShaderBlob(vd, &sys->shaders, sys->d3d_dev,
&sys->display, TRANSFER_FUNC_SRGB, COLOR_PRIMARIES_SRGB, true,
&sys->regionQuad, pPSBlob);
if (FAILED(hr))
More information about the vlc-commits
mailing list