vlc | branch: master | Steve Lhomme <[email protected]> | Fri Jan 29 15:30:33 2021 +0100| [f414dd7d8ca42011f96fea4bf40e1d09117b9990] | committer: Steve Lhomme
dxgi_fmt: rename D3D11_MAX_SHADER_VIEW to DXGI_MAX_SHADER_VIEW It only depends on the number of resources needed to render a DXGI_FORMAT. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f414dd7d8ca42011f96fea4bf40e1d09117b9990 --- modules/codec/avcodec/d3d11va.c | 24 ++++++++++++------------ modules/video_chroma/d3d11_fmt.c | 16 ++++++++-------- modules/video_chroma/d3d11_fmt.h | 10 +++++----- modules/video_chroma/dxgi_fmt.c | 4 ++-- modules/video_chroma/dxgi_fmt.h | 4 ++-- modules/video_output/win32/d3d11_quad.c | 10 +++++----- modules/video_output/win32/d3d11_quad.h | 2 +- modules/video_output/win32/d3d11_shaders.c | 6 +++--- modules/video_output/win32/d3d11_shaders.h | 4 ++-- modules/video_output/win32/direct3d11.c | 8 ++++---- 10 files changed, 44 insertions(+), 44 deletions(-) diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c index 61b5aed54b..a2424b41e2 100644 --- a/modules/codec/avcodec/d3d11va.c +++ b/modules/codec/avcodec/d3d11va.c @@ -93,7 +93,7 @@ struct vlc_va_sys_t /* pool */ va_pool_t *va_pool; ID3D11VideoDecoderOutputView *hw_surface[MAX_SURFACE_COUNT]; - ID3D11ShaderResourceView *renderSrc[MAX_SURFACE_COUNT * D3D11_MAX_SHADER_VIEW]; + ID3D11ShaderResourceView *renderSrc[MAX_SURFACE_COUNT * DXGI_MAX_SHADER_VIEW]; }; /* */ @@ -135,7 +135,7 @@ static picture_context_t *d3d11va_pic_context_copy(picture_context_t *ctx) *pic_ctx = *src_ctx; vlc_video_context_Hold(pic_ctx->ctx.s.vctx); va_surface_AddRef(pic_ctx->va_surface); - for (int i=0;i<D3D11_MAX_SHADER_VIEW; i++) + for (int i=0;i<DXGI_MAX_SHADER_VIEW; i++) { pic_ctx->ctx.picsys.resource[i] = src_ctx->ctx.picsys.resource[i]; pic_ctx->ctx.picsys.renderSrc[i] = src_ctx->ctx.picsys.renderSrc[i]; @@ -146,7 +146,7 @@ static picture_context_t *d3d11va_pic_context_copy(picture_context_t *ctx) static struct d3d11va_pic_context *CreatePicContext( UINT slice, - ID3D11ShaderResourceView *renderSrc[D3D11_MAX_SHADER_VIEW], + ID3D11ShaderResourceView *renderSrc[DXGI_MAX_SHADER_VIEW], vlc_video_context *vctx) { struct d3d11va_pic_context *pic_ctx = calloc(1, sizeof(*pic_ctx)); @@ -164,7 +164,7 @@ static struct d3d11va_pic_context *CreatePicContext( ID3D11Texture2D_GetDesc((ID3D11Texture2D*)p_resource, &txDesc); pic_ctx->ctx.picsys.slice_index = slice; - for (int i=0;i<D3D11_MAX_SHADER_VIEW; i++) + for (int i=0;i<DXGI_MAX_SHADER_VIEW; i++) { pic_ctx->ctx.picsys.resource[i] = p_resource; pic_ctx->ctx.picsys.renderSrc[i] = renderSrc[i]; @@ -178,13 +178,13 @@ static picture_context_t* NewSurfacePicContext(vlc_va_t *va, vlc_va_surface_t *v { vlc_va_sys_t *sys = va->sys; ID3D11VideoDecoderOutputView *surface = sys->hw_surface[va_surface_GetIndex(va_surface)]; - ID3D11ShaderResourceView *resourceView[D3D11_MAX_SHADER_VIEW]; + ID3D11ShaderResourceView *resourceView[DXGI_MAX_SHADER_VIEW]; D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc; ID3D11VideoDecoderOutputView_GetDesc(surface, &viewDesc); - for (size_t i=0; i<D3D11_MAX_SHADER_VIEW; i++) - resourceView[i] = sys->renderSrc[viewDesc.Texture2D.ArraySlice*D3D11_MAX_SHADER_VIEW + i]; + for (size_t i=0; i<DXGI_MAX_SHADER_VIEW; i++) + resourceView[i] = sys->renderSrc[viewDesc.Texture2D.ArraySlice*DXGI_MAX_SHADER_VIEW + i]; struct d3d11va_pic_context *pic_ctx = CreatePicContext( viewDesc.Texture2D.ArraySlice, @@ -567,9 +567,9 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id, if (texDesc.BindFlags & D3D11_BIND_SHADER_RESOURCE) { - ID3D11Texture2D *textures[D3D11_MAX_SHADER_VIEW] = {p_texture, p_texture, p_texture}; + ID3D11Texture2D *textures[DXGI_MAX_SHADER_VIEW] = {p_texture, p_texture, p_texture}; D3D11_AllocateResourceView(va, sys->d3d_dev->d3ddevice, sys->render_fmt, textures, surface_idx, - &sys->renderSrc[surface_idx * D3D11_MAX_SHADER_VIEW]); + &sys->renderSrc[surface_idx * DXGI_MAX_SHADER_VIEW]); } } ID3D11Texture2D_Release(p_texture); @@ -654,10 +654,10 @@ static void DxDestroySurfaces(void *opaque) if (sys->hw_surface[0]) { for (unsigned i = 0; i < sys->hw.surface_count; i++) { - for (int j = 0; j < D3D11_MAX_SHADER_VIEW; j++) + for (int j = 0; j < DXGI_MAX_SHADER_VIEW; j++) { - if (sys->renderSrc[i*D3D11_MAX_SHADER_VIEW + j]) - ID3D11ShaderResourceView_Release(sys->renderSrc[i*D3D11_MAX_SHADER_VIEW + j]); + if (sys->renderSrc[i*DXGI_MAX_SHADER_VIEW + j]) + ID3D11ShaderResourceView_Release(sys->renderSrc[i*DXGI_MAX_SHADER_VIEW + j]); } ID3D11VideoDecoderOutputView_Release( sys->hw_surface[i] ); } diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c index 322320973b..e5a66e14e9 100644 --- a/modules/video_chroma/d3d11_fmt.c +++ b/modules/video_chroma/d3d11_fmt.c @@ -57,7 +57,7 @@ picture_sys_d3d11_t *ActiveD3D11PictureSys(picture_t *pic) void AcquireD3D11PictureSys(picture_sys_d3d11_t *p_sys) { - for (int i=0; i<D3D11_MAX_SHADER_VIEW; i++) { + for (int i=0; i<DXGI_MAX_SHADER_VIEW; i++) { if (p_sys->renderSrc[i]) ID3D11ShaderResourceView_AddRef(p_sys->renderSrc[i]); if (p_sys->texture[i]) @@ -71,7 +71,7 @@ void AcquireD3D11PictureSys(picture_sys_d3d11_t *p_sys) void ReleaseD3D11PictureSys(picture_sys_d3d11_t *p_sys) { - for (int i=0; i<D3D11_MAX_SHADER_VIEW; i++) { + for (int i=0; i<DXGI_MAX_SHADER_VIEW; i++) { if (p_sys->renderSrc[i]) ID3D11ShaderResourceView_Release(p_sys->renderSrc[i]); if (p_sys->texture[i]) @@ -87,8 +87,8 @@ void ReleaseD3D11PictureSys(picture_sys_d3d11_t *p_sys) #undef D3D11_AllocateResourceView int D3D11_AllocateResourceView(vlc_object_t *obj, ID3D11Device *d3ddevice, const d3d_format_t *format, - ID3D11Texture2D *p_texture[D3D11_MAX_SHADER_VIEW], UINT slice_index, - ID3D11ShaderResourceView *renderSrc[D3D11_MAX_SHADER_VIEW]) + ID3D11Texture2D *p_texture[DXGI_MAX_SHADER_VIEW], UINT slice_index, + ID3D11ShaderResourceView *renderSrc[DXGI_MAX_SHADER_VIEW]) { HRESULT hr; int i; @@ -110,7 +110,7 @@ int D3D11_AllocateResourceView(vlc_object_t *obj, ID3D11Device *d3ddevice, resviewDesc.Texture2DArray.FirstArraySlice = slice_index; assert(slice_index < texDesc.ArraySize); } - for (i=0; i<D3D11_MAX_SHADER_VIEW; i++) + for (i=0; i<DXGI_MAX_SHADER_VIEW; i++) { resviewDesc.Format = format->resourceFormat[i]; if (resviewDesc.Format == DXGI_FORMAT_UNKNOWN) @@ -125,7 +125,7 @@ int D3D11_AllocateResourceView(vlc_object_t *obj, ID3D11Device *d3ddevice, } } - if (i != D3D11_MAX_SHADER_VIEW) + if (i != DXGI_MAX_SHADER_VIEW) { while (--i >= 0) { @@ -770,7 +770,7 @@ int AllocateTextures( vlc_object_t *obj, d3d11_device_t *d3d_dev, msg_Dbg(obj, "failed to get the pixel format planes for %4.4s", (char *)&fmt->i_chroma); return VLC_EGENERIC; } - assert(p_chroma_desc->plane_count <= D3D11_MAX_SHADER_VIEW); + assert(p_chroma_desc->plane_count <= DXGI_MAX_SHADER_VIEW); plane_count = p_chroma_desc->plane_count; texDesc.Format = cfg->resourceFormat[0]; @@ -820,7 +820,7 @@ int AllocateTextures( vlc_object_t *obj, d3d11_device_t *d3d_dev, { out_planes[plane] = planes[plane]; } - for (; plane < D3D11_MAX_SHADER_VIEW; plane++) { + for (; plane < DXGI_MAX_SHADER_VIEW; plane++) { if (!cfg->resourceFormat[plane]) textures[plane] = NULL; else diff --git a/modules/video_chroma/d3d11_fmt.h b/modules/video_chroma/d3d11_fmt.h index 137bf8b7ae..845c7e409c 100644 --- a/modules/video_chroma/d3d11_fmt.h +++ b/modules/video_chroma/d3d11_fmt.h @@ -55,13 +55,13 @@ typedef struct typedef struct { union { - ID3D11Texture2D *texture[D3D11_MAX_SHADER_VIEW]; - ID3D11Resource *resource[D3D11_MAX_SHADER_VIEW]; + ID3D11Texture2D *texture[DXGI_MAX_SHADER_VIEW]; + ID3D11Resource *resource[DXGI_MAX_SHADER_VIEW]; }; unsigned slice_index; ID3D11VideoProcessorInputView *processorInput; /* when used as processor input */ ID3D11VideoProcessorOutputView *processorOutput; /* when used as processor output */ - ID3D11ShaderResourceView *renderSrc[D3D11_MAX_SHADER_VIEW]; + ID3D11ShaderResourceView *renderSrc[DXGI_MAX_SHADER_VIEW]; } picture_sys_d3d11_t; struct d3d11_pic_context @@ -132,8 +132,8 @@ void ReleaseD3D11PictureSys(picture_sys_d3d11_t *p_sys); /* map texture planes to resource views */ int D3D11_AllocateResourceView(vlc_object_t *obj, ID3D11Device *d3ddevice, const d3d_format_t *format, - ID3D11Texture2D *p_texture[D3D11_MAX_SHADER_VIEW], UINT slice_index, - ID3D11ShaderResourceView *output[D3D11_MAX_SHADER_VIEW]); + ID3D11Texture2D *p_texture[DXGI_MAX_SHADER_VIEW], UINT slice_index, + ID3D11ShaderResourceView *output[DXGI_MAX_SHADER_VIEW]); #define D3D11_AllocateResourceView(a,b,c,d,e,f) D3D11_AllocateResourceView(VLC_OBJECT(a),b,c,d,e,f) d3d11_decoder_device_t *D3D11_CreateDevice(vlc_object_t *obj, IDXGIAdapter *, diff --git a/modules/video_chroma/dxgi_fmt.c b/modules/video_chroma/dxgi_fmt.c index e109e9e60c..7d6fa2cdc6 100644 --- a/modules/video_chroma/dxgi_fmt.c +++ b/modules/video_chroma/dxgi_fmt.c @@ -170,12 +170,12 @@ const char *DxgiVendorStr(unsigned int gpu_vendor) UINT DxgiResourceCount(const d3d_format_t *d3d_fmt) { - for (UINT count=0; count<D3D11_MAX_SHADER_VIEW; count++) + for (UINT count=0; count<DXGI_MAX_SHADER_VIEW; count++) { if (d3d_fmt->resourceFormat[count] == DXGI_FORMAT_UNKNOWN) return count; } - return D3D11_MAX_SHADER_VIEW; + return DXGI_MAX_SHADER_VIEW; } bool DxgiIsRGBFormat(const d3d_format_t *cfg) diff --git a/modules/video_chroma/dxgi_fmt.h b/modules/video_chroma/dxgi_fmt.h index 4851def3d1..233eff5ffb 100644 --- a/modules/video_chroma/dxgi_fmt.h +++ b/modules/video_chroma/dxgi_fmt.h @@ -36,7 +36,7 @@ #define GPU_MANUFACTURER_S3 0x5333 #define GPU_MANUFACTURER_QUALCOMM 0x4D4F4351 -#define D3D11_MAX_SHADER_VIEW 4 +#define DXGI_MAX_SHADER_VIEW 4 typedef struct { @@ -46,7 +46,7 @@ typedef struct uint8_t bitsPerChannel; uint8_t widthDenominator; uint8_t heightDenominator; - DXGI_FORMAT resourceFormat[D3D11_MAX_SHADER_VIEW]; + DXGI_FORMAT resourceFormat[DXGI_MAX_SHADER_VIEW]; } d3d_format_t; const char *DxgiFormatToStr(DXGI_FORMAT format); diff --git a/modules/video_output/win32/d3d11_quad.c b/modules/video_output/win32/d3d11_quad.c index ab427ee738..90b8736b01 100644 --- a/modules/video_output/win32/d3d11_quad.c +++ b/modules/video_output/win32/d3d11_quad.c @@ -43,7 +43,7 @@ #define nbLonBands SPHERE_SLICES void D3D11_RenderQuad(d3d11_device_t *d3d_dev, d3d_quad_t *quad, d3d_vertex_shader_t *vsshader, - ID3D11ShaderResourceView *resourceView[D3D11_MAX_SHADER_VIEW], + ID3D11ShaderResourceView *resourceView[DXGI_MAX_SHADER_VIEW], d3d11_select_plane_t selectPlane, void *selectOpaque) { UINT offset = 0; @@ -65,9 +65,9 @@ void D3D11_RenderQuad(d3d11_device_t *d3d_dev, d3d_quad_t *quad, d3d_vertex_shad /* pixel shader */ ID3D11DeviceContext_PSSetConstantBuffers(d3d_dev->d3dcontext, 0, ARRAY_SIZE(quad->pPixelShaderConstants), quad->pPixelShaderConstants); - assert(quad->resourceCount <= D3D11_MAX_SHADER_VIEW); + assert(quad->resourceCount <= DXGI_MAX_SHADER_VIEW); - for (size_t i=0; i<D3D11_MAX_SHADER_VIEW; i++) + for (size_t i=0; i<DXGI_MAX_SHADER_VIEW; i++) { if (!quad->d3dpixelShader[i]) break; @@ -85,7 +85,7 @@ void D3D11_RenderQuad(d3d11_device_t *d3d_dev, d3d_quad_t *quad, d3d_vertex_shad // /* force unbinding the input texture, otherwise we get: // * OMSetRenderTargets: Resource being set to OM RenderTarget slot 0 is still bound on input! */ - // ID3D11ShaderResourceView *reset[D3D11_MAX_SHADER_VIEW] = { 0 }; + // ID3D11ShaderResourceView *reset[DXGI_MAX_SHADER_VIEW] = { 0 }; // ID3D11DeviceContext_PSSetShaderResources(d3d_dev->d3dcontext, 0, quad->resourceCount, reset); } } @@ -1144,7 +1144,7 @@ int D3D11_SetupQuad(vlc_object_t *o, d3d11_device_t *d3d_dev, const video_format ShaderUpdateConstants(o, d3d_dev, quad, PS_CONST_COLORSPACE, &colorspace); - for (size_t i=0; i<D3D11_MAX_SHADER_VIEW; i++) + for (size_t i=0; i<DXGI_MAX_SHADER_VIEW; i++) { quad->cropViewport[i].MinDepth = 0.0f; quad->cropViewport[i].MaxDepth = 1.0f; diff --git a/modules/video_output/win32/d3d11_quad.h b/modules/video_output/win32/d3d11_quad.h index 8b7e231c38..83d6101634 100644 --- a/modules/video_output/win32/d3d11_quad.h +++ b/modules/video_output/win32/d3d11_quad.h @@ -48,7 +48,7 @@ typedef struct d3d_vertex_t { typedef bool (*d3d11_select_plane_t)(void *opaque, size_t plane_index); void D3D11_RenderQuad(d3d11_device_t *, d3d_quad_t *, d3d_vertex_shader_t *, - ID3D11ShaderResourceView *resourceViews[D3D11_MAX_SHADER_VIEW], + ID3D11ShaderResourceView *resourceViews[DXGI_MAX_SHADER_VIEW], d3d11_select_plane_t selectPlane, void *selectOpaque); int D3D11_AllocateQuad(vlc_object_t *, d3d11_device_t *, video_projection_mode_t, d3d_quad_t *); diff --git a/modules/video_output/win32/d3d11_shaders.c b/modules/video_output/win32/d3d11_shaders.c index df5abcaea6..28ea77a4dc 100644 --- a/modules/video_output/win32/d3d11_shaders.c +++ b/modules/video_output/win32/d3d11_shaders.c @@ -207,7 +207,7 @@ static HRESULT CompileTargetShader(vlc_object_t *o, const d3d11_shader_compiler_ { char *shader; int allocated = asprintf(&shader, globPixelShaderDefault, texture_array ? "Array" : "", - texture_count * D3D11_MAX_SHADER_VIEW, + texture_count * DXGI_MAX_SHADER_VIEW, psz_src_to_linear, psz_linear_to_display, psz_primaries_transform, psz_tone_mapping, psz_adjust_range, psz_move_planes, psz_sampler); @@ -637,7 +637,7 @@ HRESULT (D3D11_CompilePixelShader)(vlc_object_t *o, const d3d11_shader_compiler_ void D3D11_ReleasePixelShader(d3d_quad_t *quad) { - for (size_t i=0; i<D3D11_MAX_SHADER_VIEW; i++) + for (size_t i=0; i<DXGI_MAX_SHADER_VIEW; i++) { if (quad->d3dpixelShader[i]) { @@ -719,7 +719,7 @@ HRESULT D3D11_CreateRenderTargets( d3d11_device_t *d3d_dev, ID3D11Resource *text renderTargetViewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; renderTargetViewDesc.Texture2D.MipSlice = 0; - for (size_t i=0; i<D3D11_MAX_SHADER_VIEW; i++) + for (size_t i=0; i<DXGI_MAX_SHADER_VIEW; i++) { if (cfg->resourceFormat[i]) { diff --git a/modules/video_output/win32/d3d11_shaders.h b/modules/video_output/win32/d3d11_shaders.h index 163c23ce57..767bba87f9 100644 --- a/modules/video_output/win32/d3d11_shaders.h +++ b/modules/video_output/win32/d3d11_shaders.h @@ -91,9 +91,9 @@ typedef struct ID3D11Buffer *viewpointShaderConstant; ID3D11Buffer *pPixelShaderConstants[2]; UINT PSConstantsCount; - ID3D11PixelShader *d3dpixelShader[D3D11_MAX_SHADER_VIEW]; + ID3D11PixelShader *d3dpixelShader[DXGI_MAX_SHADER_VIEW]; ID3D11SamplerState *SamplerStates[2]; - D3D11_VIEWPORT cropViewport[D3D11_MAX_SHADER_VIEW]; + D3D11_VIEWPORT cropViewport[DXGI_MAX_SHADER_VIEW]; unsigned int i_width; unsigned int i_height; video_projection_mode_t projection; diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c index 94364cf7cd..c1f5ddabf7 100644 --- a/modules/video_output/win32/direct3d11.c +++ b/modules/video_output/win32/direct3d11.c @@ -320,7 +320,7 @@ static int UpdateStaging(vout_display_t *vd, const video_format_t *fmt) if (!is_d3d11_opaque(fmt->i_chroma) || sys->legacy_shader) { /* we need a staging texture */ - ID3D11Texture2D *textures[D3D11_MAX_SHADER_VIEW] = {0}; + ID3D11Texture2D *textures[DXGI_MAX_SHADER_VIEW] = {0}; video_format_t texture_fmt = *vd->source; texture_fmt.i_width = sys->picQuad.i_width; texture_fmt.i_height = sys->picQuad.i_height; @@ -340,7 +340,7 @@ static int UpdateStaging(vout_display_t *vd, const video_format_t *fmt) return VLC_EGENERIC; } - for (unsigned plane = 0; plane < D3D11_MAX_SHADER_VIEW; plane++) + for (unsigned plane = 0; plane < DXGI_MAX_SHADER_VIEW; plane++) sys->stagingSys.texture[plane] = textures[plane]; } #endif @@ -1325,7 +1325,7 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co if (AllocateTextures(vd, sys->d3d_dev, sys->regionQuad.textureFormat, &r->p_picture->format, d3dquad->picSys.texture, NULL)) { msg_Err(vd, "Failed to allocate %dx%d texture for OSD", r->fmt.i_visible_width, r->fmt.i_visible_height); - for (int j=0; j<D3D11_MAX_SHADER_VIEW; j++) + for (int j=0; j<DXGI_MAX_SHADER_VIEW; j++) if (d3dquad->picSys.texture[j]) ID3D11Texture2D_Release(d3dquad->picSys.texture[j]); free(d3dquad); @@ -1372,7 +1372,7 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co continue; } quad_picture = (*region)[i]; - for (size_t j=0; j<D3D11_MAX_SHADER_VIEW; j++) + for (size_t j=0; j<DXGI_MAX_SHADER_VIEW; j++) { /* TODO use something more accurate if we have different formats */ if (sys->regionQuad.d3dpixelShader[j]) _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
