Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 03b8ab2

Browse files
jvanverthSkia Commit-Bot
authored andcommitted
Reland "Create D3D device and queue"
This is a reland of 29dc430 Original change's description: > Create D3D device and queue > > Bug: skia:9935 > Change-Id: Ib6548f413ca3a8befb553d2d47354b400c9162b9 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272520 > Commit-Queue: Jim Van Verth <jvanverth@google.com> > Reviewed-by: Greg Daniel <egdaniel@google.com> Bug: skia:9935 Change-Id: I1c8797e09cdeb3694ea7f47b2236ab7d91d9519f Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272996 Reviewed-by: Ben Wagner aka dogben <benjaminwagner@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
1 parent 6dd3b73 commit 03b8ab2

20 files changed

+212
-53
lines changed

BUILD.gn

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,9 @@ optional("gpu") {
601601
public_defines += [ "SK_DIRECT3D" ]
602602
deps += [ "//third_party/spirv-cross:spirv_cross" ]
603603
sources += skia_direct3d_sources
604+
if (skia_enable_direct3d_debug_layer) {
605+
public_defines += [ "SK_ENABLE_D3D_DEBUG_LAYER" ]
606+
}
604607
libs += [
605608
"d3d12.lib",
606609
"dxgi.lib",
@@ -1385,6 +1388,7 @@ if (skia_enable_tools) {
13851388
}
13861389
if (skia_use_direct3d) {
13871390
sources += [ "tools/gpu/d3d/D3DTestContext.cpp" ]
1391+
sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ]
13881392
}
13891393
if (skia_use_dawn) {
13901394
public_deps += [ "//third_party/dawn:dawn_headers" ]

gm/rectangletexture.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class RectangleTexture : public GpuGM {
9494
return nullptr;
9595
}
9696

97-
const GrGLInterface* gl = glCtx->interface();
97+
const GrGLInterface* gl = glCtx->glInterface();
9898
// Useful for debugging whether errors result from use of RECTANGLE
9999
// static constexpr GrGLenum kTarget = GR_GL_TEXTURE_2D;
100100
static constexpr GrGLenum kTarget = GR_GL_TEXTURE_RECTANGLE;

gn/gpu.gni

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,8 @@ skia_vk_sources = [
727727
]
728728

729729
skia_direct3d_sources = [
730+
"$_include/gpu/d3d/GrD3DBackendContext.h",
731+
"$_include/gpu/d3d/GrD3D12.h",
730732
"$_src/gpu/d3d/GrD3DCaps.cpp",
731733
"$_src/gpu/d3d/GrD3DCaps.h",
732734
"$_src/gpu/d3d/GrD3DGpu.cpp",

gn/skia.gni

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ declare_args() {
2626
is_skia_dev_build && ((target_cpu == "x64" && (is_linux || is_mac)) ||
2727
(target_cpu == "arm64" && is_android))
2828
skia_enable_tools = is_skia_dev_build
29-
skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
29+
skia_enable_gpu_debug_layers = is_skia_dev_build && is_debug
3030
skia_generate_workarounds = false
3131
skia_include_multiframe_procs = false
3232
skia_lex = false
@@ -96,6 +96,8 @@ declare_args() {
9696
skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
9797
skia_use_libgifcodec = !skia_use_wuffs
9898
skia_use_sfntly = skia_use_icu
99+
skia_enable_vulkan_debug_layers = skia_enable_gpu_debug_layers
100+
skia_enable_direct3d_debug_layer = skia_enable_gpu_debug_layers
99101
}
100102

101103
# Our tools require static linking (they use non-exported symbols), and the GPU backend.

include/gpu/d3d/GrD3D12.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright 2020 Google LLC
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+
#ifndef GrD3D12_DEFINED
9+
#define GrD3D12_DEFINED
10+
11+
#include <d3d12.h>
12+
#include <wrl/client.h> // for ComPtr
13+
14+
// Abbreviate and alias ComPtr
15+
template<typename T>
16+
using gr_cp = Microsoft::WRL::ComPtr<T>;
17+
18+
#endif
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020 Google Inc.
2+
* Copyright 2020 Google LLC
33
*
44
* Use of this source code is governed by a BSD-style license that can be
55
* found in the LICENSE file.
@@ -8,11 +8,16 @@
88
#ifndef GrD3DBackendContext_DEFINED
99
#define GrD3DBackendContext_DEFINED
1010

11-
#include "include/core/SkRefCnt.h"
11+
#include "include/gpu/d3d/GrD3D12.h"
12+
13+
#include "include/gpu/GrTypes.h"
1214

1315
// The BackendContext contains all of the base D3D objects needed by the GrD3DGpu. The assumption
1416
// is that the client will set these up and pass them to the GrD3DGpu constructor.
1517
struct SK_API GrD3DBackendContext {
18+
gr_cp<ID3D12Device> fDevice;
19+
gr_cp<ID3D12CommandQueue> fQueue;
20+
GrProtected fProtectedContext = GrProtected::kNo;
1621
};
1722

1823
#endif

public.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ BASE_SRCS_ALL = struct(
250250
# Currently exclude all vulkan specific files
251251
"src/gpu/vk/*",
252252

253+
# Currently exclude all Direct3D specific files
254+
"src/gpu/d3d/*",
255+
253256
# Currently exclude all Dawn-specific files
254257
"src/gpu/dawn/*",
255258

@@ -534,6 +537,7 @@ DM_SRCS_ALL = struct(
534537
"tests/SkParagraphTest.cpp", # Skipping tests for now.
535538
"tests/skia_test.cpp", # Old main.
536539
"tools/gpu/atlastext/*",
540+
"tools/gpu/d3d/*",
537541
"tools/gpu/dawn/*",
538542
"tools/gpu/gl/angle/*",
539543
"tools/gpu/gl/egl/*",

src/gpu/GrLegacyDirectContext.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ class GrLegacyDirectContext : public GrContext {
125125
};
126126

127127
#ifdef SK_GL
128-
sk_sp<GrContext> GrContext::MakeGL(sk_sp<const GrGLInterface> interface) {
128+
sk_sp<GrContext> GrContext::MakeGL(sk_sp<const GrGLInterface> glInterface) {
129129
GrContextOptions defaultOptions;
130-
return MakeGL(std::move(interface), defaultOptions);
130+
return MakeGL(std::move(glInterface), defaultOptions);
131131
}
132132

133133
sk_sp<GrContext> GrContext::MakeGL(const GrContextOptions& options) {
@@ -139,11 +139,11 @@ sk_sp<GrContext> GrContext::MakeGL() {
139139
return MakeGL(nullptr, defaultOptions);
140140
}
141141

142-
sk_sp<GrContext> GrContext::MakeGL(sk_sp<const GrGLInterface> interface,
142+
sk_sp<GrContext> GrContext::MakeGL(sk_sp<const GrGLInterface> glInterface,
143143
const GrContextOptions& options) {
144144
sk_sp<GrContext> context(new GrLegacyDirectContext(GrBackendApi::kOpenGL, options));
145145

146-
context->fGpu = GrGLGpu::Make(std::move(interface), options, context.get());
146+
context->fGpu = GrGLGpu::Make(std::move(glInterface), options, context.get());
147147
if (!context->fGpu) {
148148
return nullptr;
149149
}

src/gpu/d3d/GrD3DCaps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020 Google Inc.
2+
* Copyright 2020 Google LLC
33
*
44
* Use of this source code is governed by a BSD-style license that can be
55
* found in the LICENSE file.

src/gpu/d3d/GrD3DCaps.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020 Google Inc.
2+
* Copyright 2020 Google LLC
33
*
44
* Use of this source code is governed by a BSD-style license that can be
55
* found in the LICENSE file.

0 commit comments

Comments
 (0)