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>2020-11-05 20:00:48 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-11-05 20:00:48 +0300
commitd9dd408b42c8b0c98e85290dc353672780212464 (patch)
tree9bf6309d403c23d72e643e5aa0060d2a741a542c
parent8819a4dce8d55c9237f7d68575f59baf7d59bb11 (diff)
parentc3e832144b0d22e3da883330212247808a9db2cf (diff)
Merge branch 'blender-v2.91-release' into master
-rw-r--r--source/blender/draw/engines/eevee/eevee_motion_blur.c2
-rw-r--r--source/blender/draw/engines/eevee/shaders/effect_velocity_resolve_frag.glsl15
-rw-r--r--source/blender/gpu/intern/gpu_framebuffer_private.hh6
-rw-r--r--source/blender/gpu/intern/gpu_immediate_private.hh2
-rw-r--r--source/blender/gpu/opengl/gl_state.cc7
5 files changed, 21 insertions, 11 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_motion_blur.c b/source/blender/draw/engines/eevee/eevee_motion_blur.c
index f60c2661cb0..fe3705f1fbb 100644
--- a/source/blender/draw/engines/eevee/eevee_motion_blur.c
+++ b/source/blender/draw/engines/eevee/eevee_motion_blur.c
@@ -490,7 +490,7 @@ void EEVEE_motion_blur_swap_data(EEVEE_Data *vedata)
BLI_assert((effects->enabled_effects & EFFECT_MOTION_BLUR) != 0);
/* Camera Data. */
- effects->motion_blur.camera[MB_PREV] = effects->motion_blur.camera[MB_CURR];
+ effects->motion_blur.camera[MB_PREV] = effects->motion_blur.camera[MB_NEXT];
/* Object Data. */
for (BLI_ghashIterator_init(&ghi, effects->motion_blur.object);
diff --git a/source/blender/draw/engines/eevee/shaders/effect_velocity_resolve_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_velocity_resolve_frag.glsl
index 145939cefb2..9182171bab4 100644
--- a/source/blender/draw/engines/eevee/shaders/effect_velocity_resolve_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/effect_velocity_resolve_frag.glsl
@@ -13,16 +13,19 @@ void main()
{
/* Extract pixel motion vector from camera movement. */
ivec2 texel = ivec2(gl_FragCoord.xy);
- vec2 uv = gl_FragCoord.xy / vec2(textureSize(depthBuffer, 0).xy);
+ vec2 uv_curr = gl_FragCoord.xy / vec2(textureSize(depthBuffer, 0).xy);
float depth = texelFetch(depthBuffer, texel, 0).r;
- vec3 world_position = project_point(currViewProjMatrixInv, vec3(uv, depth) * 2.0 - 1.0);
- vec2 uv_prev = project_point(prevViewProjMatrix, world_position).xy * 0.5 + 0.5;
- vec2 uv_next = project_point(nextViewProjMatrix, world_position).xy * 0.5 + 0.5;
+ uv_curr = uv_curr * 2.0 - 1.0;
+ depth = depth * 2.0 - 1.0;
- outData.xy = uv_prev - uv;
- outData.zw = uv_next - uv;
+ vec3 world_position = project_point(currViewProjMatrixInv, vec3(uv_curr, depth));
+ vec2 uv_prev = project_point(prevViewProjMatrix, world_position).xy;
+ vec2 uv_next = project_point(nextViewProjMatrix, world_position).xy;
+
+ outData.xy = uv_prev - uv_curr;
+ outData.zw = uv_next - uv_curr;
/* Encode to unsigned normalized 16bit texture. */
outData = outData * 0.5 + 0.5;
diff --git a/source/blender/gpu/intern/gpu_framebuffer_private.hh b/source/blender/gpu/intern/gpu_framebuffer_private.hh
index 87f0f3823e6..7afa56bfe3d 100644
--- a/source/blender/gpu/intern/gpu_framebuffer_private.hh
+++ b/source/blender/gpu/intern/gpu_framebuffer_private.hh
@@ -100,10 +100,10 @@ class FrameBuffer {
/** Debug name. */
char name_[DEBUG_NAME_LEN];
/** Frame-buffer state. */
- int viewport_[4];
- int scissor_[4];
+ int viewport_[4] = {0};
+ int scissor_[4] = {0};
bool scissor_test_ = false;
- bool dirty_state_;
+ bool dirty_state_ = true;
public:
FrameBuffer(const char *name);
diff --git a/source/blender/gpu/intern/gpu_immediate_private.hh b/source/blender/gpu/intern/gpu_immediate_private.hh
index e6c11120d7e..9fcbe2bdc0b 100644
--- a/source/blender/gpu/intern/gpu_immediate_private.hh
+++ b/source/blender/gpu/intern/gpu_immediate_private.hh
@@ -47,7 +47,7 @@ class Immediate {
/** Current draw call specification. */
GPUPrimType prim_type = GPU_PRIM_NONE;
- GPUVertFormat vertex_format;
+ GPUVertFormat vertex_format = {};
GPUShader *shader = NULL;
/** Enforce strict vertex count (disabled when using immBeginAtMost). */
bool strict_vertex_len = true;
diff --git a/source/blender/gpu/opengl/gl_state.cc b/source/blender/gpu/opengl/gl_state.cc
index 3a474da8b8e..5483f889a8a 100644
--- a/source/blender/gpu/opengl/gl_state.cc
+++ b/source/blender/gpu/opengl/gl_state.cc
@@ -437,6 +437,13 @@ void GLStateManager::set_blend(const eGPUBlend value)
}
}
+ if (value == GPU_BLEND_SUBTRACT) {
+ glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
+ }
+ else {
+ glBlendEquation(GL_FUNC_ADD);
+ }
+
/* Always set the blend function. This avoid a rendering error when blending is disabled but
* GPU_BLEND_CUSTOM was used just before and the frame-buffer is using more than 1 color target.
*/