Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-01-16 17:10:19 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-01-16 18:16:42 +0300
commita8a89db9c8217a21cc8463fe6e113709bc79be67 (patch)
tree3e7fac626cff4d23d7670cea5d955a7974ee2e83 /source/blender/gpu
parent0a378b8ebce46acfec405ca1403b126989e124ef (diff)
Preferences: always do GPU accelerated mipmapping, remove preference.
This setting was added long ago to be cautious in case some GPUs did not support this propertly, no reason to have it anymore.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/GPU_draw.h3
-rw-r--r--source/blender/gpu/intern/gpu_draw.c79
2 files changed, 4 insertions, 78 deletions
diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h
index 008f4199b02..4b94b79022b 100644
--- a/source/blender/gpu/GPU_draw.h
+++ b/source/blender/gpu/GPU_draw.h
@@ -80,9 +80,6 @@ void GPU_paint_set_mipmap(struct Main *bmain, bool mipmap);
void GPU_set_anisotropic(struct Main *bmain, float value);
float GPU_get_anisotropic(void);
-/* enable gpu mipmapping */
-void GPU_set_gpu_mipmapping(struct Main *bmain, int gpu_mipmap);
-
/* Image updates and free
* - these deal with images bound as opengl textures */
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 6f939261729..cf9cbc8ca89 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -125,23 +125,10 @@ static struct GPUTextureState {
bool texpaint;
float anisotropic;
- int gpu_mipmap;
-} GTS = {1, 0, 0, 1.0f, 0};
+} GTS = {1, 0, 0, 1.0f};
/* Mipmap settings */
-void GPU_set_gpu_mipmapping(Main *bmain, int gpu_mipmap)
-{
- int old_value = GTS.gpu_mipmap;
-
- /* only actually enable if it's supported */
- GTS.gpu_mipmap = gpu_mipmap;
-
- if (old_value != GTS.gpu_mipmap) {
- GPU_free_images(bmain);
- }
-}
-
void GPU_set_mipmap(Main *bmain, bool mipmap)
{
if (GTS.domipmap != mipmap) {
@@ -479,31 +466,7 @@ void GPU_create_gl_tex(
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
if (GPU_get_mipmap() && mipmap) {
- if (GTS.gpu_mipmap) {
- glGenerateMipmap(GL_TEXTURE_2D);
- }
- else {
- int i;
- if (!ibuf) {
- if (use_high_bit_depth) {
- ibuf = IMB_allocFromBuffer(NULL, frect, tpx, tpy);
- }
- else {
- ibuf = IMB_allocFromBuffer(rect, NULL, tpx, tpy);
- }
- }
- IMB_makemipmap(ibuf, true);
-
- for (i = 1; i < ibuf->miptot; i++) {
- ImBuf *mip = ibuf->mipmap[i - 1];
- if (use_high_bit_depth) {
- glTexImage2D(GL_TEXTURE_2D, i, GL_RGBA16F, mip->x, mip->y, 0, GL_RGBA, GL_FLOAT, mip->rect_float);
- }
- else {
- glTexImage2D(GL_TEXTURE_2D, i, GL_RGBA8, mip->x, mip->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, mip->rect);
- }
- }
- }
+ glGenerateMipmap(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter(0));
if (ima)
ima->tpageflag |= IMA_MIPMAP_COMPLETE;
@@ -527,38 +490,7 @@ void GPU_create_gl_tex(
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
if (GPU_get_mipmap() && mipmap) {
- if (GTS.gpu_mipmap) {
- glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
- }
- else {
- if (!ibuf) {
- if (use_high_bit_depth) {
- ibuf = IMB_allocFromBuffer(NULL, frect, tpx, tpy);
- }
- else {
- ibuf = IMB_allocFromBuffer(rect, NULL, tpx, tpy);
- }
- }
-
- IMB_makemipmap(ibuf, true);
-
- for (int i = 1; i < ibuf->miptot; i++) {
- ImBuf *mip = ibuf->mipmap[i - 1];
- void **mip_cube_map = gpu_gen_cube_map(
- mip->rect, mip->rect_float,
- mip->x, mip->y, use_high_bit_depth);
- int mipw = mip->x / 3, miph = mip->y / 2;
-
- if (mip_cube_map) {
- for (int j = 0; j < 6; j++) {
- glTexImage2D(
- GL_TEXTURE_CUBE_MAP_POSITIVE_X + j, i,
- informat, mipw, miph, 0, GL_RGBA, type, mip_cube_map[j]);
- }
- }
- gpu_del_cube_map(mip_cube_map);
- }
- }
+ glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter(0));
if (ima)
@@ -799,8 +731,7 @@ void GPU_paint_update_image(Image *ima, ImageUser *iuser, int x, int y, int w, i
{
ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, NULL);
- if ((!GTS.gpu_mipmap && GPU_get_mipmap()) ||
- (ima->gputexture[TEXTARGET_TEXTURE_2D] == NULL) ||
+ if ((ima->gputexture[TEXTARGET_TEXTURE_2D] == NULL) ||
(ibuf == NULL) ||
(w == 0) || (h == 0))
{
@@ -829,8 +760,6 @@ void GPU_paint_update_image(Image *ima, ImageUser *iuser, int x, int y, int w, i
MEM_freeN(buffer);
- /* we have already accounted for the case where GTS.gpu_mipmap is false
- * so we will be using GPU mipmap generation here */
if (GPU_get_mipmap()) {
glGenerateMipmap(GL_TEXTURE_2D);
}