Skip to content

Commit

Permalink
Merge pull request PixarAnimationStudios#230 from autodesk-forks/adsk…
Browse files Browse the repository at this point in the history
…/feature/ios

[OGSMOD-2797] Fix build error for iOS target. Step 1/2, sync code and fix conflict
  • Loading branch information
wingfiring authored and GitHub Enterprise committed Jan 18, 2023
2 parents 89d88ac + d75f6f0 commit 5acdc56
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 8 deletions.
12 changes: 12 additions & 0 deletions pxr/imaging/hd/renderPassState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,18 @@ HdRenderPassState::SetMultiSampleEnabled(bool enabled)
_multiSampleEnabled = enabled;
}

void
HdRenderPassState::SetCancelCallback(std::function<bool ()> const& callback)
{
_cancelCallback = callback;
}

bool
HdRenderPassState::IsCancelled() const
{
return _cancelCallback && _cancelCallback();
}

GfVec2f
HdRenderPassState::GetDrawingRangeNDC() const
{
Expand Down
8 changes: 8 additions & 0 deletions pxr/imaging/hd/renderPassState.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "pxr/base/gf/vec4f.h"

#include <memory>
#include <functional>

PXR_NAMESPACE_OPEN_SCOPE

Expand Down Expand Up @@ -344,6 +345,11 @@ class HdRenderPassState
HD_API
void SetMultiSampleEnabled(bool enabled);
bool GetMultiSampleEnabled() const { return _multiSampleEnabled; }

HD_API
void SetCancelCallback(std::function<bool()> const& callback);
HD_API
bool IsCancelled() const;

protected:
// ---------------------------------------------------------------------- //
Expand Down Expand Up @@ -425,6 +431,8 @@ class HdRenderPassState
float _stepSizeLighting;

bool _multiSampleEnabled;

std::function<bool()> _cancelCallback;
};

PXR_NAMESPACE_CLOSE_SCOPE
Expand Down
2 changes: 2 additions & 0 deletions pxr/imaging/hdSt/commandBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ HdStCommandBuffer::ExecuteDraw(
// draw batches
//
for (auto const& batch : _drawBatches) {
if (renderPassState->IsCancelled())
break;
batch->ExecuteDraw(gfxCmds, renderPassState, resourceRegistry);
}

Expand Down
2 changes: 2 additions & 0 deletions pxr/imaging/hdx/renderSetupTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ HdxRenderSetupTask::SyncParams(HdSceneDelegate* delegate,
renderPassState->SetAlphaToCoverageEnabled(
params.enableAlphaToCoverage &&
!TfDebug::IsEnabled(HDX_DISABLE_ALPHA_TO_COVERAGE));

renderPassState->SetCancelCallback(params.cancelCallback);

if (HdStRenderPassState * const hdStRenderPassState =
dynamic_cast<HdStRenderPassState*>(renderPassState.get())) {
Expand Down
3 changes: 3 additions & 0 deletions pxr/imaging/hdx/renderSetupTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ struct HdxRenderTaskParams
GfVec4d viewport;
HdCullStyle cullStyle;
std::pair<bool, CameraUtilConformWindowPolicy> overrideWindowPolicy;

// Frame cancellation
std::function<bool()> cancelCallback;
};

// VtValue requirements
Expand Down
11 changes: 3 additions & 8 deletions pxr/imaging/hgiMetal/graphicsCmds.mm
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,9 @@
hasClear = true;
}

if (@available(macos 100.100, ios 8.0, *)) {
metalColorAttachment.loadAction = MTLLoadActionLoad;
}
else {
metalColorAttachment.loadAction =
HgiMetalConversions::GetAttachmentLoadOp(
hgiColorAttachment.loadOp);
}
metalColorAttachment.loadAction =
HgiMetalConversions::GetAttachmentLoadOp(
hgiColorAttachment.loadOp);

metalColorAttachment.storeAction =
HgiMetalConversions::GetAttachmentStoreOp(
Expand Down

0 comments on commit 5acdc56

Please sign in to comment.