Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions plume_metal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2030,6 +2030,7 @@ namespace plume {
}

RenderTexture *MetalSwapChain::getTexture(const uint32_t textureIndex) {
assert(textureIndex < drawables.size());
return &drawables[textureIndex];
}

Expand Down Expand Up @@ -2400,7 +2401,7 @@ namespace plume {

for (int i = 0; i < textureBarriersCount; i++) {
const RenderTextureBarrier &textureBarrier = textureBarriers[i];
MetalTexture *interfaceTexture = static_cast<MetalTexture *>(textureBarrier.texture);
ExtendedRenderTexture *interfaceTexture = static_cast<ExtendedRenderTexture *>(textureBarrier.texture);

srcStageMask |= toStageMask(interfaceTexture->barrierStages);
interfaceTexture->barrierStages = stages;
Expand Down Expand Up @@ -2552,7 +2553,7 @@ namespace plume {
assert(range.binding < MAX_PUSH_CONSTANT_BINDINGS && "Push constants out of range");

pushConstants.resize(activeComputePipelineLayout->pushConstantRanges.size());
pushConstants[rangeIndex].data.resize(range.size);
pushConstants[rangeIndex].data.resize(alignUp(range.size));
memcpy(pushConstants[rangeIndex].data.data() + offset, data, size == 0 ? range.size : size);
pushConstants[rangeIndex].binding = range.binding;
pushConstants[rangeIndex].set = range.set;
Expand Down Expand Up @@ -2606,7 +2607,7 @@ namespace plume {
assert(range.binding < MAX_PUSH_CONSTANT_BINDINGS && "Push constants out of range");

pushConstants.resize(activeGraphicsPipelineLayout->pushConstantRanges.size());
pushConstants[rangeIndex].data.resize(range.size);
pushConstants[rangeIndex].data.resize(alignUp(range.size));
memcpy(pushConstants[rangeIndex].data.data() + offset, data, size == 0 ? range.size : size);
pushConstants[rangeIndex].binding = range.binding;
pushConstants[rangeIndex].set = range.set;
Expand Down
2 changes: 1 addition & 1 deletion plume_metal.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ namespace plume {

struct ExtendedRenderTexture : RenderTexture {
RenderTextureDesc desc;
RenderBarrierStages barrierStages = RenderBarrierStage::NONE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the right approach, I think it was just a failure on our side. ExtendedRenderTexture is any renderable texture which may be a drawable or not.

virtual MTL::Texture* getTexture() const = 0;
};

Expand Down Expand Up @@ -596,7 +597,6 @@ namespace plume {
RenderTextureLayout layout = RenderTextureLayout::UNKNOWN;
MetalPool *pool = nullptr;
MTL::Drawable *drawable = nullptr;
RenderBarrierStages barrierStages = RenderBarrierStage::NONE;

MetalTexture() = default;
MetalTexture(const MetalDevice *device, MetalPool *pool, const RenderTextureDesc &desc);
Expand Down
Loading