Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
VZout committed Sep 8, 2023
2 parents ad19894 + 48d5329 commit 467226b
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"files.associations": {
"locale": "cpp"
}
}
4 changes: 2 additions & 2 deletions FidelityFX-FSR2/src/ffx-fsr2-api/ffx_fsr2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static const ResourceBinding cbResourceBindingTable[] =
};

// Broad structure of the root signature.
typedef enum Fsr2RootSignatureLayout : signed
typedef enum Fsr2RootSignatureLayout : signed
{

FSR2_ROOT_SIGNATURE_LAYOUT_UAVS,
Expand Down Expand Up @@ -192,7 +192,7 @@ FfxConstantBuffer globalFsr2ConstantBuffers[4] = {
// Lanczos
static float lanczos2(float value)
{
return abs(value) < FFX_EPSILON ? 1.f : (sinf(FFX_PI * value) / (FFX_PI * value)) * (sinf(0.5f * FFX_PI * value) / (0.5f * FFX_PI * value));
return std::abs(value) < FFX_EPSILON ? 1.f : (sinf(FFX_PI * value) / (FFX_PI * value)) * (sinf(0.5f * FFX_PI * value) / (0.5f * FFX_PI * value));
}

// Calculate halton number for index and base.
Expand Down
5 changes: 3 additions & 2 deletions fsr2-sys/build/bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub fn generate_bindings(api_dir: &str) {
.rustified_enum("FfxResourceStates");

if cfg!(not(target_os = "windows")) {
bindings = bindings.clang_args(["-DFFX_GCC", "-fshort-wchar"]);
bindings = bindings.clang_args(["-DFFX_GCC"]);
}

let bindings = bindings.generate().expect("Unable to generate bindings");
Expand All @@ -66,14 +66,15 @@ pub fn generate_vk_bindings(api_dir: &str, vk_include_dir: &str) {
.header(wrapper)
.header(&wrapper_api)
.clang_arg("-xc++")
.clang_arg("-std=c++2a")
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
.parse_callbacks(Box::new(Renamer))
.clang_arg(format!("-I{}", vk_include_dir))
.allowlist_recursively(false)
.allowlist_file(&wrapper_api);

if cfg!(not(target_os = "windows")) {
bindings = bindings.clang_args(["-DFFX_GCC", "-fshort-wchar"]);
bindings = bindings.clang_args(["-DFFX_GCC"]);
}

let bindings = bindings.generate().expect("Unable to generate bindings");
Expand Down
2 changes: 1 addition & 1 deletion fsr2-sys/build/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn build_fsr(api_dir: &str, _vk_include_dir: &str) {
.define("DYNAMIC_LINK_VULKAN", "1")
.std("c++2a");
#[cfg(not(target_os = "windows"))]
build.define("FFX_GCC", "1").flag("-fshort-wchar");
build.define("FFX_GCC", "1");
#[cfg(feature = "vulkan")]
build
.include(&format!("{}/../../shader_permutations/vk", api_dir))
Expand Down
2 changes: 1 addition & 1 deletion fsr2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub struct ContextDescription<'a> {
pub max_render_size: [u32; 2],
pub display_size: [u32; 2],
pub device: &'a Device,
pub message_callback: Option<unsafe extern "C" fn(i32, *const u16)>,
pub message_callback: Option<unsafe extern "C" fn(i32, *const u32)>,
}

impl From<ContextDescription<'_>> for fsr2_sys::ContextDescription {
Expand Down
4 changes: 2 additions & 2 deletions fsr2/src/vk.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::*;
use ash::vk::Handle;
use widestring::U16String;
use widestring::WideString;

impl From<ash::vk::CommandBuffer> for CommandList {
fn from(value: ash::vk::CommandBuffer) -> Self {
Expand Down Expand Up @@ -67,7 +67,7 @@ pub unsafe fn get_texture_resource(
size[0],
size[1],
format.as_raw(),
U16String::from_str(name).as_ptr(),
WideString::from_str(name).as_ptr(),
state,
)
}
Expand Down

0 comments on commit 467226b

Please sign in to comment.