Changeset 2e29fe8778b750b0e0c7047c72042c23ac5547ca

Show
Ignore:
Timestamp:
02/03/04 14:00:27 (5 years ago)
Author:
Eric Petit <titer@videolan.org>
git-committer:
Eric Petit <titer@videolan.org> 1075813227 +0000
git-parent:

[9c08885d924c68f7cd8a84d9cd5ef32f25ba7de1]

git-author:
Eric Petit <titer@videolan.org> 1075813227 +0000
Message:

macosx/vout* : OpenGL VRAM texturing finaly works correctly now.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • AUTHORS

    r051ce62 r2e29fe8  
    1 # $Id: AUTHORS,v 1.101 2004/01/05 12:37:52 jlj Exp $ 
     1# $Id: AUTHORS,v 1.102 2004/02/03 13:00:27 titer Exp $ 
    22#  
    33# The format of this file was inspired by the Linux kernel CREDITS file. 
     
    255255D: BeOS module fixes and enhancements 
    256256D: Stream output 
     257D: Mac OS X OpenGL video output 
    257258S: France 
    258259 
  • modules/gui/macosx/vout.h

    r90a7231 r2e29fe8  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001-2003 VideoLAN 
    5  * $Id: vout.h,v 1.21 2004/02/02 08:50:41 titer Exp $ 
     5 * $Id: vout.h,v 1.22 2004/02/03 13:00:27 titer Exp $ 
    66 * 
    77 * Authors: Colin Delacroix <colin@zoy.org> 
    88 *          Florian G. Pflug <fgp@phlo.org> 
    99 *          Jon Lech Johansen <jon-vl@nanocrew.net> 
     10 *          Eric Petit <titer@m0k.org> 
    1011 * 
    1112 * This program is free software; you can redistribute it and/or modify 
     
    6162    vout_thread_t * p_vout; 
    6263    int             b_init_done; 
    63     unsigned long   i_cur_texture; 
     64    unsigned long   i_texture; 
    6465    float           f_x; 
    6566    float           f_y; 
     
    6869- (id) initWithFrame: (NSRect) frame vout: (vout_thread_t*) p_vout; 
    6970- (void) initTextures; 
    70 - (void) reloadTexture: (picture_t *) p_pic
     71- (void) reloadTexture
    7172 
    7273@end 
  • modules/gui/macosx/vout.m

    r90a7231 r2e29fe8  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001-2003 VideoLAN 
    5  * $Id: vout.m,v 1.76 2004/02/02 08:50:41 titer Exp $ 
     5 * $Id: vout.m,v 1.77 2004/02/03 13:00:27 titer Exp $ 
    66 * 
    77 * Authors: Colin Delacroix <colin@zoy.org> 
     
    99 *          Jon Lech Johansen <jon-vl@nanocrew.net> 
    1010 *          Derk-Jan Hartman <thedj@users.sourceforge.net> 
     11 *          Eric Petit <titer@m0k.org> 
    1112 * 
    1213 * This program is free software; you can redistribute it and/or modify 
     
    292293 
    293294    /* Try to initialize up to QT_MAX_DIRECTBUFFERS direct buffers */ 
    294     while( I_OUTPUTPICTURES < QT_MAX_DIRECTBUFFERS ) 
     295    while( I_OUTPUTPICTURES < 
     296           p_vout->p_sys->i_opengl ? 1 : QT_MAX_DIRECTBUFFERS ) 
    295297    { 
    296298        p_pic = NULL; 
     
    479481        if( [p_vout->p_sys->o_glview lockFocusIfCanDraw] ) 
    480482        { 
    481             [p_vout->p_sys->o_glview reloadTexture: p_pic]; 
     483            /* Texture gotta be reload before the buffer is filled 
     484               (thanks to gcc from arstechnica forums) */ 
    482485            [p_vout->p_sys->o_glview drawRect: 
    483486                [p_vout->p_sys->o_glview bounds]]; 
     487            [p_vout->p_sys->o_glview reloadTexture]; 
    484488            [p_vout->p_sys->o_glview unlockFocus]; 
    485489        } 
     
    13311335- (void) initTextures 
    13321336{ 
    1333     int    i; 
    1334     GLuint pi_textures[QT_MAX_DIRECTBUFFERS]; 
    1335  
    13361337    [[self openGLContext] makeCurrentContext]; 
    13371338 
    13381339    /* Create textures */ 
    1339     glGenTextures( QT_MAX_DIRECTBUFFERS, pi_textures ); 
    1340  
    1341     for( i = 0; i < I_OUTPUTPICTURES; i++ ) 
    1342     { 
    1343         glEnable( GL_TEXTURE_RECTANGLE_EXT ); 
    1344         glEnable( GL_UNPACK_CLIENT_STORAGE_APPLE ); 
    1345         glEnable( GL_APPLE_texture_range ); 
    1346  
    1347         glBindTexture( GL_TEXTURE_RECTANGLE_EXT, pi_textures[i] ); 
    1348  
    1349 #if 0 
    1350         FIXME: the lines below are supposed to avoid a memcpy and get 
    1351         a noticeable performance boost, but they are annoying side 
    1352         effects at the moment -- titer 
    1353  
    1354         /* Use AGP texturing */ 
    1355         glTextureRangeAPPLE( GL_TEXTURE_RECTANGLE_EXT, 0, NULL ); 
    1356         glTexParameteri( GL_TEXTURE_RECTANGLE_EXT, 
    1357                 GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_SHARED_APPLE ); 
    1358 #endif 
    1359  
    1360         /* Tell the driver not to make a copy of the texture but to use 
    1361            our buffer */ 
    1362         glPixelStorei( GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE ); 
    1363  
    1364         /* Linear interpolation */ 
    1365         glTexParameteri( GL_TEXTURE_RECTANGLE_EXT, 
    1366                 GL_TEXTURE_MIN_FILTER, GL_LINEAR ); 
    1367         glTexParameteri( GL_TEXTURE_RECTANGLE_EXT, 
    1368                 GL_TEXTURE_MAG_FILTER, GL_LINEAR ); 
    1369  
    1370         /* I have no idea what this exactly does, but it seems to be 
    1371            necessary for scaling */ 
    1372         glTexParameteri( GL_TEXTURE_RECTANGLE_EXT, 
    1373                 GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE ); 
    1374         glTexParameteri( GL_TEXTURE_RECTANGLE_EXT, 
    1375                 GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 
    1376         glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 ); 
    1377  
    1378         glTexImage2D( GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA, 
    1379                 p_vout->output.i_width, p_vout->output.i_height, 0, 
    1380                 GL_YCBCR_422_APPLE, GL_UNSIGNED_SHORT_8_8_APPLE, 
    1381                 PP_OUTPUTPICTURE[i]->p_data ); 
    1382  
    1383         PP_OUTPUTPICTURE[i]->p_sys = malloc( sizeof( GLuint ) ); 
    1384         *((GLuint*) PP_OUTPUTPICTURE[i]->p_sys) = pi_textures[i]; 
    1385     } 
     1340    glGenTextures( 1, &i_texture ); 
     1341 
     1342    glEnable( GL_TEXTURE_RECTANGLE_EXT ); 
     1343    glEnable( GL_UNPACK_CLIENT_STORAGE_APPLE ); 
     1344 
     1345    glBindTexture( GL_TEXTURE_RECTANGLE_EXT, i_texture ); 
     1346 
     1347    /* Use VRAM texturing */ 
     1348    glTexParameteri( GL_TEXTURE_RECTANGLE_EXT, 
     1349            GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_CACHED_APPLE ); 
     1350 
     1351    /* Tell the driver not to make a copy of the texture but to use 
     1352       our buffer */ 
     1353    glPixelStorei( GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE ); 
     1354 
     1355    /* Linear interpolation */ 
     1356    glTexParameteri( GL_TEXTURE_RECTANGLE_EXT, 
     1357            GL_TEXTURE_MIN_FILTER, GL_LINEAR ); 
     1358    glTexParameteri( GL_TEXTURE_RECTANGLE_EXT, 
     1359            GL_TEXTURE_MAG_FILTER, GL_LINEAR ); 
     1360 
     1361    /* I have no idea what this exactly does, but it seems to be 
     1362       necessary for scaling */ 
     1363    glTexParameteri( GL_TEXTURE_RECTANGLE_EXT, 
     1364            GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); 
     1365    glTexParameteri( GL_TEXTURE_RECTANGLE_EXT, 
     1366            GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 
     1367    glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 ); 
     1368 
     1369    glTexImage2D( GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA, 
     1370            p_vout->output.i_width, p_vout->output.i_height, 0, 
     1371            GL_YCBCR_422_APPLE, GL_UNSIGNED_SHORT_8_8_APPLE, 
     1372            PP_OUTPUTPICTURE[0]->p_data ); 
    13861373 
    13871374    b_init_done = 1; 
    13881375} 
    13891376 
    1390 - (void) reloadTexture: (picture_t *) p_pic 
    1391 
    1392     i_cur_texture = *((GLuint*) p_pic->p_sys); 
    1393      
     1377- (void) reloadTexture 
     1378
    13941379    [[self openGLContext] makeCurrentContext]; 
    13951380 
    1396     glBindTexture( GL_TEXTURE_RECTANGLE_EXT, i_cur_texture ); 
     1381    glBindTexture( GL_TEXTURE_RECTANGLE_EXT, i_texture ); 
    13971382 
    13981383    /* glTexSubImage2D is faster than glTexImage2D 
     
    14021387            p_vout->output.i_width, p_vout->output.i_height, 
    14031388            GL_YCBCR_422_APPLE, GL_UNSIGNED_SHORT_8_8_APPLE, 
    1404             p_pic->p_data ); 
     1389            PP_OUTPUTPICTURE[0]->p_data ); 
    14051390} 
    14061391 
     
    14261411 
    14271412    /* Draw a quad with our texture on it */ 
    1428     glBindTexture( GL_TEXTURE_RECTANGLE_EXT, i_cur_texture ); 
     1413    glBindTexture( GL_TEXTURE_RECTANGLE_EXT, i_texture ); 
    14291414    glBegin( GL_QUADS ); 
    14301415        /* Top left */