Mercurial > mplayer.hg
comparison libvo/vo_gl.c @ 36179:512629a9aa21
vo_gl: Extract some code into separate function.
This should make it less messy to support other ways
to do direct rendering.
author | reimar |
---|---|
date | Thu, 16 May 2013 19:57:32 +0000 |
parents | 94979f661d38 |
children | 3b15983f5e48 |
comparison
equal
deleted
inserted
replaced
36178:927dedf22dde | 36179:512629a9aa21 |
---|---|
984 mpglActiveTexture(GL_TEXTURE0); | 984 mpglActiveTexture(GL_TEXTURE0); |
985 } | 985 } |
986 return 0; | 986 return 0; |
987 } | 987 } |
988 | 988 |
989 static uint32_t get_image(mp_image_t *mpi) { | 989 static int get_pbo_image(mp_image_t *mpi) { |
990 int needed_size; | 990 int needed_size; |
991 dr_rejectcnt++; | |
992 if (!mpglGenBuffers || !mpglBindBuffer || !mpglBufferData || !mpglMapBuffer) { | 991 if (!mpglGenBuffers || !mpglBindBuffer || !mpglBufferData || !mpglMapBuffer) { |
993 if (!err_shown) | 992 if (!err_shown) |
994 mp_msg(MSGT_VO, MSGL_ERR, "[gl] extensions missing for dr\n" | 993 mp_msg(MSGT_VO, MSGL_ERR, "[gl] extensions missing for dr\n" |
995 "Expect a _major_ speed penalty\n"); | 994 "Expect a _major_ speed penalty\n"); |
996 err_shown = 1; | 995 err_shown = 1; |
997 return VO_FALSE; | 996 return 0; |
998 } | |
999 if (gl_bufferptr) return VO_FALSE; | |
1000 if (mpi->flags & MP_IMGFLAG_READABLE) return VO_FALSE; | |
1001 if (mpi->type != MP_IMGTYPE_STATIC && mpi->type != MP_IMGTYPE_TEMP && | |
1002 mpi->type != MP_IMGTYPE_IPB && | |
1003 mpi->type != MP_IMGTYPE_NUMBERED) | |
1004 return VO_FALSE; | |
1005 if (mesa_buffer) mpi->width = texture_width; | |
1006 else if (ati_hack) { | |
1007 mpi->width = texture_width; | |
1008 mpi->height = texture_height; | |
1009 } | 997 } |
1010 mpi->stride[0] = mpi->width * mpi->bpp / 8; | 998 mpi->stride[0] = mpi->width * mpi->bpp / 8; |
1011 needed_size = mpi->stride[0] * mpi->height + 31; | 999 needed_size = mpi->stride[0] * mpi->height + 31; |
1012 if (mesa_buffer) { | 1000 if (mesa_buffer) { |
1013 #ifdef CONFIG_GL_X11 | 1001 #ifdef CONFIG_GL_X11 |
1038 if (!mpi->planes[0]) { | 1026 if (!mpi->planes[0]) { |
1039 if (!err_shown) | 1027 if (!err_shown) |
1040 mp_msg(MSGT_VO, MSGL_ERR, "[gl] could not acquire buffer for dr\n" | 1028 mp_msg(MSGT_VO, MSGL_ERR, "[gl] could not acquire buffer for dr\n" |
1041 "Expect a _major_ speed penalty\n"); | 1029 "Expect a _major_ speed penalty\n"); |
1042 err_shown = 1; | 1030 err_shown = 1; |
1043 return VO_FALSE; | 1031 return 0; |
1044 } | 1032 } |
1045 if (is_yuv) { | 1033 if (is_yuv) { |
1046 // planar YUV | 1034 // planar YUV |
1047 int xs, ys; | 1035 int xs, ys; |
1048 int bpp; | 1036 int bpp; |
1074 } | 1062 } |
1075 mpi->planes[1] = gl_bufferptr_uv[0]; | 1063 mpi->planes[1] = gl_bufferptr_uv[0]; |
1076 mpi->planes[2] = gl_bufferptr_uv[1]; | 1064 mpi->planes[2] = gl_bufferptr_uv[1]; |
1077 } | 1065 } |
1078 } | 1066 } |
1067 return 1; | |
1068 } | |
1069 | |
1070 static uint32_t get_image(mp_image_t *mpi) { | |
1071 dr_rejectcnt++; | |
1072 if (gl_bufferptr) return VO_FALSE; | |
1073 if (mpi->flags & MP_IMGFLAG_READABLE) return VO_FALSE; | |
1074 if (mpi->type != MP_IMGTYPE_STATIC && mpi->type != MP_IMGTYPE_TEMP && | |
1075 mpi->type != MP_IMGTYPE_IPB && | |
1076 mpi->type != MP_IMGTYPE_NUMBERED) | |
1077 return VO_FALSE; | |
1078 if (mesa_buffer) mpi->width = texture_width; | |
1079 else if (ati_hack) { | |
1080 mpi->width = texture_width; | |
1081 mpi->height = texture_height; | |
1082 } | |
1083 if (!get_pbo_image(mpi)) | |
1084 return VO_FALSE; | |
1079 mpi->flags |= MP_IMGFLAG_DIRECT; | 1085 mpi->flags |= MP_IMGFLAG_DIRECT; |
1080 dr_rejectcnt--; | 1086 dr_rejectcnt--; |
1081 return VO_TRUE; | 1087 return VO_TRUE; |
1082 } | 1088 } |
1083 | 1089 |