aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/vk
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-04-03 16:57:43 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-03 21:35:47 +0000
commit18dfa980765bee6a1ce7c5f430cb32f487da6590 (patch)
treef82444c520111b4710746480652fde74d2db3815 /src/gpu/vk
parentb9c4a6fc7de252633f16d11c2df10ee6de16af03 (diff)
Store the dst texture used by an XP in GrPipeline rather than in the XP.
This will allow the XP to be created before the dst texture. Change-Id: I3e5bdfa8e5d47e58a3560792ce5cf3899d30a024 Reviewed-on: https://skia-review.googlesource.com/11011 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/vk')
-rw-r--r--src/gpu/vk/GrVkGpuCommandBuffer.cpp25
-rw-r--r--src/gpu/vk/GrVkPipelineState.cpp10
2 files changed, 23 insertions, 12 deletions
diff --git a/src/gpu/vk/GrVkGpuCommandBuffer.cpp b/src/gpu/vk/GrVkGpuCommandBuffer.cpp
index 6b2cd8ec30..8baf60e1e8 100644
--- a/src/gpu/vk/GrVkGpuCommandBuffer.cpp
+++ b/src/gpu/vk/GrVkGpuCommandBuffer.cpp
@@ -481,6 +481,17 @@ sk_sp<GrVkPipelineState> GrVkGpuCommandBuffer::prepareDrawState(
return pipelineState;
}
+static void set_texture_layout(GrVkTexture* vkTexture, GrVkGpu* gpu) {
+ // TODO: If we ever decide to create the secondary command buffers ahead of time before we
+ // are actually going to submit them, we will need to track the sampled images and delay
+ // adding the layout change/barrier until we are ready to submit.
+ vkTexture->setImageLayout(gpu,
+ VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
+ VK_ACCESS_SHADER_READ_BIT,
+ VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
+ false);
+}
+
static void prepare_sampled_images(const GrProcessor& processor, GrVkGpu* gpu) {
for (int i = 0; i < processor.numTextureSamplers(); ++i) {
const GrProcessor::TextureSampler& sampler = processor.textureSampler(i);
@@ -501,15 +512,7 @@ static void prepare_sampled_images(const GrProcessor& processor, GrVkGpu* gpu) {
vkTexture->texturePriv().dirtyMipMaps(false);
}
}
-
- // TODO: If we ever decide to create the secondary command buffers ahead of time before we
- // are actually going to submit them, we will need to track the sampled images and delay
- // adding the layout change/barrier until we are ready to submit.
- vkTexture->setImageLayout(gpu,
- VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
- VK_ACCESS_SHADER_READ_BIT,
- VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
- false);
+ set_texture_layout(vkTexture, gpu);
}
}
@@ -532,7 +535,9 @@ void GrVkGpuCommandBuffer::onDraw(const GrPipeline& pipeline,
while (const GrFragmentProcessor* fp = iter.next()) {
prepare_sampled_images(*fp, fGpu);
}
- prepare_sampled_images(pipeline.getXferProcessor(), fGpu);
+ if (GrVkTexture* dstTexture = static_cast<GrVkTexture*>(pipeline.dstTexture())) {
+ set_texture_layout(dstTexture, fGpu);
+ }
GrPrimitiveType primitiveType = meshes[0].primitiveType();
sk_sp<GrVkPipelineState> pipelineState = this->prepareDrawState(pipeline,
diff --git a/src/gpu/vk/GrVkPipelineState.cpp b/src/gpu/vk/GrVkPipelineState.cpp
index 91fdc3f990..b689866be2 100644
--- a/src/gpu/vk/GrVkPipelineState.cpp
+++ b/src/gpu/vk/GrVkPipelineState.cpp
@@ -214,8 +214,14 @@ void GrVkPipelineState::setData(GrVkGpu* gpu,
}
SkASSERT(!fp && !glslFP);
- fXferProcessor->setData(fDataManager, pipeline.getXferProcessor());
- append_texture_bindings(pipeline.getXferProcessor(), &textureBindings);
+ SkIPoint offset;
+ GrTexture* dstTexture = pipeline.dstTexture(&offset);
+ fXferProcessor->setData(fDataManager, pipeline.getXferProcessor(), dstTexture, offset);
+ GrProcessor::TextureSampler dstTextureSampler;
+ if (dstTexture) {
+ dstTextureSampler.reset(dstTexture);
+ textureBindings.push_back(&dstTextureSampler);
+ }
// Get new descriptor sets
if (fNumSamplers) {