14#define VALIDATE() this->validate()
16#define VALIDATE() do {} while(false)
23 D3D12_RESOURCE_STATES* resourceState,
25 D3D12_HEAP_TYPE heapType;
29 heapType = D3D12_HEAP_TYPE_DEFAULT;
31 *resourceState = D3D12_RESOURCE_STATE_COPY_DEST;
34 heapType = D3D12_HEAP_TYPE_READBACK;
36 *resourceState = D3D12_RESOURCE_STATE_COPY_DEST;
38 heapType = D3D12_HEAP_TYPE_UPLOAD;
41 *resourceState = D3D12_RESOURCE_STATE_GENERIC_READ;
45 D3D12_RESOURCE_DESC bufferDesc = {};
46 bufferDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
47 bufferDesc.Alignment = 0;
48 bufferDesc.Width =
size;
49 bufferDesc.Height = 1;
50 bufferDesc.DepthOrArraySize = 1;
51 bufferDesc.MipLevels = 1;
52 bufferDesc.Format = DXGI_FORMAT_UNKNOWN;
53 bufferDesc.SampleDesc.Count = 1;
54 bufferDesc.SampleDesc.Quality = 0;
55 bufferDesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
56 bufferDesc.Flags = D3D12_RESOURCE_FLAG_NONE;
59 heapType, &bufferDesc, *resourceState, alloc,
nullptr);
67 D3D12_RESOURCE_STATES resourceState;
71 &resourceState, &alloc);
77 std::move(
resource), std::move(alloc),
85 D3D12_RESOURCE_STATES resourceState,
86 std::string_view label)
88 , fResourceState(resourceState)
89 , fD3DResource(
std::move(bufferResource))
90 , fAlloc(
std::move(alloc)) {
99 D3D12_RESOURCE_STATES newResourceState) {
107 D3D12_RESOURCE_TRANSITION_BARRIER barrier = {};
109 barrier.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES;
111 barrier.StateAfter = newResourceState;
118void GrD3DBuffer::releaseResource() {
129 fD3DResource.
reset();
134 this->releaseResource();
139 this->releaseResource();
143void GrD3DBuffer::onMap(MapType
type) {
147void GrD3DBuffer::onUnmap(MapType
type) {
148 this->internalUnmap(
type, 0, this->
size());
151bool GrD3DBuffer::onClearToZero() {
165 sk_ref_sp<GrD3DBuffer>(
this),
177 std::memset(ptr, 0, this->
size());
183bool GrD3DBuffer::onUpdateData(
const void*
src,
size_t offset,
size_t size,
bool ) {
194 SkASSERT(!this->getD3DGpu()->protectedContext());
203void* GrD3DBuffer::internalMap(MapType
type,
size_t offset,
size_t size) {
222 fStagingOffset = slice.
fOffset;
233 if (fD3DResource->Map(0, &range, &
result) != S_OK) {
243void GrD3DBuffer::internalUnmap(MapType
type,
size_t offset,
size_t size) {
254 sk_ref_sp<GrD3DBuffer>(
this),
259 fStagingBuffer =
nullptr;
266 fD3DResource->Unmap(0, &range);
272void GrD3DBuffer::onSetLabel() {
281void GrD3DBuffer::validate()
const {
static gr_cp< ID3D12Resource > make_d3d_buffer(GrD3DGpu *gpu, size_t size, GrGpuBufferType intendedType, GrAccessPattern accessPattern, D3D12_RESOURCE_STATES *resourceState, sk_sp< GrD3DAlloc > *alloc)
std::wstring GrD3DMultiByteToWide(const std::string &str)
@ kStatic_GrAccessPattern
static SkString resource(SkPDFResourceType type, int index)
static constexpr bool SkToBool(const T &x)
void onAbandon() override
ID3D12Resource * d3dResource() const
void setResourceState(const GrD3DGpu *gpu, D3D12_RESOURCE_STATES newResourceState)
void onRelease() override
D3D12_RESOURCE_STATES fResourceState
static sk_sp< GrD3DBuffer > Make(GrD3DGpu *, size_t size, GrGpuBufferType, GrAccessPattern)
GrD3DBuffer(GrD3DGpu *, size_t size, GrGpuBufferType, GrAccessPattern, gr_cp< ID3D12Resource >, sk_sp< GrD3DAlloc >, D3D12_RESOURCE_STATES, std::string_view label)
void copyBufferToBuffer(sk_sp< GrD3DBuffer > dstBuffer, uint64_t dstOffset, ID3D12Resource *srcBuffer, uint64_t srcOffset, uint64_t numBytes)
void addBufferResourceBarriers(GrD3DBuffer *buffer, int numBarriers, D3D12_RESOURCE_TRANSITION_BARRIER *barriers) const
GrD3DDirectCommandList * currentCommandList() const
GrD3DMemoryAllocator * memoryAllocator() const
bool protectedContext() const
GrStagingBufferManager * stagingBufferManager() override
virtual gr_cp< ID3D12Resource > createResource(D3D12_HEAP_TYPE, const D3D12_RESOURCE_DESC *, D3D12_RESOURCE_STATES initialResourceState, sk_sp< GrD3DAlloc > *allocation, const D3D12_CLEAR_VALUE *)=0
size_t size() const final
GrGpuBufferType intendedType() const
GrAccessPattern accessPattern() const
std::string getLabel() const
bool wasDestroyed() const
void registerWithCache(skgpu::Budgeted)
Slice allocateStagingBufferSlice(size_t size, size_t requiredAlignment=1)
void reset(T *object=nullptr)
void reset(T *ptr=nullptr)
EMSCRIPTEN_KEEPALIVE void empty()
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size