- glGenTextures( QT_MAX_DIRECTBUFFERS, pi_textures );
-
- for( i = 0; i < I_OUTPUTPICTURES; i++ )
- {
- glEnable( GL_TEXTURE_RECTANGLE_EXT );
- glEnable( GL_UNPACK_CLIENT_STORAGE_APPLE );
- glEnable( GL_APPLE_texture_range );
-
- glBindTexture( GL_TEXTURE_RECTANGLE_EXT, pi_textures[i] );
-
-#if 0
- FIXME: the lines below are supposed to avoid a memcpy and get
- a noticeable performance boost, but they are annoying side
- effects at the moment -- titer
-
- /* Use AGP texturing */
- glTextureRangeAPPLE( GL_TEXTURE_RECTANGLE_EXT, 0, NULL );
- glTexParameteri( GL_TEXTURE_RECTANGLE_EXT,
- GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_SHARED_APPLE );
-#endif
-
- /* Tell the driver not to make a copy of the texture but to use
- our buffer */
- glPixelStorei( GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE );
-
- /* Linear interpolation */
- glTexParameteri( GL_TEXTURE_RECTANGLE_EXT,
- GL_TEXTURE_MIN_FILTER, GL_LINEAR );
- glTexParameteri( GL_TEXTURE_RECTANGLE_EXT,
- GL_TEXTURE_MAG_FILTER, GL_LINEAR );
-
- /* I have no idea what this exactly does, but it seems to be
- necessary for scaling */
- glTexParameteri( GL_TEXTURE_RECTANGLE_EXT,
- GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE );
- glTexParameteri( GL_TEXTURE_RECTANGLE_EXT,
- GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
-
- glTexImage2D( GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA,
- p_vout->output.i_width, p_vout->output.i_height, 0,
- GL_YCBCR_422_APPLE, GL_UNSIGNED_SHORT_8_8_APPLE,
- PP_OUTPUTPICTURE[i]->p_data );
-
- PP_OUTPUTPICTURE[i]->p_sys = malloc( sizeof( GLuint ) );
- *((GLuint*) PP_OUTPUTPICTURE[i]->p_sys) = pi_textures[i];
- }
+ glGenTextures( 1, &i_texture );
+
+ glEnable( GL_TEXTURE_RECTANGLE_EXT );
+ glEnable( GL_UNPACK_CLIENT_STORAGE_APPLE );
+
+ glBindTexture( GL_TEXTURE_RECTANGLE_EXT, i_texture );
+
+ /* Use VRAM texturing */
+ glTexParameteri( GL_TEXTURE_RECTANGLE_EXT,
+ GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_CACHED_APPLE );
+
+ /* Tell the driver not to make a copy of the texture but to use
+ our buffer */
+ glPixelStorei( GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE );
+
+ /* Linear interpolation */
+ glTexParameteri( GL_TEXTURE_RECTANGLE_EXT,
+ GL_TEXTURE_MIN_FILTER, GL_LINEAR );
+ glTexParameteri( GL_TEXTURE_RECTANGLE_EXT,
+ GL_TEXTURE_MAG_FILTER, GL_LINEAR );
+
+ /* I have no idea what this exactly does, but it seems to be
+ necessary for scaling */
+ glTexParameteri( GL_TEXTURE_RECTANGLE_EXT,
+ GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
+ glTexParameteri( GL_TEXTURE_RECTANGLE_EXT,
+ GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
+
+ glTexImage2D( GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA,
+ p_vout->output.i_width, p_vout->output.i_height, 0,
+ GL_YCBCR_422_APPLE, GL_UNSIGNED_SHORT_8_8_APPLE,
+ PP_OUTPUTPICTURE[0]->p_data );