diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-05-06 05:16:00 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-05-06 05:16:00 +0000 |
| commit | 084fc14ae2ab312d9bcb88d0bc4c1fe1ba6b6a41 (patch) | |
| tree | ce186defbfe04856a97f5e240a6aef216cabe6a3 /Shaders/PostProcess | |
| parent | GLTF renderer: fixed few GLES3.0 shader issues (diff) | |
| download | DiligentFX-084fc14ae2ab312d9bcb88d0bc4c1fe1ba6b6a41.tar.gz DiligentFX-084fc14ae2ab312d9bcb88d0bc4c1fe1ba6b6a41.zip | |
Improved int vs uint handling in shaders
Diffstat (limited to 'Shaders/PostProcess')
4 files changed, 14 insertions, 14 deletions
diff --git a/Shaders/PostProcess/EpipolarLightScattering/private/AtmosphereShadersCommon.fxh b/Shaders/PostProcess/EpipolarLightScattering/private/AtmosphereShadersCommon.fxh index a20f7de..02f55ac 100644 --- a/Shaders/PostProcess/EpipolarLightScattering/private/AtmosphereShadersCommon.fxh +++ b/Shaders/PostProcess/EpipolarLightScattering/private/AtmosphereShadersCommon.fxh @@ -17,11 +17,11 @@ #define F2ONE float2(1.0, 1.0) #ifndef NUM_EPIPOLAR_SLICES -# define NUM_EPIPOLAR_SLICES 1024 +# define NUM_EPIPOLAR_SLICES 1024u #endif #ifndef MAX_SAMPLES_IN_SLICE -# define MAX_SAMPLES_IN_SLICE 512 +# define MAX_SAMPLES_IN_SLICE 512u #endif #ifndef OPTIMIZE_SAMPLE_LOCATIONS diff --git a/Shaders/PostProcess/EpipolarLightScattering/private/UnwarpEpipolarScattering.fx b/Shaders/PostProcess/EpipolarLightScattering/private/UnwarpEpipolarScattering.fx index 4f4cc74..eccf46d 100644 --- a/Shaders/PostProcess/EpipolarLightScattering/private/UnwarpEpipolarScattering.fx +++ b/Shaders/PostProcess/EpipolarLightScattering/private/UnwarpEpipolarScattering.fx @@ -134,7 +134,7 @@ void UnwarpEpipolarInsctrImage( in float2 f2PosPS, // Now find two closest epipolar slices, from which we will interpolate // First, find index of the slice which precedes our slice // Note that 0 <= fEpipolarSlice <= 1, and both 0 and 1 refer to the first slice - float fPrecedingSliceInd = min( floor(fEpipolarSlice*float(NUM_EPIPOLAR_SLICES)), float(NUM_EPIPOLAR_SLICES-1) ); + float fPrecedingSliceInd = min( floor(fEpipolarSlice * float(NUM_EPIPOLAR_SLICES)), float(NUM_EPIPOLAR_SLICES-1u) ); // Compute EXACT texture coordinates of preceding and succeeding slices and their weights // Note that slice 0 is stored in the first texel which has exact texture coordinate 0.5/NUM_EPIPOLAR_SLICES @@ -169,7 +169,7 @@ void UnwarpEpipolarInsctrImage( in float2 f2PosPS, // Note that the first sample on the line (fSamplePosOnLine==0) is exactly the Entry Point, while // the last sample (fSamplePosOnLine==1) is exactly the Exit Point // (search for "fSamplePosOnEpipolarLine *= (float)MAX_SAMPLES_IN_SLICE / ((float)MAX_SAMPLES_IN_SLICE-1.f)") - float fSampleInd = fSamplePosOnLine * float(MAX_SAMPLES_IN_SLICE-1); + float fSampleInd = fSamplePosOnLine * float(MAX_SAMPLES_IN_SLICE-1u); // We have to manually perform bilateral filtering of the scattered radiance texture to // eliminate artifacts at depth discontinuities @@ -225,7 +225,7 @@ void UnwarpEpipolarInsctrImage( in float2 f2PosPS, // | | // |<-------------------Clamp range------------------->| // - f2BilateralUWeights *= (abs(fSamplePosOnLine - 0.5) < 0.5 + 1.0 / float(MAX_SAMPLES_IN_SLICE-1)) ? 1.0 : 0.0; + f2BilateralUWeights *= (abs(fSamplePosOnLine - 0.5) < 0.5 + 1.0 / float(MAX_SAMPLES_IN_SLICE-1u)) ? 1.0 : 0.0; // We now need to compute the following weighted summ: //f3FilteredSliceCol = // f2BilateralUWeights.x * g_tex2DScatteredColor.SampleLevel(samPoint, f2SctrColorUV, 0, int2(0,0)) + diff --git a/Shaders/PostProcess/EpipolarLightScattering/public/EpipolarLightScatteringStructures.fxh b/Shaders/PostProcess/EpipolarLightScattering/public/EpipolarLightScatteringStructures.fxh index 1c541e6..f51155f 100644 --- a/Shaders/PostProcess/EpipolarLightScattering/public/EpipolarLightScatteringStructures.fxh +++ b/Shaders/PostProcess/EpipolarLightScattering/public/EpipolarLightScatteringStructures.fxh @@ -155,18 +155,18 @@ struct EpipolarLightScatteringAttribs // Whether to use 32-bit float or 16-bit UNORM min-max binary tree. BOOL bIs32BitMinMaxMipMap DEFAULT_VALUE(FALSE); // Technique used to evaluate light scattering. - uint uiLightSctrTechnique DEFAULT_VALUE(LIGHT_SCTR_TECHNIQUE_EPIPOLAR_SAMPLING); + int iLightSctrTechnique DEFAULT_VALUE(LIGHT_SCTR_TECHNIQUE_EPIPOLAR_SAMPLING); // Shadow map cascades processing mode. - uint uiCascadeProcessingMode DEFAULT_VALUE(CASCADE_PROCESSING_MODE_SINGLE_PASS); + int iCascadeProcessingMode DEFAULT_VALUE(CASCADE_PROCESSING_MODE_SINGLE_PASS); // Epipolar sampling refinement criterion. - uint uiRefinementCriterion DEFAULT_VALUE(REFINEMENT_CRITERION_INSCTR_DIFF); + int iRefinementCriterion DEFAULT_VALUE(REFINEMENT_CRITERION_INSCTR_DIFF); // Single scattering evaluation mode. - uint uiSingleScatteringMode DEFAULT_VALUE(SINGLE_SCTR_MODE_INTEGRATION); + int iSingleScatteringMode DEFAULT_VALUE(SINGLE_SCTR_MODE_INTEGRATION); // Higher-order scattering evaluation mode. - uint uiMultipleScatteringMode DEFAULT_VALUE(MULTIPLE_SCTR_MODE_UNOCCLUDED); + int iMultipleScatteringMode DEFAULT_VALUE(MULTIPLE_SCTR_MODE_UNOCCLUDED); // Atmospheric extinction evaluation mode. - uint uiExtinctionEvalMode DEFAULT_VALUE(EXTINCTION_EVAL_MODE_EPIPOLAR); + int iExtinctionEvalMode DEFAULT_VALUE(EXTINCTION_EVAL_MODE_EPIPOLAR); // Whether to use custom scattering coefficients. BOOL bUseCustomSctrCoeffs DEFAULT_VALUE(FALSE); diff --git a/Shaders/PostProcess/ToneMapping/public/ToneMappingStructures.fxh b/Shaders/PostProcess/ToneMapping/public/ToneMappingStructures.fxh index c71a6af..d946198 100644 --- a/Shaders/PostProcess/ToneMapping/public/ToneMappingStructures.fxh +++ b/Shaders/PostProcess/ToneMapping/public/ToneMappingStructures.fxh @@ -47,13 +47,13 @@ struct ToneMappingAttribs { // Tone mapping mode. - uint uiToneMappingMode DEFAULT_VALUE(TONE_MAPPING_MODE_UNCHARTED2); + int iToneMappingMode DEFAULT_VALUE(TONE_MAPPING_MODE_UNCHARTED2); // Automatically compute exposure to use in tone mapping. - BOOL bAutoExposure DEFAULT_VALUE(TRUE); + BOOL bAutoExposure DEFAULT_VALUE(TRUE); // Middle gray value used by tone mapping operators. float fMiddleGray DEFAULT_VALUE(0.18f); // Simulate eye adaptation to light changes. - BOOL bLightAdaptation DEFAULT_VALUE(TRUE); + BOOL bLightAdaptation DEFAULT_VALUE(TRUE); // White point to use in tone mapping. float fWhitePoint DEFAULT_VALUE(3.f); |
