lordbean-git / HQAA

Merges SMAA and FXAA aiming to balance both for high quality AA effect.
53 stars 3 forks source link

vkBasalt support #12

Closed ruanformigoni closed 1 year ago

ruanformigoni commented 1 year ago

Hi, is the shader compatible with vkBasalt? I've tried it, and got the error error X3004: undeclared identifier 'BUFFER_COLOR_BIT_DEPTH'.

vkBasalt err:   /home/ruan/.config/vkBasalt/reshade/shaders/HQAA.fx(2495, 49): error X3004: undeclared identifier 'BUFFER_COLOR_BIT_DEPTH'
vkBasalt err:   /home/ruan/.config/vkBasalt/reshade/shaders/HQAA.fx(2622, 5): error X3004: undeclared identifier 'BUFFER_COLOR_BIT_DEPTH'
vkBasalt err:   /home/ruan/.config/vkBasalt/reshade/shaders/HQAA.fx(2633, 5): error X3004: undeclared identifier 'BUFFER_COLOR_BIT_DEPTH'
vkBasalt err:   /home/ruan/.config/vkBasalt/reshade/shaders/HQAA.fx(2644, 5): error X3004: undeclared identifier 'BUFFER_COLOR_BIT_DEPTH'
vkBasalt err:   /home/ruan/.config/vkBasalt/reshade/shaders/HQAA.fx(2655, 5): error X3004: undeclared identifier 'BUFFER_COLOR_BIT_DEPTH'
vkBasalt err:   /home/ruan/.config/vkBasalt/reshade/shaders/HQAA.fx(2670, 5): error X3004: undeclared identifier 'BUFFER_COLOR_BIT_DEPTH'
vkBasalt err:   /home/ruan/.config/vkBasalt/reshade/shaders/HQAA.fx(2680, 5): error X3004: undeclared identifier 'BUFFER_COLOR_BIT_DEPTH'
vkBasalt err:   /home/ruan/.config/vkBasalt/reshade/shaders/HQAA.fx(2690, 5): error X3004: undeclared identifier 'BUFFER_COLOR_BIT_DEPTH'
vkBasalt err:   /home/ruan/.config/vkBasalt/reshade/shaders/HQAA.fx(2700, 5): error X3004: undeclared identifier 'BUFFER_COLOR_BIT_DEPTH'
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
fish: Job 1, '~/Repositories/gamescope/build/…' terminated by signal SIGABRT (Abort)
lordbean-git commented 1 year ago

I've been learning HLSL from scratch throughout this project - HQAA uses some of the ReShade internal macros to check certain things about the buffer. I have an upcoming major version release, so I'll try to add some compatibility macros in the defines to detect if the environment isn't ReShade and manually configure some fallback values. I can't guarantee this will make it compatible, but it should at least help.

lordbean-git commented 1 year ago

This is tentatively fixed in version 30.0. It includes a block that checks whether the preprocessor variable RESHADE has a value, and if not, it will set up a fallback environment.

ruanformigoni commented 1 year ago

Hi, thanks a lot for the update! I still have one issue, there is a black bar that keeps moving in the screen (applying and removing the effect). Is there a way to disable it? It is on the left in the picture below.

screenshot-103

Also I'm getting this errors on the terminal:

vkBasalt err:   /home/ruan/.config/vkBasalt/reshade/shaders/HQAA.fx(2553, 49): error X3004: undeclared identifier 'BUFFER_COLOR_BIT_DEPTH'
vkBasalt err:   /home/ruan/.config/vkBasalt/reshade/shaders/HQAA.fx(2643, 5): error X3004: undeclared identifier 'BUFFER_COLOR_BIT_DEPTH'
vkBasalt err:   /home/ruan/.config/vkBasalt/reshade/shaders/HQAA.fx(2654, 5): error X3004: undeclared identifier 'BUFFER_COLOR_BIT_DEPTH'
vkBasalt err:   /home/ruan/.config/vkBasalt/reshade/shaders/HQAA.fx(2665, 5): error X3004: undeclared identifier 'BUFFER_COLOR_BIT_DEPTH'
vkBasalt err:   /home/ruan/.config/vkBasalt/reshade/shaders/HQAA.fx(2676, 5): error X3004: undeclared identifier 'BUFFER_COLOR_BIT_DEPTH'
vkBasalt err:   /home/ruan/.config/vkBasalt/reshade/shaders/HQAA.fx(2691, 5): error X3004: undeclared identifier 'BUFFER_COLOR_BIT_DEPTH'
vkBasalt err:   /home/ruan/.config/vkBasalt/reshade/shaders/HQAA.fx(2701, 5): error X3004: undeclared identifier 'BUFFER_COLOR_BIT_DEPTH'
vkBasalt err:   /home/ruan/.config/vkBasalt/reshade/shaders/HQAA.fx(2711, 5): error X3004: undeclared identifier 'BUFFER_COLOR_BIT_DEPTH'
vkBasalt err:   /home/ruan/.config/vkBasalt/reshade/shaders/HQAA.fx(2721, 5): error X3004: undeclared identifier 'BUFFER_COLOR_BIT_DEPTH'
lordbean-git commented 1 year ago

You shouldn't be seeing those errors because the fallback environment is defining that identifier if it doesn't exist. This means that vkBasalt is somehow un-defining it after HQAA defines it, which isn't a problem I can help with.

As for the black bar, this is basically the normal "first-time" environment HQAA creates. I did some tomfoolery with the preprocessor variable HQAA__INTRODUCTION_ACKNOWLEDGED to show the user a long-ish information blurb before any shader configuration unlocks in ReShade. In that environment, the shader automatically configures itself to use the Max Bang for Buck global preset and the splitscreen preview auto-scroller feature. To bypass it, you need to set the variable HQAA__INTRODUCTION_ACKNOWLEDGED to 1 either through post-compile configuration (if vkBasalt allows it) or by adding #define HQAA__INTRODUCTION_ACKNOWLEDGED 1 to the code right at the top.

Edit: You should also be seeing an arbitrary compiler warning when the fallback environment code gets processed that reads Compiling in non-ReShade environment, correct operation is not guaranteed. If this isn't popping up, it suggests that vkBasalt is putting a value into the __RESHADE__ preprocessor variable, but is not configuring any default values for any of ReShade's normally-present macro queries. This, again, is a vkBasalt problem - they need to either leave __RESHADE__ undefined, or set up ReShade's normal compiler environment fully.