Commit: bba3b4311249203e13504e480d92bec9e8a3e96b
Author: Clément Foucault
Date:   Wed Mar 14 03:20:39 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBbba3b4311249203e13504e480d92bec9e8a3e96b

GPUTexture: Save sample count inside texture struct.

This adds a quick way to know if a texture is a multisample texture and its 
sample count.

===================================================================

M       source/blender/gpu/GPU_texture.h
M       source/blender/gpu/intern/gpu_texture.c

===================================================================

diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h
index 1b64d66469b..486af0a8a74 100644
--- a/source/blender/gpu/GPU_texture.h
+++ b/source/blender/gpu/GPU_texture.h
@@ -197,6 +197,7 @@ int GPU_texture_target(const GPUTexture *tex);
 int GPU_texture_width(const GPUTexture *tex);
 int GPU_texture_height(const GPUTexture *tex);
 int GPU_texture_format(const GPUTexture *tex);
+int GPU_texture_samples(const GPUTexture *tex);
 bool GPU_texture_depth(const GPUTexture *tex);
 bool GPU_texture_stencil(const GPUTexture *tex);
 int GPU_texture_opengl_bindcode(const GPUTexture *tex);
diff --git a/source/blender/gpu/intern/gpu_texture.c 
b/source/blender/gpu/intern/gpu_texture.c
index d6b641af225..651cbda00e8 100644
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@ -67,6 +67,7 @@ struct GPUTexture {
        unsigned int bytesize; /* number of byte for one pixel */
        int format;         /* GPUTextureFormat */
        int components;     /* number of color/alpha channels */
+       int samples;        /* number of samples for multisamples textures. 0 
if not multisample target */
 };
 
 /* ------ Memory Management ------- */
@@ -340,6 +341,7 @@ static GPUTexture *GPU_texture_create_nD(
        tex->w = w;
        tex->h = h;
        tex->d = d;
+       tex->samples = samples;
        tex->number = -1;
        tex->refcount = 1;
        tex->fb_attachment = -1;
@@ -483,6 +485,7 @@ static GPUTexture *GPU_texture_cube_create(
        tex->w = w;
        tex->h = w;
        tex->d = d;
+       tex->samples = 0;
        tex->number = -1;
        tex->refcount = 1;
        tex->fb_attachment = -1;
@@ -576,6 +579,7 @@ GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser 
*iuser, int textarget
        tex->fromblender = 1;
        tex->format = -1;
        tex->components = -1;
+       tex->samples = 0;
 
        ima->gputexture[gputt] = tex;
 
@@ -1014,6 +1018,11 @@ int GPU_texture_format(const GPUTexture *tex)
        return tex->format;
 }
 
+int GPU_texture_samples(const GPUTexture *tex)
+{
+       return tex->samples;
+}
+
 bool GPU_texture_depth(const GPUTexture *tex)
 {
        return tex->depth;

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to