~ubuntu-branches/ubuntu/vivid/mpv/vivid

« back to all changes in this revision

Viewing changes to video/out/vo_direct3d.c

  • Committer: Package Import Robot
  • Author(s): Artur Rona
  • Date: 2015-02-08 11:38:05 UTC
  • mfrom: (28.1.4 vivid-proposed)
  • Revision ID: package-import@ubuntu.com-20150208113805-hb7kk68170y002es
Tags: 0.7.3-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - debian/rules:
    + Disable altivec on ppc64el again, as it FTBFS with it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
152
152
    struct texplane planes[3];
153
153
 
154
154
    IDirect3DPixelShader9 *pixel_shader;
155
 
    const BYTE *pixel_shader_data;
156
155
 
157
156
    D3DFORMAT movie_src_fmt;        /**< Movie colorspace format (depends on
158
157
                                    the movie's codec) */
237
236
static mp_image_t *get_screenshot(d3d_priv *priv);
238
237
static mp_image_t *get_window_screenshot(d3d_priv *priv);
239
238
static void draw_osd(struct vo *vo);
 
239
static bool change_d3d_backbuffer(d3d_priv *priv);
240
240
 
241
241
static void d3d_matrix_identity(D3DMATRIX *m)
242
242
{
439
439
    for (int n = 0; n < priv->plane_count; n++) {
440
440
        d3dtex_release(priv, &priv->planes[n].texture);
441
441
    }
442
 
 
443
 
    if (priv->pixel_shader)
444
 
        IDirect3DPixelShader9_Release(priv->pixel_shader);
445
 
    priv->pixel_shader = NULL;
446
442
}
447
443
 
448
444
/** @brief Destroy D3D Offscreen and Backbuffer surfaces.
504
500
        if (need_clear)
505
501
            d3d_clear_video_textures(priv);
506
502
 
507
 
        if (priv->pixel_shader_data) {
508
 
            if (!priv->pixel_shader &&
509
 
                FAILED(IDirect3DDevice9_CreatePixelShader(priv->d3d_device,
510
 
                    (DWORD *)priv->pixel_shader_data, &priv->pixel_shader)))
511
 
            {
512
 
                MP_ERR(priv, "Failed to create "
513
 
                       "YUV conversion pixel shader.\n");
514
 
                return false;
515
 
            }
516
 
        }
517
 
 
518
503
    } else {
519
504
 
520
505
        if (!priv->d3d_surface &&
658
643
    if (priv->opt_force_power_of_2)
659
644
        priv->device_caps_power2_only = 1;
660
645
 
 
646
    if (!change_d3d_backbuffer(priv))
 
647
        return false;
 
648
 
661
649
    MP_VERBOSE(priv, "device_caps_power2_only %d, device_caps_square_only %d\n"
662
650
               "device_texture_sys %d\n"
663
651
               "max_texture_width %d, max_texture_height %d\n",
693
681
// Create a new backbuffer. Create or Reset the D3D device.
694
682
static bool change_d3d_backbuffer(d3d_priv *priv)
695
683
{
696
 
    D3DPRESENT_PARAMETERS present_params;
 
684
    if (priv->pixel_shader)
 
685
        IDirect3DPixelShader9_Release(priv->pixel_shader);
 
686
    priv->pixel_shader = NULL;
697
687
 
698
688
    int window_w = priv->vo->dwidth;
699
689
    int window_h = priv->vo->dheight;
713
703
    /* The grown backbuffer dimensions are ready and fill_d3d_presentparams
714
704
     * will use them, so we can reset the device.
715
705
     */
 
706
    D3DPRESENT_PARAMETERS present_params;
716
707
    fill_d3d_presentparams(priv, &present_params);
717
708
 
718
709
    if (!priv->d3d_device) {
737
728
               present_params.BackBufferWidth, present_params.BackBufferHeight,
738
729
               window_w, window_h);
739
730
 
 
731
    if (FAILED(IDirect3DDevice9_CreatePixelShader(priv->d3d_device,
 
732
               (DWORD *)d3d_shader_yuv, &priv->pixel_shader)))
 
733
    {
 
734
        priv->pixel_shader = NULL;
 
735
        if (!priv->opt_disable_shaders)
 
736
            MP_WARN(priv, "Shader could not be created - disabling shaders.\n");
 
737
    }
 
738
 
740
739
    return 1;
741
740
}
742
741
 
828
827
 
829
828
    destroy_d3d_surfaces(priv);
830
829
 
 
830
    if (priv->pixel_shader)
 
831
        IDirect3DPixelShader9_Release(priv->pixel_shader);
 
832
    priv->pixel_shader = NULL;
 
833
 
831
834
    if (priv->d3d_device)
832
835
        IDirect3DDevice9_Release(priv->d3d_device);
833
836
    priv->d3d_device = NULL;
1032
1035
 
1033
1036
    if (priv->opt_disable_textures)
1034
1037
        texture_d3dfmt = 0;
1035
 
    if (priv->opt_disable_shaders)
 
1038
    if (priv->opt_disable_shaders || !priv->pixel_shader)
1036
1039
        shader_d3dfmt = 0;
1037
1040
    if (priv->opt_disable_stretchrect)
1038
1041
        blit_d3dfmt = 0;
1052
1055
    priv->use_shaders = false;
1053
1056
    priv->use_textures = false;
1054
1057
    priv->movie_src_fmt = 0;
1055
 
    priv->pixel_shader_data = NULL;
1056
1058
    priv->plane_count = 0;
1057
1059
    priv->image_format = fmt;
1058
1060
 
1093
1095
                if (n > 0)
1094
1096
                    planes[n].clearval = get_chroma_clear_val(desc.plane_bits);
1095
1097
            }
1096
 
            priv->pixel_shader_data = d3d_shader_yuv;
1097
1098
        }
1098
1099
 
1099
1100
        for (n = 0; n < priv->plane_count; n++) {
1190
1191
        goto err_out;
1191
1192
    }
1192
1193
 
1193
 
    if (!init_d3d(priv))
1194
 
        goto err_out;
1195
 
 
1196
1194
    /* w32_common framework call. Configures window on the screen, gets
1197
1195
     * fullscreen dimensions and does other useful stuff.
1198
1196
     */
1201
1199
        goto err_out;
1202
1200
    }
1203
1201
 
 
1202
    if (!init_d3d(priv))
 
1203
        goto err_out;
 
1204
 
1204
1205
    return 0;
1205
1206
 
1206
1207
err_out: