31 std::unique_ptr<GrGeometryProcessor::ProgramImpl> gpImpl,
32 std::unique_ptr<GrXferProcessor::ProgramImpl> xpImpl,
33 std::vector<std::unique_ptr<GrFragmentProcessor::ProgramImpl>> fpImpls,
35 size_t instanceStride)
36 : fPipeline(
std::move(pipeline))
37 , fRootSignature(
std::move(rootSignature))
38 , fBuiltinUniformHandles(builtinUniformHandles)
39 , fGPImpl(
std::move(gpImpl))
40 , fXPImpl(
std::move(xpImpl))
41 , fFPImpls(
std::move(fpImpls))
42 , fDataManager(uniforms, uniformSize)
43 , fNumSamplers(numSamplers)
44 , fVertexStride(vertexStride)
45 , fInstanceStride(instanceStride) {}
50 this->setRenderTargetState(renderTarget, programInfo.
origin());
54 for (
int i = 0;
i < programInfo.
pipeline().numFragmentProcessors(); ++
i) {
65 D3D12_GPU_VIRTUAL_ADDRESS constantsAddress = fDataManager.
uploadConstants(gpu);
75 if (fRenderTargetState.fRenderTargetOrigin != origin ||
76 fRenderTargetState.fRenderTargetSize != dimensions) {
77 fRenderTargetState.fRenderTargetSize = dimensions;
78 fRenderTargetState.fRenderTargetOrigin = origin;
86 if (fBuiltinUniformHandles.
fRTFlipUni.isValid()) {
100 std::vector<D3D12_CPU_DESCRIPTOR_HANDLE> shaderResourceViews(fNumSamplers);
101 std::vector<D3D12_CPU_DESCRIPTOR_HANDLE> samplers(fNumSamplers);
102 unsigned int currTextureBinding = 0;
105 SkASSERT(geomProcTextures[
i]->asTextureProxy());
108 shaderResourceViews[currTextureBinding] =
texture->shaderResourceView();
109 samplers[currTextureBinding++] =
116 shaderResourceViews[currTextureBinding] =
texture->shaderResourceView();
125 shaderResourceViews[currTextureBinding] =
texture->shaderResourceView();
126 samplers[currTextureBinding++] =
131 SkASSERT(fNumSamplers == currTextureBinding);
134 if (fNumSamplers > 0) {
145 srvTable->baseGpuDescriptor());
150 samplerTable->baseGpuDescriptor());
161 auto* d3dVertexBuffer =
static_cast<const GrD3DBuffer*
>(vertexBuffer.
get());
162 SkASSERT(!d3dVertexBuffer->isCpuBuffer());
163 SkASSERT(!d3dVertexBuffer->isMapped());
164 const_cast<GrD3DBuffer*
>(d3dVertexBuffer)->setResourceState(
165 gpu, D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER);
167 if (instanceBuffer) {
168 auto* d3dInstanceBuffer =
static_cast<const GrD3DBuffer*
>(instanceBuffer.
get());
169 SkASSERT(!d3dInstanceBuffer->isCpuBuffer());
170 SkASSERT(!d3dInstanceBuffer->isMapped());
171 const_cast<GrD3DBuffer*
>(d3dInstanceBuffer)->setResourceState(
172 gpu, D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER);
175 std::move(instanceBuffer), fInstanceStride);
177 if (
auto* d3dIndexBuffer =
static_cast<const GrD3DBuffer*
>(indexBuffer.
get())) {
178 SkASSERT(!d3dIndexBuffer->isCpuBuffer());
179 SkASSERT(!d3dIndexBuffer->isMapped());
180 const_cast<GrD3DBuffer*
>(d3dIndexBuffer)->setResourceState(
181 gpu, D3D12_RESOURCE_STATE_INDEX_BUFFER);
@ kTopLeft_GrSurfaceOrigin
const GrShaderCaps * shaderCaps() const
void addSampledTextureRef(GrD3DTexture *)
void setGraphicsRootConstantBufferView(unsigned int rootParameterIndex, D3D12_GPU_VIRTUAL_ADDRESS bufferLocation)
void setVertexBuffers(unsigned int startSlot, sk_sp< const GrBuffer > vertexBuffer, size_t vertexStride, sk_sp< const GrBuffer > instanceBuffer, size_t instanceStride)
void setDescriptorHeaps(ID3D12DescriptorHeap *srvDescriptorHeap, ID3D12DescriptorHeap *samplerDescriptorHeap)
void setIndexBuffer(sk_sp< const GrBuffer > indexBuffer)
void setGraphicsRootDescriptorTable(unsigned int rootParameterIndex, D3D12_GPU_DESCRIPTOR_HANDLE bufferLocation)
GrD3DDirectCommandList * currentCommandList() const
GrD3DResourceProvider & resourceProvider()
D3D12_GPU_VIRTUAL_ADDRESS uploadConstants(GrD3DGpu *gpu)
void setAndBindTextures(GrD3DGpu *, const GrGeometryProcessor &, const GrSurfaceProxy *const geomProcTextures[], const GrPipeline &)
const sk_sp< GrD3DPipeline > & pipeline() const
void setAndBindConstants(GrD3DGpu *, const GrRenderTarget *, const GrProgramInfo &)
void bindBuffers(GrD3DGpu *, sk_sp< const GrBuffer > indexBuffer, sk_sp< const GrBuffer > instanceBuffer, sk_sp< const GrBuffer > vertexBuffer, GrD3DDirectCommandList *commandList)
GrD3DPipelineState(sk_sp< GrD3DPipeline > pipeline, sk_sp< GrD3DRootSignature > rootSignature, const GrGLSLBuiltinUniformHandles &builtinUniformHandles, const UniformInfoArray &uniforms, uint32_t uniformSize, uint32_t numSamplers, std::unique_ptr< GrGeometryProcessor::ProgramImpl > gpImpl, std::unique_ptr< GrXferProcessor::ProgramImpl > xpImpl, std::vector< std::unique_ptr< GrFragmentProcessor::ProgramImpl > > fpImpls, size_t vertexStride, size_t instanceStride)
sk_sp< GrD3DDescriptorTable > findOrCreateShaderViewTable(const std::vector< D3D12_CPU_DESCRIPTOR_HANDLE > &shaderViews)
D3D12_CPU_DESCRIPTOR_HANDLE findOrCreateCompatibleSampler(const GrSamplerState ¶ms)
sk_sp< GrD3DDescriptorTable > findOrCreateSamplerTable(const std::vector< D3D12_CPU_DESCRIPTOR_HANDLE > &samplers)
@ kShaderViewDescriptorTable
@ kSamplerDescriptorTable
void setData(const GrGLSLProgramDataManager &pdman, const GrFragmentProcessor &processor)
const TextureSampler & textureSampler(int index) const
int numTextureSamplers() const
const GrCaps * caps() const
void setDstTextureUniforms(const GrGLSLProgramDataManager &pdm, GrGLSLBuiltinUniformHandles *fBuiltinUniformHandles) const
const GrFragmentProcessor & getFragmentProcessor(int idx) const
const GrXferProcessor & getXferProcessor() const
GrSurfaceOrigin origin() const
const GrPipeline & pipeline() const
const GrGeometryProcessor & geomProc() const
GrTexture * peekTexture() const
SkISize dimensions() const
GrTexture * texture() const
GrSamplerState samplerState() const
static std::array< float, 2 > GetRTFlipVector(int rtHeight, bool flipY)
static std::array< float, 4 > GetRTAdjustVector(SkISize rtDims, bool flipY)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d