[Bf-blender-cvs] [77fd1a6a4b5] temp-eeveelightcache: Merge remote-tracking branch 'origin/blender2.8' into temp-eeveelightcache

Clément Foucault noreply at git.blender.org
Fri Jun 22 17:46:48 CEST 2018


Commit: 77fd1a6a4b504bb43d7fb7bc558b0321c3997de7
Author: Clément Foucault
Date:   Fri Jun 22 17:41:15 2018 +0200
Branches: temp-eeveelightcache
https://developer.blender.org/rB77fd1a6a4b504bb43d7fb7bc558b0321c3997de7

Merge remote-tracking branch 'origin/blender2.8' into temp-eeveelightcache

# Conflicts:
#	source/blender/gpu/intern/gpu_texture.c

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



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

diff --cc source/blender/gpu/GPU_texture.h
index 3c93d275892,07880df9dc0..66dfcb80379
--- a/source/blender/gpu/GPU_texture.h
+++ b/source/blender/gpu/GPU_texture.h
@@@ -166,10 -179,11 +179,13 @@@ GPUTexture *GPU_texture_from_blender
          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);
+ void GPU_texture_update(GPUTexture *tex, const void *pixels);
+ void GPU_texture_update_sub(
+         GPUTexture *tex, const void *pixels,
+         int offset_x, int offset_y, int offset_z, int width, int height, int depth);
  
 +void *GPU_texture_read(GPUTexture *tex, int miplvl);
 +
  void GPU_invalid_tex_init(void);
  void GPU_invalid_tex_bind(int mode);
  void GPU_invalid_tex_free(void);
diff --cc source/blender/gpu/intern/gpu_texture.c
index dfa9e2365ec,6fa2a39bf03..89d102a7c31
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@@ -913,26 -933,11 +933,31 @@@ void GPU_texture_update_sub
  	glBindTexture(tex->target, 0);
  }
  
 +void *GPU_texture_read(GPUTexture *tex, int miplvl)
 +{
 +	glBindTexture(tex->target, tex->bindcode);
 +
 +	size_t buf_size = gpu_texture_memory_footprint_compute(tex);
 +	/* We want floats (or ints) */
 +	buf_size = tex->components * sizeof(float) * (buf_size / tex->bytesize);
 +	void *buf = MEM_mallocN(buf_size, "GPU_texture_read");
 +
 +	GLenum format, data_format;
 +	gpu_texture_get_format(tex->components, tex->format, &format, &data_format,
 +	                       &tex->format_flag, &tex->bytesize);
 +
 +	glGetTexImage(tex->target, miplvl, format, data_format, buf);
 +
 +	glBindTexture(tex->target, 0);
 +
 +	return buf;
 +}
 +
+ void GPU_texture_update(GPUTexture *tex, const void *pixels)
+ {
+ 	GPU_texture_update_sub(tex, pixels, 0, 0, 0, tex->w, tex->h, tex->d);
+ }
+ 
  void GPU_invalid_tex_init(void)
  {
  	memory_usage = 0;



More information about the Bf-blender-cvs mailing list