Mercurial > mplayer.hg
comparison libvo/vo_gl.c @ 27621:53b5cf466361
Change glCreateClearTex to use the same host data format as later uploads.
This fixes at least some of the massive performance problems the ATI drivers have.
author | reimar |
---|---|
date | Sat, 20 Sep 2008 17:48:01 +0000 |
parents | 4876c89bafdd |
children | b59875975f93 |
comparison
equal
deleted
inserted
replaced
27620:ed0ea697cf40 | 27621:53b5cf466361 |
---|---|
279 if (!img) | 279 if (!img) |
280 return; | 280 return; |
281 if (!largeeosdtex[0]) { | 281 if (!largeeosdtex[0]) { |
282 glGenTextures(2, largeeosdtex); | 282 glGenTextures(2, largeeosdtex); |
283 BindTexture(gl_target, largeeosdtex[0]); | 283 BindTexture(gl_target, largeeosdtex[0]); |
284 glCreateClearTex(gl_target, GL_ALPHA, scale_type, 512, 512, 0); | 284 glCreateClearTex(gl_target, GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE, scale_type, 512, 512, 0); |
285 BindTexture(gl_target, largeeosdtex[1]); | 285 BindTexture(gl_target, largeeosdtex[1]); |
286 glCreateClearTex(gl_target, GL_ALPHA, scale_type, 512, 512, 0); | 286 glCreateClearTex(gl_target, GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE, scale_type, 512, 512, 0); |
287 } | 287 } |
288 for (i = img; i; i = i->next) | 288 for (i = img; i; i = i->next) |
289 { | 289 { |
290 if (i->w <= 0 || i->h <= 0 || i->stride < i->w) | 290 if (i->w <= 0 || i->h <= 0 || i->stride < i->w) |
291 continue; | 291 continue; |
320 BindTexture(gl_target, largeeosdtex[1]); | 320 BindTexture(gl_target, largeeosdtex[1]); |
321 smalltexcur++; | 321 smalltexcur++; |
322 } else { | 322 } else { |
323 texSize(i->w, i->h, &sx, &sy); | 323 texSize(i->w, i->h, &sx, &sy); |
324 BindTexture(gl_target, *curtex++); | 324 BindTexture(gl_target, *curtex++); |
325 glCreateClearTex(gl_target, GL_ALPHA, scale_type, sx, sy, 0); | 325 glCreateClearTex(gl_target, GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE, scale_type, sx, sy, 0); |
326 } | 326 } |
327 glUploadTex(gl_target, GL_ALPHA, GL_UNSIGNED_BYTE, i->bitmap, i->stride, | 327 glUploadTex(gl_target, GL_ALPHA, GL_UNSIGNED_BYTE, i->bitmap, i->stride, |
328 x, y, i->w, i->h, 0); | 328 x, y, i->w, i->h, 0); |
329 } | 329 } |
330 eosdDispList = glGenLists(1); | 330 eosdDispList = glGenLists(1); |
410 BindTexture(GL_TEXTURE_2D, default_texs[i]); | 410 BindTexture(GL_TEXTURE_2D, default_texs[i]); |
411 BindTexture(GL_TEXTURE_RECTANGLE, default_texs[i + 7]); | 411 BindTexture(GL_TEXTURE_RECTANGLE, default_texs[i + 7]); |
412 BindTexture(GL_TEXTURE_3D, default_texs[i + 14]); | 412 BindTexture(GL_TEXTURE_3D, default_texs[i + 14]); |
413 } | 413 } |
414 ActiveTexture(GL_TEXTURE1); | 414 ActiveTexture(GL_TEXTURE1); |
415 glCreateClearTex(gl_target, gl_texfmt, GL_LINEAR, | 415 glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, GL_LINEAR, |
416 texture_width / 2, texture_height / 2, 128); | 416 texture_width / 2, texture_height / 2, 128); |
417 ActiveTexture(GL_TEXTURE2); | 417 ActiveTexture(GL_TEXTURE2); |
418 glCreateClearTex(gl_target, gl_texfmt, GL_LINEAR, | 418 glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, GL_LINEAR, |
419 texture_width / 2, texture_height / 2, 128); | 419 texture_width / 2, texture_height / 2, 128); |
420 switch (use_yuv) { | 420 switch (use_yuv) { |
421 case YUV_CONVERSION_FRAGMENT_LOOKUP: | 421 case YUV_CONVERSION_FRAGMENT_LOOKUP: |
422 case YUV_CONVERSION_FRAGMENT_POW: | 422 case YUV_CONVERSION_FRAGMENT_POW: |
423 case YUV_CONVERSION_FRAGMENT: | 423 case YUV_CONVERSION_FRAGMENT: |
431 } | 431 } |
432 ActiveTexture(GL_TEXTURE0); | 432 ActiveTexture(GL_TEXTURE0); |
433 BindTexture(gl_target, 0); | 433 BindTexture(gl_target, 0); |
434 update_yuvconv(); | 434 update_yuvconv(); |
435 } | 435 } |
436 glCreateClearTex(gl_target, gl_texfmt, GL_LINEAR, | 436 glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, GL_LINEAR, |
437 texture_width, texture_height, 0); | 437 texture_width, texture_height, 0); |
438 | 438 |
439 resize(d_width, d_height); | 439 resize(d_width, d_height); |
440 | 440 |
441 glClearColor( 0.0f,0.0f,0.0f,0.0f ); | 441 glClearColor( 0.0f,0.0f,0.0f,0.0f ); |
535 } | 535 } |
536 | 536 |
537 // create Textures for OSD part | 537 // create Textures for OSD part |
538 glGenTextures(1, &osdtex[osdtexCnt]); | 538 glGenTextures(1, &osdtex[osdtexCnt]); |
539 BindTexture(gl_target, osdtex[osdtexCnt]); | 539 BindTexture(gl_target, osdtex[osdtexCnt]); |
540 glCreateClearTex(gl_target, GL_LUMINANCE, scale_type, sx, sy, 0); | 540 glCreateClearTex(gl_target, GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE, scale_type, sx, sy, 0); |
541 glUploadTex(gl_target, GL_LUMINANCE, GL_UNSIGNED_BYTE, src, stride, | 541 glUploadTex(gl_target, GL_LUMINANCE, GL_UNSIGNED_BYTE, src, stride, |
542 0, 0, w, h, 0); | 542 0, 0, w, h, 0); |
543 | 543 |
544 #ifndef FAST_OSD | 544 #ifndef FAST_OSD |
545 glGenTextures(1, &osdatex[osdtexCnt]); | 545 glGenTextures(1, &osdatex[osdtexCnt]); |
546 BindTexture(gl_target, osdatex[osdtexCnt]); | 546 BindTexture(gl_target, osdatex[osdtexCnt]); |
547 glCreateClearTex(gl_target, GL_ALPHA, scale_type, sx, sy, 255); | 547 glCreateClearTex(gl_target, GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE, scale_type, sx, sy, 255); |
548 { | 548 { |
549 int i; | 549 int i; |
550 char *tmp = malloc(stride * h); | 550 char *tmp = malloc(stride * h); |
551 // convert alpha from weird MPlayer scale. | 551 // convert alpha from weird MPlayer scale. |
552 // in-place is not possible since it is reused for future OSDs | 552 // in-place is not possible since it is reused for future OSDs |