Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/draw_manager_texture.c
| Show First 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | |||||
| GPUTexture *DRW_texture_create_2D(int w, int h, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels) | GPUTexture *DRW_texture_create_2D(int w, int h, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels) | ||||
| { | { | ||||
| GPUTexture *tex = GPU_texture_create_2D(w, h, format, fpixels, NULL); | GPUTexture *tex = GPU_texture_create_2D(w, h, format, fpixels, NULL); | ||||
| drw_texture_set_parameters(tex, flags); | drw_texture_set_parameters(tex, flags); | ||||
| return tex; | return tex; | ||||
| } | } | ||||
| GPUTexture *DRW_texture_create_2D_multisample(int w, int h, GPUTextureFormat format, int samples, DRWTextureFlag flags, const float *fpixels) | |||||
| { | |||||
| GPUTexture *tex = GPU_texture_create_2D_multisample(w, h, format, fpixels, samples, NULL); | |||||
| drw_texture_set_parameters(tex, flags); | |||||
| return tex; | |||||
| } | |||||
| GPUTexture *DRW_texture_create_2D_array( | GPUTexture *DRW_texture_create_2D_array( | ||||
| int w, int h, int d, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels) | int w, int h, int d, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels) | ||||
| { | { | ||||
| GPUTexture *tex = GPU_texture_create_2D_array(w, h, d, format, fpixels, NULL); | GPUTexture *tex = GPU_texture_create_2D_array(w, h, d, format, fpixels, NULL); | ||||
| drw_texture_set_parameters(tex, flags); | drw_texture_set_parameters(tex, flags); | ||||
| return tex; | return tex; | ||||
| } | } | ||||
| Show All 33 Lines | |||||
| void DRW_texture_ensure_2D(GPUTexture **tex, int w, int h, GPUTextureFormat format, DRWTextureFlag flags) | void DRW_texture_ensure_2D(GPUTexture **tex, int w, int h, GPUTextureFormat format, DRWTextureFlag flags) | ||||
| { | { | ||||
| if (*(tex) == NULL) { | if (*(tex) == NULL) { | ||||
| *(tex) = DRW_texture_create_2D(w, h, format, flags, NULL); | *(tex) = DRW_texture_create_2D(w, h, format, flags, NULL); | ||||
| } | } | ||||
| } | } | ||||
| void DRW_texture_ensure_fullscreen_2D_multisample(GPUTexture **tex, GPUTextureFormat format, int samples, DRWTextureFlag flags) | |||||
| { | |||||
| if (*(tex) == NULL) { | |||||
| const float *size = DRW_viewport_size_get(); | |||||
| *(tex) = DRW_texture_create_2D_multisample((int)size[0], (int)size[1], format, samples, flags, NULL); | |||||
| } | |||||
| } | |||||
| void DRW_texture_ensure_2D_multisample(GPUTexture **tex, int w, int h, GPUTextureFormat format, int samples, DRWTextureFlag flags) | |||||
| { | |||||
| if (*(tex) == NULL) { | |||||
| *(tex) = DRW_texture_create_2D_multisample(w, h, format, samples, flags, NULL); | |||||
| } | |||||
| } | |||||
| void DRW_texture_generate_mipmaps(GPUTexture *tex) | void DRW_texture_generate_mipmaps(GPUTexture *tex) | ||||
| { | { | ||||
| GPU_texture_bind(tex, 0); | GPU_texture_bind(tex, 0); | ||||
| GPU_texture_generate_mipmap(tex); | GPU_texture_generate_mipmap(tex); | ||||
| GPU_texture_unbind(tex); | GPU_texture_unbind(tex); | ||||
| } | } | ||||
| void DRW_texture_free(GPUTexture *tex) | void DRW_texture_free(GPUTexture *tex) | ||||
| { | { | ||||
| GPU_texture_free(tex); | GPU_texture_free(tex); | ||||
| } | } | ||||