Debian Codegraph @

src/gpu/ganesh/d3d/GrD3DPipelineStateDataManager.cpp

raw
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "src/gpu/ganesh/d3d/GrD3DPipelineStateDataManager.h"
9
10 #include "src/gpu/ganesh/d3d/GrD3DGpu.h"
11 #include "src/gpu/ganesh/d3d/GrD3DResourceProvider.h"
12
13 GrD3DPipelineStateDataManager::GrD3DPipelineStateDataManager(const UniformInfoArray& uniforms,
14 uint32_t uniformSize)
15 : INHERITED(uniforms.count(), uniformSize) {
16 // We must add uniforms in same order as the UniformInfoArray so that UniformHandles already
17 // owned by other objects will still match up here.
18 int i = 0;
19 for (const auto& uniformInfo : uniforms.items()) {
20 Uniform& uniform = fUniforms[i];
21 SkASSERT(GrShaderVar::kNonArray == uniformInfo.fVariable.getArrayCount() ||
22 uniformInfo.fVariable.getArrayCount() > 0);
23 SkDEBUGCODE(
24 uniform.fArrayCount = uniformInfo.fVariable.getArrayCount();
25 uniform.setType(uniformInfo.fVariable.getType());
26 )
27
28 uniform.fOffset = uniformInfo.fUBOOffset;
29 ++i;
30 }
31 }
32
33 D3D12_GPU_VIRTUAL_ADDRESS GrD3DPipelineStateDataManager::uploadConstants(GrD3DGpu* gpu) {
34 if (fUniformsDirty) {
35 fConstantBufferAddress = gpu->resourceProvider().uploadConstantData(fUniformData.get(),
36 fUniformSize);
37 fUniformsDirty = false;
38 }
39
40 return fConstantBufferAddress;
41 }