本文整理汇总了C++中GrVkRenderTarget::simpleRenderPass方法的典型用法代码示例。如果您正苦于以下问题:C++ GrVkRenderTarget::simpleRenderPass方法的具体用法?C++ GrVkRenderTarget::simpleRenderPass怎么用?C++ GrVkRenderTarget::simpleRenderPass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrVkRenderTarget
的用法示例。
在下文中一共展示了GrVkRenderTarget::simpleRenderPass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildStateKey
void GrVkPipelineState::BuildStateKey(const GrPipeline& pipeline, GrPrimitiveType primitiveType,
SkTArray<uint8_t, true>* key) {
// Save room for the key length and key header
key->reset();
key->push_back_n(kData_StateKeyOffset);
GrProcessorKeyBuilder b(key);
GrVkRenderTarget* vkRT = (GrVkRenderTarget*)pipeline.getRenderTarget();
vkRT->simpleRenderPass()->genKey(&b);
pipeline.getStencil().genKey(&b);
SkASSERT(sizeof(GrPipelineBuilder::DrawFace) <= sizeof(uint32_t));
b.add32(pipeline.getDrawFace());
b.add32(get_blend_info_key(pipeline));
b.add32(primitiveType);
// Set key length
int keyLength = key->count();
SkASSERT(0 == (keyLength % 4));
*reinterpret_cast<uint32_t*>(key->begin()) = SkToU32(keyLength);
}
示例2: onDraw
void GrVkGpuCommandBuffer::onDraw(const GrPipeline& pipeline,
const GrPrimitiveProcessor& primProc,
const GrMesh* meshes,
int meshCount) {
if (!meshCount) {
return;
}
GrRenderTarget* rt = pipeline.getRenderTarget();
GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(rt);
const GrVkRenderPass* renderPass = vkRT->simpleRenderPass();
SkASSERT(renderPass);
prepare_sampled_images(primProc, fGpu);
GrFragmentProcessor::Iter iter(pipeline);
while (const GrFragmentProcessor* fp = iter.next()) {
prepare_sampled_images(*fp, fGpu);
}
prepare_sampled_images(pipeline.getXferProcessor(), fGpu);
GrPrimitiveType primitiveType = meshes[0].primitiveType();
sk_sp<GrVkPipelineState> pipelineState = this->prepareDrawState(pipeline,
primProc,
primitiveType,
*renderPass);
if (!pipelineState) {
return;
}
for (int i = 0; i < meshCount; ++i) {
const GrMesh& mesh = meshes[i];
GrMesh::Iterator iter;
const GrNonInstancedMesh* nonIdxMesh = iter.init(mesh);
do {
if (nonIdxMesh->primitiveType() != primitiveType) {
// Technically we don't have to call this here (since there is a safety check in
// pipelineState:setData but this will allow for quicker freeing of resources if the
// pipelineState sits in a cache for a while.
pipelineState->freeTempResources(fGpu);
SkDEBUGCODE(pipelineState = nullptr);
primitiveType = nonIdxMesh->primitiveType();
pipelineState = this->prepareDrawState(pipeline,
primProc,
primitiveType,
*renderPass);
if (!pipelineState) {
return;
}
}
SkASSERT(pipelineState);
this->bindGeometry(primProc, *nonIdxMesh);
if (nonIdxMesh->isIndexed()) {
fCommandBuffer->drawIndexed(fGpu,
nonIdxMesh->indexCount(),
1,
nonIdxMesh->startIndex(),
nonIdxMesh->startVertex(),
0);
} else {
fCommandBuffer->draw(fGpu,
nonIdxMesh->vertexCount(),
1,
nonIdxMesh->startVertex(),
0);
}
fIsEmpty = false;
fGpu->stats()->incNumDraws();
} while ((nonIdxMesh = iter.next()));
}
// Technically we don't have to call this here (since there is a safety check in
// pipelineState:setData but this will allow for quicker freeing of resources if the
// pipelineState sits in a cache for a while.
pipelineState->freeTempResources(fGpu);
}
示例3: copySurfaceAsDraw
//.........这里部分代码省略.........
GrStencilAttachment* stencil = rt->renderTargetPriv().getStencilAttachment();
if (stencil) {
GrVkStencilAttachment* vkStencil = (GrVkStencilAttachment*)stencil;
// We aren't actually using the stencil but we still load and store it so we need
// appropriate barriers.
// TODO: Once we refactor surface and how we conntect stencil to RTs, we should not even
// have the stencil on this render pass if possible.
vkStencil->setImageLayout(gpu,
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT |
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT,
VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT,
false);
}
VkAttachmentLoadOp loadOp = canDiscardOutsideDstRect ? VK_ATTACHMENT_LOAD_OP_DONT_CARE
: VK_ATTACHMENT_LOAD_OP_LOAD;
GrVkRenderPass::LoadStoreOps vkColorOps(loadOp, VK_ATTACHMENT_STORE_OP_STORE);
GrVkRenderPass::LoadStoreOps vkStencilOps(VK_ATTACHMENT_LOAD_OP_LOAD,
VK_ATTACHMENT_STORE_OP_STORE);
const GrVkRenderPass* renderPass;
const GrVkResourceProvider::CompatibleRPHandle& rpHandle = rt->compatibleRenderPassHandle();
if (rpHandle.isValid()) {
renderPass = gpu->resourceProvider().findRenderPass(rpHandle,
vkColorOps,
vkStencilOps);
} else {
renderPass = gpu->resourceProvider().findRenderPass(*rt,
vkColorOps,
vkStencilOps);
}
SkASSERT(renderPass->isCompatible(*rt->simpleRenderPass()));
GrVkPrimaryCommandBuffer* cmdBuffer = gpu->currentCommandBuffer();
cmdBuffer->beginRenderPass(gpu, renderPass, nullptr, *rt, bounds, true);
GrVkSecondaryCommandBuffer* secondary = gpu->cmdPool()->findOrCreateSecondaryCommandBuffer(gpu);
if (!secondary) {
return false;
}
secondary->begin(gpu, rt->framebuffer(), renderPass);
secondary->bindPipeline(gpu, pipeline);
// Uniform DescriptorSet, Sampler DescriptorSet, and vertex shader uniformBuffer
SkSTArray<3, const GrVkRecycledResource*> descriptorRecycledResources;
descriptorRecycledResources.push_back(uniformDS);
descriptorRecycledResources.push_back(samplerDS);
descriptorRecycledResources.push_back(fUniformBuffer->resource());
// One sampler, texture view, and texture
SkSTArray<3, const GrVkResource*> descriptorResources;
descriptorResources.push_back(sampler);
descriptorResources.push_back(srcTex->textureView());
descriptorResources.push_back(srcTex->resource());
secondary->bindDescriptorSets(gpu,
descriptorRecycledResources,
descriptorResources,
fPipelineLayout,
0,
2,
vkDescSets,
0,