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:
Diffstat (limited to 'source/blender/draw/engines/eevee_next')
-rw-r--r--source/blender/draw/engines/eevee_next/eevee_camera.cc6
-rw-r--r--source/blender/draw/engines/eevee_next/eevee_camera.hh2
-rw-r--r--source/blender/draw/engines/eevee_next/eevee_defines.hh2
-rw-r--r--source/blender/draw/engines/eevee_next/eevee_pipeline.cc6
-rw-r--r--source/blender/draw/engines/eevee_next/eevee_shader_shared.hh2
-rw-r--r--source/blender/draw/engines/eevee_next/shaders/eevee_nodetree_lib.glsl2
-rw-r--r--source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh9
7 files changed, 23 insertions, 6 deletions
diff --git a/source/blender/draw/engines/eevee_next/eevee_camera.cc b/source/blender/draw/engines/eevee_next/eevee_camera.cc
index b9040f0f3ab..ad22219f0ae 100644
--- a/source/blender/draw/engines/eevee_next/eevee_camera.cc
+++ b/source/blender/draw/engines/eevee_next/eevee_camera.cc
@@ -85,7 +85,9 @@ void Camera::sync()
DRW_view_winmat_get(inst_.drw_view, data.wininv.ptr(), true);
DRW_view_persmat_get(inst_.drw_view, data.persmat.ptr(), false);
DRW_view_persmat_get(inst_.drw_view, data.persinv.ptr(), true);
- DRW_view_camtexco_get(inst_.drw_view, data.uv_scale);
+ /* TODO(fclem): Derive from rv3d instead. */
+ data.uv_scale = float2(1.0f);
+ data.uv_bias = float2(0.0f);
}
else if (inst_.render) {
/* TODO(@fclem): Over-scan. */
@@ -106,6 +108,8 @@ void Camera::sync()
data.wininv = data.winmat.inverted();
data.persmat = data.winmat * data.viewmat;
data.persinv = data.persmat.inverted();
+ data.uv_scale = float2(1.0f);
+ data.uv_bias = float2(0.0f);
}
if (camera_eval) {
diff --git a/source/blender/draw/engines/eevee_next/eevee_camera.hh b/source/blender/draw/engines/eevee_next/eevee_camera.hh
index 49f9b14e11b..aaef0f5898d 100644
--- a/source/blender/draw/engines/eevee_next/eevee_camera.hh
+++ b/source/blender/draw/engines/eevee_next/eevee_camera.hh
@@ -99,7 +99,7 @@ class Camera {
BLI_assert(data_.initialized);
return data_;
}
- const GPUUniformBuf *ubo_get() const
+ GPUUniformBuf *ubo_get() const
{
return data_;
}
diff --git a/source/blender/draw/engines/eevee_next/eevee_defines.hh b/source/blender/draw/engines/eevee_next/eevee_defines.hh
index 248dfae6df9..fca8737f661 100644
--- a/source/blender/draw/engines/eevee_next/eevee_defines.hh
+++ b/source/blender/draw/engines/eevee_next/eevee_defines.hh
@@ -90,6 +90,8 @@
#define VELOCITY_CAMERA_CURR_BUF 4
#define VELOCITY_CAMERA_NEXT_BUF 5
+#define CAMERA_BUF_SLOT 6
+
/* Storage Buffers. */
#define LIGHT_CULL_BUF_SLOT 0
#define LIGHT_BUF_SLOT 1
diff --git a/source/blender/draw/engines/eevee_next/eevee_pipeline.cc b/source/blender/draw/engines/eevee_next/eevee_pipeline.cc
index cc5a4d56231..e6b37b4ad47 100644
--- a/source/blender/draw/engines/eevee_next/eevee_pipeline.cc
+++ b/source/blender/draw/engines/eevee_next/eevee_pipeline.cc
@@ -79,6 +79,8 @@ void ForwardPipeline::sync()
/* Textures. */
prepass_ps_.bind_texture(RBUFS_UTILITY_TEX_SLOT, inst_.pipelines.utility_tx);
+ /* Uniform Buf. */
+ prepass_ps_.bind_ubo(CAMERA_BUF_SLOT, inst_.camera.ubo_get());
inst_.velocity.bind_resources(&prepass_ps_);
inst_.sampling.bind_resources(&prepass_ps_);
@@ -117,6 +119,8 @@ void ForwardPipeline::sync()
opaque_ps_.bind_ssbo(RBUFS_AOV_BUF_SLOT, &inst_.film.aovs_info);
/* Textures. */
opaque_ps_.bind_texture(RBUFS_UTILITY_TEX_SLOT, inst_.pipelines.utility_tx);
+ /* Uniform Buf. */
+ opaque_ps_.bind_ubo(CAMERA_BUF_SLOT, inst_.camera.ubo_get());
inst_.lights.bind_resources(&opaque_ps_);
inst_.sampling.bind_resources(&opaque_ps_);
@@ -140,6 +144,8 @@ void ForwardPipeline::sync()
/* Textures. */
sub.bind_texture(RBUFS_UTILITY_TEX_SLOT, inst_.pipelines.utility_tx);
+ /* Uniform Buf. */
+ opaque_ps_.bind_ubo(CAMERA_BUF_SLOT, inst_.camera.ubo_get());
inst_.lights.bind_resources(&sub);
inst_.sampling.bind_resources(&sub);
diff --git a/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh b/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh
index 8e96445d6b9..fd06cdc7f23 100644
--- a/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh
+++ b/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh
@@ -163,7 +163,7 @@ struct CameraData {
float4x4 viewinv;
float4x4 winmat;
float4x4 wininv;
- /** Camera UV scale and bias. Also known as `viewcamtexcofac`. */
+ /** Camera UV scale and bias. */
float2 uv_scale;
float2 uv_bias;
/** Panorama parameters. */
diff --git a/source/blender/draw/engines/eevee_next/shaders/eevee_nodetree_lib.glsl b/source/blender/draw/engines/eevee_next/shaders/eevee_nodetree_lib.glsl
index 9422cb726b7..4b53375575c 100644
--- a/source/blender/draw/engines/eevee_next/shaders/eevee_nodetree_lib.glsl
+++ b/source/blender/draw/engines/eevee_next/shaders/eevee_nodetree_lib.glsl
@@ -345,7 +345,7 @@ vec3 coordinate_screen(vec3 P)
else {
/* TODO(fclem): Actual camera transform. */
window.xy = project_point(ProjectionMatrix, transform_point(ViewMatrix, P)).xy * 0.5 + 0.5;
- window.xy = window.xy * CameraTexCoFactors.xy + CameraTexCoFactors.zw;
+ window.xy = window.xy * camera_buf.uv_scale + camera_buf.uv_bias;
}
return window;
}
diff --git a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh
index 78d52d4b90e..b632564a9ca 100644
--- a/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh
+++ b/source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh
@@ -20,6 +20,8 @@ GPU_SHADER_CREATE_INFO(eevee_sampling_data)
GPU_SHADER_CREATE_INFO(eevee_utility_texture)
.sampler(RBUFS_UTILITY_TEX_SLOT, ImageType::FLOAT_2D_ARRAY, "utility_tx");
+GPU_SHADER_CREATE_INFO(eevee_camera).uniform_buf(CAMERA_BUF_SLOT, "CameraData", "camera_buf");
+
/** \} */
/* -------------------------------------------------------------------- */
@@ -114,7 +116,8 @@ GPU_SHADER_CREATE_INFO(eevee_surf_deferred)
// .image_out(6, Qualifier::READ_WRITE, GPU_RGBA16F, "rpass_volume_light")
/* TODO: AOVs maybe? */
.fragment_source("eevee_surf_deferred_frag.glsl")
- // .additional_info("eevee_aov_out", "eevee_sampling_data", "eevee_utility_texture")
+ // .additional_info("eevee_aov_out", "eevee_sampling_data", "eevee_camera",
+ // "eevee_utility_texture")
;
GPU_SHADER_CREATE_INFO(eevee_surf_forward)
@@ -127,6 +130,7 @@ GPU_SHADER_CREATE_INFO(eevee_surf_forward)
.fragment_source("eevee_surf_forward_frag.glsl")
.additional_info("eevee_cryptomatte_out",
"eevee_light_data",
+ "eevee_camera",
"eevee_utility_texture",
"eevee_sampling_data"
// "eevee_lightprobe_data",
@@ -141,7 +145,7 @@ GPU_SHADER_CREATE_INFO(eevee_surf_forward)
GPU_SHADER_CREATE_INFO(eevee_surf_depth)
.vertex_out(eevee_surf_iface)
.fragment_source("eevee_surf_depth_frag.glsl")
- .additional_info("eevee_sampling_data", "eevee_utility_texture");
+ .additional_info("eevee_sampling_data", "eevee_camera", "eevee_utility_texture");
GPU_SHADER_CREATE_INFO(eevee_surf_world)
.vertex_out(eevee_surf_iface)
@@ -151,6 +155,7 @@ GPU_SHADER_CREATE_INFO(eevee_surf_world)
.additional_info("eevee_aov_out",
"eevee_cryptomatte_out",
"eevee_render_pass_out",
+ "eevee_camera",
"eevee_utility_texture");
#undef image_out