feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -33,9 +33,9 @@
|
|||
#include "../storage_rd/texture_storage.h"
|
||||
#include "../uniform_set_cache_rd.h"
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
#ifndef XR_DISABLED
|
||||
#include "servers/xr_server.h"
|
||||
#endif // _3D_DISABLED
|
||||
#endif // XR_DISABLED
|
||||
|
||||
using namespace RendererRD;
|
||||
|
||||
|
|
@ -44,6 +44,8 @@ VRS::VRS() {
|
|||
Vector<String> vrs_modes;
|
||||
vrs_modes.push_back("\n"); // VRS_DEFAULT
|
||||
vrs_modes.push_back("\n#define USE_MULTIVIEW\n"); // VRS_MULTIVIEW
|
||||
vrs_modes.push_back("\n#define SPLIT_RG\n"); // VRS_RG
|
||||
vrs_modes.push_back("\n#define SPLIT_RG\n#define USE_MULTIVIEW\n"); // VRS_RG_MULTIVIEW
|
||||
|
||||
vrs_shader.shader.initialize(vrs_modes);
|
||||
|
||||
|
|
@ -80,14 +82,16 @@ void VRS::copy_vrs(RID p_source_rd_texture, RID p_dest_framebuffer, bool p_multi
|
|||
|
||||
RD::Uniform u_source_rd_texture(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, p_source_rd_texture }));
|
||||
|
||||
int mode = 0;
|
||||
VRSPushConstant push_constant = {};
|
||||
|
||||
int mode = p_multiview ? VRS_MULTIVIEW : VRS_DEFAULT;
|
||||
|
||||
// Set maximum texel factor based on maximum fragment size, some GPUs do not support 8x8 (fragment shading rate approach).
|
||||
if (MIN(RD::get_singleton()->limit_get(RD::LIMIT_VRS_MAX_FRAGMENT_WIDTH), RD::get_singleton()->limit_get(RD::LIMIT_VRS_MAX_FRAGMENT_HEIGHT)) > 4) {
|
||||
push_constant.max_texel_factor = 3.0;
|
||||
bool uses_rg_format = RD::get_singleton()->vrs_get_format() == RD::DATA_FORMAT_R8G8_UNORM;
|
||||
if (uses_rg_format) {
|
||||
mode = p_multiview ? VRS_RG_MULTIVIEW : VRS_RG;
|
||||
} else {
|
||||
mode = p_multiview ? VRS_MULTIVIEW : VRS_DEFAULT;
|
||||
|
||||
// Default to 4x4 as it's not possible to query the max fragment size from RenderingDevice. This can be improved to use the largest size
|
||||
// available if this code is moved over to RenderingDevice at some point.
|
||||
push_constant.max_texel_factor = 2.0;
|
||||
}
|
||||
|
||||
|
|
@ -103,18 +107,8 @@ void VRS::copy_vrs(RID p_source_rd_texture, RID p_dest_framebuffer, bool p_multi
|
|||
}
|
||||
|
||||
Size2i VRS::get_vrs_texture_size(const Size2i p_base_size) const {
|
||||
int32_t texel_width = RD::get_singleton()->limit_get(RD::LIMIT_VRS_TEXEL_WIDTH);
|
||||
int32_t texel_height = RD::get_singleton()->limit_get(RD::LIMIT_VRS_TEXEL_HEIGHT);
|
||||
|
||||
int width = p_base_size.x / texel_width;
|
||||
if (p_base_size.x % texel_width != 0) {
|
||||
width++;
|
||||
}
|
||||
int height = p_base_size.y / texel_height;
|
||||
if (p_base_size.y % texel_height != 0) {
|
||||
height++;
|
||||
}
|
||||
return Size2i(width, height);
|
||||
Size2i vrs_texel_size = RD::get_singleton()->vrs_get_texel_size();
|
||||
return Size2i((p_base_size.x + vrs_texel_size.x - 1) / vrs_texel_size.x, (p_base_size.y + vrs_texel_size.y - 1) / vrs_texel_size.y);
|
||||
}
|
||||
|
||||
void VRS::update_vrs_texture(RID p_vrs_fb, RID p_render_target) {
|
||||
|
|
@ -135,7 +129,7 @@ void VRS::update_vrs_texture(RID p_vrs_fb, RID p_render_target) {
|
|||
copy_vrs(rd_texture, p_vrs_fb, layers > 1);
|
||||
}
|
||||
}
|
||||
#ifndef _3D_DISABLED
|
||||
#ifndef XR_DISABLED
|
||||
} else if (vrs_mode == RS::VIEWPORT_VRS_XR) {
|
||||
Ref<XRInterface> interface = XRServer::get_singleton()->get_primary_interface();
|
||||
if (interface.is_valid()) {
|
||||
|
|
@ -150,7 +144,7 @@ void VRS::update_vrs_texture(RID p_vrs_fb, RID p_render_target) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif // _3D_DISABLED
|
||||
#endif // XR_DISABLED
|
||||
}
|
||||
|
||||
if (vrs_update_mode == RS::VIEWPORT_VRS_UPDATE_ONCE) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue