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:
authorClément Foucault <foucault.clem@gmail.com>2018-03-14 05:20:39 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-03-14 05:29:10 +0300
commitbba3b4311249203e13504e480d92bec9e8a3e96b (patch)
tree71a2765b6ea5de2eba2a56499ede6107abbdcb84 /source/blender/gpu/intern
parent585208e0e911c985a062dd74b6cc689e4fb63ef8 (diff)
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.
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r--source/blender/gpu/intern/gpu_texture.c9
1 files changed, 9 insertions, 0 deletions
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;