Page MenuHomeWildfire Games

Contrast-Adaptiv-Sharpening pass
Needs ReviewPublic

Authored by OptimusShepard on Feb 20 2020, 8:50 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Trac Tickets
#5677
Summary

Adds an sharpening pass option to the game.

Test Plan

Select CAS as sharpening pass in the graphic settings. Select different sharpness factors by slider.

Event Timeline

OptimusShepard created this revision.Feb 20 2020, 8:50 PM

Do I have to add something to the LICENSE.txt?
I ported the reshade port of AMDs CAS, so is there anything else to consider?

OptimusShepard planned changes to this revision.Feb 20 2020, 9:00 PM

I will add a slider for selecting the sharpness factor.

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/renderer/PostprocManager.h
|  26| class·CPostprocManager
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCPostprocManager{' is invalid C code. Use --std or --language to configure the language.

source/renderer/scripting/JSInterface_Renderer.h
|  27| namespace·JSI_Renderer
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'namespaceJSI_Renderer{' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1794/display/redirect

nani awarded a token.Feb 21 2020, 12:02 AM

@OptimusShepard I tested your patch and when I select CAS in the options, the error appears:

ERROR: Failed to compile shader 'shaders/glsl/cas.fs': 0(64) : warning C1503: undefined variable "rcp" 0(70) : warning C1503: undefined variable "rcp" 0(73) : warning C1503: undefined variable "rcp" 0(64) : error C1008: undefined variable "rcp" 0(70) : error C1008: undefined variable "rcp" 0(73) : error C1008: undefined variable "rcp"

Imarok added a subscriber: Imarok.EditedFeb 23 2020, 3:44 PM

I got

ERROR: Failed to compile shader 'shaders/glsl/cas.fs':
0(64) : error C1008: undefined variable "rcp"
0(70) : error C1008: undefined variable "rcp"
0(73) : error C1008: undefined variable "rcp"

Edit: Tested on Ubuntu 18.04 with GTX 960

@OptimusShepard I tested your patch and when I select CAS in the options, the error appears:
ERROR: Failed to compile shader 'shaders/glsl/cas.fs': 0(64) : warning C1503: undefined variable "rcp" 0(70) : warning C1503: undefined variable "rcp" 0(73) : warning C1503: undefined variable "rcp" 0(64) : error C1008: undefined variable "rcp" 0(70) : error C1008: undefined variable "rcp" 0(73) : error C1008: undefined variable "rcp"

May I ask you which setup did you use?

Stan added a subscriber: Stan.Feb 23 2020, 4:14 PM

AFAIK @gameboy uses Windows.

OptimusShepard retitled this revision from Contras-Adaptiv-Sharpening pass to Contrast-Adaptiv-Sharpening pass.Feb 23 2020, 4:17 PM
In D2642#110914, @Stan wrote:

AFAIK @gameboy uses Windows.

Do you know from which vendor his GPU is?

OptimusShepard added a subscriber: vladislavbelov.

Replace rcp(x) to 1/x.
rcp seems to be a performance optimized function for AMD GPUs. As strange, rsqrt is also a special function, which doesn't work with my GPU. I had it replaced bevor my first upload.
@vladislavbelov do you know more about such things? Is it possible to implement a parallel path for AMD hardware?

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/renderer/scripting/JSInterface_Renderer.h
|  27| namespace·JSI_Renderer
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'namespaceJSI_Renderer{' is invalid C code. Use --std or --language to configure the language.

source/renderer/PostprocManager.h
|  26| class·CPostprocManager
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCPostprocManager{' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1806/display/redirect

I got

ERROR: Failed to compile shader 'shaders/glsl/cas.fs':
0(64) : error C1008: undefined variable "rcp"
0(70) : error C1008: undefined variable "rcp"
0(73) : error C1008: undefined variable "rcp"

Edit: Tested on Ubuntu 18.04 with GTX 960

Works with the new version.

I use Intel CPU, and the graphics card USES NVIDIA GTX850M. The operating system is Windows10 64bit. Do you support Intel CPU and NVIDIA series of graphics CARDS in this patch

I use Intel CPU, and the graphics card USES NVIDIA GTX850M. The operating system is Windows10 64bit. Do you support Intel CPU and NVIDIA series of graphics CARDS in this patch

Thanks. As I replaced the rcp function, it should now work with every GPU.

OptimusShepard edited the test plan for this revision. (Show Details)

Add slider for sharpness factor.

Stan added inline comments.Feb 25 2020, 8:27 PM
binaries/data/mods/public/shaders/glsl/cas.fs
4

Might want to say you edited it :)

Angen added a subscriber: Angen.Feb 25 2020, 8:31 PM
Angen added inline comments.
binaries/data/mods/public/shaders/glsl/cas.fs
4

If edited, it needs to be said

OptimusShepard added inline comments.Feb 25 2020, 8:44 PM
binaries/data/mods/public/shaders/glsl/cas.fs
4

It's a port of the Reshade port from AMDs CAS. So, do I need to say I edited a port, or is it only necessary to say the original (AMD) source has been edited?

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/renderer/scripting/JSInterface_Renderer.h
|  27| namespace·JSI_Renderer
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'namespaceJSI_Renderer{' is invalid C code. Use --std or --language to configure the language.

source/renderer/PostprocManager.h
|  26| class·CPostprocManager
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCPostprocManager{' is invalid C code. Use --std or --language to configure the language.

source/ps/CStrInternStatic.h
|   1| /*·Copyright·(C)·2014·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2020" year instead of "2014"
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1815/display/redirect

Add an editing info to the cas.fs header.

OptimusShepard marked 2 inline comments as done.Feb 26 2020, 3:59 PM
OptimusShepard added inline comments.
binaries/data/mods/public/shaders/glsl/cas.fs
4

I compared the original source and the Reshade port. It's nearly the same. They only difference I've adopted is, to put the scalar operations together to a vector. I don't think this is license relevant?

4

I added an commentary to the end of the header.

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/renderer/PostprocManager.h
|  26| class·CPostprocManager
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCPostprocManager{' is invalid C code. Use --std or --language to configure the language.

source/ps/CStrInternStatic.h
|   1| /*·Copyright·(C)·2014·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2020" year instead of "2014"

source/renderer/scripting/JSInterface_Renderer.h
|  27| namespace·JSI_Renderer
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'namespaceJSI_Renderer{' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1818/display/redirect

nani added a subscriber: nani.Feb 26 2020, 4:45 PM
nani added inline comments.
binaries/data/mods/public/shaders/glsl/cas.fs
52

Some compilers don't infer the value type so better change vec2(1, 1) to vec2(1.0, 1.0).
Do the same for all the other values meant to be a float.

Change the representation of floats in cas.fs.

OptimusShepard marked an inline comment as done.Feb 26 2020, 6:51 PM

Thx

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/renderer/PostprocManager.h
|  26| class·CPostprocManager
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCPostprocManager{' is invalid C code. Use --std or --language to configure the language.

source/ps/CStrInternStatic.h
|   1| /*·Copyright·(C)·2014·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2020" year instead of "2014"

source/renderer/scripting/JSInterface_Renderer.h
|  27| namespace·JSI_Renderer
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'namespaceJSI_Renderer{' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1820/display/redirect