Implemented AMD's FSR as a computer shader for upscaling 3D scenes
This commit is contained in:
parent
5efe80f308
commit
20deb0917d
|
@ -120,6 +120,11 @@ Copyright: 2007, Starbreeze Studios
|
|||
2014-2021, Godot Engine contributors.
|
||||
License: Expat and Zlib
|
||||
|
||||
Files: ./thirdparty/amd-fsr/
|
||||
Comment: AMD FidelityFX Super Resolution
|
||||
Copyright: 2021, Advanced Micro Devices, Inc.
|
||||
License: Expat
|
||||
|
||||
Files: ./thirdparty/basis_universal/
|
||||
Comment: Basis Universal
|
||||
Copyright: 2019, Binomial LLC.
|
||||
|
|
|
@ -1506,12 +1506,8 @@
|
|||
</member>
|
||||
<member name="rendering/2d/snap/snap_2d_vertices_to_pixel" type="bool" setter="" getter="" default="false">
|
||||
</member>
|
||||
<member name="rendering/3d/viewport/scale" type="float" setter="" getter="" default="1.0">
|
||||
Scales the 3D render buffer based on the viewport size and displays the result with linear filtering. Values lower than [code]1.0[/code] can be used to speed up 3D rendering at the cost of quality (undersampling). Values greater than [code]1.0[/code] can be used to improve 3D rendering quality at a high performance cost (supersampling). See also [member rendering/anti_aliasing/quality/msaa] for multi-sample antialiasing, which is significantly cheaper but only smoothens the edges of polygons.
|
||||
[b]Note:[/b] This property is only read when the project starts. To change the 3D rendering resolution scale at runtime, set [member Viewport.scale_3d] instead.
|
||||
</member>
|
||||
<member name="rendering/anti_aliasing/quality/msaa" type="int" setter="" getter="" default="0">
|
||||
Sets the number of MSAA samples to use (as a power of two). MSAA is used to reduce aliasing around the edges of polygons. A higher MSAA value results in smoother edges but can be significantly slower on some hardware. See also [member rendering/3d/viewport/scale] for supersampling, which provides higher quality but is much more expensive.
|
||||
Sets the number of MSAA samples to use (as a power of two). MSAA is used to reduce aliasing around the edges of polygons. A higher MSAA value results in smoother edges but can be significantly slower on some hardware. See also bilinear scaling 3d [member rendering/scaling_3d/mode] for supersampling, which provides higher quality but is much more expensive.
|
||||
</member>
|
||||
<member name="rendering/anti_aliasing/quality/screen_space_aa" type="int" setter="" getter="" default="0">
|
||||
Sets the screen-space antialiasing mode for the default screen [Viewport]. Screen-space antialiasing works by selectively blurring edges in a post-process shader. It differs from MSAA which takes multiple coverage samples while rendering objects. Screen-space AA methods are typically faster than MSAA and will smooth out specular aliasing, but tend to make scenes appear blurry.
|
||||
|
@ -1718,6 +1714,18 @@
|
|||
<member name="rendering/reflections/sky_reflections/texture_array_reflections.mobile" type="bool" setter="" getter="" default="false">
|
||||
Lower-end override for [member rendering/reflections/sky_reflections/texture_array_reflections] on mobile devices, due to performance concerns or driver support.
|
||||
</member>
|
||||
<member name="rendering/scaling_3d/fsr_mipmap_bias" type="float" setter="" getter="" default="0.0">
|
||||
Affects the final texture sharpness by reading from a lower or higher mipmap. Negative values make textures sharper, while positive values make textures blurrier. When using FSR, this value is used to adjust the mipmap bias calculated internally which is based on the selected quality. The formula for this is [code]-log2(1.0 / scale) + mipmap_bias[/code]
|
||||
</member>
|
||||
<member name="rendering/scaling_3d/fsr_sharpness" type="float" setter="" getter="" default="0.2">
|
||||
Determines how sharp the upscaled image will be when using the FSR upscaling mode. Sharpness halves with every whole number. Values go from 0.0 (sharpest) to 2.0. Values above 2.0 won't make a visible difference.
|
||||
</member>
|
||||
<member name="rendering/scaling_3d/mode" type="int" setter="" getter="" default="0">
|
||||
Sets the scaling 3D mode. Bilinear scaling renders at different resolution to either undersample or supersample the viewport. FidelityFX Super Resolution 1.0, abbreviated to FSR, is an upscaling technology that produces high quality images at fast framerates by using a spatially aware upscaling algorithm. FSR is slightly more expensive than bilinear, but it produces significantly higher image quality. FSR should be used where possible.
|
||||
</member>
|
||||
<member name="rendering/scaling_3d/scale" type="float" setter="" getter="" default="1.0">
|
||||
Scales the 3D render buffer based on the viewport size uses an image filter specified in [member rendering/scaling_3d/mode] to scale the output image to the full viewport size. Values lower than [code]1.0[/code] can be used to speed up 3D rendering at the cost of quality (undersampling). Values greater than [code]1.0[/code] are only valid for bilinear mode and can be used to improve 3D rendering quality at a high performance cost (supersampling). See also [member rendering/anti_aliasing/quality/msaa] for multi-sample antialiasing, which is significantly cheaper but only smoothens the edges of polygons.
|
||||
</member>
|
||||
<member name="rendering/shader_compiler/shader_cache/compress" type="bool" setter="" getter="" default="true">
|
||||
</member>
|
||||
<member name="rendering/shader_compiler/shader_cache/enabled" type="bool" setter="" getter="" default="true">
|
||||
|
|
|
@ -3100,6 +3100,22 @@
|
|||
If [code]true[/code], rendering of a viewport's environment is disabled.
|
||||
</description>
|
||||
</method>
|
||||
<method name="viewport_set_fsr_mipmap_bias">
|
||||
<return type="void" />
|
||||
<argument index="0" name="viewport" type="RID" />
|
||||
<argument index="1" name="mipmap_bias" type="float" />
|
||||
<description>
|
||||
Affects the final texture sharpness by reading from a lower or higher mipmap. Negative values make textures sharper, while positive values make textures blurrier. When using FSR, this value is used to adjust the mipmap bias calculated internally which is based on the selected quality. The formula for this is [code]-log2(1.0 / scale) + mipmap_bias[/code]
|
||||
</description>
|
||||
</method>
|
||||
<method name="viewport_set_fsr_sharpness">
|
||||
<return type="void" />
|
||||
<argument index="0" name="viewport" type="RID" />
|
||||
<argument index="1" name="sharpness" type="float" />
|
||||
<description>
|
||||
Determines how sharp the upscaled image will be when using the FSR upscaling mode. Sharpness halves with every whole number. Values go from 0.0 (sharpest) to 2.0. Values above 2.0 won't make a visible difference.
|
||||
</description>
|
||||
</method>
|
||||
<method name="viewport_set_global_canvas_transform">
|
||||
<return type="void" />
|
||||
<argument index="0" name="viewport" type="RID" />
|
||||
|
@ -3151,12 +3167,21 @@
|
|||
If [code]true[/code], render the contents of the viewport directly to screen. This allows a low-level optimization where you can skip drawing a viewport to the root viewport. While this optimization can result in a significant increase in speed (especially on older devices), it comes at a cost of usability. When this is enabled, you cannot read from the viewport or from the [code]SCREEN_TEXTURE[/code]. You also lose the benefit of certain window settings, such as the various stretch modes. Another consequence to be aware of is that in 2D the rendering happens in window coordinates, so if you have a viewport that is double the size of the window, and you set this, then only the portion that fits within the window will be drawn, no automatic scaling is possible, even if your game scene is significantly larger than the window size.
|
||||
</description>
|
||||
</method>
|
||||
<method name="viewport_set_scale_3d">
|
||||
<method name="viewport_set_scaling_3d_mode">
|
||||
<return type="void" />
|
||||
<argument index="0" name="viewport" type="RID" />
|
||||
<argument index="1" name="scaling_3d_mode" type="int" enum="RenderingServer.ViewportScaling3DMode" />
|
||||
<description>
|
||||
Sets scaling 3d mode. Bilinear scaling renders at different resolution to either undersample or supersample the viewport. FidelityFX Super Resolution 1.0, abbreviated to FSR, is an upscaling technology that produces high quality images at fast framerates by using a spatially aware upscaling algorithm. FSR is slightly more expensive than bilinear, but it produces significantly higher image quality. FSR should be used where possible.
|
||||
</description>
|
||||
</method>
|
||||
<method name="viewport_set_scaling_3d_scale">
|
||||
<return type="void" />
|
||||
<argument index="0" name="viewport" type="RID" />
|
||||
<argument index="1" name="scale" type="float" />
|
||||
<description>
|
||||
Sets the scale at which we render 3D contents.
|
||||
Scales the 3D render buffer based on the viewport size uses an image filter specified in [enum ViewportScaling3DMode] to scale the output image to the full viewport size. Values lower than [code]1.0[/code] can be used to speed up 3D rendering at the cost of quality (undersampling). Values greater than [code]1.0[/code] are only valid for bilinear mode and can be used to improve 3D rendering quality at a high performance cost (supersampling). See also [enum ViewportMSAA] for multi-sample antialiasing, which is significantly cheaper but only smoothens the edges of polygons.
|
||||
When using FSR upscaling, AMD recommends exposing the following values as preset options to users "Ultra Quality: 0.77", "Quality: 0.67", "Balanced: 0.59", "Performance: 0.5" instead of exposing the entire scale.
|
||||
</description>
|
||||
</method>
|
||||
<method name="viewport_set_scenario">
|
||||
|
@ -3844,6 +3869,14 @@
|
|||
<constant name="FOG_VOLUME_SHAPE_WORLD" value="2" enum="FogVolumeShape">
|
||||
[FogVolume] will have no shape, will cover the whole world and will not be culled.
|
||||
</constant>
|
||||
<constant name="VIEWPORT_SCALING_3D_MODE_BILINEAR" value="0" enum="ViewportScaling3DMode">
|
||||
Enables bilinear scaling on 3D viewports. The amount of scaling can be set using [member Viewport.scaling_3d_scale]. Values less then [code]1.0[/code] will result in undersampling while values greater than [code]1.0[/code] will result in supersampling. A value of [code]1.0[/code] disables scaling.
|
||||
</constant>
|
||||
<constant name="VIEWPORT_SCALING_3D_MODE_FSR" value="1" enum="ViewportScaling3DMode">
|
||||
Enables FSR upscaling on 3D viewports. The amount of scaling can be set using [member Viewport.scaling_3d_scale]. Values less then [code]1.0[/code] will be result in the viewport being upscaled using FSR. Values greater than [code]1.0[/code] are not supported and bilinear supersampling will be used instead. A value of [code]1.0[/code] disables scaling.
|
||||
</constant>
|
||||
<constant name="VIEWPORT_SCALING_3D_MODE_MAX" value="2" enum="ViewportScaling3DMode">
|
||||
</constant>
|
||||
<constant name="VIEWPORT_UPDATE_DISABLED" value="0" enum="ViewportUpdateMode">
|
||||
Do not update the viewport.
|
||||
</constant>
|
||||
|
|
|
@ -194,6 +194,14 @@
|
|||
<member name="disable_3d" type="bool" setter="set_disable_3d" getter="is_3d_disabled" default="false">
|
||||
Disable 3D rendering (but keep 2D rendering).
|
||||
</member>
|
||||
<member name="fsr_mipmap_bias" type="float" setter="set_fsr_mipmap_bias" getter="get_fsr_mipmap_bias" default="0.0">
|
||||
Affects the final texture sharpness by reading from a lower or higher mipmap when using FSR. Mipmap bias does nothing when FSR is not being used. Negative values make textures sharper, while positive values make textures blurrier. This value is used to adjust the mipmap bias calculated internally which is based on the selected quality. The formula for this is [code]-log2(1.0 / scale) + mipmap_bias[/code]. This updates the rendering server's mipmap bias when called
|
||||
To control this property on the root viewport, set the [member ProjectSettings.rendering/scaling_3d/fsr_mipmap_bias] project setting.
|
||||
</member>
|
||||
<member name="fsr_sharpness" type="float" setter="set_fsr_sharpness" getter="get_fsr_sharpness" default="0.2">
|
||||
Determines how sharp the upscaled image will be when using the FSR upscaling mode. Sharpness halves with every whole number. Values go from 0.0 (sharpest) to 2.0. Values above 2.0 won't make a visible difference.
|
||||
To control this property on the root viewport, set the [member ProjectSettings.rendering/scaling_3d/fsr_sharpness] project setting.
|
||||
</member>
|
||||
<member name="global_canvas_transform" type="Transform2D" setter="set_global_canvas_transform" getter="get_global_canvas_transform">
|
||||
The global canvas transform of the viewport. The canvas transform is relative to this.
|
||||
</member>
|
||||
|
@ -210,7 +218,7 @@
|
|||
<member name="lod_threshold" type="float" setter="set_lod_threshold" getter="get_lod_threshold" default="1.0">
|
||||
</member>
|
||||
<member name="msaa" type="int" setter="set_msaa" getter="get_msaa" enum="Viewport.MSAA" default="0">
|
||||
The multisample anti-aliasing mode. A higher number results in smoother edges at the cost of significantly worse performance. A value of 2 or 4 is best unless targeting very high-end systems. See also [member scale_3d] for supersampling, which provides higher quality but is much more expensive.
|
||||
The multisample anti-aliasing mode. A higher number results in smoother edges at the cost of significantly worse performance. A value of 2 or 4 is best unless targeting very high-end systems. See also bilinear scaling 3d [member scaling_3d_mode] for supersampling, which provides higher quality but is much more expensive.
|
||||
</member>
|
||||
<member name="own_world_3d" type="bool" setter="set_use_own_world_3d" getter="is_using_own_world_3d" default="false">
|
||||
If [code]true[/code], the viewport will use the [World3D] defined in [member world_3d].
|
||||
|
@ -218,9 +226,14 @@
|
|||
<member name="physics_object_picking" type="bool" setter="set_physics_object_picking" getter="get_physics_object_picking" default="false">
|
||||
If [code]true[/code], the objects rendered by viewport become subjects of mouse picking process.
|
||||
</member>
|
||||
<member name="scale_3d" type="float" setter="set_scale_3d" getter="get_scale_3d" default="1.0">
|
||||
Scales the 3D render buffer based on the viewport size and displays the result with linear filtering. Values lower than [code]1.0[/code] can be used to speed up 3D rendering at the cost of quality (undersampling). Values greater than [code]1.0[/code] can be used to improve 3D rendering quality at a high performance cost (supersampling). See also [member msaa] for multi-sample antialiasing, which is significantly cheaper but only smoothens the edges of polygons.
|
||||
To control this property on the root viewport, set the [member ProjectSettings.rendering/3d/viewport/scale] project setting.
|
||||
<member name="scaling_3d_mode" type="int" setter="set_scaling_3d_mode" getter="get_scaling_3d_mode" enum="Viewport.Scaling3DMode" default="0">
|
||||
Sets scaling 3d mode. Bilinear scaling renders at different resolution to either undersample or supersample the viewport. FidelityFX Super Resolution 1.0, abbreviated to FSR, is an upscaling technology that produces high quality images at fast framerates by using a spatially aware upscaling algorithm. FSR is slightly more expensive than bilinear, but it produces significantly higher image quality. FSR should be used where possible.
|
||||
To control this property on the root viewport, set the [member ProjectSettings.rendering/scaling_3d/mode] project setting.
|
||||
</member>
|
||||
<member name="scaling_3d_scale" type="float" setter="set_scaling_3d_scale" getter="get_scaling_3d_scale" default="1.0">
|
||||
Scales the 3D render buffer based on the viewport size uses an image filter specified in [member ProjectSettings.rendering/scaling_3d/mode] to scale the output image to the full viewport size. Values lower than [code]1.0[/code] can be used to speed up 3D rendering at the cost of quality (undersampling). Values greater than [code]1.0[/code] are only valid for bilinear mode and can be used to improve 3D rendering quality at a high performance cost (supersampling). See also [member ProjectSettings.rendering/anti_aliasing/quality/msaa] for multi-sample antialiasing, which is significantly cheaper but only smoothens the edges of polygons.
|
||||
When using FSR upscaling, AMD recommends exposing the following values as preset options to users "Ultra Quality: 0.77", "Quality: 0.67", "Balanced: 0.59", "Performance: 0.5" instead of exposing the entire scale.
|
||||
To control this property on the root viewport, set the [member ProjectSettings.rendering/scaling_3d/scale] project setting.
|
||||
</member>
|
||||
<member name="screen_space_aa" type="int" setter="set_screen_space_aa" getter="get_screen_space_aa" enum="Viewport.ScreenSpaceAA" default="0">
|
||||
Sets the screen-space antialiasing method used. Screen-space antialiasing works by selectively blurring edges in a post-process shader. It differs from MSAA which takes multiple coverage samples while rendering objects. Screen-space AA methods are typically faster than MSAA and will smooth out specular aliasing, but tend to make scenes appear blurry.
|
||||
|
@ -306,6 +319,15 @@
|
|||
<constant name="SHADOW_ATLAS_QUADRANT_SUBDIV_MAX" value="7" enum="ShadowAtlasQuadrantSubdiv">
|
||||
Represents the size of the [enum ShadowAtlasQuadrantSubdiv] enum.
|
||||
</constant>
|
||||
<constant name="SCALING_3D_MODE_BILINEAR" value="0" enum="Scaling3DMode">
|
||||
Enables bilinear scaling on 3D viewports. The amount of scaling can be set using [member scaling_3d_scale]. Values less then [code]1.0[/code] will result in undersampling while values greater than [code]1.0[/code] will result in supersampling. A value of [code]1.0[/code] disables scaling.
|
||||
</constant>
|
||||
<constant name="SCALING_3D_MODE_FSR" value="1" enum="Scaling3DMode">
|
||||
Enables FSR upscaling on 3D viewports. The amount of scaling can be set using [member scaling_3d_scale]. Values less then [code]1.0[/code] will be result in the viewport being upscaled using FSR. Values greater than [code]1.0[/code] are not supported and bilinear supersampling will be used instead. A value of [code]1.0[/code] disables scaling.
|
||||
</constant>
|
||||
<constant name="SCALING_3D_MODE_MAX" value="2" enum="Scaling3DMode">
|
||||
Represents the size of the [enum Scaling3DMode] enum.
|
||||
</constant>
|
||||
<constant name="MSAA_DISABLED" value="0" enum="MSAA">
|
||||
Multisample antialiasing mode disabled. This is the default value, and is also the fastest setting.
|
||||
</constant>
|
||||
|
|
|
@ -421,7 +421,7 @@ RID RasterizerSceneGLES3::render_buffers_create() {
|
|||
return RID();
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES3::render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count) {
|
||||
void RasterizerSceneGLES3::render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_internal_width, int p_internal_height, int p_width, int p_height, float p_fsr_sharpness, float p_fsr_mipmap_bias, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count) {
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES3::gi_set_use_half_resolution(bool p_enable) {
|
||||
|
|
|
@ -203,7 +203,7 @@ public:
|
|||
void set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw) override;
|
||||
|
||||
RID render_buffers_create() override;
|
||||
void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count) override;
|
||||
void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_internal_width, int p_internal_height, int p_width, int p_height, float p_fsr_sharpness, float p_fsr_mipmap_bias, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count) override;
|
||||
void gi_set_use_half_resolution(bool p_enable) override;
|
||||
|
||||
void screen_space_roughness_limiter_set_active(bool p_enable, float p_amount, float p_curve) override;
|
||||
|
|
|
@ -8822,6 +8822,7 @@ void RenderingDeviceVulkan::initialize(VulkanContext *p_context, bool p_local_de
|
|||
// get info about further features
|
||||
VulkanContext::MultiviewCapabilities multiview_capabilies = p_context->get_multiview_capabilities();
|
||||
device_capabilities.supports_multiview = multiview_capabilies.is_supported && multiview_capabilies.max_view_count > 1;
|
||||
device_capabilities.supports_fsr_half_float = p_context->get_shader_capabilities().shader_float16_is_supported && p_context->get_storage_buffer_capabilities().storage_buffer_16_bit_access_is_supported;
|
||||
}
|
||||
|
||||
context = p_context;
|
||||
|
|
|
@ -535,6 +535,24 @@ Error VulkanContext::_check_capabilities() {
|
|||
multiview_capabilities.is_supported = multiview_features.multiview;
|
||||
multiview_capabilities.geometry_shader_is_supported = multiview_features.multiviewGeometryShader;
|
||||
multiview_capabilities.tessellation_shader_is_supported = multiview_features.multiviewTessellationShader;
|
||||
|
||||
VkPhysicalDeviceShaderFloat16Int8FeaturesKHR shader_features;
|
||||
shader_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES_KHR;
|
||||
shader_features.pNext = NULL;
|
||||
|
||||
device_features.pNext = &shader_features;
|
||||
|
||||
device_features_func(gpu, &device_features);
|
||||
shader_capabilities.shader_float16_is_supported = shader_features.shaderFloat16;
|
||||
|
||||
VkPhysicalDevice16BitStorageFeaturesKHR storage_feature;
|
||||
storage_feature.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR;
|
||||
storage_feature.pNext = NULL;
|
||||
|
||||
device_features.pNext = &storage_feature;
|
||||
|
||||
device_features_func(gpu, &device_features);
|
||||
storage_buffer_capabilities.storage_buffer_16_bit_access_is_supported = storage_feature.storageBuffer16BitAccess;
|
||||
}
|
||||
|
||||
// check extended properties
|
||||
|
|
|
@ -66,6 +66,14 @@ public:
|
|||
uint32_t max_instance_count;
|
||||
};
|
||||
|
||||
struct ShaderCapabilities {
|
||||
bool shader_float16_is_supported;
|
||||
};
|
||||
|
||||
struct StorageBufferCapabilities {
|
||||
bool storage_buffer_16_bit_access_is_supported;
|
||||
};
|
||||
|
||||
private:
|
||||
enum {
|
||||
MAX_EXTENSIONS = 128,
|
||||
|
@ -88,6 +96,8 @@ private:
|
|||
uint32_t vulkan_patch = 0;
|
||||
SubgroupCapabilities subgroup_capabilities;
|
||||
MultiviewCapabilities multiview_capabilities;
|
||||
ShaderCapabilities shader_capabilities;
|
||||
StorageBufferCapabilities storage_buffer_capabilities;
|
||||
|
||||
String device_vendor;
|
||||
String device_name;
|
||||
|
@ -239,6 +249,8 @@ public:
|
|||
uint32_t get_vulkan_minor() const { return vulkan_minor; };
|
||||
SubgroupCapabilities get_subgroup_capabilities() const { return subgroup_capabilities; };
|
||||
MultiviewCapabilities get_multiview_capabilities() const { return multiview_capabilities; };
|
||||
ShaderCapabilities get_shader_capabilities() const { return shader_capabilities; };
|
||||
StorageBufferCapabilities get_storage_buffer_capabilities() const { return storage_buffer_capabilities; };
|
||||
|
||||
VkDevice get_device();
|
||||
VkPhysicalDevice get_physical_device();
|
||||
|
|
|
@ -29,6 +29,10 @@ def include_file_in_rd_header(filename, header_data, depth):
|
|||
|
||||
while line:
|
||||
|
||||
index = line.find("//")
|
||||
if index != -1:
|
||||
line = line[:index]
|
||||
|
||||
if line.find("#[vertex]") != -1:
|
||||
header_data.reading = "vertex"
|
||||
line = fs.readline()
|
||||
|
@ -55,7 +59,14 @@ def include_file_in_rd_header(filename, header_data, depth):
|
|||
|
||||
import os.path
|
||||
|
||||
included_file = os.path.relpath(os.path.dirname(filename) + "/" + includeline)
|
||||
included_file = ""
|
||||
|
||||
if includeline.startswith("thirdparty/"):
|
||||
included_file = os.path.relpath(includeline)
|
||||
|
||||
else:
|
||||
included_file = os.path.relpath(os.path.dirname(filename) + "/" + includeline)
|
||||
|
||||
if not included_file in header_data.vertex_included_files and header_data.reading == "vertex":
|
||||
header_data.vertex_included_files += [included_file]
|
||||
if include_file_in_rd_header(included_file, header_data, depth + 1) is None:
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include "scene/resources/world_2d.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
#include "servers/audio_server.h"
|
||||
#include "servers/rendering/rendering_server_globals.h"
|
||||
|
||||
void ViewportTexture::setup_local_to_scene() {
|
||||
Node *local_scene = get_local_scene();
|
||||
|
@ -3473,17 +3474,60 @@ bool Viewport::is_using_xr() {
|
|||
return use_xr;
|
||||
}
|
||||
|
||||
void Viewport::set_scale_3d(float p_scale_3d) {
|
||||
void Viewport::set_scaling_3d_mode(Scaling3DMode p_scaling_3d_mode) {
|
||||
if (scaling_3d_mode == p_scaling_3d_mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
scaling_3d_mode = p_scaling_3d_mode;
|
||||
RS::get_singleton()->viewport_set_scaling_3d_mode(viewport, (RS::ViewportScaling3DMode)(int)p_scaling_3d_mode);
|
||||
}
|
||||
|
||||
Viewport::Scaling3DMode Viewport::get_scaling_3d_mode() const {
|
||||
return scaling_3d_mode;
|
||||
}
|
||||
|
||||
void Viewport::set_scaling_3d_scale(float p_scaling_3d_scale) {
|
||||
// Clamp to reasonable values that are actually useful.
|
||||
// Values above 2.0 don't serve a practical purpose since the viewport
|
||||
// isn't displayed with mipmaps.
|
||||
scale_3d = CLAMP(p_scale_3d, 0.1, 2.0);
|
||||
scaling_3d_scale = CLAMP(p_scaling_3d_scale, 0.1, 2.0);
|
||||
|
||||
RS::get_singleton()->viewport_set_scale_3d(viewport, scale_3d);
|
||||
RS::get_singleton()->viewport_set_scaling_3d_scale(viewport, scaling_3d_scale);
|
||||
}
|
||||
|
||||
float Viewport::get_scale_3d() const {
|
||||
return scale_3d;
|
||||
float Viewport::get_scaling_3d_scale() const {
|
||||
return scaling_3d_scale;
|
||||
}
|
||||
|
||||
void Viewport::set_fsr_sharpness(float p_fsr_sharpness) {
|
||||
if (fsr_sharpness == p_fsr_sharpness) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (p_fsr_sharpness < 0.0f) {
|
||||
p_fsr_sharpness = 0.0f;
|
||||
}
|
||||
|
||||
fsr_sharpness = p_fsr_sharpness;
|
||||
RS::get_singleton()->viewport_set_fsr_sharpness(viewport, p_fsr_sharpness);
|
||||
}
|
||||
|
||||
float Viewport::get_fsr_sharpness() const {
|
||||
return fsr_sharpness;
|
||||
}
|
||||
|
||||
void Viewport::set_fsr_mipmap_bias(float p_fsr_mipmap_bias) {
|
||||
if (fsr_mipmap_bias == p_fsr_mipmap_bias) {
|
||||
return;
|
||||
}
|
||||
|
||||
fsr_mipmap_bias = p_fsr_mipmap_bias;
|
||||
RS::get_singleton()->viewport_set_fsr_mipmap_bias(viewport, p_fsr_mipmap_bias);
|
||||
}
|
||||
|
||||
float Viewport::get_fsr_mipmap_bias() const {
|
||||
return fsr_mipmap_bias;
|
||||
}
|
||||
|
||||
#endif // _3D_DISABLED
|
||||
|
@ -3611,12 +3655,20 @@ void Viewport::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_use_xr", "use"), &Viewport::set_use_xr);
|
||||
ClassDB::bind_method(D_METHOD("is_using_xr"), &Viewport::is_using_xr);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_scale_3d", "scale"), &Viewport::set_scale_3d);
|
||||
ClassDB::bind_method(D_METHOD("get_scale_3d"), &Viewport::get_scale_3d);
|
||||
ClassDB::bind_method(D_METHOD("set_scaling_3d_mode", "scaling_3d_mode"), &Viewport::set_scaling_3d_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_scaling_3d_mode"), &Viewport::get_scaling_3d_mode);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_scaling_3d_scale", "scale"), &Viewport::set_scaling_3d_scale);
|
||||
ClassDB::bind_method(D_METHOD("get_scaling_3d_scale"), &Viewport::get_scaling_3d_scale);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_fsr_sharpness", "fsr_sharpness"), &Viewport::set_fsr_sharpness);
|
||||
ClassDB::bind_method(D_METHOD("get_fsr_sharpness"), &Viewport::get_fsr_sharpness);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_fsr_mipmap_bias", "fsr_mipmap_bias"), &Viewport::set_fsr_mipmap_bias);
|
||||
ClassDB::bind_method(D_METHOD("get_fsr_mipmap_bias"), &Viewport::get_fsr_mipmap_bias);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disable_3d"), "set_disable_3d", "is_3d_disabled");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_xr"), "set_use_xr", "is_using_xr");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "scale_3d", PROPERTY_HINT_RANGE, "0.25,2.0,0.01"), "set_scale_3d", "get_scale_3d");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "audio_listener_enable_3d"), "set_as_audio_listener_3d", "is_audio_listener_3d");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "own_world_3d"), "set_use_own_world_3d", "is_using_own_world_3d");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "world_3d", PROPERTY_HINT_RESOURCE_TYPE, "World3D"), "set_world_3d", "get_world_3d");
|
||||
|
@ -3633,6 +3685,13 @@ void Viewport::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_occlusion_culling"), "set_use_occlusion_culling", "is_using_occlusion_culling");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "lod_threshold", PROPERTY_HINT_RANGE, "0,1024,0.1"), "set_lod_threshold", "get_lod_threshold");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "debug_draw", PROPERTY_HINT_ENUM, "Disabled,Unshaded,Overdraw,Wireframe"), "set_debug_draw", "get_debug_draw");
|
||||
#ifndef _3D_DISABLED
|
||||
ADD_GROUP("Scaling 3D", "");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "scaling_3d_mode", PROPERTY_HINT_ENUM, "Disabled (Slowest),Bilinear (Fastest),FSR (Fast)"), "set_scaling_3d_mode", "get_scaling_3d_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "scaling_3d_scale", PROPERTY_HINT_RANGE, "0.25,2.0,0.01"), "set_scaling_3d_scale", "get_scaling_3d_scale");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fsr_mipmap_bias", PROPERTY_HINT_RANGE, "-2,2,0.1"), "set_fsr_mipmap_bias", "get_fsr_mipmap_bias");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fsr_sharpness", PROPERTY_HINT_RANGE, "0,2,0.1"), "set_fsr_sharpness", "get_fsr_sharpness");
|
||||
#endif
|
||||
ADD_GROUP("Canvas Items", "canvas_item_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "canvas_item_default_texture_filter", PROPERTY_HINT_ENUM, "Nearest,Linear,Linear Mipmap,Nearest Mipmap"), "set_default_canvas_item_texture_filter", "get_default_canvas_item_texture_filter");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "canvas_item_default_texture_repeat", PROPERTY_HINT_ENUM, "Disabled,Enabled,Mirror"), "set_default_canvas_item_texture_repeat", "get_default_canvas_item_texture_repeat");
|
||||
|
@ -3669,6 +3728,10 @@ void Viewport::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_1024);
|
||||
BIND_ENUM_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_MAX);
|
||||
|
||||
BIND_ENUM_CONSTANT(SCALING_3D_MODE_BILINEAR);
|
||||
BIND_ENUM_CONSTANT(SCALING_3D_MODE_FSR);
|
||||
BIND_ENUM_CONSTANT(SCALING_3D_MODE_MAX);
|
||||
|
||||
BIND_ENUM_CONSTANT(MSAA_DISABLED);
|
||||
BIND_ENUM_CONSTANT(MSAA_2X);
|
||||
BIND_ENUM_CONSTANT(MSAA_4X);
|
||||
|
@ -3772,7 +3835,16 @@ Viewport::Viewport() {
|
|||
ProjectSettings::get_singleton()->set_custom_property_info("gui/timers/tooltip_delay_sec", PropertyInfo(Variant::FLOAT, "gui/timers/tooltip_delay_sec", PROPERTY_HINT_RANGE, "0,5,0.01,or_greater")); // No negative numbers
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
set_scale_3d(GLOBAL_GET("rendering/3d/viewport/scale"));
|
||||
Viewport::Scaling3DMode scaling_3d_mode = (Viewport::Scaling3DMode)(int)GLOBAL_GET("rendering/scaling_3d/mode");
|
||||
set_scaling_3d_mode(scaling_3d_mode);
|
||||
|
||||
set_scaling_3d_scale(GLOBAL_GET("rendering/scaling_3d/scale"));
|
||||
|
||||
float fsr_sharpness = GLOBAL_GET("rendering/scaling_3d/fsr_sharpness");
|
||||
set_fsr_sharpness(fsr_sharpness);
|
||||
|
||||
float fsr_mipmap_bias = GLOBAL_GET("rendering/scaling_3d/fsr_mipmap_bias");
|
||||
set_fsr_mipmap_bias(fsr_mipmap_bias);
|
||||
#endif // _3D_DISABLED
|
||||
|
||||
set_sdf_oversize(sdf_oversize); // Set to server.
|
||||
|
|
|
@ -89,6 +89,12 @@ class Viewport : public Node {
|
|||
GDCLASS(Viewport, Node);
|
||||
|
||||
public:
|
||||
enum Scaling3DMode {
|
||||
SCALING_3D_MODE_BILINEAR,
|
||||
SCALING_3D_MODE_FSR,
|
||||
SCALING_3D_MODE_MAX
|
||||
};
|
||||
|
||||
enum ShadowAtlasQuadrantSubdiv {
|
||||
SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED,
|
||||
SHADOW_ATLAS_QUADRANT_SUBDIV_1,
|
||||
|
@ -284,6 +290,11 @@ private:
|
|||
|
||||
MSAA msaa = MSAA_DISABLED;
|
||||
ScreenSpaceAA screen_space_aa = SCREEN_SPACE_AA_DISABLED;
|
||||
|
||||
Scaling3DMode scaling_3d_mode = SCALING_3D_MODE_BILINEAR;
|
||||
float scaling_3d_scale = 1.0;
|
||||
float fsr_sharpness = 0.2f;
|
||||
float fsr_mipmap_bias = 0.0f;
|
||||
bool use_debanding = false;
|
||||
float lod_threshold = 1.0;
|
||||
bool use_occlusion_culling = false;
|
||||
|
@ -504,6 +515,18 @@ public:
|
|||
void set_screen_space_aa(ScreenSpaceAA p_screen_space_aa);
|
||||
ScreenSpaceAA get_screen_space_aa() const;
|
||||
|
||||
void set_scaling_3d_mode(Scaling3DMode p_scaling_3d_mode);
|
||||
Scaling3DMode get_scaling_3d_mode() const;
|
||||
|
||||
void set_scaling_3d_scale(float p_scaling_3d_scale);
|
||||
float get_scaling_3d_scale() const;
|
||||
|
||||
void set_fsr_sharpness(float p_fsr_sharpness);
|
||||
float get_fsr_sharpness() const;
|
||||
|
||||
void set_fsr_mipmap_bias(float p_fsr_mipmap_bias);
|
||||
float get_fsr_mipmap_bias() const;
|
||||
|
||||
void set_use_debanding(bool p_use_debanding);
|
||||
bool is_using_debanding() const;
|
||||
|
||||
|
@ -586,7 +609,6 @@ public:
|
|||
|
||||
#ifndef _3D_DISABLED
|
||||
bool use_xr = false;
|
||||
float scale_3d = 1.0;
|
||||
friend class AudioListener3D;
|
||||
AudioListener3D *audio_listener_3d = nullptr;
|
||||
Set<AudioListener3D *> audio_listener_3d_set;
|
||||
|
@ -657,9 +679,6 @@ public:
|
|||
|
||||
void set_use_xr(bool p_use_xr);
|
||||
bool is_using_xr();
|
||||
|
||||
void set_scale_3d(float p_scale_3d);
|
||||
float get_scale_3d() const;
|
||||
#endif // _3D_DISABLED
|
||||
|
||||
Viewport();
|
||||
|
@ -714,6 +733,7 @@ public:
|
|||
SubViewport();
|
||||
~SubViewport();
|
||||
};
|
||||
VARIANT_ENUM_CAST(Viewport::Scaling3DMode);
|
||||
VARIANT_ENUM_CAST(SubViewport::UpdateMode);
|
||||
VARIANT_ENUM_CAST(Viewport::ShadowAtlasQuadrantSubdiv);
|
||||
VARIANT_ENUM_CAST(Viewport::MSAA);
|
||||
|
|
|
@ -195,7 +195,7 @@ public:
|
|||
void set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw) override {}
|
||||
|
||||
RID render_buffers_create() override { return RID(); }
|
||||
void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count) override {}
|
||||
void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_internal_width, int p_internal_height, int p_width, int p_height, float p_fsr_sharpness, float p_fsr_mipmap_bias, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count) override {}
|
||||
void gi_set_use_half_resolution(bool p_enable) override {}
|
||||
|
||||
void screen_space_roughness_limiter_set_active(bool p_enable, float p_amount, float p_curve) override {}
|
||||
|
|
|
@ -67,6 +67,7 @@ private:
|
|||
|
||||
protected:
|
||||
static RendererCompositor *(*_create_func)();
|
||||
bool back_end = false;
|
||||
|
||||
public:
|
||||
static RendererCompositor *create();
|
||||
|
@ -88,7 +89,7 @@ public:
|
|||
virtual uint64_t get_frame_number() const = 0;
|
||||
virtual double get_frame_delta_time() const = 0;
|
||||
|
||||
virtual bool is_low_end() const = 0;
|
||||
_FORCE_INLINE_ virtual bool is_low_end() const { return back_end; };
|
||||
virtual bool is_xr_enabled() const;
|
||||
|
||||
RendererCompositor();
|
||||
|
|
|
@ -237,6 +237,43 @@ RID EffectsRD::_get_compute_uniform_set_from_image_pair(RID p_texture1, RID p_te
|
|||
return uniform_set;
|
||||
}
|
||||
|
||||
void EffectsRD::fsr_upscale(RID p_source_rd_texture, RID p_secondary_texture, RID p_destination_texture, const Size2i &p_internal_size, const Size2i &p_size, float p_fsr_upscale_sharpness) {
|
||||
memset(&FSR_upscale.push_constant, 0, sizeof(FSRUpscalePushConstant));
|
||||
|
||||
int dispatch_x = (p_size.x + 15) / 16;
|
||||
int dispatch_y = (p_size.y + 15) / 16;
|
||||
|
||||
RD::ComputeListID compute_list = RD::get_singleton()->compute_list_begin();
|
||||
RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, FSR_upscale.pipeline);
|
||||
|
||||
FSR_upscale.push_constant.resolution_width = p_internal_size.width;
|
||||
FSR_upscale.push_constant.resolution_height = p_internal_size.height;
|
||||
FSR_upscale.push_constant.upscaled_width = p_size.width;
|
||||
FSR_upscale.push_constant.upscaled_height = p_size.height;
|
||||
FSR_upscale.push_constant.sharpness = p_fsr_upscale_sharpness;
|
||||
|
||||
//FSR Easc
|
||||
FSR_upscale.push_constant.pass = FSR_UPSCALE_PASS_EASU;
|
||||
RD::get_singleton()->compute_list_bind_uniform_set(compute_list, _get_compute_uniform_set_from_texture(p_source_rd_texture), 0);
|
||||
RD::get_singleton()->compute_list_bind_uniform_set(compute_list, _get_uniform_set_from_image(p_secondary_texture), 1);
|
||||
|
||||
RD::get_singleton()->compute_list_set_push_constant(compute_list, &FSR_upscale.push_constant, sizeof(FSRUpscalePushConstant));
|
||||
|
||||
RD::get_singleton()->compute_list_dispatch(compute_list, dispatch_x, dispatch_y, 1);
|
||||
RD::get_singleton()->compute_list_add_barrier(compute_list);
|
||||
|
||||
//FSR Rcas
|
||||
FSR_upscale.push_constant.pass = FSR_UPSCALE_PASS_RCAS;
|
||||
RD::get_singleton()->compute_list_bind_uniform_set(compute_list, _get_compute_uniform_set_from_texture(p_secondary_texture), 0);
|
||||
RD::get_singleton()->compute_list_bind_uniform_set(compute_list, _get_uniform_set_from_image(p_destination_texture), 1);
|
||||
|
||||
RD::get_singleton()->compute_list_set_push_constant(compute_list, &FSR_upscale.push_constant, sizeof(FSRUpscalePushConstant));
|
||||
|
||||
RD::get_singleton()->compute_list_dispatch(compute_list, dispatch_x, dispatch_y, 1);
|
||||
|
||||
RD::get_singleton()->compute_list_end(compute_list);
|
||||
}
|
||||
|
||||
void EffectsRD::copy_to_atlas_fb(RID p_source_rd_texture, RID p_dest_framebuffer, const Rect2 &p_uv_rect, RD::DrawListID p_draw_list, bool p_flip_y, bool p_panorama) {
|
||||
memset(©_to_fb.push_constant, 0, sizeof(CopyToFbPushConstant));
|
||||
|
||||
|
@ -1888,6 +1925,27 @@ void EffectsRD::sort_buffer(RID p_uniform_set, int p_size) {
|
|||
}
|
||||
|
||||
EffectsRD::EffectsRD(bool p_prefer_raster_effects) {
|
||||
{
|
||||
Vector<String> FSR_upscale_modes;
|
||||
|
||||
#if defined(OSX_ENABLED) || defined(IPHONE_ENABLED)
|
||||
// MoltenVK does not support some of the operations used by the normal mode of FSR. Fallback works just fine though.
|
||||
FSR_upscale_modes.push_back("\n#define MODE_FSR_UPSCALE_FALLBACK\n");
|
||||
#else
|
||||
// Everyone else can use normal mode when available.
|
||||
if (RD::get_singleton()->get_device_capabilities()->supports_fsr_half_float) {
|
||||
FSR_upscale_modes.push_back("\n#define MODE_FSR_UPSCALE_NORMAL\n");
|
||||
} else {
|
||||
FSR_upscale_modes.push_back("\n#define MODE_FSR_UPSCALE_FALLBACK\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
FSR_upscale.shader.initialize(FSR_upscale_modes);
|
||||
|
||||
FSR_upscale.shader_version = FSR_upscale.shader.version_create();
|
||||
FSR_upscale.pipeline = RD::get_singleton()->compute_pipeline_create(FSR_upscale.shader.version_get_shader(FSR_upscale.shader_version, 0));
|
||||
}
|
||||
|
||||
prefer_raster_effects = p_prefer_raster_effects;
|
||||
|
||||
if (prefer_raster_effects) {
|
||||
|
@ -2523,6 +2581,7 @@ EffectsRD::~EffectsRD() {
|
|||
RD::get_singleton()->free(index_buffer); //array gets freed as dependency
|
||||
RD::get_singleton()->free(filter.coefficient_buffer);
|
||||
|
||||
FSR_upscale.shader.version_free(FSR_upscale.shader_version);
|
||||
if (prefer_raster_effects) {
|
||||
blur_raster.shader.version_free(blur_raster.shader_version);
|
||||
bokeh.raster_shader.version_free(blur_raster.shader_version);
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "servers/rendering/renderer_rd/shaders/cubemap_filter_raster.glsl.gen.h"
|
||||
#include "servers/rendering/renderer_rd/shaders/cubemap_roughness.glsl.gen.h"
|
||||
#include "servers/rendering/renderer_rd/shaders/cubemap_roughness_raster.glsl.gen.h"
|
||||
#include "servers/rendering/renderer_rd/shaders/fsr_upscale.glsl.gen.h"
|
||||
#include "servers/rendering/renderer_rd/shaders/luminance_reduce.glsl.gen.h"
|
||||
#include "servers/rendering/renderer_rd/shaders/luminance_reduce_raster.glsl.gen.h"
|
||||
#include "servers/rendering/renderer_rd/shaders/resolve.glsl.gen.h"
|
||||
|
@ -69,6 +70,28 @@ class EffectsRD {
|
|||
private:
|
||||
bool prefer_raster_effects;
|
||||
|
||||
enum FSRUpscalePass {
|
||||
FSR_UPSCALE_PASS_EASU = 0,
|
||||
FSR_UPSCALE_PASS_RCAS = 1
|
||||
};
|
||||
|
||||
struct FSRUpscalePushConstant {
|
||||
float resolution_width;
|
||||
float resolution_height;
|
||||
float upscaled_width;
|
||||
float upscaled_height;
|
||||
float sharpness;
|
||||
int pass;
|
||||
int _unused0, _unused1;
|
||||
};
|
||||
|
||||
struct FSRUpscale {
|
||||
FSRUpscalePushConstant push_constant;
|
||||
FsrUpscaleShaderRD shader;
|
||||
RID shader_version;
|
||||
RID pipeline;
|
||||
} FSR_upscale;
|
||||
|
||||
enum BlurRasterMode {
|
||||
BLUR_MIPMAP,
|
||||
|
||||
|
@ -754,6 +777,7 @@ private:
|
|||
public:
|
||||
bool get_prefer_raster_effects();
|
||||
|
||||
void fsr_upscale(RID p_source_rd_texture, RID p_secondary_texture, RID p_destination_texture, const Size2i &p_internal_size, const Size2i &p_size, float p_fsr_upscale_sharpness);
|
||||
void copy_to_fb_rect(RID p_source_rd_texture, RID p_dest_framebuffer, const Rect2i &p_rect, bool p_flip_y = false, bool p_force_luminance = false, bool p_alpha_to_zero = false, bool p_srgb = false, RID p_secondary = RID());
|
||||
void copy_to_rect(RID p_source_rd_texture, RID p_dest_texture, const Rect2i &p_rect, bool p_flip_y = false, bool p_force_luminance = false, bool p_all_source = false, bool p_8_bit_dst = false, bool p_alpha_to_one = false);
|
||||
void copy_cubemap_to_panorama(RID p_source_cube, RID p_dest_panorama, const Size2i &p_panorama_size, float p_lod, bool p_is_array);
|
||||
|
|
|
@ -1954,7 +1954,9 @@ void RenderForwardClustered::_base_uniforms_changed() {
|
|||
}
|
||||
|
||||
void RenderForwardClustered::_update_render_base_uniform_set() {
|
||||
if (render_base_uniform_set.is_null() || !RD::get_singleton()->uniform_set_is_valid(render_base_uniform_set) || (lightmap_texture_array_version != storage->lightmap_array_get_version())) {
|
||||
if (render_base_uniform_set.is_null() || !RD::get_singleton()->uniform_set_is_valid(render_base_uniform_set) || (lightmap_texture_array_version != storage->lightmap_array_get_version()) || base_uniform_set_updated) {
|
||||
base_uniform_set_updated = false;
|
||||
|
||||
if (render_base_uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(render_base_uniform_set)) {
|
||||
RD::get_singleton()->free(render_base_uniform_set);
|
||||
}
|
||||
|
@ -1969,18 +1971,18 @@ void RenderForwardClustered::_update_render_base_uniform_set() {
|
|||
u.binding = 1;
|
||||
u.ids.resize(12);
|
||||
RID *ids_ptr = u.ids.ptrw();
|
||||
ids_ptr[0] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
ids_ptr[1] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
ids_ptr[2] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
ids_ptr[3] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
ids_ptr[4] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
ids_ptr[5] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
ids_ptr[6] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
|
||||
ids_ptr[7] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
|
||||
ids_ptr[8] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
|
||||
ids_ptr[9] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
|
||||
ids_ptr[10] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
|
||||
ids_ptr[11] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
|
||||
ids_ptr[0] = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
ids_ptr[1] = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
ids_ptr[2] = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
ids_ptr[3] = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
ids_ptr[4] = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
ids_ptr[5] = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
ids_ptr[6] = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
|
||||
ids_ptr[7] = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
|
||||
ids_ptr[8] = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
|
||||
ids_ptr[9] = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
|
||||
ids_ptr[10] = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
|
||||
ids_ptr[11] = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
|
||||
uniforms.push_back(u);
|
||||
}
|
||||
|
||||
|
@ -1999,19 +2001,19 @@ void RenderForwardClustered::_update_render_base_uniform_set() {
|
|||
RID sampler;
|
||||
switch (decals_get_filter()) {
|
||||
case RS::DECAL_FILTER_NEAREST: {
|
||||
sampler = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
sampler = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
} break;
|
||||
case RS::DECAL_FILTER_NEAREST_MIPMAPS: {
|
||||
sampler = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
sampler = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
} break;
|
||||
case RS::DECAL_FILTER_LINEAR: {
|
||||
sampler = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
sampler = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
} break;
|
||||
case RS::DECAL_FILTER_LINEAR_MIPMAPS: {
|
||||
sampler = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
sampler = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
} break;
|
||||
case RS::DECAL_FILTER_LINEAR_MIPMAPS_ANISOTROPIC: {
|
||||
sampler = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
sampler = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
} break;
|
||||
}
|
||||
|
||||
|
@ -2026,19 +2028,19 @@ void RenderForwardClustered::_update_render_base_uniform_set() {
|
|||
RID sampler;
|
||||
switch (light_projectors_get_filter()) {
|
||||
case RS::LIGHT_PROJECTOR_FILTER_NEAREST: {
|
||||
sampler = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
sampler = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
} break;
|
||||
case RS::LIGHT_PROJECTOR_FILTER_NEAREST_MIPMAPS: {
|
||||
sampler = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
sampler = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
} break;
|
||||
case RS::LIGHT_PROJECTOR_FILTER_LINEAR: {
|
||||
sampler = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
sampler = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
} break;
|
||||
case RS::LIGHT_PROJECTOR_FILTER_LINEAR_MIPMAPS: {
|
||||
sampler = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
sampler = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
} break;
|
||||
case RS::LIGHT_PROJECTOR_FILTER_LINEAR_MIPMAPS_ANISOTROPIC: {
|
||||
sampler = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
sampler = storage->sampler_rd_get_custom(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
|
||||
} break;
|
||||
}
|
||||
|
||||
|
|
|
@ -129,6 +129,7 @@ class RenderForwardClustered : public RendererSceneRenderRD {
|
|||
virtual void _base_uniforms_changed() override;
|
||||
virtual RID _render_buffers_get_normal_texture(RID p_render_buffers) override;
|
||||
|
||||
bool base_uniform_set_updated = false;
|
||||
void _update_render_base_uniform_set();
|
||||
RID _setup_sdfgi_render_pass_uniform_set(RID p_albedo_texture, RID p_emission_texture, RID p_emission_aniso_texture, RID p_geom_facing_texture);
|
||||
RID _setup_render_pass_uniform_set(RenderListType p_render_list, const RenderDataRD *p_render_data, RID p_radiance_texture, bool p_use_directional_shadow_atlas = false, int p_index = 0);
|
||||
|
@ -603,6 +604,11 @@ protected:
|
|||
virtual void _render_particle_collider_heightfield(RID p_fb, const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, const PagedArray<GeometryInstance *> &p_instances) override;
|
||||
|
||||
public:
|
||||
_FORCE_INLINE_ virtual void update_uniform_sets() override {
|
||||
base_uniform_set_updated = true;
|
||||
_update_render_base_uniform_set();
|
||||
}
|
||||
|
||||
virtual GeometryInstance *geometry_instance_create(RID p_base) override;
|
||||
virtual void geometry_instance_set_skeleton(GeometryInstance *p_geometry_instance, RID p_skeleton) override;
|
||||
virtual void geometry_instance_set_material_override(GeometryInstance *p_geometry_instance, RID p_override) override;
|
||||
|
|
|
@ -281,12 +281,12 @@ RendererCompositorRD::RendererCompositorRD() {
|
|||
storage = memnew(RendererStorageRD);
|
||||
canvas = memnew(RendererCanvasRenderRD(storage));
|
||||
|
||||
uint32_t back_end = GLOBAL_GET("rendering/vulkan/rendering/back_end");
|
||||
back_end = (bool)(int)GLOBAL_GET("rendering/vulkan/rendering/back_end");
|
||||
uint32_t textures_per_stage = RD::get_singleton()->limit_get(RD::LIMIT_MAX_TEXTURES_PER_SHADER_STAGE);
|
||||
|
||||
if (back_end == 1 || textures_per_stage < 48) {
|
||||
if (back_end || textures_per_stage < 48) {
|
||||
scene = memnew(RendererSceneRenderImplementation::RenderForwardMobile(storage));
|
||||
} else { // back_end == 0
|
||||
} else { // back_end == false
|
||||
// default to our high end renderer
|
||||
scene = memnew(RendererSceneRenderImplementation::RenderForwardClustered(storage));
|
||||
}
|
||||
|
|
|
@ -116,8 +116,6 @@ public:
|
|||
_create_func = _create_current;
|
||||
}
|
||||
|
||||
virtual bool is_low_end() const { return false; }
|
||||
|
||||
static RendererCompositorRD *singleton;
|
||||
RendererCompositorRD();
|
||||
~RendererCompositorRD();
|
||||
|
|
|
@ -3132,8 +3132,8 @@ void RendererSceneGIRD::process_gi(RID p_render_buffers, RID p_normal_roughness_
|
|||
|
||||
RD::TextureFormat tf;
|
||||
tf.format = RD::DATA_FORMAT_R16G16B16A16_SFLOAT;
|
||||
tf.width = rb->width;
|
||||
tf.height = rb->height;
|
||||
tf.width = rb->internal_width;
|
||||
tf.height = rb->internal_height;
|
||||
if (half_resolution) {
|
||||
tf.width >>= 1;
|
||||
tf.height >>= 1;
|
||||
|
@ -3146,13 +3146,13 @@ void RendererSceneGIRD::process_gi(RID p_render_buffers, RID p_normal_roughness_
|
|||
|
||||
PushConstant push_constant;
|
||||
|
||||
push_constant.screen_size[0] = rb->width;
|
||||
push_constant.screen_size[1] = rb->height;
|
||||
push_constant.screen_size[0] = rb->internal_width;
|
||||
push_constant.screen_size[1] = rb->internal_height;
|
||||
push_constant.z_near = p_projection.get_z_near();
|
||||
push_constant.z_far = p_projection.get_z_far();
|
||||
push_constant.orthogonal = p_projection.is_orthogonal();
|
||||
push_constant.proj_info[0] = -2.0f / (rb->width * p_projection.matrix[0][0]);
|
||||
push_constant.proj_info[1] = -2.0f / (rb->height * p_projection.matrix[1][1]);
|
||||
push_constant.proj_info[0] = -2.0f / (rb->internal_width * p_projection.matrix[0][0]);
|
||||
push_constant.proj_info[1] = -2.0f / (rb->internal_height * p_projection.matrix[1][1]);
|
||||
push_constant.proj_info[2] = (1.0f - p_projection.matrix[0][2]) / p_projection.matrix[0][0];
|
||||
push_constant.proj_info[3] = (1.0f + p_projection.matrix[1][2]) / p_projection.matrix[1][1];
|
||||
push_constant.max_voxel_gi_instances = MIN((uint64_t)MAX_VOXEL_GI_INSTANCES, p_voxel_gi_instances.size());
|
||||
|
@ -3344,9 +3344,9 @@ void RendererSceneGIRD::process_gi(RID p_render_buffers, RID p_normal_roughness_
|
|||
RD::get_singleton()->compute_list_set_push_constant(compute_list, &push_constant, sizeof(PushConstant));
|
||||
|
||||
if (rb->gi.using_half_size_gi) {
|
||||
RD::get_singleton()->compute_list_dispatch_threads(compute_list, rb->width >> 1, rb->height >> 1, 1);
|
||||
RD::get_singleton()->compute_list_dispatch_threads(compute_list, rb->internal_width >> 1, rb->internal_height >> 1, 1);
|
||||
} else {
|
||||
RD::get_singleton()->compute_list_dispatch_threads(compute_list, rb->width, rb->height, 1);
|
||||
RD::get_singleton()->compute_list_dispatch_threads(compute_list, rb->internal_width, rb->internal_height, 1);
|
||||
}
|
||||
//do barrier later to allow oeverlap
|
||||
//RD::get_singleton()->compute_list_end(RD::BARRIER_MASK_NO_BARRIER); //no barriers, let other compute, raster and transfer happen at the same time
|
||||
|
|
|
@ -1503,8 +1503,8 @@ void RendererSceneRenderRD::_allocate_blur_textures(RenderBuffers *rb) {
|
|||
|
||||
RD::TextureFormat tf;
|
||||
tf.format = _render_buffers_get_color_format(); // RD::DATA_FORMAT_R16G16B16A16_SFLOAT;
|
||||
tf.width = rb->width;
|
||||
tf.height = rb->height;
|
||||
tf.width = rb->internal_width;
|
||||
tf.height = rb->internal_height;
|
||||
tf.texture_type = rb->view_count > 1 ? RD::TEXTURE_TYPE_2D_ARRAY : RD::TEXTURE_TYPE_2D;
|
||||
tf.array_layers = rb->view_count;
|
||||
tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_CAN_COPY_TO_BIT;
|
||||
|
@ -1515,6 +1515,10 @@ void RendererSceneRenderRD::_allocate_blur_textures(RenderBuffers *rb) {
|
|||
}
|
||||
tf.mipmaps = mipmaps_required;
|
||||
|
||||
rb->sss_texture = RD::get_singleton()->texture_create(tf, RD::TextureView());
|
||||
|
||||
tf.width = rb->internal_width;
|
||||
tf.height = rb->internal_height;
|
||||
rb->blur[0].texture = RD::get_singleton()->texture_create(tf, RD::TextureView());
|
||||
//the second one is smaller (only used for separatable part of blur)
|
||||
tf.width >>= 1;
|
||||
|
@ -1522,8 +1526,8 @@ void RendererSceneRenderRD::_allocate_blur_textures(RenderBuffers *rb) {
|
|||
tf.mipmaps--;
|
||||
rb->blur[1].texture = RD::get_singleton()->texture_create(tf, RD::TextureView());
|
||||
|
||||
int base_width = rb->width;
|
||||
int base_height = rb->height;
|
||||
int base_width = rb->internal_width;
|
||||
int base_height = rb->internal_height;
|
||||
|
||||
for (uint32_t i = 0; i < mipmaps_required; i++) {
|
||||
RenderBuffers::Blur::Mipmap mm;
|
||||
|
@ -1577,8 +1581,8 @@ void RendererSceneRenderRD::_allocate_blur_textures(RenderBuffers *rb) {
|
|||
// create 4 weight textures, 2 full size, 2 half size
|
||||
|
||||
tf.format = RD::DATA_FORMAT_R16_SFLOAT; // We could probably use DATA_FORMAT_R8_SNORM if we don't pre-multiply by blur_size but that depends on whether we can remove DEPTH_GAP
|
||||
tf.width = rb->width;
|
||||
tf.height = rb->height;
|
||||
tf.width = rb->internal_width;
|
||||
tf.height = rb->internal_height;
|
||||
tf.texture_type = rb->view_count > 1 ? RD::TEXTURE_TYPE_2D_ARRAY : RD::TEXTURE_TYPE_2D;
|
||||
tf.array_layers = rb->view_count;
|
||||
tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_CAN_COPY_TO_BIT | RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||
|
@ -1656,8 +1660,8 @@ void RendererSceneRenderRD::_allocate_depth_backbuffer_textures(RenderBuffers *r
|
|||
void RendererSceneRenderRD::_allocate_luminance_textures(RenderBuffers *rb) {
|
||||
ERR_FAIL_COND(!rb->luminance.current.is_null());
|
||||
|
||||
int w = rb->width;
|
||||
int h = rb->height;
|
||||
int w = rb->internal_width;
|
||||
int h = rb->internal_height;
|
||||
|
||||
while (true) {
|
||||
w = MAX(w / 8, 1);
|
||||
|
@ -1709,9 +1713,26 @@ void RendererSceneRenderRD::_free_render_buffer_data(RenderBuffers *rb) {
|
|||
rb->texture_fb = RID();
|
||||
}
|
||||
|
||||
if (rb->texture.is_valid()) {
|
||||
RD::get_singleton()->free(rb->texture);
|
||||
if (rb->internal_texture == rb->texture && rb->internal_texture.is_valid()) {
|
||||
RD::get_singleton()->free(rb->internal_texture);
|
||||
rb->texture = RID();
|
||||
rb->internal_texture = RID();
|
||||
rb->upscale_texture = RID();
|
||||
} else {
|
||||
if (rb->texture.is_valid()) {
|
||||
RD::get_singleton()->free(rb->texture);
|
||||
rb->texture = RID();
|
||||
}
|
||||
|
||||
if (rb->internal_texture.is_valid()) {
|
||||
RD::get_singleton()->free(rb->internal_texture);
|
||||
rb->internal_texture = RID();
|
||||
}
|
||||
|
||||
if (rb->upscale_texture.is_valid()) {
|
||||
RD::get_singleton()->free(rb->upscale_texture);
|
||||
rb->upscale_texture = RID();
|
||||
}
|
||||
}
|
||||
|
||||
if (rb->depth_texture.is_valid()) {
|
||||
|
@ -1729,6 +1750,11 @@ void RendererSceneRenderRD::_free_render_buffer_data(RenderBuffers *rb) {
|
|||
rb->depth_back_texture = RID();
|
||||
}
|
||||
|
||||
if (rb->sss_texture.is_valid()) {
|
||||
RD::get_singleton()->free(rb->sss_texture);
|
||||
rb->sss_texture = RID();
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (int m = 0; m < rb->blur[i].mipmaps.size(); m++) {
|
||||
// do we free the texture slice here? or is it enough to free the main texture?
|
||||
|
@ -1818,7 +1844,7 @@ void RendererSceneRenderRD::_process_sss(RID p_render_buffers, const CameraMatri
|
|||
RenderBuffers *rb = render_buffers_owner.get_or_null(p_render_buffers);
|
||||
ERR_FAIL_COND(!rb);
|
||||
|
||||
bool can_use_effects = rb->width >= 8 && rb->height >= 8;
|
||||
bool can_use_effects = rb->internal_width >= 8 && rb->internal_height >= 8;
|
||||
|
||||
if (!can_use_effects) {
|
||||
//just copy
|
||||
|
@ -1829,18 +1855,18 @@ void RendererSceneRenderRD::_process_sss(RID p_render_buffers, const CameraMatri
|
|||
_allocate_blur_textures(rb);
|
||||
}
|
||||
|
||||
storage->get_effects()->sub_surface_scattering(rb->texture, rb->blur[0].mipmaps[0].texture, rb->depth_texture, p_camera, Size2i(rb->width, rb->height), sss_scale, sss_depth_scale, sss_quality);
|
||||
storage->get_effects()->sub_surface_scattering(rb->internal_texture, rb->sss_texture, rb->depth_texture, p_camera, Size2i(rb->internal_width, rb->internal_height), sss_scale, sss_depth_scale, sss_quality);
|
||||
}
|
||||
|
||||
void RendererSceneRenderRD::_process_ssr(RID p_render_buffers, RID p_dest_framebuffer, RID p_normal_buffer, RID p_specular_buffer, RID p_metallic, const Color &p_metallic_mask, RID p_environment, const CameraMatrix &p_projection, bool p_use_additive) {
|
||||
RenderBuffers *rb = render_buffers_owner.get_or_null(p_render_buffers);
|
||||
ERR_FAIL_COND(!rb);
|
||||
|
||||
bool can_use_effects = rb->width >= 8 && rb->height >= 8;
|
||||
bool can_use_effects = rb->internal_width >= 8 && rb->internal_height >= 8;
|
||||
|
||||
if (!can_use_effects) {
|
||||
//just copy
|
||||
storage->get_effects()->merge_specular(p_dest_framebuffer, p_specular_buffer, p_use_additive ? RID() : rb->texture, RID());
|
||||
storage->get_effects()->merge_specular(p_dest_framebuffer, p_specular_buffer, p_use_additive ? RID() : rb->internal_texture, RID());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1852,8 +1878,8 @@ void RendererSceneRenderRD::_process_ssr(RID p_render_buffers, RID p_dest_frameb
|
|||
if (rb->ssr.depth_scaled.is_null()) {
|
||||
RD::TextureFormat tf;
|
||||
tf.format = RD::DATA_FORMAT_R32_SFLOAT;
|
||||
tf.width = rb->width / 2;
|
||||
tf.height = rb->height / 2;
|
||||
tf.width = rb->internal_width / 2;
|
||||
tf.height = rb->internal_height / 2;
|
||||
tf.texture_type = RD::TEXTURE_TYPE_2D;
|
||||
tf.usage_bits = RD::TEXTURE_USAGE_STORAGE_BIT;
|
||||
|
||||
|
@ -1867,8 +1893,8 @@ void RendererSceneRenderRD::_process_ssr(RID p_render_buffers, RID p_dest_frameb
|
|||
if (ssr_roughness_quality != RS::ENV_SSR_ROUGNESS_QUALITY_DISABLED && !rb->ssr.blur_radius[0].is_valid()) {
|
||||
RD::TextureFormat tf;
|
||||
tf.format = RD::DATA_FORMAT_R8_UNORM;
|
||||
tf.width = rb->width / 2;
|
||||
tf.height = rb->height / 2;
|
||||
tf.width = rb->internal_width / 2;
|
||||
tf.height = rb->internal_height / 2;
|
||||
tf.texture_type = RD::TEXTURE_TYPE_2D;
|
||||
tf.usage_bits = RD::TEXTURE_USAGE_STORAGE_BIT | RD::TEXTURE_USAGE_SAMPLING_BIT;
|
||||
|
||||
|
@ -1880,8 +1906,8 @@ void RendererSceneRenderRD::_process_ssr(RID p_render_buffers, RID p_dest_frameb
|
|||
_allocate_blur_textures(rb);
|
||||
}
|
||||
|
||||
storage->get_effects()->screen_space_reflection(rb->texture, p_normal_buffer, ssr_roughness_quality, rb->ssr.blur_radius[0], rb->ssr.blur_radius[1], p_metallic, p_metallic_mask, rb->depth_texture, rb->ssr.depth_scaled, rb->ssr.normal_scaled, rb->blur[0].mipmaps[1].texture, rb->blur[1].mipmaps[0].texture, Size2i(rb->width / 2, rb->height / 2), env->ssr_max_steps, env->ssr_fade_in, env->ssr_fade_out, env->ssr_depth_tolerance, p_projection);
|
||||
storage->get_effects()->merge_specular(p_dest_framebuffer, p_specular_buffer, p_use_additive ? RID() : rb->texture, rb->blur[0].mipmaps[1].texture);
|
||||
storage->get_effects()->screen_space_reflection(rb->internal_texture, p_normal_buffer, ssr_roughness_quality, rb->ssr.blur_radius[0], rb->ssr.blur_radius[1], p_metallic, p_metallic_mask, rb->depth_texture, rb->ssr.depth_scaled, rb->ssr.normal_scaled, rb->blur[0].mipmaps[1].texture, rb->blur[1].mipmaps[0].texture, Size2i(rb->internal_width / 2, rb->internal_height / 2), env->ssr_max_steps, env->ssr_fade_in, env->ssr_fade_out, env->ssr_depth_tolerance, p_projection);
|
||||
storage->get_effects()->merge_specular(p_dest_framebuffer, p_specular_buffer, p_use_additive ? RID() : rb->internal_texture, rb->blur[0].mipmaps[1].texture);
|
||||
}
|
||||
|
||||
void RendererSceneRenderRD::_process_ssao(RID p_render_buffers, RID p_environment, RID p_normal_buffer, const CameraMatrix &p_projection) {
|
||||
|
@ -1918,15 +1944,15 @@ void RendererSceneRenderRD::_process_ssao(RID p_render_buffers, RID p_environmen
|
|||
int half_width;
|
||||
int half_height;
|
||||
if (ssao_half_size) {
|
||||
buffer_width = (rb->width + 3) / 4;
|
||||
buffer_height = (rb->height + 3) / 4;
|
||||
half_width = (rb->width + 7) / 8;
|
||||
half_height = (rb->height + 7) / 8;
|
||||
buffer_width = (rb->internal_width + 3) / 4;
|
||||
buffer_height = (rb->internal_height + 3) / 4;
|
||||
half_width = (rb->internal_width + 7) / 8;
|
||||
half_height = (rb->internal_height + 7) / 8;
|
||||
} else {
|
||||
buffer_width = (rb->width + 1) / 2;
|
||||
buffer_height = (rb->height + 1) / 2;
|
||||
half_width = (rb->width + 3) / 4;
|
||||
half_height = (rb->height + 3) / 4;
|
||||
buffer_width = (rb->internal_width + 1) / 2;
|
||||
buffer_height = (rb->internal_height + 1) / 2;
|
||||
half_width = (rb->internal_width + 3) / 4;
|
||||
half_height = (rb->internal_height + 3) / 4;
|
||||
}
|
||||
bool uniform_sets_are_invalid = false;
|
||||
if (rb->ssao.depth.is_null()) {
|
||||
|
@ -1998,8 +2024,8 @@ void RendererSceneRenderRD::_process_ssao(RID p_render_buffers, RID p_environmen
|
|||
{
|
||||
RD::TextureFormat tf;
|
||||
tf.format = RD::DATA_FORMAT_R8_UNORM;
|
||||
tf.width = rb->width;
|
||||
tf.height = rb->height;
|
||||
tf.width = rb->internal_width;
|
||||
tf.height = rb->internal_height;
|
||||
tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT;
|
||||
rb->ssao.ao_final = RD::get_singleton()->texture_create(tf, RD::TextureView());
|
||||
RD::get_singleton()->set_resource_name(rb->ssao.ao_final, "SSAO Final");
|
||||
|
@ -2022,7 +2048,7 @@ void RendererSceneRenderRD::_process_ssao(RID p_render_buffers, RID p_environmen
|
|||
settings.blur_passes = ssao_blur_passes;
|
||||
settings.fadeout_from = ssao_fadeout_from;
|
||||
settings.fadeout_to = ssao_fadeout_to;
|
||||
settings.full_screen_size = Size2i(rb->width, rb->height);
|
||||
settings.full_screen_size = Size2i(rb->internal_width, rb->internal_height);
|
||||
settings.half_screen_size = Size2i(buffer_width, buffer_height);
|
||||
settings.quarter_screen_size = Size2i(half_width, half_height);
|
||||
|
||||
|
@ -2102,9 +2128,9 @@ void RendererSceneRenderRD::_render_buffers_post_process_and_tonemap(const Rende
|
|||
|
||||
EffectsRD::BokehBuffers buffers;
|
||||
|
||||
// Textures we use.
|
||||
buffers.base_texture_size = Size2i(rb->width, rb->height);
|
||||
buffers.base_texture = rb->texture;
|
||||
// Textures we use
|
||||
buffers.base_texture_size = Size2i(rb->internal_width, rb->internal_height);
|
||||
buffers.base_texture = rb->internal_texture;
|
||||
buffers.depth_texture = rb->depth_texture;
|
||||
buffers.secondary_texture = rb->blur[0].mipmaps[0].texture;
|
||||
buffers.half_texture[0] = rb->blur[1].mipmaps[0].texture;
|
||||
|
@ -2143,9 +2169,9 @@ void RendererSceneRenderRD::_render_buffers_post_process_and_tonemap(const Rende
|
|||
|
||||
double step = env->auto_exp_speed * time_step;
|
||||
if (can_use_storage) {
|
||||
storage->get_effects()->luminance_reduction(rb->texture, Size2i(rb->width, rb->height), rb->luminance.reduce, rb->luminance.current, env->min_luminance, env->max_luminance, step, set_immediate);
|
||||
storage->get_effects()->luminance_reduction(rb->internal_texture, Size2i(rb->internal_width, rb->internal_height), rb->luminance.reduce, rb->luminance.current, env->min_luminance, env->max_luminance, step, set_immediate);
|
||||
} else {
|
||||
storage->get_effects()->luminance_reduction_raster(rb->texture, Size2i(rb->width, rb->height), rb->luminance.reduce, rb->luminance.fb, rb->luminance.current, env->min_luminance, env->max_luminance, step, set_immediate);
|
||||
storage->get_effects()->luminance_reduction_raster(rb->internal_texture, Size2i(rb->internal_width, rb->internal_height), rb->luminance.reduce, rb->luminance.fb, rb->luminance.current, env->min_luminance, env->max_luminance, step, set_immediate);
|
||||
}
|
||||
// Swap final reduce with prev luminance.
|
||||
SWAP(rb->luminance.current, rb->luminance.reduce.write[rb->luminance.reduce.size() - 1]);
|
||||
|
@ -2188,9 +2214,9 @@ void RendererSceneRenderRD::_render_buffers_post_process_and_tonemap(const Rende
|
|||
luminance_texture = rb->luminance.current;
|
||||
}
|
||||
if (can_use_storage) {
|
||||
storage->get_effects()->gaussian_glow(rb->texture, rb->blur[1].mipmaps[i].texture, Size2i(vp_w, vp_h), env->glow_strength, glow_high_quality, true, env->glow_hdr_luminance_cap, env->exposure, env->glow_bloom, env->glow_hdr_bleed_threshold, env->glow_hdr_bleed_scale, luminance_texture, env->auto_exp_scale);
|
||||
storage->get_effects()->gaussian_glow(rb->internal_texture, rb->blur[1].mipmaps[i].texture, Size2i(vp_w, vp_h), env->glow_strength, glow_high_quality, true, env->glow_hdr_luminance_cap, env->exposure, env->glow_bloom, env->glow_hdr_bleed_threshold, env->glow_hdr_bleed_scale, luminance_texture, env->auto_exp_scale);
|
||||
} else {
|
||||
storage->get_effects()->gaussian_glow_raster(rb->texture, rb->blur[1].mipmaps[i].half_fb, rb->blur[1].mipmaps[i].half_texture, rb->blur[1].mipmaps[i].fb, Size2i(vp_w, vp_h), env->glow_strength, glow_high_quality, true, env->glow_hdr_luminance_cap, env->exposure, env->glow_bloom, env->glow_hdr_bleed_threshold, env->glow_hdr_bleed_scale, luminance_texture, env->auto_exp_scale);
|
||||
storage->get_effects()->gaussian_glow_raster(rb->internal_texture, rb->blur[1].mipmaps[i].half_fb, rb->blur[1].mipmaps[i].half_texture, rb->blur[1].mipmaps[i].fb, Size2i(vp_w, vp_h), env->glow_strength, glow_high_quality, true, env->glow_hdr_luminance_cap, env->exposure, env->glow_bloom, env->glow_hdr_bleed_threshold, env->glow_hdr_bleed_scale, luminance_texture, env->auto_exp_scale);
|
||||
}
|
||||
} else {
|
||||
if (can_use_storage) {
|
||||
|
@ -2237,7 +2263,7 @@ void RendererSceneRenderRD::_render_buffers_post_process_and_tonemap(const Rende
|
|||
}
|
||||
|
||||
tonemap.use_debanding = rb->use_debanding;
|
||||
tonemap.texture_size = Vector2i(rb->width, rb->height);
|
||||
tonemap.texture_size = Vector2i(rb->internal_width, rb->internal_height);
|
||||
|
||||
if (env) {
|
||||
tonemap.tonemap_mode = env->tone_mapper;
|
||||
|
@ -2268,7 +2294,15 @@ void RendererSceneRenderRD::_render_buffers_post_process_and_tonemap(const Rende
|
|||
tonemap.luminance_multiplier = _render_buffers_get_luminance_multiplier();
|
||||
tonemap.view_count = p_render_data->view_count;
|
||||
|
||||
storage->get_effects()->tonemapper(rb->texture, storage->render_target_get_rd_framebuffer(rb->render_target), tonemap);
|
||||
storage->get_effects()->tonemapper(rb->internal_texture, storage->render_target_get_rd_framebuffer(rb->render_target), tonemap);
|
||||
|
||||
RD::get_singleton()->draw_command_end_label();
|
||||
}
|
||||
|
||||
if (can_use_effects && can_use_storage && (rb->internal_width != rb->width || rb->internal_height != rb->height)) {
|
||||
RD::get_singleton()->draw_command_begin_label("FSR Upscale");
|
||||
|
||||
storage->get_effects()->fsr_upscale(rb->internal_texture, rb->upscale_texture, rb->texture, Size2i(rb->internal_width, rb->internal_height), Size2i(rb->width, rb->height), rb->fsr_sharpness);
|
||||
|
||||
RD::get_singleton()->draw_command_end_label();
|
||||
}
|
||||
|
@ -2628,14 +2662,28 @@ bool RendererSceneRenderRD::_render_buffers_can_be_storage() {
|
|||
return true;
|
||||
}
|
||||
|
||||
void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RenderingServer::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count) {
|
||||
void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_internal_width, int p_internal_height, int p_width, int p_height, float p_fsr_sharpness, float p_fsr_mipmap_bias, RS::ViewportMSAA p_msaa, RenderingServer::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count) {
|
||||
ERR_FAIL_COND_MSG(p_view_count == 0, "Must have at least 1 view");
|
||||
|
||||
if (!_render_buffers_can_be_storage()) {
|
||||
p_internal_height = p_height;
|
||||
p_internal_width = p_width;
|
||||
}
|
||||
|
||||
if (p_width != p_internal_width) {
|
||||
float fsr_mipmap_bias = -log2f(p_width / p_internal_width) + p_fsr_mipmap_bias;
|
||||
storage->sampler_rd_configure_custom(fsr_mipmap_bias);
|
||||
update_uniform_sets();
|
||||
}
|
||||
|
||||
RenderBuffers *rb = render_buffers_owner.get_or_null(p_render_buffers);
|
||||
|
||||
// Should we add an overrule per viewport?
|
||||
rb->internal_width = p_internal_width;
|
||||
rb->internal_height = p_internal_height;
|
||||
rb->width = p_width;
|
||||
rb->height = p_height;
|
||||
rb->fsr_sharpness = p_fsr_sharpness;
|
||||
rb->render_target = p_render_target;
|
||||
rb->msaa = p_msaa;
|
||||
rb->screen_space_aa = p_screen_space_aa;
|
||||
|
@ -2657,8 +2705,8 @@ void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p
|
|||
tf.texture_type = RD::TEXTURE_TYPE_2D_ARRAY;
|
||||
}
|
||||
tf.format = _render_buffers_get_color_format();
|
||||
tf.width = rb->width;
|
||||
tf.height = rb->height;
|
||||
tf.width = rb->internal_width; // If set to rb->width, msaa won't crash
|
||||
tf.height = rb->internal_height; // If set to rb->width, msaa won't crash
|
||||
tf.array_layers = rb->view_count; // create a layer for every view
|
||||
tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | (_render_buffers_can_be_storage() ? RD::TEXTURE_USAGE_STORAGE_BIT : 0) | RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||
if (rb->msaa != RS::VIEWPORT_MSAA_DISABLED) {
|
||||
|
@ -2666,7 +2714,17 @@ void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p
|
|||
}
|
||||
tf.usage_bits |= RD::TEXTURE_USAGE_INPUT_ATTACHMENT_BIT; // only needed when using subpasses in the mobile renderer
|
||||
|
||||
rb->texture = RD::get_singleton()->texture_create(tf, RD::TextureView());
|
||||
rb->internal_texture = RD::get_singleton()->texture_create(tf, RD::TextureView());
|
||||
|
||||
if ((p_internal_width != p_width || p_internal_height != p_height)) {
|
||||
tf.width = rb->width;
|
||||
tf.height = rb->height;
|
||||
rb->texture = RD::get_singleton()->texture_create(tf, RD::TextureView());
|
||||
rb->upscale_texture = RD::get_singleton()->texture_create(tf, RD::TextureView());
|
||||
} else {
|
||||
rb->texture = rb->internal_texture;
|
||||
rb->upscale_texture = rb->internal_texture;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -2680,8 +2738,8 @@ void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p
|
|||
tf.format = RD::DATA_FORMAT_R32_SFLOAT;
|
||||
}
|
||||
|
||||
tf.width = rb->width;
|
||||
tf.height = rb->height;
|
||||
tf.width = rb->internal_width;
|
||||
tf.height = rb->internal_height;
|
||||
tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT;
|
||||
tf.array_layers = rb->view_count; // create a layer for every view
|
||||
|
||||
|
@ -2697,16 +2755,16 @@ void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p
|
|||
if (!_render_buffers_can_be_storage()) {
|
||||
// ONLY USED ON MOBILE RENDERER, ONLY USED FOR POST EFFECTS!
|
||||
Vector<RID> fb;
|
||||
fb.push_back(rb->texture);
|
||||
fb.push_back(rb->internal_texture);
|
||||
|
||||
rb->texture_fb = RD::get_singleton()->framebuffer_create(fb, RenderingDevice::INVALID_ID, rb->view_count);
|
||||
}
|
||||
|
||||
RID target_texture = storage->render_target_get_rd_texture(rb->render_target);
|
||||
rb->data->configure(rb->texture, rb->depth_texture, target_texture, rb->width, rb->height, p_msaa, p_view_count);
|
||||
rb->data->configure(rb->internal_texture, rb->depth_texture, target_texture, p_internal_width, p_internal_height, p_msaa, p_view_count);
|
||||
|
||||
if (is_clustered_enabled()) {
|
||||
rb->cluster_builder->setup(Size2i(rb->width, rb->height), max_cluster_elements, rb->depth_texture, storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED), rb->texture);
|
||||
rb->cluster_builder->setup(Size2i(p_internal_width, p_internal_height), max_cluster_elements, rb->depth_texture, storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED), rb->internal_texture);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4704,9 +4762,7 @@ void RendererSceneRenderRD::render_scene(RID p_render_buffers, const CameraData
|
|||
if (p_render_buffers.is_valid()) {
|
||||
/*
|
||||
_debug_draw_cluster(p_render_buffers);
|
||||
|
||||
RENDER_TIMESTAMP("Tonemap");
|
||||
|
||||
_render_buffers_post_process_and_tonemap(&render_data);
|
||||
*/
|
||||
|
||||
|
|
|
@ -456,7 +456,11 @@ private:
|
|||
|
||||
struct RenderBuffers {
|
||||
RenderBufferData *data = nullptr;
|
||||
int width = 0, height = 0;
|
||||
int internal_width = 0;
|
||||
int internal_height = 0;
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
float fsr_sharpness = 0.2f;
|
||||
RS::ViewportMSAA msaa = RS::VIEWPORT_MSAA_DISABLED;
|
||||
RS::ViewportScreenSpaceAA screen_space_aa = RS::VIEWPORT_SCREEN_SPACE_AA_DISABLED;
|
||||
bool use_debanding = false;
|
||||
|
@ -466,9 +470,12 @@ private:
|
|||
|
||||
uint64_t auto_exposure_version = 1;
|
||||
|
||||
RID texture; //main texture for rendering to, must be filled after done rendering
|
||||
RID sss_texture; //texture for sss. This needs to be a different resolution than blur[0]
|
||||
RID internal_texture; //main texture for rendering to, must be filled after done rendering
|
||||
RID texture; //upscaled version of main texture (This uses the same resource as internal_texture if there is no upscaling)
|
||||
RID depth_texture; //main depth texture
|
||||
RID texture_fb; // framebuffer for the main texture, ONLY USED FOR MOBILE RENDERER POST EFFECTS, DO NOT USE FOR RENDERING 3D!!!
|
||||
RID upscale_texture; //used when upscaling internal_texture (This uses the same resource as internal_texture if there is no upscaling)
|
||||
|
||||
RendererSceneGIRD::SDFGI *sdfgi = nullptr;
|
||||
VolumetricFog *volumetric_fog = nullptr;
|
||||
|
@ -1332,7 +1339,7 @@ public:
|
|||
virtual RD::DataFormat _render_buffers_get_color_format();
|
||||
virtual bool _render_buffers_can_be_storage();
|
||||
virtual RID render_buffers_create() override;
|
||||
virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count) override;
|
||||
virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_internal_width, int p_internal_height, int p_width, int p_height, float p_fsr_sharpness, float p_fsr_mipmap_bias, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count) override;
|
||||
virtual void gi_set_use_half_resolution(bool p_enable) override;
|
||||
|
||||
RID render_buffers_get_depth_texture(RID p_render_buffers);
|
||||
|
@ -1363,6 +1370,8 @@ public:
|
|||
float render_buffers_get_volumetric_fog_end(RID p_render_buffers);
|
||||
float render_buffers_get_volumetric_fog_detail_spread(RID p_render_buffers);
|
||||
|
||||
virtual void update_uniform_sets(){};
|
||||
|
||||
virtual void render_scene(RID p_render_buffers, const CameraData *p_camera_data, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, const PagedArray<RID> &p_fog_volumes, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data = nullptr, RendererScene::RenderInfo *r_render_info = nullptr) override;
|
||||
|
||||
virtual void render_material(const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, const PagedArray<GeometryInstance *> &p_instances, RID p_framebuffer, const Rect2i &p_region) override;
|
||||
|
|
|
@ -1227,6 +1227,100 @@ RendererStorageRD::CanvasTexture::~CanvasTexture() {
|
|||
clear_sets();
|
||||
}
|
||||
|
||||
void RendererStorageRD::sampler_rd_configure_custom(float p_mipmap_bias) {
|
||||
for (int i = 1; i < RS::CANVAS_ITEM_TEXTURE_FILTER_MAX; i++) {
|
||||
for (int j = 1; j < RS::CANVAS_ITEM_TEXTURE_REPEAT_MAX; j++) {
|
||||
RD::SamplerState sampler_state;
|
||||
switch (i) {
|
||||
case RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST: {
|
||||
sampler_state.mag_filter = RD::SAMPLER_FILTER_NEAREST;
|
||||
sampler_state.min_filter = RD::SAMPLER_FILTER_NEAREST;
|
||||
sampler_state.max_lod = 0;
|
||||
} break;
|
||||
case RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR: {
|
||||
sampler_state.mag_filter = RD::SAMPLER_FILTER_LINEAR;
|
||||
sampler_state.min_filter = RD::SAMPLER_FILTER_LINEAR;
|
||||
sampler_state.max_lod = 0;
|
||||
} break;
|
||||
case RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS: {
|
||||
sampler_state.mag_filter = RD::SAMPLER_FILTER_NEAREST;
|
||||
sampler_state.min_filter = RD::SAMPLER_FILTER_NEAREST;
|
||||
if (GLOBAL_GET("rendering/textures/default_filters/use_nearest_mipmap_filter")) {
|
||||
sampler_state.mip_filter = RD::SAMPLER_FILTER_NEAREST;
|
||||
} else {
|
||||
sampler_state.mip_filter = RD::SAMPLER_FILTER_LINEAR;
|
||||
}
|
||||
sampler_state.lod_bias = p_mipmap_bias;
|
||||
} break;
|
||||
case RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS: {
|
||||
sampler_state.mag_filter = RD::SAMPLER_FILTER_LINEAR;
|
||||
sampler_state.min_filter = RD::SAMPLER_FILTER_LINEAR;
|
||||
if (GLOBAL_GET("rendering/textures/default_filters/use_nearest_mipmap_filter")) {
|
||||
sampler_state.mip_filter = RD::SAMPLER_FILTER_NEAREST;
|
||||
} else {
|
||||
sampler_state.mip_filter = RD::SAMPLER_FILTER_LINEAR;
|
||||
}
|
||||
sampler_state.lod_bias = p_mipmap_bias;
|
||||
|
||||
} break;
|
||||
case RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC: {
|
||||
sampler_state.mag_filter = RD::SAMPLER_FILTER_NEAREST;
|
||||
sampler_state.min_filter = RD::SAMPLER_FILTER_NEAREST;
|
||||
if (GLOBAL_GET("rendering/textures/default_filters/use_nearest_mipmap_filter")) {
|
||||
sampler_state.mip_filter = RD::SAMPLER_FILTER_NEAREST;
|
||||
} else {
|
||||
sampler_state.mip_filter = RD::SAMPLER_FILTER_LINEAR;
|
||||
}
|
||||
sampler_state.lod_bias = p_mipmap_bias;
|
||||
sampler_state.use_anisotropy = true;
|
||||
sampler_state.anisotropy_max = 1 << int(GLOBAL_GET("rendering/textures/default_filters/anisotropic_filtering_level"));
|
||||
} break;
|
||||
case RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC: {
|
||||
sampler_state.mag_filter = RD::SAMPLER_FILTER_LINEAR;
|
||||
sampler_state.min_filter = RD::SAMPLER_FILTER_LINEAR;
|
||||
if (GLOBAL_GET("rendering/textures/default_filters/use_nearest_mipmap_filter")) {
|
||||
sampler_state.mip_filter = RD::SAMPLER_FILTER_NEAREST;
|
||||
} else {
|
||||
sampler_state.mip_filter = RD::SAMPLER_FILTER_LINEAR;
|
||||
}
|
||||
sampler_state.lod_bias = p_mipmap_bias;
|
||||
sampler_state.use_anisotropy = true;
|
||||
sampler_state.anisotropy_max = 1 << int(GLOBAL_GET("rendering/textures/default_filters/anisotropic_filtering_level"));
|
||||
|
||||
} break;
|
||||
default: {
|
||||
}
|
||||
}
|
||||
switch (j) {
|
||||
case RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED: {
|
||||
sampler_state.repeat_u = RD::SAMPLER_REPEAT_MODE_CLAMP_TO_EDGE;
|
||||
sampler_state.repeat_v = RD::SAMPLER_REPEAT_MODE_CLAMP_TO_EDGE;
|
||||
sampler_state.repeat_w = RD::SAMPLER_REPEAT_MODE_CLAMP_TO_EDGE;
|
||||
|
||||
} break;
|
||||
case RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED: {
|
||||
sampler_state.repeat_u = RD::SAMPLER_REPEAT_MODE_REPEAT;
|
||||
sampler_state.repeat_v = RD::SAMPLER_REPEAT_MODE_REPEAT;
|
||||
sampler_state.repeat_w = RD::SAMPLER_REPEAT_MODE_REPEAT;
|
||||
} break;
|
||||
case RS::CANVAS_ITEM_TEXTURE_REPEAT_MIRROR: {
|
||||
sampler_state.repeat_u = RD::SAMPLER_REPEAT_MODE_MIRRORED_REPEAT;
|
||||
sampler_state.repeat_v = RD::SAMPLER_REPEAT_MODE_MIRRORED_REPEAT;
|
||||
sampler_state.repeat_w = RD::SAMPLER_REPEAT_MODE_MIRRORED_REPEAT;
|
||||
} break;
|
||||
default: {
|
||||
}
|
||||
}
|
||||
|
||||
if (custom_rd_samplers[i][j].is_valid()) {
|
||||
RD::get_singleton()->free(custom_rd_samplers[i][j]);
|
||||
}
|
||||
|
||||
custom_rd_samplers[i][j] = RD::get_singleton()->sampler_create(sampler_state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RID RendererStorageRD::canvas_texture_allocate() {
|
||||
return canvas_texture_owner.allocate_rid();
|
||||
}
|
||||
|
@ -9774,6 +9868,9 @@ RendererStorageRD::RendererStorageRD() {
|
|||
}
|
||||
}
|
||||
|
||||
//custom sampler
|
||||
sampler_rd_configure_custom(0.0f);
|
||||
|
||||
//default rd buffers
|
||||
{
|
||||
Vector<uint8_t> buffer;
|
||||
|
@ -10104,6 +10201,15 @@ RendererStorageRD::~RendererStorageRD() {
|
|||
}
|
||||
}
|
||||
|
||||
//custom samplers
|
||||
for (int i = 1; i < RS::CANVAS_ITEM_TEXTURE_FILTER_MAX; i++) {
|
||||
for (int j = 0; j < RS::CANVAS_ITEM_TEXTURE_REPEAT_MAX; j++) {
|
||||
if (custom_rd_samplers[i][j].is_valid()) {
|
||||
RD::get_singleton()->free(custom_rd_samplers[i][j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//def buffers
|
||||
for (int i = 0; i < DEFAULT_RD_BUFFER_MAX; i++) {
|
||||
RD::get_singleton()->free(mesh_default_rd_buffers[i]);
|
||||
|
|
|
@ -320,6 +320,7 @@ private:
|
|||
|
||||
RID default_rd_textures[DEFAULT_RD_TEXTURE_MAX];
|
||||
RID default_rd_samplers[RS::CANVAS_ITEM_TEXTURE_FILTER_MAX][RS::CANVAS_ITEM_TEXTURE_REPEAT_MAX];
|
||||
RID custom_rd_samplers[RS::CANVAS_ITEM_TEXTURE_FILTER_MAX][RS::CANVAS_ITEM_TEXTURE_REPEAT_MAX];
|
||||
RID default_rd_storage_buffer;
|
||||
|
||||
/* DECAL ATLAS */
|
||||
|
@ -1391,6 +1392,13 @@ public:
|
|||
_FORCE_INLINE_ RID sampler_rd_get_default(RS::CanvasItemTextureFilter p_filter, RS::CanvasItemTextureRepeat p_repeat) {
|
||||
return default_rd_samplers[p_filter][p_repeat];
|
||||
}
|
||||
_FORCE_INLINE_ RID sampler_rd_get_custom(RS::CanvasItemTextureFilter p_filter, RS::CanvasItemTextureRepeat p_repeat) {
|
||||
return custom_rd_samplers[p_filter][p_repeat];
|
||||
}
|
||||
|
||||
void sampler_rd_configure_custom(float mipmap_bias);
|
||||
|
||||
void sampler_rd_set_default(float p_mipmap_bias);
|
||||
|
||||
/* CANVAS TEXTURE API */
|
||||
|
||||
|
|
|
@ -0,0 +1,173 @@
|
|||
/*************************************************************************/
|
||||
/* fsr_upscale.glsl */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#[compute]
|
||||
|
||||
#version 450
|
||||
|
||||
#VERSION_DEFINES
|
||||
|
||||
#define A_GPU
|
||||
#define A_GLSL
|
||||
|
||||
#ifdef MODE_FSR_UPSCALE_NORMAL
|
||||
|
||||
#define A_HALF
|
||||
|
||||
#endif
|
||||
|
||||
#include "thirdparty/amd-fsr/ffx_a.h"
|
||||
|
||||
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(rgba16f, set = 1, binding = 0) uniform restrict writeonly image2D fsr_image;
|
||||
layout(set = 0, binding = 0) uniform sampler2D source_image;
|
||||
|
||||
#define FSR_UPSCALE_PASS_TYPE_EASU 0
|
||||
#define FSR_UPSCALE_PASS_TYPE_RCAS 1
|
||||
|
||||
layout(push_constant, binding = 1, std430) uniform Params {
|
||||
float resolution_width;
|
||||
float resolution_height;
|
||||
float upscaled_width;
|
||||
float upscaled_height;
|
||||
float sharpness;
|
||||
int pass;
|
||||
}
|
||||
params;
|
||||
|
||||
AU4 Const0, Const1, Const2, Const3;
|
||||
|
||||
#ifdef MODE_FSR_UPSCALE_FALLBACK
|
||||
|
||||
#define FSR_EASU_F
|
||||
AF4 FsrEasuRF(AF2 p) {
|
||||
AF4 res = textureGather(source_image, p, 0);
|
||||
return res;
|
||||
}
|
||||
AF4 FsrEasuGF(AF2 p) {
|
||||
AF4 res = textureGather(source_image, p, 1);
|
||||
return res;
|
||||
}
|
||||
AF4 FsrEasuBF(AF2 p) {
|
||||
AF4 res = textureGather(source_image, p, 2);
|
||||
return res;
|
||||
}
|
||||
|
||||
#define FSR_RCAS_F
|
||||
AF4 FsrRcasLoadF(ASU2 p) {
|
||||
return AF4(texelFetch(source_image, ASU2(p), 0));
|
||||
}
|
||||
void FsrRcasInputF(inout AF1 r, inout AF1 g, inout AF1 b) {}
|
||||
|
||||
#else
|
||||
|
||||
#define FSR_EASU_H
|
||||
AH4 FsrEasuRH(AF2 p) {
|
||||
AH4 res = AH4(textureGather(source_image, p, 0));
|
||||
return res;
|
||||
}
|
||||
AH4 FsrEasuGH(AF2 p) {
|
||||
AH4 res = AH4(textureGather(source_image, p, 1));
|
||||
return res;
|
||||
}
|
||||
AH4 FsrEasuBH(AF2 p) {
|
||||
AH4 res = AH4(textureGather(source_image, p, 2));
|
||||
return res;
|
||||
}
|
||||
|
||||
#define FSR_RCAS_H
|
||||
AH4 FsrRcasLoadH(ASW2 p) {
|
||||
return AH4(texelFetch(source_image, ASU2(p), 0));
|
||||
}
|
||||
void FsrRcasInputH(inout AH1 r, inout AH1 g, inout AH1 b) {}
|
||||
|
||||
#endif
|
||||
|
||||
#include "thirdparty/amd-fsr/ffx_fsr1.h"
|
||||
|
||||
void fsr_easu_pass(AU2 pos) {
|
||||
#ifdef MODE_FSR_UPSCALE_NORMAL
|
||||
|
||||
AH3 Gamma2Color = AH3(0, 0, 0);
|
||||
FsrEasuH(Gamma2Color, pos, Const0, Const1, Const2, Const3);
|
||||
imageStore(fsr_image, ASU2(pos), AH4(Gamma2Color, 1));
|
||||
|
||||
#else
|
||||
|
||||
AF3 Gamma2Color = AF3(0, 0, 0);
|
||||
FsrEasuF(Gamma2Color, pos, Const0, Const1, Const2, Const3);
|
||||
imageStore(fsr_image, ASU2(pos), AF4(Gamma2Color, 1));
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void fsr_rcas_pass(AU2 pos) {
|
||||
#ifdef MODE_FSR_UPSCALE_NORMAL
|
||||
|
||||
AH3 Gamma2Color = AH3(0, 0, 0);
|
||||
FsrRcasH(Gamma2Color.r, Gamma2Color.g, Gamma2Color.b, pos, Const0);
|
||||
imageStore(fsr_image, ASU2(pos), AH4(Gamma2Color, 1));
|
||||
|
||||
#else
|
||||
|
||||
AF3 Gamma2Color = AF3(0, 0, 0);
|
||||
FsrRcasF(Gamma2Color.r, Gamma2Color.g, Gamma2Color.b, pos, Const0);
|
||||
imageStore(fsr_image, ASU2(pos), AF4(Gamma2Color, 1));
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void fsr_pass(AU2 pos) {
|
||||
if (params.pass == FSR_UPSCALE_PASS_TYPE_EASU) {
|
||||
fsr_easu_pass(pos);
|
||||
} else if (params.pass == FSR_UPSCALE_PASS_TYPE_RCAS) {
|
||||
fsr_rcas_pass(pos);
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
// Clang does not like unused functions. If ffx_a.h is included in the binary, clang will throw a fit and not compile so we must configure FSR in this shader
|
||||
if (params.pass == FSR_UPSCALE_PASS_TYPE_EASU) {
|
||||
FsrEasuCon(Const0, Const1, Const2, Const3, params.resolution_width, params.resolution_height, params.resolution_width, params.resolution_height, params.upscaled_width, params.upscaled_height);
|
||||
} else if (params.pass == FSR_UPSCALE_PASS_TYPE_RCAS) {
|
||||
FsrRcasCon(Const0, params.sharpness);
|
||||
}
|
||||
|
||||
AU2 gxy = ARmp8x8(gl_LocalInvocationID.x) + AU2(gl_WorkGroupID.x << 4u, gl_WorkGroupID.y << 4u);
|
||||
|
||||
fsr_pass(gxy);
|
||||
gxy.x += 8u;
|
||||
fsr_pass(gxy);
|
||||
gxy.y += 8u;
|
||||
fsr_pass(gxy);
|
||||
gxy.x -= 8u;
|
||||
fsr_pass(gxy);
|
||||
}
|
|
@ -191,7 +191,7 @@ public:
|
|||
|
||||
virtual RID render_buffers_create() = 0;
|
||||
|
||||
virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count) = 0;
|
||||
virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_internal_width, int p_internal_height, int p_width, int p_height, float p_fsr_sharpness, float p_fsr_mipmap_bias, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count) = 0;
|
||||
|
||||
virtual void gi_set_use_half_resolution(bool p_enable) = 0;
|
||||
|
||||
|
|
|
@ -1155,7 +1155,7 @@ public:
|
|||
/* Render Buffers */
|
||||
|
||||
PASS0R(RID, render_buffers_create)
|
||||
PASS8(render_buffers_configure, RID, RID, int, int, RS::ViewportMSAA, RS::ViewportScreenSpaceAA, bool, uint32_t)
|
||||
PASS12(render_buffers_configure, RID, RID, int, int, int, int, float, float, RS::ViewportMSAA, RS::ViewportScreenSpaceAA, bool, uint32_t)
|
||||
PASS1(gi_set_use_half_resolution, bool)
|
||||
|
||||
/* Shadow Atlas */
|
||||
|
|
|
@ -256,7 +256,7 @@ public:
|
|||
virtual void set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw) = 0;
|
||||
|
||||
virtual RID render_buffers_create() = 0;
|
||||
virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count) = 0;
|
||||
virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_internal_width, int p_internal_height, int p_width, int p_height, float p_fsr_sharpness, float p_fsr_mipmap_bias, RS::ViewportMSAA p_msaa, RS::ViewportScreenSpaceAA p_screen_space_aa, bool p_use_debanding, uint32_t p_view_count) = 0;
|
||||
virtual void gi_set_use_half_resolution(bool p_enable) = 0;
|
||||
|
||||
virtual void screen_space_roughness_limiter_set_active(bool p_enable, float p_amount, float p_limit) = 0;
|
||||
|
|
|
@ -77,18 +77,69 @@ void RendererViewport::_configure_3d_render_buffers(Viewport *p_viewport) {
|
|||
RSG::scene->free(p_viewport->render_buffers);
|
||||
p_viewport->render_buffers = RID();
|
||||
} else {
|
||||
float scale_3d = p_viewport->scale_3d;
|
||||
if (Engine::get_singleton()->is_editor_hint()) {
|
||||
// Ignore the 3D viewport render scaling inside of the editor.
|
||||
// The Half Resolution 3D editor viewport option should be used instead.
|
||||
scale_3d = 1.0;
|
||||
float scaling_3d_scale = p_viewport->scaling_3d_scale;
|
||||
|
||||
RS::ViewportScaling3DMode scaling_3d_mode = p_viewport->scaling_3d_mode;
|
||||
bool scaling_enabled = true;
|
||||
|
||||
if ((scaling_3d_mode == RS::VIEWPORT_SCALING_3D_MODE_FSR) && (scaling_3d_scale > 1.0)) {
|
||||
// FSR is not design for downsampling.
|
||||
// Throw a warning and fallback to VIEWPORT_SCALING_3D_MODE_BILINEAR
|
||||
print_error("FSR does not support supersampling. Falling back to bilinear mode.");
|
||||
scaling_3d_mode = RS::VIEWPORT_SCALING_3D_MODE_BILINEAR;
|
||||
}
|
||||
|
||||
// Clamp 3D rendering resolution to reasonable values supported on most hardware.
|
||||
// This prevents freezing the engine or outright crashing on lower-end GPUs.
|
||||
const int width = CLAMP(p_viewport->size.width * scale_3d, 1, 16384);
|
||||
const int height = CLAMP(p_viewport->size.height * scale_3d, 1, 16384);
|
||||
RSG::scene->render_buffers_configure(p_viewport->render_buffers, p_viewport->render_target, width, height, p_viewport->msaa, p_viewport->screen_space_aa, p_viewport->use_debanding, p_viewport->get_view_count());
|
||||
if ((scaling_3d_mode == RS::VIEWPORT_SCALING_3D_MODE_FSR) && !p_viewport->fsr_enabled) {
|
||||
// FSR is not actually available.
|
||||
// Throw a warning and fallback to disable scaling
|
||||
print_error("FSR is not available. Disabled FSR scaling 3D. Try bilinear mode.");
|
||||
scaling_enabled = false;
|
||||
}
|
||||
|
||||
if (scaling_3d_scale == 1.0) {
|
||||
scaling_enabled = false;
|
||||
}
|
||||
|
||||
int width;
|
||||
int height;
|
||||
int render_width;
|
||||
int render_height;
|
||||
|
||||
if (scaling_enabled) {
|
||||
switch (scaling_3d_mode) {
|
||||
case RS::VIEWPORT_SCALING_3D_MODE_BILINEAR:
|
||||
// Clamp 3D rendering resolution to reasonable values supported on most hardware.
|
||||
// This prevents freezing the engine or outright crashing on lower-end GPUs.
|
||||
width = CLAMP(p_viewport->size.width * scaling_3d_scale, 1, 16384);
|
||||
height = CLAMP(p_viewport->size.height * scaling_3d_scale, 1, 16384);
|
||||
render_width = width;
|
||||
render_height = height;
|
||||
break;
|
||||
case RS::VIEWPORT_SCALING_3D_MODE_FSR:
|
||||
width = p_viewport->size.width;
|
||||
height = p_viewport->size.height;
|
||||
render_width = MAX(width * scaling_3d_scale, 1.0); // width / (width * scaling)
|
||||
render_height = MAX(height * scaling_3d_scale, 1.0);
|
||||
break;
|
||||
default:
|
||||
// This is an unknown mode.
|
||||
print_error(vformat("Unknown scaling mode: %d, disabling scaling 3D", scaling_3d_mode));
|
||||
width = p_viewport->size.width;
|
||||
height = p_viewport->size.height;
|
||||
render_width = width;
|
||||
render_height = height;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
width = p_viewport->size.width;
|
||||
height = p_viewport->size.height;
|
||||
render_width = width;
|
||||
render_height = height;
|
||||
}
|
||||
|
||||
p_viewport->internal_size = Size2(render_width, render_height);
|
||||
|
||||
RSG::scene->render_buffers_configure(p_viewport->render_buffers, p_viewport->render_target, render_width, render_height, width, height, p_viewport->fsr_sharpness, p_viewport->fsr_mipmap_bias, p_viewport->msaa, p_viewport->screen_space_aa, p_viewport->use_debanding, p_viewport->get_view_count());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +168,7 @@ void RendererViewport::_draw_3d(Viewport *p_viewport) {
|
|||
}
|
||||
|
||||
float screen_lod_threshold = p_viewport->lod_threshold / float(p_viewport->size.width);
|
||||
RSG::scene->render_camera(p_viewport->render_buffers, p_viewport->camera, p_viewport->scenario, p_viewport->self, p_viewport->size, screen_lod_threshold, p_viewport->shadow_atlas, xr_interface, &p_viewport->render_info);
|
||||
RSG::scene->render_camera(p_viewport->render_buffers, p_viewport->camera, p_viewport->scenario, p_viewport->self, p_viewport->internal_size, screen_lod_threshold, p_viewport->shadow_atlas, xr_interface, &p_viewport->render_info);
|
||||
|
||||
RENDER_TIMESTAMP("<End Rendering 3D Scene");
|
||||
}
|
||||
|
@ -571,7 +622,7 @@ void RendererViewport::draw_viewports() {
|
|||
// override our size, make sure it matches our required size and is created as a stereo target
|
||||
vp->size = xr_interface->get_render_target_size();
|
||||
uint32_t view_count = xr_interface->get_view_count();
|
||||
RSG::storage->render_target_set_size(vp->render_target, vp->size.x, vp->size.y, view_count);
|
||||
RSG::storage->render_target_set_size(vp->render_target, vp->internal_size.x, vp->internal_size.y, view_count);
|
||||
|
||||
// check for an external texture destination (disabled for now, not yet supported)
|
||||
// RSG::storage->render_target_set_external_texture(vp->render_target, xr_interface->get_external_texture_for_eye(leftOrMono));
|
||||
|
@ -662,6 +713,8 @@ void RendererViewport::viewport_initialize(RID p_rid) {
|
|||
viewport->render_target = RSG::storage->render_target_create();
|
||||
viewport->shadow_atlas = RSG::scene->shadow_atlas_create();
|
||||
viewport->viewport_render_direct_to_screen = false;
|
||||
|
||||
viewport->fsr_enabled = !RSG::rasterizer->is_low_end() && !viewport->disable_3d;
|
||||
}
|
||||
|
||||
void RendererViewport::viewport_set_use_xr(RID p_viewport, bool p_use_xr) {
|
||||
|
@ -676,18 +729,42 @@ void RendererViewport::viewport_set_use_xr(RID p_viewport, bool p_use_xr) {
|
|||
_configure_3d_render_buffers(viewport);
|
||||
}
|
||||
|
||||
void RendererViewport::viewport_set_scale_3d(RID p_viewport, float p_scale_3d) {
|
||||
void RendererViewport::viewport_set_scaling_3d_mode(RID p_viewport, RS::ViewportScaling3DMode p_mode) {
|
||||
Viewport *viewport = viewport_owner.get_or_null(p_viewport);
|
||||
ERR_FAIL_COND(!viewport);
|
||||
|
||||
viewport->scaling_3d_mode = p_mode;
|
||||
_configure_3d_render_buffers(viewport);
|
||||
}
|
||||
|
||||
void RendererViewport::viewport_set_fsr_sharpness(RID p_viewport, float p_sharpness) {
|
||||
Viewport *viewport = viewport_owner.get_or_null(p_viewport);
|
||||
ERR_FAIL_COND(!viewport);
|
||||
|
||||
viewport->fsr_sharpness = p_sharpness;
|
||||
_configure_3d_render_buffers(viewport);
|
||||
}
|
||||
|
||||
void RendererViewport::viewport_set_fsr_mipmap_bias(RID p_viewport, float p_mipmap_bias) {
|
||||
Viewport *viewport = viewport_owner.get_or_null(p_viewport);
|
||||
ERR_FAIL_COND(!viewport);
|
||||
|
||||
viewport->fsr_mipmap_bias = p_mipmap_bias;
|
||||
_configure_3d_render_buffers(viewport);
|
||||
}
|
||||
|
||||
void RendererViewport::viewport_set_scaling_3d_scale(RID p_viewport, float p_scaling_3d_scale) {
|
||||
Viewport *viewport = viewport_owner.get_or_null(p_viewport);
|
||||
ERR_FAIL_COND(!viewport);
|
||||
|
||||
// Clamp to reasonable values that are actually useful.
|
||||
// Values above 2.0 don't serve a practical purpose since the viewport
|
||||
// isn't displayed with mipmaps.
|
||||
if (viewport->scale_3d == CLAMP(p_scale_3d, 0.1, 2.0)) {
|
||||
if (viewport->scaling_3d_scale == CLAMP(p_scaling_3d_scale, 0.1, 2.0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
viewport->scale_3d = CLAMP(p_scale_3d, 0.1, 2.0);
|
||||
viewport->scaling_3d_scale = CLAMP(p_scaling_3d_scale, 0.1, 2.0);
|
||||
_configure_3d_render_buffers(viewport);
|
||||
}
|
||||
|
||||
|
@ -713,6 +790,7 @@ void RendererViewport::viewport_set_size(RID p_viewport, int p_width, int p_heig
|
|||
ERR_FAIL_COND(!viewport);
|
||||
|
||||
viewport->size = Size2(p_width, p_height);
|
||||
|
||||
uint32_t view_count = viewport->get_view_count();
|
||||
RSG::storage->render_target_set_size(viewport->render_target, p_width, p_height, view_count);
|
||||
_configure_3d_render_buffers(viewport);
|
||||
|
@ -765,7 +843,7 @@ void RendererViewport::viewport_attach_to_screen(RID p_viewport, const Rect2 &p_
|
|||
// if render_direct_to_screen was used, reset size and position
|
||||
if (RSG::rasterizer->is_low_end() && viewport->viewport_render_direct_to_screen) {
|
||||
RSG::storage->render_target_set_position(viewport->render_target, 0, 0);
|
||||
RSG::storage->render_target_set_size(viewport->render_target, viewport->size.x, viewport->size.y, viewport->get_view_count());
|
||||
RSG::storage->render_target_set_size(viewport->render_target, viewport->internal_size.x, viewport->internal_size.y, viewport->get_view_count());
|
||||
}
|
||||
|
||||
viewport->viewport_to_screen_rect = Rect2();
|
||||
|
|
|
@ -49,12 +49,16 @@ public:
|
|||
|
||||
bool use_xr; /* use xr interface to override camera positioning and projection matrices and control output */
|
||||
|
||||
float scale_3d = 1.0;
|
||||
|
||||
Size2i internal_size;
|
||||
Size2i size;
|
||||
RID camera;
|
||||
RID scenario;
|
||||
|
||||
RS::ViewportScaling3DMode scaling_3d_mode;
|
||||
float scaling_3d_scale = 1.0;
|
||||
float fsr_sharpness = 0.2f;
|
||||
float fsr_mipmap_bias = 0.0f;
|
||||
bool fsr_enabled;
|
||||
RS::ViewportUpdateMode update_mode;
|
||||
RID render_target;
|
||||
RID render_target_texture;
|
||||
|
@ -207,7 +211,6 @@ public:
|
|||
void viewport_initialize(RID p_rid);
|
||||
|
||||
void viewport_set_use_xr(RID p_viewport, bool p_use_xr);
|
||||
void viewport_set_scale_3d(RID p_viewport, float p_scale_3d);
|
||||
|
||||
void viewport_set_size(RID p_viewport, int p_width, int p_height);
|
||||
|
||||
|
@ -216,6 +219,12 @@ public:
|
|||
|
||||
void viewport_set_active(RID p_viewport, bool p_active);
|
||||
void viewport_set_parent_viewport(RID p_viewport, RID p_parent_viewport);
|
||||
|
||||
void viewport_set_scaling_3d_mode(RID p_viewport, RS::ViewportScaling3DMode p_mode);
|
||||
void viewport_set_scaling_3d_scale(RID p_viewport, float p_scaling_3d_scale);
|
||||
void viewport_set_fsr_sharpness(RID p_viewport, float p_sharpness);
|
||||
void viewport_set_fsr_mipmap_bias(RID p_viewport, float p_mipmap_bias);
|
||||
|
||||
void viewport_set_update_mode(RID p_viewport, RS::ViewportUpdateMode p_mode);
|
||||
void viewport_set_vflip(RID p_viewport, bool p_enable);
|
||||
|
||||
|
|
|
@ -120,6 +120,7 @@ public:
|
|||
|
||||
// features
|
||||
bool supports_multiview = false; // If true this device supports multiview options
|
||||
bool supports_fsr_half_float = false; // If true this device supports FSR scaling 3D in half float mode, otherwise use the fallback mode
|
||||
};
|
||||
|
||||
typedef String (*ShaderSPIRVGetCacheKeyFunction)(const Capabilities *p_capabilities);
|
||||
|
|
|
@ -528,7 +528,6 @@ public:
|
|||
FUNCRIDSPLIT(viewport)
|
||||
|
||||
FUNC2(viewport_set_use_xr, RID, bool)
|
||||
FUNC2(viewport_set_scale_3d, RID, float)
|
||||
FUNC3(viewport_set_size, RID, int, int)
|
||||
|
||||
FUNC2(viewport_set_active, RID, bool)
|
||||
|
@ -539,6 +538,11 @@ public:
|
|||
FUNC3(viewport_attach_to_screen, RID, const Rect2 &, int)
|
||||
FUNC2(viewport_set_render_direct_to_screen, RID, bool)
|
||||
|
||||
FUNC2(viewport_set_scaling_3d_mode, RID, ViewportScaling3DMode)
|
||||
FUNC2(viewport_set_scaling_3d_scale, RID, float)
|
||||
FUNC2(viewport_set_fsr_sharpness, RID, float)
|
||||
FUNC2(viewport_set_fsr_mipmap_bias, RID, float)
|
||||
|
||||
FUNC2(viewport_set_update_mode, RID, ViewportUpdateMode)
|
||||
|
||||
FUNC1RC(RID, viewport_get_texture, RID)
|
||||
|
|
|
@ -2165,13 +2165,16 @@ void RenderingServer::_bind_methods() {
|
|||
|
||||
ClassDB::bind_method(D_METHOD("viewport_create"), &RenderingServer::viewport_create);
|
||||
ClassDB::bind_method(D_METHOD("viewport_set_use_xr", "viewport", "use_xr"), &RenderingServer::viewport_set_use_xr);
|
||||
ClassDB::bind_method(D_METHOD("viewport_set_scale_3d", "viewport", "scale"), &RenderingServer::viewport_set_scale_3d);
|
||||
ClassDB::bind_method(D_METHOD("viewport_set_size", "viewport", "width", "height"), &RenderingServer::viewport_set_size);
|
||||
ClassDB::bind_method(D_METHOD("viewport_set_active", "viewport", "active"), &RenderingServer::viewport_set_active);
|
||||
ClassDB::bind_method(D_METHOD("viewport_set_parent_viewport", "viewport", "parent_viewport"), &RenderingServer::viewport_set_parent_viewport);
|
||||
ClassDB::bind_method(D_METHOD("viewport_attach_to_screen", "viewport", "rect", "screen"), &RenderingServer::viewport_attach_to_screen, DEFVAL(Rect2()), DEFVAL(DisplayServer::MAIN_WINDOW_ID));
|
||||
ClassDB::bind_method(D_METHOD("viewport_set_render_direct_to_screen", "viewport", "enabled"), &RenderingServer::viewport_set_render_direct_to_screen);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("viewport_set_scaling_3d_mode", "viewport", "scaling_3d_mode"), &RenderingServer::viewport_set_scaling_3d_mode);
|
||||
ClassDB::bind_method(D_METHOD("viewport_set_scaling_3d_scale", "viewport", "scale"), &RenderingServer::viewport_set_scaling_3d_scale);
|
||||
ClassDB::bind_method(D_METHOD("viewport_set_fsr_sharpness", "viewport", "sharpness"), &RenderingServer::viewport_set_fsr_sharpness);
|
||||
ClassDB::bind_method(D_METHOD("viewport_set_fsr_mipmap_bias", "viewport", "mipmap_bias"), &RenderingServer::viewport_set_fsr_mipmap_bias);
|
||||
ClassDB::bind_method(D_METHOD("viewport_set_update_mode", "viewport", "update_mode"), &RenderingServer::viewport_set_update_mode);
|
||||
ClassDB::bind_method(D_METHOD("viewport_set_clear_mode", "viewport", "clear_mode"), &RenderingServer::viewport_set_clear_mode);
|
||||
ClassDB::bind_method(D_METHOD("viewport_get_texture", "viewport"), &RenderingServer::viewport_get_texture);
|
||||
|
@ -2213,6 +2216,10 @@ void RenderingServer::_bind_methods() {
|
|||
|
||||
ClassDB::bind_method(D_METHOD("viewport_get_measured_render_time_gpu", "viewport"), &RenderingServer::viewport_get_measured_render_time_gpu);
|
||||
|
||||
BIND_ENUM_CONSTANT(VIEWPORT_SCALING_3D_MODE_BILINEAR);
|
||||
BIND_ENUM_CONSTANT(VIEWPORT_SCALING_3D_MODE_FSR);
|
||||
BIND_ENUM_CONSTANT(VIEWPORT_SCALING_3D_MODE_MAX);
|
||||
|
||||
BIND_ENUM_CONSTANT(VIEWPORT_UPDATE_DISABLED);
|
||||
BIND_ENUM_CONSTANT(VIEWPORT_UPDATE_ONCE); //then goes to disabled); must be manually updated
|
||||
BIND_ENUM_CONSTANT(VIEWPORT_UPDATE_WHEN_VISIBLE); // default
|
||||
|
@ -2837,12 +2844,6 @@ RenderingServer::RenderingServer() {
|
|||
GLOBAL_DEF("rendering/vulkan/staging_buffer/texture_upload_region_size_px", 64);
|
||||
GLOBAL_DEF("rendering/vulkan/descriptor_pools/max_descriptors_per_pool", 64);
|
||||
|
||||
GLOBAL_DEF("rendering/3d/viewport/scale", 1.0);
|
||||
ProjectSettings::get_singleton()->set_custom_property_info("rendering/3d/viewport/scale",
|
||||
PropertyInfo(Variant::FLOAT,
|
||||
"rendering/3d/viewport/scale",
|
||||
PROPERTY_HINT_RANGE, "0.25,2.0,0.01"));
|
||||
|
||||
GLOBAL_DEF("rendering/shader_compiler/shader_cache/enabled", true);
|
||||
GLOBAL_DEF("rendering/shader_compiler/shader_cache/compress", true);
|
||||
GLOBAL_DEF("rendering/shader_compiler/shader_cache/use_zstd_compression", true);
|
||||
|
@ -2903,6 +2904,29 @@ RenderingServer::RenderingServer() {
|
|||
ProjectSettings::get_singleton()->set_custom_property_info("rendering/anti_aliasing/screen_space_roughness_limiter/amount", PropertyInfo(Variant::FLOAT, "rendering/anti_aliasing/screen_space_roughness_limiter/amount", PROPERTY_HINT_RANGE, "0.01,4.0,0.01"));
|
||||
ProjectSettings::get_singleton()->set_custom_property_info("rendering/anti_aliasing/screen_space_roughness_limiter/limit", PropertyInfo(Variant::FLOAT, "rendering/anti_aliasing/screen_space_roughness_limiter/limit", PROPERTY_HINT_RANGE, "0.01,1.0,0.01"));
|
||||
|
||||
GLOBAL_DEF_RST("rendering/scaling_3d/mode", 0);
|
||||
GLOBAL_DEF_RST("rendering/scaling_3d/scale", 1.0);
|
||||
GLOBAL_DEF_RST("rendering/scaling_3d/fsr_sharpness", 0.2f);
|
||||
GLOBAL_DEF_RST("rendering/scaling_3d/fsr_mipmap_bias", 0.0f);
|
||||
ProjectSettings::get_singleton()->set_custom_property_info("rendering/scaling_3d/mode",
|
||||
PropertyInfo(Variant::INT,
|
||||
"rendering/scaling_3d/mode",
|
||||
PROPERTY_HINT_ENUM, "Bilinear (Fastest),FSR (Fast)"));
|
||||
|
||||
ProjectSettings::get_singleton()->set_custom_property_info("rendering/scaling_3d/scale",
|
||||
PropertyInfo(Variant::FLOAT,
|
||||
"rendering/scaling_3d/scale",
|
||||
PROPERTY_HINT_RANGE, "0.25,2.0,0.01"));
|
||||
|
||||
ProjectSettings::get_singleton()->set_custom_property_info("rendering/scaling_3d/fsr_sharpness",
|
||||
PropertyInfo(Variant::FLOAT,
|
||||
"rendering/scaling_3d/fsr_sharpness",
|
||||
PROPERTY_HINT_RANGE, "0,2,0.1"));
|
||||
ProjectSettings::get_singleton()->set_custom_property_info("rendering/scaling_3d/fsr_mipmap_bias",
|
||||
PropertyInfo(Variant::FLOAT,
|
||||
"rendering/scaling_3d/fsr_mipmap_bias",
|
||||
PROPERTY_HINT_RANGE, "-2,2,0.1"));
|
||||
|
||||
GLOBAL_DEF("rendering/textures/decals/filter", DECAL_FILTER_LINEAR_MIPMAPS);
|
||||
ProjectSettings::get_singleton()->set_custom_property_info("rendering/textures/decals/filter", PropertyInfo(Variant::INT, "rendering/textures/decals/filter", PROPERTY_HINT_ENUM, "Nearest (Fast),Nearest+Mipmaps,Linear,Linear+Mipmaps,Linear+Mipmaps Anisotropic (Slow)"));
|
||||
GLOBAL_DEF("rendering/textures/light_projectors/filter", LIGHT_PROJECTOR_FILTER_LINEAR_MIPMAPS);
|
||||
|
|
|
@ -770,8 +770,13 @@ public:
|
|||
|
||||
virtual RID viewport_create() = 0;
|
||||
|
||||
enum ViewportScaling3DMode {
|
||||
VIEWPORT_SCALING_3D_MODE_BILINEAR,
|
||||
VIEWPORT_SCALING_3D_MODE_FSR,
|
||||
VIEWPORT_SCALING_3D_MODE_MAX
|
||||
};
|
||||
|
||||
virtual void viewport_set_use_xr(RID p_viewport, bool p_use_xr) = 0;
|
||||
virtual void viewport_set_scale_3d(RID p_viewport, float p_scale_3d) = 0;
|
||||
virtual void viewport_set_size(RID p_viewport, int p_width, int p_height) = 0;
|
||||
virtual void viewport_set_active(RID p_viewport, bool p_active) = 0;
|
||||
virtual void viewport_set_parent_viewport(RID p_viewport, RID p_parent_viewport) = 0;
|
||||
|
@ -779,6 +784,11 @@ public:
|
|||
virtual void viewport_attach_to_screen(RID p_viewport, const Rect2 &p_rect = Rect2(), DisplayServer::WindowID p_screen = DisplayServer::MAIN_WINDOW_ID) = 0;
|
||||
virtual void viewport_set_render_direct_to_screen(RID p_viewport, bool p_enable) = 0;
|
||||
|
||||
virtual void viewport_set_scaling_3d_mode(RID p_viewport, ViewportScaling3DMode p_scaling_3d_mode) = 0;
|
||||
virtual void viewport_set_scaling_3d_scale(RID p_viewport, float p_scaling_3d_scale) = 0;
|
||||
virtual void viewport_set_fsr_sharpness(RID p_viewport, float p_fsr_sharpness) = 0;
|
||||
virtual void viewport_set_fsr_mipmap_bias(RID p_viewport, float p_fsr_mipmap_bias) = 0;
|
||||
|
||||
enum ViewportUpdateMode {
|
||||
VIEWPORT_UPDATE_DISABLED,
|
||||
VIEWPORT_UPDATE_ONCE, //then goes to disabled, must be manually updated
|
||||
|
@ -1561,6 +1571,7 @@ VARIANT_ENUM_CAST(RenderingServer::ParticlesEmitFlags);
|
|||
VARIANT_ENUM_CAST(RenderingServer::ParticlesCollisionType);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ParticlesCollisionHeightfieldResolution);
|
||||
VARIANT_ENUM_CAST(RenderingServer::FogVolumeShape);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ViewportScaling3DMode);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ViewportUpdateMode);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ViewportClearMode);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ViewportMSAA);
|
||||
|
|
|
@ -5,6 +5,18 @@ respective folder names. Use two empty lines to separate categories for
|
|||
readability.
|
||||
|
||||
|
||||
## amd-fsr
|
||||
|
||||
Upstream: https://github.com/GPUOpen-Effects/FidelityFX-FSR
|
||||
Version: 1.0.2 (a21ffb8f6c13233ba336352bdff293894c706575, 2021)
|
||||
License: MIT
|
||||
|
||||
Files extracted from upstream source:
|
||||
|
||||
- `ffx_a.h` and `ffx_fsr1.h` from `ffx-fsr`
|
||||
- `license.txt`
|
||||
|
||||
|
||||
## basis_universal
|
||||
|
||||
- Upstream: https://github.com/BinomialLLC/basis_universal
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
Loading…
Reference in New Issue