void GrVkProgram::setData(const GrVkGpu* gpu, const GrPrimitiveProcessor& primProc, const GrPipeline& pipeline) { // This is here to protect against someone calling setData multiple times in a row without // freeing the tempData between calls. this->freeTempResources(gpu); this->setRenderTargetState(pipeline); SkSTArray<8, const GrTextureAccess*> textureBindings; fGeometryProcessor->setData(fProgramDataManager, primProc); append_texture_bindings(primProc, &textureBindings); for (int i = 0; i < fFragmentProcessors.count(); ++i) { const GrFragmentProcessor& processor = pipeline.getFragmentProcessor(i); fFragmentProcessors[i]->setData(fProgramDataManager, processor); fGeometryProcessor->setTransformData(primProc, fProgramDataManager, i, processor.coordTransforms()); append_texture_bindings(processor, &textureBindings); } fXferProcessor->setData(fProgramDataManager, pipeline.getXferProcessor()); append_texture_bindings(pipeline.getXferProcessor(), &textureBindings); this->writeUniformBuffers(gpu); this->writeSamplers(gpu, textureBindings); }
void GrVkPipelineState::setData(GrVkGpu* gpu, const GrPrimitiveProcessor& primProc, const GrPipeline& pipeline) { // This is here to protect against someone calling setData multiple times in a row without // freeing the tempData between calls. this->freeTempResources(gpu); this->setRenderTargetState(pipeline); SkSTArray<8, const GrTextureAccess*> textureBindings; fGeometryProcessor->setData(fDataManager, primProc); append_texture_bindings(primProc, &textureBindings); for (int i = 0; i < fFragmentProcessors.count(); ++i) { const GrFragmentProcessor& processor = pipeline.getFragmentProcessor(i); fFragmentProcessors[i]->setData(fDataManager, processor); fGeometryProcessor->setTransformData(primProc, fDataManager, i, processor.coordTransforms()); append_texture_bindings(processor, &textureBindings); } fXferProcessor->setData(fDataManager, pipeline.getXferProcessor()); append_texture_bindings(pipeline.getXferProcessor(), &textureBindings); // Get new descriptor sets if (fNumSamplers) { fSamplerPoolManager.getNewDescriptorSet(gpu, &fDescriptorSets[GrVkUniformHandler::kSamplerDescSet]); this->writeSamplers(gpu, textureBindings, pipeline.getAllowSRGBInputs()); } if (fVertexUniformBuffer.get() || fFragmentUniformBuffer.get()) { if (fDataManager.uploadUniformBuffers(gpu, fVertexUniformBuffer, fFragmentUniformBuffer) || VK_NULL_HANDLE == fDescriptorSets[GrVkUniformHandler::kUniformBufferDescSet]) { const GrVkDescriptorPool* pool; int uniformDSIdx = GrVkUniformHandler::kUniformBufferDescSet; gpu->resourceProvider().getUniformDescriptorSet(&fDescriptorSets[uniformDSIdx], &pool); if (pool != fCurrentUniformDescPool) { if (fCurrentUniformDescPool) { fCurrentUniformDescPool->unref(gpu); } fCurrentUniformDescPool = pool; fCurrentUniformDescPool->ref(); } this->writeUniformBuffers(gpu); } } }
void GrGLProgram::setData(const GrPrimitiveProcessor& primProc, const GrPipeline& pipeline, SkTArray<const GrTextureAccess*>* textureBindings) { this->setRenderTargetState(primProc, pipeline); // we set the textures, and uniforms for installed processors in a generic way, but subclasses // of GLProgram determine how to set coord transforms fGeometryProcessor->setData(fProgramDataManager, primProc); append_texture_bindings(primProc, textureBindings); this->setFragmentData(primProc, pipeline, textureBindings); if (primProc.getPixelLocalStorageState() != GrPixelLocalStorageState::kDraw_GrPixelLocalStorageState) { const GrXferProcessor& xp = pipeline.getXferProcessor(); fXferProcessor->setData(fProgramDataManager, xp); append_texture_bindings(xp, textureBindings); } }
void GrGLProgram::setFragmentData(const GrPrimitiveProcessor& primProc, const GrPipeline& pipeline, SkTArray<const GrTextureAccess*>* textureBindings) { int numProcessors = fFragmentProcessors.count(); for (int i = 0; i < numProcessors; ++i) { const GrFragmentProcessor& processor = pipeline.getFragmentProcessor(i); fFragmentProcessors[i]->setData(fProgramDataManager, processor); this->setTransformData(primProc, processor, i); append_texture_bindings(processor, textureBindings); } }