Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions | Variables
GrD3DPipelineStateBuilder.cpp File Reference
#include "src/gpu/ganesh/d3d/GrD3DPipelineStateBuilder.h"
#include "include/gpu/GrDirectContext.h"
#include "include/gpu/d3d/GrD3DTypes.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkTraceEvent.h"
#include "src/gpu/PipelineUtils.h"
#include "src/gpu/ganesh/GrAutoLocaleSetter.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
#include "src/gpu/ganesh/GrPersistentCacheUtils.h"
#include "src/gpu/ganesh/GrShaderCaps.h"
#include "src/gpu/ganesh/GrStencilSettings.h"
#include "src/gpu/ganesh/d3d/GrD3DGpu.h"
#include "src/gpu/ganesh/d3d/GrD3DPipeline.h"
#include "src/gpu/ganesh/d3d/GrD3DRenderTarget.h"
#include "src/gpu/ganesh/d3d/GrD3DRootSignature.h"
#include "src/gpu/ganesh/d3d/GrD3DUtil.h"
#include "src/sksl/SkSLCompiler.h"
#include "src/sksl/SkSLProgramKind.h"
#include "src/sksl/SkSLProgramSettings.h"
#include "src/utils/SkShaderUtils.h"
#include <d3dcompiler.h>

Go to the source code of this file.

Functions

static gr_cp< ID3DBlob > GrCompileHLSLShader (GrD3DGpu *gpu, const std::string &hlsl, SkSL::ProgramKind kind)
 
static DXGI_FORMAT attrib_type_to_format (GrVertexAttribType type)
 
static void setup_vertex_input_layout (const GrGeometryProcessor &geomProc, D3D12_INPUT_ELEMENT_DESC *inputElements)
 
static D3D12_BLEND blend_coeff_to_d3d_blend (skgpu::BlendCoeff coeff)
 
static D3D12_BLEND blend_coeff_to_d3d_blend_for_alpha (skgpu::BlendCoeff coeff)
 
static D3D12_BLEND_OP blend_equation_to_d3d_op (skgpu::BlendEquation equation)
 
static void fill_in_blend_state (const GrPipeline &pipeline, D3D12_BLEND_DESC *blendDesc)
 
static void fill_in_rasterizer_state (const GrPipeline &pipeline, bool multisampleEnable, const GrCaps *caps, D3D12_RASTERIZER_DESC *rasterizer)
 
static D3D12_STENCIL_OP stencil_op_to_d3d_op (GrStencilOp op)
 
static D3D12_COMPARISON_FUNC stencil_test_to_d3d_func (GrStencilTest test)
 
static void setup_stencilop_desc (D3D12_DEPTH_STENCILOP_DESC *desc, const GrStencilSettings::Face &stencilFace)
 
static void fill_in_depth_stencil_state (const GrProgramInfo &programInfo, D3D12_DEPTH_STENCIL_DESC *dsDesc)
 
static D3D12_PRIMITIVE_TOPOLOGY_TYPE gr_primitive_type_to_d3d (GrPrimitiveType primitiveType)
 
gr_cp< ID3D12PipelineState > create_pipeline_state (GrD3DGpu *gpu, const GrProgramInfo &programInfo, const sk_sp< GrD3DRootSignature > &rootSig, gr_cp< ID3DBlob > vertexShader, gr_cp< ID3DBlob > pixelShader, DXGI_FORMAT renderTargetFormat, DXGI_FORMAT depthStencilFormat, unsigned int sampleQualityPattern)
 

Variables

static constexpr SkFourByteTag kHLSL_Tag = SkSetFourByteTag('H', 'L', 'S', 'L')
 
static constexpr SkFourByteTag kSKSL_Tag = SkSetFourByteTag('S', 'K', 'S', 'L')
 

Function Documentation

◆ attrib_type_to_format()

static DXGI_FORMAT attrib_type_to_format ( GrVertexAttribType  type)
static

Definition at line 151 of file GrD3DPipelineStateBuilder.cpp.

151 {
152 switch (type) {
154 return DXGI_FORMAT_R32_FLOAT;
156 return DXGI_FORMAT_R32G32_FLOAT;
158 return DXGI_FORMAT_R32G32B32_FLOAT;
160 return DXGI_FORMAT_R32G32B32A32_FLOAT;
162 return DXGI_FORMAT_R16_FLOAT;
164 return DXGI_FORMAT_R16G16_FLOAT;
166 return DXGI_FORMAT_R16G16B16A16_FLOAT;
168 return DXGI_FORMAT_R32G32_SINT;
170 return DXGI_FORMAT_R32G32B32_SINT;
172 return DXGI_FORMAT_R32G32B32A32_SINT;
174 return DXGI_FORMAT_R8_SINT;
176 return DXGI_FORMAT_R8G8_SINT;
178 return DXGI_FORMAT_R8G8B8A8_SINT;
180 return DXGI_FORMAT_R8_UINT;
182 return DXGI_FORMAT_R8G8_UINT;
184 return DXGI_FORMAT_R8G8B8A8_UINT;
186 return DXGI_FORMAT_R8_UNORM;
188 return DXGI_FORMAT_R8G8B8A8_UNORM;
190 return DXGI_FORMAT_R16G16_SINT;
192 return DXGI_FORMAT_R16G16B16A16_SINT;
194 return DXGI_FORMAT_R16G16_UINT;
196 return DXGI_FORMAT_R16G16_UNORM;
198 return DXGI_FORMAT_R32_SINT;
200 return DXGI_FORMAT_R32_UINT;
202 return DXGI_FORMAT_R16_UNORM;
204 return DXGI_FORMAT_R16G16B16A16_UNORM;
205 }
206 SK_ABORT("Unknown vertex attrib type");
207}
@ kUShort_norm_GrVertexAttribType
@ kFloat2_GrVertexAttribType
@ kUShort2_GrVertexAttribType
@ kUInt_GrVertexAttribType
@ kUByte4_norm_GrVertexAttribType
@ kUByte_GrVertexAttribType
@ kShort2_GrVertexAttribType
@ kUShort4_norm_GrVertexAttribType
@ kInt_GrVertexAttribType
@ kByte_GrVertexAttribType
@ kByte4_GrVertexAttribType
@ kFloat3_GrVertexAttribType
@ kFloat_GrVertexAttribType
@ kByte2_GrVertexAttribType
@ kFloat4_GrVertexAttribType
@ kShort4_GrVertexAttribType
@ kUShort2_norm_GrVertexAttribType
@ kInt3_GrVertexAttribType
@ kHalf2_GrVertexAttribType
@ kHalf4_GrVertexAttribType
@ kUByte4_GrVertexAttribType
@ kUByte2_GrVertexAttribType
@ kInt4_GrVertexAttribType
@ kUByte_norm_GrVertexAttribType
@ kInt2_GrVertexAttribType
@ kHalf_GrVertexAttribType
#define SK_ABORT(message,...)
Definition SkAssert.h:70

◆ blend_coeff_to_d3d_blend()

static D3D12_BLEND blend_coeff_to_d3d_blend ( skgpu::BlendCoeff  coeff)
static

Definition at line 244 of file GrD3DPipelineStateBuilder.cpp.

244 {
245 switch (coeff) {
247 return D3D12_BLEND_ZERO;
249 return D3D12_BLEND_ONE;
251 return D3D12_BLEND_SRC_COLOR;
253 return D3D12_BLEND_INV_SRC_COLOR;
255 return D3D12_BLEND_DEST_COLOR;
257 return D3D12_BLEND_INV_DEST_COLOR;
259 return D3D12_BLEND_SRC_ALPHA;
261 return D3D12_BLEND_INV_SRC_ALPHA;
263 return D3D12_BLEND_DEST_ALPHA;
265 return D3D12_BLEND_INV_DEST_ALPHA;
267 return D3D12_BLEND_BLEND_FACTOR;
269 return D3D12_BLEND_INV_BLEND_FACTOR;
271 return D3D12_BLEND_SRC1_COLOR;
273 return D3D12_BLEND_INV_SRC1_COLOR;
275 return D3D12_BLEND_SRC1_ALPHA;
277 return D3D12_BLEND_INV_SRC1_ALPHA;
279 return D3D12_BLEND_ZERO;
280 }
282}
#define SkUNREACHABLE
Definition SkAssert.h:135

◆ blend_coeff_to_d3d_blend_for_alpha()

static D3D12_BLEND blend_coeff_to_d3d_blend_for_alpha ( skgpu::BlendCoeff  coeff)
static

Definition at line 284 of file GrD3DPipelineStateBuilder.cpp.

284 {
285 switch (coeff) {
286 // Force all srcColor used in alpha slot to alpha version.
288 return D3D12_BLEND_SRC_ALPHA;
290 return D3D12_BLEND_INV_SRC_ALPHA;
292 return D3D12_BLEND_DEST_ALPHA;
294 return D3D12_BLEND_INV_DEST_ALPHA;
296 return D3D12_BLEND_SRC1_ALPHA;
298 return D3D12_BLEND_INV_SRC1_ALPHA;
299
300 default:
301 return blend_coeff_to_d3d_blend(coeff);
302 }
303}
static D3D12_BLEND blend_coeff_to_d3d_blend(skgpu::BlendCoeff coeff)

◆ blend_equation_to_d3d_op()

static D3D12_BLEND_OP blend_equation_to_d3d_op ( skgpu::BlendEquation  equation)
static

Definition at line 306 of file GrD3DPipelineStateBuilder.cpp.

306 {
307 switch (equation) {
309 return D3D12_BLEND_OP_ADD;
311 return D3D12_BLEND_OP_SUBTRACT;
313 return D3D12_BLEND_OP_REV_SUBTRACT;
314 default:
316 }
317}

◆ create_pipeline_state()

gr_cp< ID3D12PipelineState > create_pipeline_state ( GrD3DGpu gpu,
const GrProgramInfo programInfo,
const sk_sp< GrD3DRootSignature > &  rootSig,
gr_cp< ID3DBlob >  vertexShader,
gr_cp< ID3DBlob >  pixelShader,
DXGI_FORMAT  renderTargetFormat,
DXGI_FORMAT  depthStencilFormat,
unsigned int  sampleQualityPattern 
)

Definition at line 463 of file GrD3DPipelineStateBuilder.cpp.

467 {
468 D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {};
469
470 psoDesc.pRootSignature = rootSig->rootSignature();
471
472 psoDesc.VS = { reinterpret_cast<UINT8*>(vertexShader->GetBufferPointer()),
473 vertexShader->GetBufferSize() };
474 psoDesc.PS = { reinterpret_cast<UINT8*>(pixelShader->GetBufferPointer()),
475 pixelShader->GetBufferSize() };
476
477 psoDesc.StreamOutput = { nullptr, 0, nullptr, 0, 0 };
478
479 fill_in_blend_state(programInfo.pipeline(), &psoDesc.BlendState);
480 psoDesc.SampleMask = UINT_MAX;
481
482 fill_in_rasterizer_state(programInfo.pipeline(), programInfo.numSamples() > 1, gpu->caps(),
483 &psoDesc.RasterizerState);
484
485 fill_in_depth_stencil_state(programInfo, &psoDesc.DepthStencilState);
486
487 unsigned int totalAttributeCnt = programInfo.geomProc().numVertexAttributes() +
488 programInfo.geomProc().numInstanceAttributes();
489 AutoSTArray<4, D3D12_INPUT_ELEMENT_DESC> inputElements(totalAttributeCnt);
490 setup_vertex_input_layout(programInfo.geomProc(), inputElements.get());
491
492 psoDesc.InputLayout = { inputElements.get(), totalAttributeCnt };
493
494 psoDesc.IBStripCutValue = D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_DISABLED;
495
496 // This is for geometry or hull shader primitives
497 psoDesc.PrimitiveTopologyType = gr_primitive_type_to_d3d(programInfo.primitiveType());
498
499 psoDesc.NumRenderTargets = 1;
500
501 psoDesc.RTVFormats[0] = renderTargetFormat;
502
503 psoDesc.DSVFormat = depthStencilFormat;
504
505 unsigned int numSamples = programInfo.numSamples();
506 psoDesc.SampleDesc = { numSamples, sampleQualityPattern };
507
508 // Only used for multi-adapter systems.
509 psoDesc.NodeMask = 0;
510
511 psoDesc.CachedPSO = { nullptr, 0 };
512 psoDesc.Flags = D3D12_PIPELINE_STATE_FLAG_NONE;
513
514 gr_cp<ID3D12PipelineState> pipelineState;
515 {
516 TRACE_EVENT0("skia.shaders", "CreateGraphicsPipelineState");
518 gpu->device()->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&pipelineState)));
519 }
520
521 return pipelineState;
522}
static void setup_vertex_input_layout(const GrGeometryProcessor &geomProc, D3D12_INPUT_ELEMENT_DESC *inputElements)
static void fill_in_depth_stencil_state(const GrProgramInfo &programInfo, D3D12_DEPTH_STENCIL_DESC *dsDesc)
static void fill_in_rasterizer_state(const GrPipeline &pipeline, bool multisampleEnable, const GrCaps *caps, D3D12_RASTERIZER_DESC *rasterizer)
static D3D12_PRIMITIVE_TOPOLOGY_TYPE gr_primitive_type_to_d3d(GrPrimitiveType primitiveType)
static void fill_in_blend_state(const GrPipeline &pipeline, D3D12_BLEND_DESC *blendDesc)
#define GR_D3D_CALL_ERRCHECK(X)
Definition GrD3DUtil.h:16
ID3D12Device * device() const
Definition GrD3DGpu.h:43
ID3D12RootSignature * rootSignature() const
const GrCaps * caps() const
Definition GrGpu.h:73
int numSamples() const
GrPrimitiveType primitiveType() const
const GrPipeline & pipeline() const
const GrGeometryProcessor & geomProc() const
#define TRACE_EVENT0(category_group, name)

◆ fill_in_blend_state()

static void fill_in_blend_state ( const GrPipeline pipeline,
D3D12_BLEND_DESC *  blendDesc 
)
static

Definition at line 319 of file GrD3DPipelineStateBuilder.cpp.

319 {
320 blendDesc->AlphaToCoverageEnable = false;
321 blendDesc->IndependentBlendEnable = false;
322
323 const skgpu::BlendInfo& blendInfo = pipeline.getXferProcessor().getBlendInfo();
324
325 skgpu::BlendEquation equation = blendInfo.fEquation;
326 skgpu::BlendCoeff srcCoeff = blendInfo.fSrcBlend;
327 skgpu::BlendCoeff dstCoeff = blendInfo.fDstBlend;
328 bool blendOff = skgpu::BlendShouldDisable(equation, srcCoeff, dstCoeff);
329
330 auto& rtBlend = blendDesc->RenderTarget[0];
331 rtBlend.BlendEnable = !blendOff;
332 if (!blendOff) {
333 rtBlend.SrcBlend = blend_coeff_to_d3d_blend(srcCoeff);
334 rtBlend.DestBlend = blend_coeff_to_d3d_blend(dstCoeff);
335 rtBlend.BlendOp = blend_equation_to_d3d_op(equation);
336 rtBlend.SrcBlendAlpha = blend_coeff_to_d3d_blend_for_alpha(srcCoeff);
337 rtBlend.DestBlendAlpha = blend_coeff_to_d3d_blend_for_alpha(dstCoeff);
338 rtBlend.BlendOpAlpha = blend_equation_to_d3d_op(equation);
339 }
340
341 if (!blendInfo.fWritesColor) {
342 rtBlend.RenderTargetWriteMask = 0;
343 } else {
344 rtBlend.RenderTargetWriteMask = D3D12_COLOR_WRITE_ENABLE_ALL;
345 }
346}
static D3D12_BLEND blend_coeff_to_d3d_blend_for_alpha(skgpu::BlendCoeff coeff)
static D3D12_BLEND_OP blend_equation_to_d3d_op(skgpu::BlendEquation equation)
const GrXferProcessor & getXferProcessor() const
Definition GrPipeline.h:116
skgpu::BlendInfo getBlendInfo() const
static constexpr bool BlendShouldDisable(BlendEquation equation, BlendCoeff srcCoeff, BlendCoeff dstCoeff)
Definition Blend.h:145
BlendEquation
Definition Blend.h:26
BlendCoeff
Definition Blend.h:60
skgpu::BlendCoeff fDstBlend
Definition Blend.h:96
bool fWritesColor
Definition Blend.h:98
skgpu::BlendCoeff fSrcBlend
Definition Blend.h:95

◆ fill_in_depth_stencil_state()

static void fill_in_depth_stencil_state ( const GrProgramInfo programInfo,
D3D12_DEPTH_STENCIL_DESC *  dsDesc 
)
static

Definition at line 418 of file GrD3DPipelineStateBuilder.cpp.

419 {
420 GrStencilSettings stencilSettings = programInfo.nonGLStencilSettings();
421 GrSurfaceOrigin origin = programInfo.origin();
422
423 dsDesc->DepthEnable = false;
424 dsDesc->DepthWriteMask = D3D12_DEPTH_WRITE_MASK_ZERO;
425 dsDesc->DepthFunc = D3D12_COMPARISON_FUNC_NEVER;
426 dsDesc->StencilEnable = !stencilSettings.isDisabled();
427 if (!stencilSettings.isDisabled()) {
428 if (stencilSettings.isTwoSided()) {
429 const auto& frontFace = stencilSettings.postOriginCCWFace(origin);
430 const auto& backFace = stencilSettings.postOriginCWFace(origin);
431
432 SkASSERT(frontFace.fTestMask == backFace.fTestMask);
433 SkASSERT(frontFace.fWriteMask == backFace.fWriteMask);
434 dsDesc->StencilReadMask = frontFace.fTestMask;
435 dsDesc->StencilWriteMask = frontFace.fWriteMask;
436
437 setup_stencilop_desc(&dsDesc->FrontFace, frontFace);
438 setup_stencilop_desc(&dsDesc->BackFace, backFace);
439 } else {
440 dsDesc->StencilReadMask = stencilSettings.singleSidedFace().fTestMask;
441 dsDesc->StencilWriteMask = stencilSettings.singleSidedFace().fWriteMask;
442 setup_stencilop_desc(&dsDesc->FrontFace, stencilSettings.singleSidedFace());
443 dsDesc->BackFace = dsDesc->FrontFace;
444 }
445 }
446}
static void setup_stencilop_desc(D3D12_DEPTH_STENCILOP_DESC *desc, const GrStencilSettings::Face &stencilFace)
GrSurfaceOrigin
Definition GrTypes.h:147
#define SkASSERT(cond)
Definition SkAssert.h:116
GrSurfaceOrigin origin() const
GrStencilSettings nonGLStencilSettings() const
bool isTwoSided() const
const Face & postOriginCCWFace(GrSurfaceOrigin origin) const
bool isDisabled() const
const Face & singleSidedFace() const
const Face & postOriginCWFace(GrSurfaceOrigin origin) const

◆ fill_in_rasterizer_state()

static void fill_in_rasterizer_state ( const GrPipeline pipeline,
bool  multisampleEnable,
const GrCaps caps,
D3D12_RASTERIZER_DESC *  rasterizer 
)
static

Definition at line 348 of file GrD3DPipelineStateBuilder.cpp.

351 {
352 rasterizer->FillMode = (caps->wireframeMode() || pipeline.isWireframe()) ?
353 D3D12_FILL_MODE_WIREFRAME : D3D12_FILL_MODE_SOLID;
354 rasterizer->CullMode = D3D12_CULL_MODE_NONE;
355 rasterizer->FrontCounterClockwise = true;
356 rasterizer->DepthBias = 0;
357 rasterizer->DepthBiasClamp = 0.0f;
358 rasterizer->SlopeScaledDepthBias = 0.0f;
359 rasterizer->DepthClipEnable = false;
360 rasterizer->MultisampleEnable = multisampleEnable;
361 rasterizer->AntialiasedLineEnable = false;
362 rasterizer->ForcedSampleCount = 0;
363 rasterizer->ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF;
364}
bool wireframeMode() const
Definition GrCaps.h:399
bool isWireframe() const
Definition GrPipeline.h:170

◆ gr_primitive_type_to_d3d()

static D3D12_PRIMITIVE_TOPOLOGY_TYPE gr_primitive_type_to_d3d ( GrPrimitiveType  primitiveType)
static

Definition at line 448 of file GrD3DPipelineStateBuilder.cpp.

448 {
449 switch (primitiveType) {
451 case GrPrimitiveType::kTriangleStrip: //fall through
452 return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
454 return D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT;
455 case GrPrimitiveType::kLines: // fall through
457 return D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE;
458 default:
460 }
461}

◆ GrCompileHLSLShader()

static gr_cp< ID3DBlob > GrCompileHLSLShader ( GrD3DGpu gpu,
const std::string &  hlsl,
SkSL::ProgramKind  kind 
)
static

Definition at line 73 of file GrD3DPipelineStateBuilder.cpp.

75 {
76 TRACE_EVENT0("skia.shaders", "driver_compile_shader");
77 const char* compileTarget = nullptr;
78 switch (kind) {
80 compileTarget = "vs_5_1";
81 break;
83 compileTarget = "ps_5_1";
84 break;
85 default:
87 }
88
89 uint32_t compileFlags = 0;
90#ifdef SK_DEBUG
91 // Enable better shader debugging with the graphics debugging tools.
92 compileFlags |= D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION;
93#endif
94 // SPRIV-cross does matrix multiplication expecting row major matrices
95 compileFlags |= D3DCOMPILE_PACK_MATRIX_ROW_MAJOR;
96
97 gr_cp<ID3DBlob> shader;
99 HRESULT hr = D3DCompile(hlsl.c_str(), hlsl.length(), nullptr, nullptr, nullptr, "main",
100 compileTarget, compileFlags, 0, &shader, &errors);
101 if (!SUCCEEDED(hr)) {
103 hlsl.c_str(), reinterpret_cast<char*>(errors->GetBufferPointer()));
104 }
105 return shader;
106}
GrContextOptions::ShaderErrorHandler * getShaderErrorHandler() const
GrDirectContextPriv priv()
GrDirectContext * getContext()
Definition GrGpu.h:67
virtual void compileError(const char *shader, const char *errors)
#define SUCCEEDED(hr)

◆ setup_stencilop_desc()

static void setup_stencilop_desc ( D3D12_DEPTH_STENCILOP_DESC *  desc,
const GrStencilSettings::Face stencilFace 
)
static

Definition at line 410 of file GrD3DPipelineStateBuilder.cpp.

411 {
412 desc->StencilFailOp = stencil_op_to_d3d_op(stencilFace.fFailOp);
413 desc->StencilDepthFailOp = desc->StencilFailOp;
414 desc->StencilPassOp = stencil_op_to_d3d_op(stencilFace.fPassOp);
415 desc->StencilFunc = stencil_test_to_d3d_func(stencilFace.fTest);
416}
static D3D12_STENCIL_OP stencil_op_to_d3d_op(GrStencilOp op)
static D3D12_COMPARISON_FUNC stencil_test_to_d3d_func(GrStencilTest test)

◆ setup_vertex_input_layout()

static void setup_vertex_input_layout ( const GrGeometryProcessor geomProc,
D3D12_INPUT_ELEMENT_DESC *  inputElements 
)
static

Definition at line 209 of file GrD3DPipelineStateBuilder.cpp.

210 {
211 unsigned int slotNumber = 0;
212 unsigned int vertexSlot = 0;
213 unsigned int instanceSlot = 0;
214 if (geomProc.hasVertexAttributes()) {
215 vertexSlot = slotNumber++;
216 }
217 if (geomProc.hasInstanceAttributes()) {
218 instanceSlot = slotNumber++;
219 }
220
221 unsigned int currentAttrib = 0;
222
223 for (auto attrib : geomProc.vertexAttributes()) {
224 // When using SPIRV-Cross it converts the location modifier in SPIRV to be
225 // TEXCOORD<N> where N is the location value for eveery vertext attribute
226 inputElements[currentAttrib] = { "TEXCOORD", currentAttrib,
227 attrib_type_to_format(attrib.cpuType()),
228 vertexSlot, SkToU32(*attrib.offset()),
229 D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 };
230 currentAttrib++;
231 }
232
233 for (auto attrib : geomProc.instanceAttributes()) {
234 // When using SPIRV-Cross it converts the location modifier in SPIRV to be
235 // TEXCOORD<N> where N is the location value for eveery vertext attribute
236 inputElements[currentAttrib] = { "TEXCOORD", currentAttrib,
237 attrib_type_to_format(attrib.cpuType()),
238 instanceSlot, SkToU32(*attrib.offset()),
239 D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA, 1 };
240 currentAttrib++;
241 }
242}
static DXGI_FORMAT attrib_type_to_format(GrVertexAttribType type)
constexpr uint32_t SkToU32(S x)
Definition SkTo.h:26
bool hasInstanceAttributes() const

◆ stencil_op_to_d3d_op()

static D3D12_STENCIL_OP stencil_op_to_d3d_op ( GrStencilOp  op)
static

Definition at line 366 of file GrD3DPipelineStateBuilder.cpp.

366 {
367 switch (op) {
369 return D3D12_STENCIL_OP_KEEP;
371 return D3D12_STENCIL_OP_ZERO;
373 return D3D12_STENCIL_OP_REPLACE;
375 return D3D12_STENCIL_OP_INVERT;
377 return D3D12_STENCIL_OP_INCR;
379 return D3D12_STENCIL_OP_DECR;
381 return D3D12_STENCIL_OP_INCR_SAT;
383 return D3D12_STENCIL_OP_DECR_SAT;
384 }
386}

◆ stencil_test_to_d3d_func()

static D3D12_COMPARISON_FUNC stencil_test_to_d3d_func ( GrStencilTest  test)
static

Definition at line 388 of file GrD3DPipelineStateBuilder.cpp.

388 {
389 switch (test) {
391 return D3D12_COMPARISON_FUNC_ALWAYS;
393 return D3D12_COMPARISON_FUNC_NEVER;
395 return D3D12_COMPARISON_FUNC_GREATER;
397 return D3D12_COMPARISON_FUNC_GREATER_EQUAL;
399 return D3D12_COMPARISON_FUNC_LESS;
401 return D3D12_COMPARISON_FUNC_LESS_EQUAL;
403 return D3D12_COMPARISON_FUNC_EQUAL;
405 return D3D12_COMPARISON_FUNC_NOT_EQUAL;
406 }
408}

Variable Documentation

◆ kHLSL_Tag

constexpr SkFourByteTag kHLSL_Tag = SkSetFourByteTag('H', 'L', 'S', 'L')
staticconstexpr

Definition at line 524 of file GrD3DPipelineStateBuilder.cpp.

◆ kSKSL_Tag

constexpr SkFourByteTag kSKSL_Tag = SkSetFourByteTag('S', 'K', 'S', 'L')
staticconstexpr

Definition at line 525 of file GrD3DPipelineStateBuilder.cpp.