Skip to content

Commit

Permalink
added ER_PLATFORM_SUPPORTS_IMMEDIATE_CONTEXT define
Browse files Browse the repository at this point in the history
  • Loading branch information
steaklive committed Mar 17, 2024
1 parent 2384385 commit 0e110a6
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
2 changes: 2 additions & 0 deletions source/EveryRay_Core/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ using namespace DirectX;
#define ER_GPU_BUFFER_ALIGNMENT 256
#endif

#define ER_PLATFORM_SUPPORTS_IMMEDIATE_CONTEXT ER_PLATFORM_WIN64_DX11

#define NUM_SHADOW_CASCADES 3
#define MAX_LOD 3
#define MAX_MESH_COUNT 32 // should match with IndirectCulling.hlsli
Expand Down
4 changes: 2 additions & 2 deletions source/EveryRay_Core/ER_FoliageManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ namespace EveryRay_Core
mOutputPositionsOnTerrainBuffer->CreateGPUBufferResource(rhi, mCurrentPositions, mPatchesCount, sizeof(XMFLOAT4), false, ER_BIND_NONE, 0x10000L | 0x20000L /*legacy from DX11*/, ER_RESOURCE_MISC_BUFFER_STRUCTURED); //should be STAGING

terrain->PlaceOnTerrain(mOutputPositionsOnTerrainBuffer, mInputPositionsOnTerrainBuffer, mCurrentPositions, mPatchesCount, (TerrainSplatChannels)mTerrainSplatChannel, nullptr, 0, mPlacementHeightDelta);
#ifndef ER_PLATFORM_WIN64_DX11
#if !ER_PLATFORM_SUPPORTS_IMMEDIATE_CONTEXT
std::string eventName = "On-terrain placement callback - initialization of foliage: " + mName;
terrain->ReadbackPlacedPositionsOnInitEvent->AddListener(eventName, [&](ER_Terrain* aTerrain)
{
Expand Down Expand Up @@ -582,7 +582,7 @@ namespace EveryRay_Core
mOutputPositionsOnTerrainBuffer->CreateGPUBufferResource(rhi, mCurrentPositions, mPatchesCount, sizeof(XMFLOAT4), false, ER_BIND_NONE, 0x10000L | 0x20000L /*legacy from DX11*/, ER_RESOURCE_MISC_BUFFER_STRUCTURED); //should be STAGING

terrain->PlaceOnTerrain(mOutputPositionsOnTerrainBuffer, mInputPositionsOnTerrainBuffer, mCurrentPositions, mPatchesCount, currentChannel, nullptr, 0, mPlacementHeightDelta);
#ifndef ER_PLATFORM_WIN64_DX11
#if !ER_PLATFORM_SUPPORTS_IMMEDIATE_CONTEXT
std::string eventName = "On-terrain placement callback - update of foliage: " + mName;
terrain->ReadbackPlacedPositionsOnUpdateEvent->AddListener(eventName, [&](ER_Terrain* aTerrain)
{
Expand Down
2 changes: 1 addition & 1 deletion source/EveryRay_Core/ER_LightProbesManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ namespace EveryRay_Core

ER_RHI_GPUBuffer* finalGPUBuffer = (aType == DIFFUSE_PROBE) ? mDiffuseProbesPositionsGPUBuffer : mSpecularProbesPositionsGPUBuffer;

#ifndef ER_PLATFORM_WIN64_DX11
#if !ER_PLATFORM_SUPPORTS_IMMEDIATE_CONTEXT
const std::string probeTypeName = (aType == DIFFUSE_PROBE) ? "diffuse" : "specular";
const std::string eventName = "On-terrain placement callback - placement of probes: " + probeTypeName;
terrain->ReadbackPlacedPositionsOnInitEvent->AddListener(eventName,
Expand Down
2 changes: 1 addition & 1 deletion source/EveryRay_Core/ER_LightProbesManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ namespace EveryRay_Core
ER_RHI_GPUBuffer* GetSpecularProbesPositionsBuffer() const { return mSpecularProbesPositionsGPUBuffer; }
float GetDistanceBetweenSpecularProbes() { return mDistanceBetweenSpecularProbes; }

ER_RHI_GPUTexture* GetIntegrationMap() { return mIntegrationMapTextureSRV; }
ER_RHI_GPUTexture* GetIntegrationMap() const { return mIntegrationMapTextureSRV; }

XMFLOAT4 GetProbesCellsCount(ER_ProbeType aType);
const XMFLOAT3& GetSceneProbesVolumeMin() { return mSceneProbesMinBounds; }
Expand Down
4 changes: 2 additions & 2 deletions source/EveryRay_Core/ER_RenderingObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ namespace EveryRay_Core
terrain->PlaceOnTerrain(mOutputPositionsOnTerrainBuffer, mInputPositionsOnTerrainBuffer, &currentPos, 1, (TerrainSplatChannels)mTerrainProceduralPlacementSplatChannel,
nullptr, 0, abs(mTerrainProceduralPlacementHeightDelta) < std::numeric_limits<float>::epsilon() ? FLT_MAX : mTerrainProceduralPlacementHeightDelta);

#ifndef ER_PLATFORM_WIN64_DX11
#if !ER_PLATFORM_SUPPORTS_IMMEDIATE_CONTEXT
std::string eventName = "On-terrain placement callback - initialization of ER_RenderingObject: " + mName;
terrain->ReadbackPlacedPositionsOnInitEvent->AddListener(eventName, [&](ER_Terrain* aTerrain)
{
Expand Down Expand Up @@ -848,7 +848,7 @@ namespace EveryRay_Core
terrain->PlaceOnTerrain(mOutputPositionsOnTerrainBuffer, mInputPositionsOnTerrainBuffer, mTempInstancesPositions, mInstanceCount, (TerrainSplatChannels)mTerrainProceduralPlacementSplatChannel,
nullptr, 0, abs(mTerrainProceduralPlacementHeightDelta) < std::numeric_limits<float>::epsilon() ? FLT_MAX : mTerrainProceduralPlacementHeightDelta);

#ifndef ER_PLATFORM_WIN64_DX11
#if !ER_PLATFORM_SUPPORTS_IMMEDIATE_CONTEXT
std::string eventName = "On-terrain placement callback - initialization of ER_RenderingObject: " + mName;
terrain->ReadbackPlacedPositionsOnInitEvent->AddListener(eventName, [&](ER_Terrain* aTerrain)
{
Expand Down
3 changes: 1 addition & 2 deletions source/EveryRay_Core/ER_Terrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1119,11 +1119,10 @@ namespace EveryRay_Core

rhi->EndEventTag();

#ifdef ER_PLATFORM_WIN64_DX11
#if ER_PLATFORM_SUPPORTS_IMMEDIATE_CONTEXT
if (needsCPUReadback)
ReadbackPlacedPositions(outputBuffer, inputBuffer, positions, positionsCount); //direct readback in the dx11 immediate context
#endif

}

// Read-back (GPU to CPU) new positions from placement compute pass
Expand Down
2 changes: 1 addition & 1 deletion source/EveryRay_Core/ER_Utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ static float clearColorBlack[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
static float clearColorWhite[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
static float clearColorRed[4] = { 1.0f, 0.0f, 0.0f, 1.0f };

static std::string engineVersionString = "v1.1";
static std::string engineVersionString = "v1.1.1";

namespace EveryRay_Core
{
Expand Down

0 comments on commit 0e110a6

Please sign in to comment.