summaryrefslogtreecommitdiffstats
path: root/src/libs/dxvk-native-1.9.2a/src/d3d11/d3d11_video.h
blob: 85979eb8f96233218e7c84dfa548a05f7a85cd30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
#pragma once

#include "d3d11_device.h"

namespace dxvk {

  static constexpr uint32_t D3D11_VK_VIDEO_STREAM_COUNT = 8;

  class D3D11VideoProcessorEnumerator : public D3D11DeviceChild<ID3D11VideoProcessorEnumerator> {

  public:

    D3D11VideoProcessorEnumerator(
            D3D11Device*            pDevice,
      const D3D11_VIDEO_PROCESSOR_CONTENT_DESC& Desc);

    ~D3D11VideoProcessorEnumerator();

    HRESULT STDMETHODCALLTYPE QueryInterface(
            REFIID                  riid,
            void**                  ppvObject);

    HRESULT STDMETHODCALLTYPE GetVideoProcessorContentDesc(
            D3D11_VIDEO_PROCESSOR_CONTENT_DESC* pContentDesc);

    HRESULT STDMETHODCALLTYPE CheckVideoProcessorFormat(
            DXGI_FORMAT             Format,
            UINT*                   pFlags);

    HRESULT STDMETHODCALLTYPE GetVideoProcessorCaps(
            D3D11_VIDEO_PROCESSOR_CAPS* pCaps);

    HRESULT STDMETHODCALLTYPE GetVideoProcessorRateConversionCaps(
            UINT                    TypeIndex,
            D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS* pCaps);

    HRESULT STDMETHODCALLTYPE GetVideoProcessorCustomRate(
            UINT                    TypeIndex,
            UINT                    CustomRateIndex,
            D3D11_VIDEO_PROCESSOR_CUSTOM_RATE* pRate);

    HRESULT STDMETHODCALLTYPE GetVideoProcessorFilterRange(
            D3D11_VIDEO_PROCESSOR_FILTER        Filter,
            D3D11_VIDEO_PROCESSOR_FILTER_RANGE* pRange);

  private:

    D3D11_VIDEO_PROCESSOR_CONTENT_DESC  m_desc;

  };


  struct D3D11VideoProcessorStreamState {
    BOOL autoProcessingEnabled  = TRUE;
    BOOL dstRectEnabled         = FALSE;
    BOOL srcRectEnabled         = FALSE;
    BOOL rotationEnabled        = FALSE;
    RECT dstRect                = RECT();
    RECT srcRect                = RECT();
    D3D11_VIDEO_FRAME_FORMAT frameFormat = D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE;
    D3D11_VIDEO_PROCESSOR_ROTATION rotation = D3D11_VIDEO_PROCESSOR_ROTATION_IDENTITY;
    D3D11_VIDEO_PROCESSOR_COLOR_SPACE colorSpace = D3D11_VIDEO_PROCESSOR_COLOR_SPACE();
  };

  struct D3D11VideoProcessorState {
    BOOL outputStereoModeEnabled                       = FALSE;
    BOOL outputBackgroundColorIsYCbCr                  = FALSE;
    BOOL outputTargetRectEnabled                       = FALSE;
    RECT outputTargetRect                              = RECT();
    D3D11_VIDEO_COLOR outputBackgroundColor            = D3D11_VIDEO_COLOR();
    D3D11_VIDEO_PROCESSOR_COLOR_SPACE outputColorSpace = D3D11_VIDEO_PROCESSOR_COLOR_SPACE();
  };

  class D3D11VideoProcessor : public D3D11DeviceChild<ID3D11VideoProcessor> {

  public:

    D3D11VideoProcessor(
            D3D11Device*                    pDevice,
            D3D11VideoProcessorEnumerator*  pEnumerator,
            UINT                            RateConversionIndex);

    ~D3D11VideoProcessor();

    HRESULT STDMETHODCALLTYPE QueryInterface(
            REFIID                  riid,
            void**                  ppvObject);

    void STDMETHODCALLTYPE GetContentDesc(
            D3D11_VIDEO_PROCESSOR_CONTENT_DESC *pDesc);

    void STDMETHODCALLTYPE GetRateConversionCaps(
            D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS *pCaps);

    D3D11VideoProcessorState* GetState() {
      return &m_state;
    }

    D3D11VideoProcessorStreamState* GetStreamState(UINT StreamIndex) {
      return StreamIndex < D3D11_VK_VIDEO_STREAM_COUNT
        ? &m_streams[StreamIndex]
        : nullptr;
    }

  private:

    D3D11VideoProcessorEnumerator* m_enumerator;
    uint32_t                       m_rateConversionIndex;
    D3D11VideoProcessorState       m_state;
    D3D11VideoProcessorStreamState m_streams[D3D11_VK_VIDEO_STREAM_COUNT];

  };



  class D3D11VideoProcessorInputView : public D3D11DeviceChild<ID3D11VideoProcessorInputView> {

  public:

    D3D11VideoProcessorInputView(
            D3D11Device*            pDevice,
            ID3D11Resource*         pResource,
      const D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC& Desc);

    ~D3D11VideoProcessorInputView();

    HRESULT STDMETHODCALLTYPE QueryInterface(
            REFIID                  riid,
            void**                  ppvObject);

    void STDMETHODCALLTYPE GetResource(
            ID3D11Resource**        ppResource);

    void STDMETHODCALLTYPE GetDesc(
            D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC* pDesc);

    const bool IsYCbCr() const {
      return m_isYCbCr;
    }

    const bool NeedsCopy() const {
      return m_copy != nullptr;
    }

    Rc<DxvkImage> GetImage() const {
      return GetCommonTexture(m_resource.ptr())->GetImage();
    }

    VkImageSubresourceLayers GetImageSubresources() const {
      return m_subresources;
    }

    Rc<DxvkImage> GetShadowCopy() const {
      return m_copy;
    }

    std::array<Rc<DxvkImageView>, 2> GetViews() const {
      return m_views;
    }

  private:

    Com<ID3D11Resource>                   m_resource;
    D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC m_desc;
    VkImageSubresourceLayers              m_subresources;
    Rc<DxvkImage>                         m_copy;
    std::array<Rc<DxvkImageView>, 2>      m_views;
    bool                                  m_isYCbCr = false;

    static bool IsYCbCrFormat(DXGI_FORMAT Format);

  };



  class D3D11VideoProcessorOutputView : public D3D11DeviceChild<ID3D11VideoProcessorOutputView> {

  public:

    D3D11VideoProcessorOutputView(
            D3D11Device*            pDevice,
            ID3D11Resource*         pResource,
      const D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC& Desc);

    ~D3D11VideoProcessorOutputView();

    HRESULT STDMETHODCALLTYPE QueryInterface(
            REFIID                  riid,
            void**                  ppvObject);

    void STDMETHODCALLTYPE GetResource(
            ID3D11Resource**        ppResource);

    void STDMETHODCALLTYPE GetDesc(
            D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC* pDesc);

    Rc<DxvkImageView> GetView() const {
      return m_view;
    }

  private:

    Com<ID3D11Resource>                     m_resource;
    D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC  m_desc;
    Rc<DxvkImageView>                       m_view;

  };



  class D3D11VideoContext : public ID3D11VideoContext {

  public:

    D3D11VideoContext(
            D3D11ImmediateContext*  pContext,
      const Rc<DxvkDevice>&         Device);

    ~D3D11VideoContext();

    ULONG STDMETHODCALLTYPE AddRef();

    ULONG STDMETHODCALLTYPE Release();

    HRESULT STDMETHODCALLTYPE QueryInterface(
            REFIID                  riid,
            void**                  ppvObject);

    HRESULT STDMETHODCALLTYPE GetPrivateData(
            REFGUID                 Name,
            UINT*                   pDataSize,
            void*                   pData);

    HRESULT STDMETHODCALLTYPE SetPrivateData(
            REFGUID                 Name,
            UINT                    DataSize,
      const void*                   pData);

    HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            REFGUID                 Name,
      const IUnknown*               pUnknown);

    void STDMETHODCALLTYPE GetDevice(
            ID3D11Device**          ppDevice);

    HRESULT STDMETHODCALLTYPE GetDecoderBuffer(
            ID3D11VideoDecoder*             pDecoder,
            D3D11_VIDEO_DECODER_BUFFER_TYPE Type,
            UINT*                           BufferSize,
            void**                          ppBuffer);

    HRESULT STDMETHODCALLTYPE ReleaseDecoderBuffer(
            ID3D11VideoDecoder*             pDecoder,
            D3D11_VIDEO_DECODER_BUFFER_TYPE Type);

    HRESULT STDMETHODCALLTYPE DecoderBeginFrame(
            ID3D11VideoDecoder*             pDecoder,
            ID3D11VideoDecoderOutputView*   pView,
            UINT                            KeySize,
      const void*                           pKey);

    HRESULT STDMETHODCALLTYPE DecoderEndFrame(
            ID3D11VideoDecoder*             pDecoder);

    HRESULT STDMETHODCALLTYPE SubmitDecoderBuffers(
            ID3D11VideoDecoder*             pDecoder,
            UINT                            BufferCount,
      const D3D11_VIDEO_DECODER_BUFFER_DESC* pBufferDescs);

    HRESULT STDMETHODCALLTYPE DecoderExtension(
            ID3D11VideoDecoder*             pDecoder,
      const D3D11_VIDEO_DECODER_EXTENSION*  pExtension);

    void STDMETHODCALLTYPE VideoProcessorSetOutputTargetRect(
            ID3D11VideoProcessor*           pVideoProcessor,
            BOOL                            Enable,
      const RECT*                           pRect);

    void STDMETHODCALLTYPE VideoProcessorSetOutputBackgroundColor(
            ID3D11VideoProcessor*           pVideoProcessor,
            BOOL                            YCbCr,
      const D3D11_VIDEO_COLOR*              pColor);

    void STDMETHODCALLTYPE VideoProcessorSetOutputColorSpace(
            ID3D11VideoProcessor*           pVideoProcessor,
      const D3D11_VIDEO_PROCESSOR_COLOR_SPACE *pColorSpace);

    void STDMETHODCALLTYPE VideoProcessorSetOutputAlphaFillMode(
            ID3D11VideoProcessor*           pVideoProcessor,
            D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE AlphaFillMode,
            UINT                            StreamIndex);

    void STDMETHODCALLTYPE VideoProcessorSetOutputConstriction(
            ID3D11VideoProcessor*           pVideoProcessor,
            BOOL                            Enable,
            SIZE                            Size);

    void STDMETHODCALLTYPE VideoProcessorSetOutputStereoMode(
            ID3D11VideoProcessor*           pVideoProcessor,
            BOOL                            Enable);

    HRESULT STDMETHODCALLTYPE VideoProcessorSetOutputExtension(
            ID3D11VideoProcessor*           pVideoProcessor,
      const GUID*                           pExtensionGuid,
            UINT                            DataSize,
            void*                           pData);

    void STDMETHODCALLTYPE VideoProcessorSetStreamFrameFormat(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            D3D11_VIDEO_FRAME_FORMAT        Format);

    void STDMETHODCALLTYPE VideoProcessorSetStreamColorSpace(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
      const D3D11_VIDEO_PROCESSOR_COLOR_SPACE *pColorSpace);

    void STDMETHODCALLTYPE VideoProcessorSetStreamOutputRate(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            D3D11_VIDEO_PROCESSOR_OUTPUT_RATE Rate,
            BOOL                            Repeat,
      const DXGI_RATIONAL*                  CustomRate);

    void STDMETHODCALLTYPE VideoProcessorSetStreamSourceRect(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            BOOL                            Enable,
      const RECT*                           pRect);

    void STDMETHODCALLTYPE VideoProcessorSetStreamDestRect(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            BOOL                            Enable,
      const RECT*                           pRect);

    void STDMETHODCALLTYPE VideoProcessorSetStreamAlpha(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            BOOL                            Enable,
            FLOAT                           Alpha);

    void STDMETHODCALLTYPE VideoProcessorSetStreamPalette(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            UINT                            EntryCount,
      const UINT*                           pEntries);

    void STDMETHODCALLTYPE VideoProcessorSetStreamPixelAspectRatio(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            BOOL                            Enable,
      const DXGI_RATIONAL*                  pSrcAspectRatio,
      const DXGI_RATIONAL*                  pDstAspectRatio);

    void STDMETHODCALLTYPE VideoProcessorSetStreamLumaKey(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            BOOL                            Enable,
            FLOAT                           Lower,
            FLOAT                           Upper);

    void STDMETHODCALLTYPE VideoProcessorSetStreamStereoFormat(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            BOOL                            Enable,
            D3D11_VIDEO_PROCESSOR_STEREO_FORMAT Format,
            BOOL                            LeftViewFrame0,
            BOOL                            BaseViewFrame0,
            D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE FlipMode,
            int                             MonoOffset);

    void STDMETHODCALLTYPE VideoProcessorSetStreamAutoProcessingMode(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            BOOL                            Enable);

    void STDMETHODCALLTYPE VideoProcessorSetStreamFilter(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            D3D11_VIDEO_PROCESSOR_FILTER    Filter,
            BOOL                            Enable,
            int                             Level);

    HRESULT STDMETHODCALLTYPE VideoProcessorSetStreamExtension(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
      const GUID*                           pExtensionGuid,
            UINT                            DataSize,
            void*                           pData);

    void STDMETHODCALLTYPE VideoProcessorSetStreamRotation(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            BOOL                            Enable,
            D3D11_VIDEO_PROCESSOR_ROTATION  Rotation);

    void STDMETHODCALLTYPE VideoProcessorGetOutputTargetRect(
            ID3D11VideoProcessor*           pVideoProcessor,
            BOOL*                           pEnabled,
            RECT*                           pRect);

    void STDMETHODCALLTYPE VideoProcessorGetOutputBackgroundColor(
            ID3D11VideoProcessor*           pVideoProcessor,
            BOOL*                           pYCbCr,
            D3D11_VIDEO_COLOR*              pColor);

    void STDMETHODCALLTYPE VideoProcessorGetOutputColorSpace(
            ID3D11VideoProcessor*           pVideoProcessor,
            D3D11_VIDEO_PROCESSOR_COLOR_SPACE* pColorSpace);

    void STDMETHODCALLTYPE VideoProcessorGetOutputAlphaFillMode(
            ID3D11VideoProcessor*           pVideoProcessor,
            D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE* pAlphaFillMode,
            UINT*                           pStreamIndex);

    void STDMETHODCALLTYPE VideoProcessorGetOutputConstriction(
            ID3D11VideoProcessor*           pVideoProcessor,
            BOOL*                           pEnabled,
            SIZE*                           pSize);

    void STDMETHODCALLTYPE VideoProcessorGetOutputStereoMode(
            ID3D11VideoProcessor*           pVideoProcessor,
            BOOL*                           pEnabled);

    HRESULT STDMETHODCALLTYPE VideoProcessorGetOutputExtension(
            ID3D11VideoProcessor*           pVideoProcessor,
      const GUID*                           pExtensionGuid,
            UINT                            DataSize,
            void*                           pData);

    void STDMETHODCALLTYPE VideoProcessorGetStreamFrameFormat(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            D3D11_VIDEO_FRAME_FORMAT*       pFormat);

    void STDMETHODCALLTYPE VideoProcessorGetStreamColorSpace(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            D3D11_VIDEO_PROCESSOR_COLOR_SPACE* pColorSpace);

    void STDMETHODCALLTYPE VideoProcessorGetStreamOutputRate(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            D3D11_VIDEO_PROCESSOR_OUTPUT_RATE* pRate,
            BOOL*                           pRepeat,
            DXGI_RATIONAL*                  pCustomRate);

    void STDMETHODCALLTYPE VideoProcessorGetStreamSourceRect(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            BOOL*                           pEnabled,
            RECT*                           pRect);

    void STDMETHODCALLTYPE VideoProcessorGetStreamDestRect(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            BOOL*                           pEnabled,
            RECT*                           pRect);

    void STDMETHODCALLTYPE VideoProcessorGetStreamAlpha(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            BOOL*                           pEnabled,
            FLOAT*                          pAlpha);

    void STDMETHODCALLTYPE VideoProcessorGetStreamPalette(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            UINT                            EntryCount,
            UINT*                           pEntries);

    void STDMETHODCALLTYPE VideoProcessorGetStreamPixelAspectRatio(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            BOOL*                           pEnabled,
            DXGI_RATIONAL*                  pSrcAspectRatio,
            DXGI_RATIONAL*                  pDstAspectRatio);

    void STDMETHODCALLTYPE VideoProcessorGetStreamLumaKey(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            BOOL*                           pEnabled,
            FLOAT*                          pLower,
            FLOAT*                          pUpper);

    void STDMETHODCALLTYPE VideoProcessorGetStreamStereoFormat(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            BOOL*                           pEnabled,
            D3D11_VIDEO_PROCESSOR_STEREO_FORMAT* pFormat,
            BOOL*                           pLeftViewFrame0,
            BOOL*                           pBaseViewFrame0,
            D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE* pFlipMode,
            int*                            pMonoOffset);

    void STDMETHODCALLTYPE VideoProcessorGetStreamAutoProcessingMode(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            BOOL*                           pEnabled);

    void STDMETHODCALLTYPE VideoProcessorGetStreamFilter(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            D3D11_VIDEO_PROCESSOR_FILTER    Filter,
            BOOL*                           pEnabled,
            int*                            pLevel);

    HRESULT STDMETHODCALLTYPE VideoProcessorGetStreamExtension(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
      const GUID*                           pExtensionGuid,
            UINT                            DataSize,
            void*                           pData);

    void STDMETHODCALLTYPE VideoProcessorGetStreamRotation(
            ID3D11VideoProcessor*           pVideoProcessor,
            UINT                            StreamIndex,
            BOOL*                           pEnable,
            D3D11_VIDEO_PROCESSOR_ROTATION* pRotation);

    HRESULT STDMETHODCALLTYPE VideoProcessorBlt(
            ID3D11VideoProcessor*           pVideoProcessor,
            ID3D11VideoProcessorOutputView* pOutputView,
            UINT                            FrameIdx,
            UINT                            StreamCount,
      const D3D11_VIDEO_PROCESSOR_STREAM*   pStreams);

    HRESULT STDMETHODCALLTYPE NegotiateCryptoSessionKeyExchange(
            ID3D11CryptoSession*            pSession,
            UINT                            DataSize,
            void*                           pData);

    void STDMETHODCALLTYPE EncryptionBlt(
            ID3D11CryptoSession*            pSession,
            ID3D11Texture2D*                pSrcSurface,
            ID3D11Texture2D*                pDstSurface,
            UINT                            IVSize,
            void*                           pIV);

    void STDMETHODCALLTYPE DecryptionBlt(
            ID3D11CryptoSession*            pSession,
            ID3D11Texture2D*                pSrcSurface,
            ID3D11Texture2D*                pDstSurface,
            D3D11_ENCRYPTED_BLOCK_INFO*     pBlockInfo,
            UINT                            KeySize,
      const void*                           pKey,
            UINT                            IVSize,
            void*                           pIV);

    void STDMETHODCALLTYPE StartSessionKeyRefresh(
            ID3D11CryptoSession*            pSession,
            UINT                            RandomNumberSize,
            void*                           pRandomNumber);

    void STDMETHODCALLTYPE FinishSessionKeyRefresh(
            ID3D11CryptoSession*            pSession);

    HRESULT STDMETHODCALLTYPE GetEncryptionBltKey(
            ID3D11CryptoSession*            pSession,
            UINT                            KeySize,
            void*                           pKey);

    HRESULT STDMETHODCALLTYPE NegotiateAuthenticatedChannelKeyExchange(
            ID3D11AuthenticatedChannel*     pChannel,
            UINT                            DataSize,
            void*                           pData);

    HRESULT STDMETHODCALLTYPE QueryAuthenticatedChannel(
            ID3D11AuthenticatedChannel*     pChannel,
            UINT                            InputSize,
      const void*                           pInput,
            UINT                            OutputSize,
            void*                           pOutput);

    HRESULT STDMETHODCALLTYPE ConfigureAuthenticatedChannel(
            ID3D11AuthenticatedChannel*     pChannel,
            UINT                            InputSize,
      const void*                           pInput,
            D3D11_AUTHENTICATED_CONFIGURE_OUTPUT* pOutput);

  private:

    struct alignas(16) UboData {
      float colorMatrix[3][4];
      float coordMatrix[3][2];
      float yMin, yMax;
    };

    D3D11ImmediateContext* m_ctx;

    Rc<DxvkSampler> m_sampler;
    Rc<DxvkShader> m_vs;
    Rc<DxvkShader> m_fs;
    Rc<DxvkBuffer> m_ubo;

    VkExtent2D m_dstExtent = { 0u, 0u };

    void ApplyColorMatrix(float pDst[3][4], const float pSrc[3][4]);

    void ApplyYCbCrMatrix(float pColorMatrix[3][4], bool UseBt709);

    void BindOutputView(
            ID3D11VideoProcessorOutputView* pOutputView);

    void BlitStream(
      const D3D11VideoProcessorStreamState* pStreamState,
      const D3D11_VIDEO_PROCESSOR_STREAM*   pStream);

  };

}