Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
GrD3DPipelineStateBuilder Class Reference

#include <GrD3DPipelineStateBuilder.h>

Inheritance diagram for GrD3DPipelineStateBuilder:
GrGLSLProgramBuilder

Public Member Functions

const GrCapscaps () const override
 
GrD3DGpugpu () const
 
void finalizeFragmentSecondaryColor (GrShaderVar &outputColor) override
 
- Public Member Functions inherited from GrGLSLProgramBuilder
virtual ~GrGLSLProgramBuilder ()
 
virtual const GrCapscaps () const =0
 
const GrShaderCapsshaderCaps () const
 
GrSurfaceOrigin origin () const
 
const GrPipelinepipeline () const
 
const GrGeometryProcessorgeometryProcessor () const
 
bool snapVerticesToPixelCenters () const
 
bool hasPointSize () const
 
const GrProgramDescdesc () const
 
void appendUniformDecls (GrShaderFlags visibility, SkString *) const
 
const char * samplerVariable (SamplerHandle handle) const
 
skgpu::Swizzle samplerSwizzle (SamplerHandle handle) const
 
const char * inputSamplerVariable (SamplerHandle handle) const
 
skgpu::Swizzle inputSamplerSwizzle (SamplerHandle handle) const
 
void addRTFlipUniform (const char *name)
 
SkString nameVariable (char prefix, const char *name, bool mangle=true)
 
bool emitTextureSamplersForFPs (const GrFragmentProcessor &fp, GrFragmentProcessor::ProgramImpl &impl, int *samplerIndex)
 
void advanceStage ()
 
void writeFPFunction (const GrFragmentProcessor &fp, GrFragmentProcessor::ProgramImpl &impl)
 
std::string invokeFP (const GrFragmentProcessor &fp, const GrFragmentProcessor::ProgramImpl &impl, const char *inputColor, const char *destColor, const char *coords) const
 
bool fragmentProcessorHasCoordsParam (const GrFragmentProcessor *) const
 
virtual GrGLSLUniformHandleruniformHandler ()=0
 
virtual const GrGLSLUniformHandleruniformHandler () const =0
 
virtual GrGLSLVaryingHandlervaryingHandler ()=0
 
virtual void finalizeFragmentSecondaryColor (GrShaderVar &outputColor)
 

Static Public Member Functions

static std::unique_ptr< GrD3DPipelineStateMakePipelineState (GrD3DGpu *, GrD3DRenderTarget *, const GrProgramDesc &, const GrProgramInfo &)
 
static sk_sp< GrD3DPipelineMakeComputePipeline (GrD3DGpu *, GrD3DRootSignature *, const char *shader)
 

Additional Inherited Members

- Public Types inherited from GrGLSLProgramBuilder
using UniformHandle = GrGLSLUniformHandler::UniformHandle
 
using SamplerHandle = GrGLSLUniformHandler::SamplerHandle
 
- Public Attributes inherited from GrGLSLProgramBuilder
GrGLSLVertexBuilder fVS
 
GrGLSLFragmentShaderBuilder fFS
 
const GrProgramDescfDesc
 
const GrProgramInfofProgramInfo
 
GrGLSLBuiltinUniformHandles fUniformHandles
 
std::unique_ptr< GrGeometryProcessor::ProgramImplfGPImpl
 
std::unique_ptr< GrXferProcessor::ProgramImplfXPImpl
 
std::vector< std::unique_ptr< GrFragmentProcessor::ProgramImpl > > fFPImpls
 
SamplerHandle fDstTextureSamplerHandle
 
GrSurfaceOrigin fDstTextureOrigin
 
- Static Public Attributes inherited from GrGLSLProgramBuilder
static const int kVarsPerBlock = 8
 
- Protected Member Functions inherited from GrGLSLProgramBuilder
 GrGLSLProgramBuilder (const GrProgramDesc &, const GrProgramInfo &)
 
void addFeature (GrShaderFlags shaders, uint32_t featureBit, const char *extensionName)
 
bool emitAndInstallProcs ()
 
void finalizeShaders ()
 
bool fragColorIsInOut () const
 

Detailed Description

Definition at line 33 of file GrD3DPipelineStateBuilder.h.

Member Function Documentation

◆ caps()

const GrCaps * GrD3DPipelineStateBuilder::caps ( ) const
overridevirtual

Implements GrGLSLProgramBuilder.

Definition at line 65 of file GrD3DPipelineStateBuilder.cpp.

65 {
66 return fGpu->caps();
67}
const GrCaps * caps() const
Definition: GrGpu.h:73

◆ finalizeFragmentSecondaryColor()

void GrD3DPipelineStateBuilder::finalizeFragmentSecondaryColor ( GrShaderVar outputColor)
overridevirtual

Reimplemented from GrGLSLProgramBuilder.

Definition at line 69 of file GrD3DPipelineStateBuilder.cpp.

69 {
70 outputColor.addLayoutQualifier("location = 0, index = 1");
71}
void addLayoutQualifier(const char *layoutQualifier)
Definition: GrShaderVar.h:103

◆ gpu()

GrD3DGpu * GrD3DPipelineStateBuilder::gpu ( ) const
inline

Definition at line 51 of file GrD3DPipelineStateBuilder.h.

51{ return fGpu; }

◆ MakeComputePipeline()

sk_sp< GrD3DPipeline > GrD3DPipelineStateBuilder::MakeComputePipeline ( GrD3DGpu gpu,
GrD3DRootSignature rootSig,
const char *  shader 
)
static

Definition at line 638 of file GrD3DPipelineStateBuilder.cpp.

640 {
641 D3D12_COMPUTE_PIPELINE_STATE_DESC psoDesc = {};
642 psoDesc.pRootSignature = rootSig->rootSignature();
643
644 // compile shader
645 gr_cp<ID3DBlob> shaderBlob;
646 {
647 TRACE_EVENT0("skia.shaders", "driver_compile_shader");
648 uint32_t compileFlags = 0;
649#ifdef SK_DEBUG
650 // Enable better shader debugging with the graphics debugging tools.
651 compileFlags |= D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION;
652#endif
653
655 HRESULT hr = D3DCompile(shader, strlen(shader), nullptr, nullptr, nullptr, "main",
656 "cs_5_1", compileFlags, 0, &shaderBlob, &errors);
657 if (!SUCCEEDED(hr)) {
659 shader, reinterpret_cast<char*>(errors->GetBufferPointer()));
660 return nullptr;
661 }
662 psoDesc.CS = { reinterpret_cast<UINT8*>(shaderBlob->GetBufferPointer()),
663 shaderBlob->GetBufferSize() };
664 }
665
666 // Only used for multi-adapter systems.
667 psoDesc.NodeMask = 0;
668
669 psoDesc.CachedPSO = { nullptr, 0 };
670 psoDesc.Flags = D3D12_PIPELINE_STATE_FLAG_NONE;
671
672 gr_cp<ID3D12PipelineState> pipelineState;
673 {
674 TRACE_EVENT0("skia.shaders", "CreateComputePipelineState");
676 gpu->device()->CreateComputePipelineState(&psoDesc, IID_PPV_ARGS(&pipelineState)));
677 }
678
679 return GrD3DPipeline::Make(std::move(pipelineState));
680}
#define GR_D3D_CALL_ERRCHECK(X)
Definition: GrD3DUtil.h:18
GrContextOptions::ShaderErrorHandler * getShaderErrorHandler() const
ID3D12Device * device() const
Definition: GrD3DGpu.h:43
static sk_sp< GrD3DPipeline > Make(gr_cp< ID3D12PipelineState > pipelineState)
Definition: GrD3DPipeline.h:16
ID3D12RootSignature * rootSignature() const
GrDirectContextPriv priv()
GrDirectContext * getContext()
Definition: GrGpu.h:67
virtual void compileError(const char *shader, const char *errors)
#define TRACE_EVENT0(category_group, name)
Definition: trace_event.h:131
#define SUCCEEDED(hr)

◆ MakePipelineState()

std::unique_ptr< GrD3DPipelineState > GrD3DPipelineStateBuilder::MakePipelineState ( GrD3DGpu gpu,
GrD3DRenderTarget renderTarget,
const GrProgramDesc desc,
const GrProgramInfo programInfo 
)
static

Generates a pipeline state.

The returned GrD3DPipelineState implements the supplied GrProgramInfo.

Returns
the created pipeline if generation was successful; nullptr otherwise

Definition at line 36 of file GrD3DPipelineStateBuilder.cpp.

40 {
41 // ensure that we use "." as a decimal separator when creating SkSL code
42 GrAutoLocaleSetter als("C");
43
44 // create a builder. This will be handed off to effects so they can use it to add
45 // uniforms, varyings, textures, etc
46 GrD3DPipelineStateBuilder builder(gpu, renderTarget, desc, programInfo);
47
48 if (!builder.emitAndInstallProcs()) {
49 return nullptr;
50 }
51
52 return builder.finalize();
53}
const GrProgramDesc & desc() const

The documentation for this class was generated from the following files: