summaryrefslogtreecommitdiffstats
path: root/drivers/gles3/effects/copy_effects.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gles3/effects/copy_effects.cpp')
-rw-r--r--drivers/gles3/effects/copy_effects.cpp42
1 files changed, 41 insertions, 1 deletions
diff --git a/drivers/gles3/effects/copy_effects.cpp b/drivers/gles3/effects/copy_effects.cpp
index 996e7eee7f..29e7de873b 100644
--- a/drivers/gles3/effects/copy_effects.cpp
+++ b/drivers/gles3/effects/copy_effects.cpp
@@ -125,6 +125,36 @@ void CopyEffects::copy_to_rect(const Rect2 &p_rect) {
draw_screen_quad();
}
+void CopyEffects::copy_to_rect_3d(const Rect2 &p_rect, float p_layer, int p_type, float p_lod) {
+ ERR_FAIL_COND(p_type != Texture::TYPE_LAYERED && p_type != Texture::TYPE_3D);
+
+ CopyShaderGLES3::ShaderVariant variant = p_type == Texture::TYPE_LAYERED
+ ? CopyShaderGLES3::MODE_COPY_SECTION_2D_ARRAY
+ : CopyShaderGLES3::MODE_COPY_SECTION_3D;
+
+ bool success = copy.shader.version_bind_shader(copy.shader_version, variant);
+ if (!success) {
+ return;
+ }
+
+ copy.shader.version_set_uniform(CopyShaderGLES3::COPY_SECTION, p_rect.position.x, p_rect.position.y, p_rect.size.x, p_rect.size.y, copy.shader_version, variant);
+ copy.shader.version_set_uniform(CopyShaderGLES3::LAYER, p_layer, copy.shader_version, variant);
+ copy.shader.version_set_uniform(CopyShaderGLES3::LOD, p_lod, copy.shader_version, variant);
+ draw_screen_quad();
+}
+
+void CopyEffects::copy_to_and_from_rect(const Rect2 &p_rect) {
+ bool success = copy.shader.version_bind_shader(copy.shader_version, CopyShaderGLES3::MODE_COPY_SECTION_SOURCE);
+ if (!success) {
+ return;
+ }
+
+ copy.shader.version_set_uniform(CopyShaderGLES3::COPY_SECTION, p_rect.position.x, p_rect.position.y, p_rect.size.x, p_rect.size.y, copy.shader_version, CopyShaderGLES3::MODE_COPY_SECTION_SOURCE);
+ copy.shader.version_set_uniform(CopyShaderGLES3::SOURCE_SECTION, p_rect.position.x, p_rect.position.y, p_rect.size.x, p_rect.size.y, copy.shader_version, CopyShaderGLES3::MODE_COPY_SECTION_SOURCE);
+
+ draw_screen_quad();
+}
+
void CopyEffects::copy_screen() {
bool success = copy.shader.version_bind_shader(copy.shader_version, CopyShaderGLES3::MODE_DEFAULT);
if (!success) {
@@ -140,7 +170,17 @@ void CopyEffects::copy_cube_to_rect(const Rect2 &p_rect) {
return;
}
- copy.shader.version_set_uniform(CopyShaderGLES3::COPY_SECTION, p_rect.position.x, p_rect.position.y, p_rect.size.x, p_rect.size.y, copy.shader_version, CopyShaderGLES3::MODE_COPY_SECTION);
+ copy.shader.version_set_uniform(CopyShaderGLES3::COPY_SECTION, p_rect.position.x, p_rect.position.y, p_rect.size.x, p_rect.size.y, copy.shader_version, CopyShaderGLES3::MODE_CUBE_TO_OCTAHEDRAL);
+ draw_screen_quad();
+}
+
+void CopyEffects::copy_cube_to_panorama(float p_mip_level) {
+ bool success = copy.shader.version_bind_shader(copy.shader_version, CopyShaderGLES3::MODE_CUBE_TO_PANORAMA);
+ if (!success) {
+ return;
+ }
+
+ copy.shader.version_set_uniform(CopyShaderGLES3::MIP_LEVEL, p_mip_level, copy.shader_version, CopyShaderGLES3::MODE_CUBE_TO_PANORAMA);
draw_screen_quad();
}