Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/image/image_engine.c
| Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | static void space_image_gpu_texture_get(Image *image, | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| SpaceImage *sima = (SpaceImage *)draw_ctx->space_data; | SpaceImage *sima = (SpaceImage *)draw_ctx->space_data; | ||||
| if (BKE_image_is_multilayer(image)) { | if (BKE_image_is_multilayer(image)) { | ||||
| /* Update multi-index and pass for the current eye. */ | /* Update multi-index and pass for the current eye. */ | ||||
| BKE_image_multilayer_index(image->rr, &sima->iuser); | BKE_image_multilayer_index(image->rr, &sima->iuser); | ||||
| } | } | ||||
| BKE_image_multiview_index(image, &sima->iuser); | BKE_image_multiview_index(image, &sima->iuser); | ||||
| if (ibuf) { | if (ibuf == NULL) { | ||||
| return; | |||||
| } | |||||
| if (ibuf->rect == NULL && ibuf->rect_float == NULL) { | |||||
| /* This codepath is only supposed to happen when drawing a lazily-allocatable render result. | |||||
| * In all the other cases the `ED_space_image_acquire_buffer()` si expected to return NULL as | |||||
brecht: si -> is | |||||
| * an image buffer when it has no pixels. */ | |||||
| BLI_assert(image->type == IMA_TYPE_R_RESULT); | |||||
| float zero[4] = {0, 0, 0, 0}; | |||||
| *r_gpu_texture = GPU_texture_create_2d(__func__, 1, 1, 0, GPU_RGBA16F, zero); | |||||
| *r_owns_texture = true; | |||||
| return; | |||||
| } | |||||
| const int sima_flag = sima->flag & ED_space_image_get_display_channel_mask(ibuf); | const int sima_flag = sima->flag & ED_space_image_get_display_channel_mask(ibuf); | ||||
| if (sima_flag & SI_SHOW_ZBUF && (ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels == 1))) { | if (sima_flag & SI_SHOW_ZBUF && (ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels == 1))) { | ||||
| if (ibuf->zbuf) { | if (ibuf->zbuf) { | ||||
| BLI_assert_msg(0, "Integer based depth buffers not supported"); | BLI_assert_msg(0, "Integer based depth buffers not supported"); | ||||
| } | } | ||||
| else if (ibuf->zbuf_float) { | else if (ibuf->zbuf_float) { | ||||
| *r_gpu_texture = GPU_texture_create_2d( | *r_gpu_texture = GPU_texture_create_2d( | ||||
| __func__, ibuf->x, ibuf->y, 0, GPU_R16F, ibuf->zbuf_float); | __func__, ibuf->x, ibuf->y, 0, GPU_R16F, ibuf->zbuf_float); | ||||
| *r_owns_texture = true; | *r_owns_texture = true; | ||||
| } | } | ||||
| else if (ibuf->rect_float && ibuf->channels == 1) { | else if (ibuf->rect_float && ibuf->channels == 1) { | ||||
| *r_gpu_texture = GPU_texture_create_2d( | *r_gpu_texture = GPU_texture_create_2d( | ||||
| __func__, ibuf->x, ibuf->y, 0, GPU_R16F, ibuf->rect_float); | __func__, ibuf->x, ibuf->y, 0, GPU_R16F, ibuf->rect_float); | ||||
| *r_owns_texture = true; | *r_owns_texture = true; | ||||
| } | } | ||||
| } | } | ||||
| else if (image->source == IMA_SRC_TILED) { | else if (image->source == IMA_SRC_TILED) { | ||||
| *r_gpu_texture = BKE_image_get_gpu_tiles(image, iuser, ibuf); | *r_gpu_texture = BKE_image_get_gpu_tiles(image, iuser, ibuf); | ||||
| *r_tex_tile_data = BKE_image_get_gpu_tilemap(image, iuser, NULL); | *r_tex_tile_data = BKE_image_get_gpu_tilemap(image, iuser, NULL); | ||||
| *r_owns_texture = false; | *r_owns_texture = false; | ||||
| } | } | ||||
| else { | else { | ||||
| *r_gpu_texture = BKE_image_get_gpu_texture(image, iuser, ibuf); | *r_gpu_texture = BKE_image_get_gpu_texture(image, iuser, ibuf); | ||||
| *r_owns_texture = false; | *r_owns_texture = false; | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| static void space_node_gpu_texture_get(Image *image, | static void space_node_gpu_texture_get(Image *image, | ||||
| ImageUser *iuser, | ImageUser *iuser, | ||||
| ImBuf *ibuf, | ImBuf *ibuf, | ||||
| GPUTexture **r_gpu_texture, | GPUTexture **r_gpu_texture, | ||||
| bool *r_owns_texture, | bool *r_owns_texture, | ||||
| GPUTexture **r_tex_tile_data) | GPUTexture **r_tex_tile_data) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 291 Lines • Show Last 20 Lines | |||||
si -> is