GPU: consistenly use mipmap on/off in all draw modes.
This is important for good texture paint performance.
This commit is contained in:
parent
14db989e73
commit
0626de2033
|
@ -568,7 +568,7 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
|
|||
|
||||
case OB_TEXTURE:
|
||||
{
|
||||
GPUTexture *tex = GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false, false, false);
|
||||
GPUTexture *tex = GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false, 0.0);
|
||||
DRW_shgroup_uniform_texture(material->shgrp, "image", tex);
|
||||
break;
|
||||
}
|
||||
|
@ -631,7 +631,7 @@ static void workbench_cache_populate_particles(WORKBENCH_Data *vedata, Object *o
|
|||
DRW_shgroup_uniform_int(shgrp, "object_id", &material->object_id, 1);
|
||||
DRW_shgroup_uniform_block(shgrp, "material_block", material->material_ubo);
|
||||
if (image) {
|
||||
GPUTexture *tex = GPU_texture_from_blender(image, NULL, GL_TEXTURE_2D, false, false, false);
|
||||
GPUTexture *tex = GPU_texture_from_blender(image, NULL, GL_TEXTURE_2D, false, 0.0f);
|
||||
DRW_shgroup_uniform_texture(shgrp, "image", tex);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
|
|||
|
||||
case OB_TEXTURE:
|
||||
{
|
||||
GPUTexture *tex = GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false, false, false);
|
||||
GPUTexture *tex = GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false, 0.0f);
|
||||
DRW_shgroup_uniform_texture(grp, "image", tex);
|
||||
break;
|
||||
}
|
||||
|
@ -427,7 +427,7 @@ static void workbench_forward_cache_populate_particles(WORKBENCH_Data *vedata, O
|
|||
float hair_alpha = wpd->shading.xray_alpha * 0.33f;
|
||||
DRW_shgroup_uniform_float_copy(shgrp, "alpha", hair_alpha);
|
||||
if (image) {
|
||||
GPUTexture *tex = GPU_texture_from_blender(image, NULL, GL_TEXTURE_2D, false, false, false);
|
||||
GPUTexture *tex = GPU_texture_from_blender(image, NULL, GL_TEXTURE_2D, false, 0.0f);
|
||||
DRW_shgroup_uniform_texture(shgrp, "image", tex);
|
||||
}
|
||||
if (STUDIOLIGHT_ORIENTATION_VIEWNORMAL_ENABLED(wpd)) {
|
||||
|
|
|
@ -768,7 +768,7 @@ static DRWShadingGroup *drw_shgroup_material_inputs(DRWShadingGroup *grp, struct
|
|||
if (input->ima) {
|
||||
double time = 0.0; /* TODO make time variable */
|
||||
GPUTexture *tex = GPU_texture_from_blender(
|
||||
input->ima, input->iuser, input->textarget, input->image_isdata, time, 1);
|
||||
input->ima, input->iuser, input->textarget, input->image_isdata, time);
|
||||
|
||||
if (input->bindtex) {
|
||||
DRW_shgroup_uniform_texture(grp, input->shadername, tex);
|
||||
|
|
|
@ -799,7 +799,7 @@ static void DRW_shgroup_empty_image(
|
|||
struct EmptyImageShadingGroupData *empty_image_data;
|
||||
|
||||
GPUTexture *tex = ob->data ?
|
||||
GPU_texture_from_blender(ob->data, ob->iuser, GL_TEXTURE_2D, false, false, false) : NULL;
|
||||
GPU_texture_from_blender(ob->data, ob->iuser, GL_TEXTURE_2D, false, 0.0f) : NULL;
|
||||
void **val_p;
|
||||
|
||||
/* Create on demand, 'tex' may be NULL. */
|
||||
|
|
|
@ -222,7 +222,7 @@ static void PAINT_TEXTURE_cache_init(void *vedata)
|
|||
Material *ma = give_current_material(ob, i + 1);
|
||||
Image *ima = (ma && ma->texpaintslot) ? ma->texpaintslot[ma->paint_active_slot].ima : NULL;
|
||||
GPUTexture *tex = ima ?
|
||||
GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false, false, false) : NULL;
|
||||
GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false, 0.0f) : NULL;
|
||||
|
||||
if (tex) {
|
||||
DRWShadingGroup *grp = DRW_shgroup_create(e_data.image_sh, psl->image_faces);
|
||||
|
@ -237,7 +237,7 @@ static void PAINT_TEXTURE_cache_init(void *vedata)
|
|||
else {
|
||||
Image *ima = scene->toolsettings->imapaint.canvas;
|
||||
GPUTexture *tex = ima ?
|
||||
GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false, false, false) : NULL;
|
||||
GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false, 0.0f) : NULL;
|
||||
|
||||
if (tex) {
|
||||
DRWShadingGroup *grp = DRW_shgroup_create(e_data.image_sh, psl->image_faces);
|
||||
|
|
|
@ -163,7 +163,7 @@ GPUTexture *GPU_texture_create_buffer(
|
|||
|
||||
GPUTexture *GPU_texture_from_bindcode(int textarget, int bindcode);
|
||||
GPUTexture *GPU_texture_from_blender(
|
||||
struct Image *ima, struct ImageUser *iuser, int textarget, bool is_data, double time, int mipmap);
|
||||
struct Image *ima, struct ImageUser *iuser, int textarget, bool is_data, double time);
|
||||
GPUTexture *GPU_texture_from_preview(struct PreviewImage *prv, int mipmap);
|
||||
|
||||
void GPU_texture_update(GPUTexture *tex, const float *pixels);
|
||||
|
|
|
@ -288,8 +288,7 @@ GPUTexture *GPU_texture_from_blender(Image *ima,
|
|||
ImageUser *iuser,
|
||||
int textarget,
|
||||
bool is_data,
|
||||
double UNUSED(time),
|
||||
int mipmap)
|
||||
double UNUSED(time))
|
||||
{
|
||||
if (ima == NULL) {
|
||||
return NULL;
|
||||
|
@ -361,6 +360,8 @@ GPUTexture *GPU_texture_from_blender(Image *ima,
|
|||
}
|
||||
}
|
||||
|
||||
const bool mipmap = GPU_get_mipmap();
|
||||
|
||||
#ifdef WITH_DDS
|
||||
if (ibuf->ftype == IMB_FTYPE_DDS)
|
||||
GPU_create_gl_tex_compressed(&bindcode, rect, rectw, recth, textarget, mipmap, ima, ibuf);
|
||||
|
|
Loading…
Reference in New Issue