Merge remote-tracking branch 'origin/master' into gi

This commit is contained in:
Wojciech Figat
2022-04-21 12:57:08 +02:00
78 changed files with 604 additions and 311 deletions

View File

@@ -70,7 +70,7 @@ void ForwardMaterialShader::Bind(BindParameters& params)
MaterialParameter::BindMeta bindMeta;
bindMeta.Context = context;
bindMeta.Constants = cb;
bindMeta.Input = nullptr; // forward pass materials cannot sample scene color for now
bindMeta.Input = params.Input;
bindMeta.Buffers = params.RenderContext.Buffers;
bindMeta.CanSampleDepth = GPUDevice::Instance->Limits.HasReadOnlyDepth;
bindMeta.CanSampleGBuffer = true;

View File

@@ -272,6 +272,11 @@ API_ENUM(Attributes="Flags") enum class MaterialFeaturesFlags : uint32
/// The flag used to enable refraction offset based on the difference between the per-pixel normal and the per-vertex normal. Useful for large water-like surfaces.
/// </summary>
PixelNormalOffsetRefraction = 1 << 9,
/// <summary>
/// The flag used to enable high-quality reflections based on the screen space raytracing. Useful for large water-like surfaces. The Forward Pass materials option.
/// </summary>
ScreenSpaceReflections = 1 << 10,
};
DECLARE_ENUM_OPERATORS(MaterialFeaturesFlags);

View File

@@ -406,11 +406,13 @@ void MaterialParameter::Bind(BindMeta& meta) const
{
case MaterialSceneTextures::SceneDepth:
view = meta.CanSampleDepth
? (GPUDevice::Instance->Limits.HasReadOnlyDepth ? meta.Buffers->DepthBuffer->ViewReadOnlyDepth() : meta.Buffers->DepthBuffer->View())
? meta.Buffers->DepthBuffer->GetDescription().Flags & GPUTextureFlags::ReadOnlyDepthView ? meta.Buffers->DepthBuffer->ViewReadOnlyDepth() : meta.Buffers->DepthBuffer->View()
: GPUDevice::Instance->GetDefaultWhiteTexture()->View();
break;
case MaterialSceneTextures::AmbientOcclusion:
case MaterialSceneTextures::BaseColor:
case MaterialSceneTextures::DiffuseColor:
case MaterialSceneTextures::SpecularColor:
view = meta.CanSampleGBuffer ? meta.Buffers->GBuffer0->View() : nullptr;
break;
case MaterialSceneTextures::WorldNormal:

View File

@@ -10,7 +10,7 @@
/// <summary>
/// Current materials shader version.
/// </summary>
#define MATERIAL_GRAPH_VERSION 150
#define MATERIAL_GRAPH_VERSION 151
class Material;
class GPUShader;