Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/movieclip.c
| Show First 20 Lines • Show All 1,869 Lines • ▼ Show 20 Lines | |||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name GPU textures | /** \name GPU textures | ||||
| * \{ */ | * \{ */ | ||||
| static GPUTexture **movieclip_get_gputexture_ptr(MovieClip *clip, | static GPUTexture **movieclip_get_gputexture_ptr(MovieClip *clip, | ||||
| MovieClipUser *cuser, | MovieClipUser *cuser, | ||||
| eGPUTextureTarget textarget) | eGPUTextureTarget textarget) | ||||
| { | { | ||||
| LISTBASE_FOREACH (MovieClip_RuntimeGPUTexture *, tex, &clip->runtime.gputextures) { | /* Check if we have an existing entry for that clip user. */ | ||||
| MovieClip_RuntimeGPUTexture *tex; | |||||
| for (tex = clip->runtime.gputextures.first; tex; tex = tex->next) { | |||||
| if (memcmp(&tex->user, cuser, sizeof(MovieClipUser)) == 0) { | if (memcmp(&tex->user, cuser, sizeof(MovieClipUser)) == 0) { | ||||
| break; | |||||
| } | |||||
| } | |||||
| /* If not, allocate a new one. */ | |||||
| if (tex == NULL) { | if (tex == NULL) { | ||||
| tex = (MovieClip_RuntimeGPUTexture *)MEM_mallocN(sizeof(MovieClip_RuntimeGPUTexture), | tex = (MovieClip_RuntimeGPUTexture *)MEM_mallocN(sizeof(MovieClip_RuntimeGPUTexture), | ||||
| __func__); | __func__); | ||||
| for (int i = 0; i < TEXTARGET_COUNT; i++) { | for (int i = 0; i < TEXTARGET_COUNT; i++) { | ||||
| tex->gputexture[i] = NULL; | tex->gputexture[i] = NULL; | ||||
| } | } | ||||
| memcpy(&tex->user, cuser, sizeof(MovieClipUser)); | memcpy(&tex->user, cuser, sizeof(MovieClipUser)); | ||||
| BLI_addtail(&clip->runtime.gputextures, tex); | BLI_addtail(&clip->runtime.gputextures, tex); | ||||
| } | } | ||||
| return &tex->gputexture[textarget]; | return &tex->gputexture[textarget]; | ||||
| } | } | ||||
| } | |||||
| return NULL; | |||||
| } | |||||
| GPUTexture *BKE_movieclip_get_gpu_texture(MovieClip *clip, MovieClipUser *cuser) | GPUTexture *BKE_movieclip_get_gpu_texture(MovieClip *clip, MovieClipUser *cuser) | ||||
| { | { | ||||
| if (clip == NULL) { | if (clip == NULL) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| GPUTexture **tex = movieclip_get_gputexture_ptr(clip, cuser, TEXTARGET_2D); | GPUTexture **tex = movieclip_get_gputexture_ptr(clip, cuser, TEXTARGET_2D); | ||||
| ▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines | |||||