GPUOpen-LibrariesAndSDKs / RadeonImageFilter

https://gpuopen.com/radeon-prorender-suite/
Other
48 stars 14 forks source link

User defined filter white space changes the output of the filter. #17

Closed BartSiwek closed 2 years ago

BartSiwek commented 2 years ago

I have been adding a user defined filter to our filter pipeline for the purpose of converting a view space depth buffer to a NDC depth buffer that can be later consumed by the AI denoise filter.

For that purpose I added the following code:

static const rif_char DEPTH_CONVERSION_CODE[] = "int2 coord;"
                        "GET_COORD_OR_RETURN(coord, GET_BUFFER_SIZE(outputImage));"
                        "vec4 pixel = ReadPixelTyped(inputImage, coord.x, coord.y);"
                        "float depth = pixel.z;"
                        "vec4 conversionParams = getConversionParams();"
                        "float ndcDepth = (conversionParams.x * depth + conversionParams.y)/(conversionParams.z * depth + conversionParams.w);"
                        "pixel = (vec4)ndcDepth;"
                        "WritePixelTyped(outputImage, coord.x, coord.y, pixel);";
RIF_CHECK( rifImageFilterSetParameterString( depthConversionFilter, "code", DEPTH_CONVERSION_CODE ), "Error setting the 'code' parameter on the depth conversion filter" );

static const rif_char DECLARAIONS[] = "vec4 getConversionParams() { return vec4(1.0f, 2.0f, 3.0f, 4.0f); }";
RIF_CHECK( rifImageFilterSetParameterString( depthConversionFilter, "declarations", DECLARAIONS ), "Error setting the 'declarations' parameter on the depth conversion filter" );

The following line works well in the filter: float ndcDepth = (conversionParams.x * depth + conversionParams.y)/(conversionParams.z * depth + conversionParams.w); However when replaced with a line that contains space around the / operator the filter no longer works and outputs zeros: float ndcDepth = (conversionParams.x * depth + conversionParams.y) / (conversionParams.z * depth + conversionParams.w);

Notes:

BartSiwek commented 2 years ago

I should also add that is with the DirectX12 backend.

givinar commented 2 years ago

Hi @BartSiwek, We found the cause of the problem. This will be fixed in the next release. Thanks.

givinar commented 2 years ago

Hi @BartSiwek The problem has been fixed in version 1.7.3. Could you close the issue?