Commit Graph

227 Commits

Author SHA1 Message Date
John Stiles
6e9ead9166 Revert "Remove custom SkSort algorithms."
This reverts commit 70474c1cb0.

Reason for revert: bot build failure

Original change's description:
> Remove custom SkSort algorithms.
> 
> SortBench shows that SkTQSort and SkTHeapSort are inferior to std::sort.
> The difference is small on randomized inputs, but quite significant for
> semi-ordered inputs (forward/backward/repeated). There doesn't seem to
> to be any compelling advantage to SkTQSort.
> 
> Nanobench results: https://screenshot.googleplex.com/9JOLV1d6Z0u
> 
> (These performance numbers are from an optimized build my local machine;
> it's possible that we might see different results on the test bots.)
> 
> Change-Id: Iaf19563041547eae7de2953be249129108f093b1
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302295
> Commit-Queue: John Stiles <johnstiles@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>

TBR=mtklein@google.com,brianosman@google.com,johnstiles@google.com

Change-Id: I1126dd4cda95716dac225ad32d5b0e5cf3f09421
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302447
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-07-14 00:25:05 +00:00
John Stiles
70474c1cb0 Remove custom SkSort algorithms.
SortBench shows that SkTQSort and SkTHeapSort are inferior to std::sort.
The difference is small on randomized inputs, but quite significant for
semi-ordered inputs (forward/backward/repeated). There doesn't seem to
to be any compelling advantage to SkTQSort.

Nanobench results: https://screenshot.googleplex.com/9JOLV1d6Z0u

(These performance numbers are from an optimized build my local machine;
it's possible that we might see different results on the test bots.)

Change-Id: Iaf19563041547eae7de2953be249129108f093b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302295
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-13 23:35:20 +00:00
Brian Osman
3b5a4fac1e Use stable sort for Viewer's help screen
Fixes flickering help text

Change-Id: I61159e6946125e9e2ce7be3f8f8f6103473855be
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302266
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-07-13 17:25:56 +00:00
Robert Phillips
ed65339084 Update the sk_app WindowContext to hold a GrDirectContext
This CL is working towards replacing GrContext with the GrDirectContext/
GrRecordingContext pair.

Change-Id: Id4488e1280d76a16c37d58bd8d29fb7f8dde6b1d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301940
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-10 18:27:03 +00:00
Mike Klein
77482cb335 add Sk- prefix to SkOSLibrary functions
Just refactored names.  Looking at adding SkCloseDynamicLibrary too.

Change-Id: Ibc3ad556386dad3e80bf91bd9ee46e9b9fe68c4a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301900
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-10 16:55:03 +00:00
Robert Phillips
2a4acf328c Remove all internal uses of (and deprecate) SkSurface::getContext
We are replacing GrContext with the GrDirectContext/GrRecordingContext
pair. This starts making that change visible to clients (and weaning
Skia off of GrContext).

Change-Id: I00cc9bf208499984de855a1646229bd7557fc925
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300706
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-08 16:09:27 +00:00
Jim Van Verth
275f419a60 Add D3D support for MSAA
Change-Id: I7f9122bb99fea952a67fa47aaada789037438152
Bug: skia:10476
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300906
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-07-07 20:34:15 +00:00
John Stiles
6fc05d8b37 Allow system key equivalents to work again.
The changes in http://review.skia.org/300182 caused cmd-Q to stop
working normally in Viewer, because the Mac window would report that it
had processed all key equivalents. This prevented the NSApp from
handling key equivalents in the menu bar. This CL now forwards on all
key equivalents to the system for processing (even as it passes them to
ImGui), allowing cmd-Q to work again.

This CL also simplifies the pattern for updating modifier keys slightly.

Change-Id: I2285839b41dd361e34694eccbc6d581662b24648
Bug: skia:10338
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300651
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-07-06 19:02:24 +00:00
John Stiles
d2f870c911 Fix modifier key handling in OS X to allow command-keys to work.
A variety of modifier key handling issues are addressed in this CL:
- Added a skui::Key for the Super key (this is ImGui's name for command)
- Added OS X event handling for `flagsChanged` (sent when modifier keys
  are pressed)
- OS X manually tracks modifier key state and sends key-up and key-down
  events to the ImGuiLayer as necessary
- OS X does not send key-up events when hotkeys are pressed, so these
  are manually synthesized and sent to ImGui (otherwise hotkeys are
  repeated forever)
- Replaced hardcoded Virtual Key valus in OS X code with named constants
- Our custom bitmask type was lacking the ability to XOR

This CL does NOT enable the OS X clipboard; this uses the ImGui internal
clipboard.

Change-Id: I76b55215858bfb6441dbef18ad638426fa8bc073
Bug: skia:10338
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300182
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-07-01 16:07:03 +00:00
Jim Van Verth
e381036051 Fix D3D debug clang build.
Adds in the GR_D3D_CALL_ERRCHECK utility macro to avoid this in the
future.

Change-Id: I68112bcccbd8cb9d55ae02e99de954269d0ac4bd
Bug: skia:9935
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300176
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-07-01 14:39:53 +00:00
Jim Van Verth
b29a1a6653 Fix D3D dynamic buffer reuse.
This is a temporary fix to handle an issue where we try to map a
dynamic buffer when it's in use in a previous command list.

Change-Id: Ibc6b071508c11ea394a320b326645ecc4b22105a
Bug: skia:9935
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299392
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-06-26 20:58:23 +00:00
Greg Daniel
9efe386978 Add SkSurface flush call that takes a GrBackendSurfaceMutableState.
This new api will eventually replace the version that takes an

SkSurface::BackendAccess.
Change-Id: I48cd013725e14027f386b0b111223459944ac44a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295567
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-06-12 20:40:54 +00:00
Greg Daniel
aa9d99ff6b Add support for vk image sharing mode and handle queues xfers correctly.
Change-Id: I9dbe6020d67cc452c9cbbdeace68f1d01275b419
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293559
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-06-02 15:58:28 +00:00
Greg Daniel
f83baf230c Fix D3d window context after submit change.
Change-Id: Ifec54ef7948707f0d9811bc0b865223ad02822b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291181
Commit-Queue: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-05-20 21:44:41 +00:00
Greg Daniel
0a2464f51f Update internal skia uses to use flushAndSubmit and submit calls.
Bug: skia:10118
Change-Id: Ieb7c0eece56d3d9df56ecb52e00e76c01f038de8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289888
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-05-14 20:26:44 +00:00
Jim Van Verth
682a2f4de6 Add Direct3D swapchain support
Change-Id: I4d4025fb842eb937785509bc7947f85f28a98ab8
Bug: skia:9935
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/288551
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-05-14 14:23:02 +00:00
Jim Van Verth
28d920a916 Fix OpenGL MSAA on Catalina.
Catalina requires that we call [NSOpenGLContext clearCurrentContext]
when tearing down contexts. We were doing it in the GLWindowContext
destructor, but not when switching for MSAA.

Bug: skia:10134
Change-Id: I81be962419ca4afa724ab3f896081af4bbedda3f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/288157
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-05-06 19:55:04 +00:00
Jim Van Verth
517af96936 Fix colorspace in Viewer for Metal
Change-Id: Id8394acf854f1c069c5fde449ede225b2d81968b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/288056
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-05-06 13:00:19 +00:00
John Stiles
e1d9b10f9a Add missing NSOpenGLPFAMultisample attribute to the OpenGL pixel format.
According to the documentation at
https://developer.apple.com/documentation/appkit/nsopenglpfamultisample
this attribute is necessary to enable MSAA antialiasing.

(Unfortunately, even with this change, MSAA is still not working
properly in OpenGL.)

Change-Id: I1f59a4659d4891fc239ab4c56df7b134f0f5f2a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/287996
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-05-06 12:44:29 +00:00
Jim Van Verth
a1c140afed Remove linear filter from Metal layer.
Metal layer was using linear filter which was introducing blur.
Changed to nearest filter.

Bug: skia:10172
Change-Id: Ia69d6c9a56f9a2f69b5e98fd9941be52ec01b7d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/286616
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-05-01 20:22:53 +00:00
John Stiles
f61ee1ecac Fix assertion in ImGui::NewFrame if getBackbufferSurface returns null.
Previously, in cases where the backbuffer was null, we would call layer->onPrePaint (which starts a new frame with ImGui::NewFrame) without a matching call to layer->onPaint (which calls ImGui::Render). This causes the ImGui frame counter to go out of sync, which leads to an assertion when NewFrame is next called.

(The backbuffer can become null if unsupported settings are used, e.g. a MSAA setting above the maximum supported by your GPU.)

Change-Id: I1b8fbaa1bf78ad5e1aa41fd04eda6be206c952b4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/283196
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-04-13 14:16:52 +00:00
Corentin Wallez
e2c5bcf868 Remove the dependency on Dawn's SwapChainUtils.
This is not part of the public API of Dawn and will be unnecessary once
Dawn move to "surface based swapchains". DawnD3D12WindowContext didn't
need the include so all that's needed is copying the helper in
DawnMTLWindowContext.

Change-Id: I8d0682b6b0801dc311ad4c7d73d4c07e575ecf4e
Bug: chromium:1064305
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/282496
Reviewed-by: Zhenyao Mo <zmo@google.com>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-04-09 20:31:30 +00:00
Brian Osman
01e6d17fe8 Stop including SkCanvas.h from GrTypesPriv.h
It was too easy to get into circular include chains. Added static
asserts to ensure we keep our quad AA flags in sync. Also, IWYU.

Change-Id: I01aefa264aa56420ab5a46a8ecd9e63c021c79ab
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280405
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-03-30 20:43:34 +00:00
Sean Gilhuly
695f57da6c Roll Dawn and add dependencies
Add Dawn's dependencies shaderc and glslang, and roll SPIRV. Update the
BUILD.gn files to match upstream changes.

Bug: skia:9939, chromium:1064563
Change-Id: Ie9720806efe823312da10f7911688f12cad0713e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278770
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Weston Tracey <westont@google.com>
2020-03-30 18:52:06 +00:00
Brian Salomon
f4ba4ec796 Revert "Revert "Revert "Revert "Don't build GL on Metal, Vulkan, Dawn, Direct3D bots""""
Updated to use sentinel GL context even when GL backend is not built.

This reverts commit 1171d314ef.

Change-Id: Ia94bbe4865ddd4e898446c13886877c539f0eb0b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277976
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-03-20 17:11:58 +00:00
Brian Salomon
1171d314ef Revert "Revert "Revert "Don't build GL on Metal, Vulkan, Dawn, Direct3D bots"""
This reverts commit fb27c9a25f.

Revert "Remove MoltenVK support"

Reason: TSAN Vulkan bots hanging.

This reverts commit 6cafe73da9.

Change-Id: I8ec9db35c112f3c8da8636dab2065e6f18de7d0b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277936
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-03-19 13:10:59 +00:00
Brian Salomon
fb27c9a25f Revert "Revert "Don't build GL on Metal, Vulkan, Dawn, Direct3D bots""
This reverts commit 00ba5ef4a6.

Bug: skia:10051

Change-Id: I13fd5494b7e7e64159e6330f168ab8c16a2db149
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277609
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-03-18 18:12:11 +00:00
Brian Salomon
00ba5ef4a6 Revert "Don't build GL on Metal, Vulkan, Dawn, Direct3D bots"
This reverts commit f6784a8c84.

Reason for revert: breakage of builds

Original change's description:
> Don't build GL on Metal, Vulkan, Dawn, Direct3D bots
> 
> Misc fixes to omit GL-dependent targets and fix assumptions that
> SK_SUPPORT_GPU implies SK_GL.
> 
> Bug: skia:10051
> Change-Id: Ida88ac3f1bf4d9e23f66d0700c2bce18b938ed6f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277456
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>

TBR=egdaniel@google.com,jvanverth@google.com,bsalomon@google.com

Change-Id: I4e02f675fd8820ed3c8efee192c64e570a23c3e5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10051
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277601
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-03-18 14:42:28 +00:00
Brian Salomon
f6784a8c84 Don't build GL on Metal, Vulkan, Dawn, Direct3D bots
Misc fixes to omit GL-dependent targets and fix assumptions that
SK_SUPPORT_GPU implies SK_GL.

Bug: skia:10051
Change-Id: Ida88ac3f1bf4d9e23f66d0700c2bce18b938ed6f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277456
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-03-18 14:26:28 +00:00
Mike Klein
cff6396875 begin refactoring SkTDynamicHash and SkTMultiMap
The biggest mismatch between these and SkTHash{Map,Set,Table}
is the old ones provide Iter and ConstIter, the new ones foreach().

This CL,

   - adds foreach() methods to the old types,
   - replaces all uses of ConstIter with foreach(),
   - replaces most uses of Iter with foreach(),

I'm leaving one spot using Iter to walk the table and remove its
elements for its own CL... it'll be a little more complicated to get
that right.

From there it should be straightforward to turn SkTDynamicHash
into a thin wrapper over an SkTHashTable.

Bugs: skia:9703
Change-Id: Ia6ba87c35b89585c42b5b9f118f4cbf3abd04f0d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277098
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-03-16 14:06:30 +00:00
Brian Osman
788b91678f Remove SkTMin and SkTMax
Use std::min and std::max everywhere.

SkTPin still exists. We can't use std::clamp yet, and even when
we can, it has undefined behavior with NaN. SkTPin is written
to ensure that we return a value in the [lo, hi] range.

Change-Id: I506852a36e024ae405358d5078a872e2c77fa71e
Docs-Preview: https://skia.org/?cl=269357
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269357
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-02-07 18:40:09 +00:00
Jim Van Verth
3a17a32305 Reset current context on Mac GLContext destruction.
Looks like the OS now holds on to the current GL context and doesn't
release it unless explicitly told to.

Bug: skia:9885
Change-Id: Ic7bc6860ec96d88e278682b7f2f67e1ac365d27b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269369
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Jim Van Verth <jvanverth@google.com>
2020-02-07 18:20:28 +00:00
Brian Osman
116b33e8ab Remove SkMaxScalar and SkMinScalar
Use std::max and std::min instead

Change-Id: Icf3796609e5cb511687fb50bd31229ae4b6b9b39
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268841
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-06 15:43:22 +00:00
Stephen White
f03c116021 Roll dawn and adjust for new SwapChain API.
Split GrDawnImageInfo into GrDawnTextureInfo and GrDawnRenderTargetInfo.
The former holds only a wgpu::Texture, and the latter holds only a
wgpu::TextureView. This split is necessary because Dawn SwapChains now
vend TextureViews, not Textures.

The TextureView held by GrDawnRenderTargetInfo is always 1-mip, since
it's a requirement for rendering to a texture in Dawn.

Change-Id: Id6e99b5e4bf18f97e939170856a665e2038253ea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254810
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-01-28 18:26:44 +00:00
Stephen White
a521c962b1 Update dawn.h -> webgpu.h, dawn_cpp.h -> webgpu_cpp.h.
Also fix some compile breakages from recent Skia changes.
No changes to Skia API.

Change-Id: Ifd0b1d89fb4ea3cf1f6a7170f2f74614276364ae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257877
Commit-Queue: Stephen White <senorblanco@chromium.org>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-12-04 15:24:16 +00:00
Robert Phillips
fcaae486d7 Use GrProgramInfo's primitiveType field
This improves the encapsulation of all the data required to make a program/pipeline w/in the GrProgramInfo class.

Bug: skia:9455
Change-Id: Ib41519c8ded9f27a7bbe787097a431b38ab101bd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253376
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-11-07 16:15:04 +00:00
Greg Daniel
e643da6ab8 Add new macro for checking device lost when making Vulkan calls.
This CL itself doesn't really change how anything is running today. However,
it is the first step into gracefully supporting a vulkan device lost return
error and being able to correctly clean everything up.

Bug: skia:9603
Change-Id: I9693c514a32ca437df61a7aee63651e2e40ee1c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252819
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-11-05 18:56:35 +00:00
Jim Van Verth
923dad7a47 Fix memory leak in iOS viewer.
Forgot to add code to drain the Autorelease pool, so objects created
with autorelease just built up over time.

Bug: skia:8243
Change-Id: I373c6820df8ee102b110386377378858c235b2fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252601
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-11-04 20:35:21 +00:00
Stephen White
3cc8d4fb7f Dawn: s/dawn::/wgpu::/g.
The new webgpu_cpp.h hotness for native apps brings with it a new
namespace: wgpu. This is a straight substitution.

Note: no Skia API changes.
Change-Id: I12b26417e76838cd8fa2b39b8161cbaa2cd8fa78
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251660
Commit-Queue: Stephen White <senorblanco@chromium.org>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-10-30 14:29:46 +00:00
Jim Van Verth
cbf59e0e39 Use LazyProxy to set up Metal swapchain.
The purpose of this is to delay acquiring the next drawable in the
swapchain to avoid stalling and gain better parallel execution between
the CPU and GPU.

Change-Id: I40ef7672394fd00616de43685530d2feaf7cab2d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249005
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-10-18 14:04:41 +00:00
Stephen White
7b86d4e8a2 Dawn: allow CopySrc usage of swapchain texture.
This allows readbacks, which fixes backdrop_hintrect_clipping test.

Change-Id: I6b9002d7387b0bc79301848a2e7c70deb7b95f70
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249418
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2019-10-18 13:56:31 +00:00
Stephen White
1e2adcf428 Roll Dawn to ToT.
This requires some changes to dawnSetProcs() and some build file changes.

Change-Id: I8a643ec0690857d53db7c1f8f5223077e30f69e8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248860
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-10-16 14:19:14 +00:00
Stephen White
20c626aa23 Update Dawn backend to ToT. This is about 3 months of changes.
Remove optional param to SetIndexBuffer().
Update SetVertexBuffers -> SetVertexBuffer.
PipelineStageDescriptor -> ProgrammableStageDescriptor.
Update past generator changes, ring buffer changes, etc.
Add ErrorScopeTracker.cpp/.h to the build.
Add Vulkan MemoryResourceAllocator files.
Fix vertexShader ShaderStageDescriptor.
Fix spirv-cross include path.
TextureUsageBit -> TextureUsage, etc.
DawnErrorCallback fixes.
Removal of texture.CreateDefaultView.
Fix GL supported_extesions mumbo jumbo.
Update past ChromeOS change.
Add PassResourceUsageTracker.cpp/.h to build.
Add GLFormat.cpp/.h to build.
Add Extensions and Toggles to the build.
Add EncodingContext, AttachmentState to build.
Add RenderEncoderBase to Dawn build.
gn format dawn BUILD.gn, spirv-cross BUILD.gn.

Change-Id: I26538d63c93668647048814aad6ad456ae323679
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248261
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-10-15 22:26:38 +00:00
Jim Van Verth
b7c5bac9da Remove some more MoltenVK support
Change-Id: I511f15f056e15beddeaaf203414a1519569bfbe4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248815
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-10-15 20:44:17 +00:00
Greg Daniel
a718a61003 Enable preferring using primary CB over secondary CB.
Bug: skia:9512
Change-Id: Ie099d37191ca62918b88ac12bb0b93e252e3aa79
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243424
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-10-07 20:51:33 +00:00
Jim Van Verth
598903fe6d Guard some more Metal code to support older versions.
With these changes we can build across all versions of Metal, and for
the most part run on older OSes (further testing is necessary).

Bug: skia:9408
Change-Id: I00ee03b9a3a0e49483af4a610544b20d482a0cdd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245957
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-10-07 20:37:33 +00:00
Jim Van Verth
b2f55532bb Set up prototype interface for MakeFromCAMetalLayer
Change-Id: I87b0fc76ef48c1a21498e576853a6c3b4a6a98f9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242563
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-09-19 17:37:00 +00:00
Jim Van Verth
d0cf5da20d Hook up pinch-zoom and swipe gestures.
Sets UIPinchGestureRecognizer and UISwipeGestureRecognizers and
passes the result down to the sk_app::Window. To simplify detection,
swipes take precedence over pans, and pans require a single touch.
This is less flexible for the app, but in most cases I think is
what we want.

Bug: skia:8737
Change-Id: Ib031b6ad465d3a353da29d7e0b48a666d4ff8b9a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/239776
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-09-10 13:34:47 +00:00
Jim Van Verth
dfda49e3b5 Add touch support to viewer
Bug: skia:8737
Change-Id: I81379bd57684626705da48e03c91b83e91031e0b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/239104
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-09-05 20:21:41 +00:00
Jim Van Verth
e58d532bc3 Get Metal running on iOS viewer.
Adds MetalWindowContext_ios and hooks it up to Window_ios.
Also includes some minor clean up in other iOS code.

Bug: skia:8737
Change-Id: I2e8a0c755310fbc4ed534f975815c60f8eca130b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/238438
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-09-03 14:07:39 +00:00
Jim Van Verth
68cb8b0239 Switch to new IOS windowing system.
This replaces the SDL-based system and should allow Metal to work on iOS.
OpenGL and raster will render but there's no touch input yet.

Bug: skia:8737
Change-Id: I863accc47f0e1781192d567dbe54d1e321c3cd2e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/231561
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-08-29 20:13:03 +00:00
Hal Canary
b1f411ac05 tools/skui: put all enums in a common namespace
Change-Id: Icd331e8946d80652750b8b6ea0db65f5f676ac3e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/238058
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-08-29 15:39:32 +00:00
Stephen White
a800ec96f7 Dawn: implement sk_app window contexts for all backends.
Implement Window contexts for D3D12, Metal and Vulkan, as well as
a base class for all of them (DawnWindowContext).
Implement WSI, swap chains and external textures for all backends.
Add Dawn support to Viewer app.

Change-Id: I9368eae8d43594821aa1edd9fd559c8a9ba30066
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/228060
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2019-08-02 19:51:02 +00:00
Hal Canary
149f3f1978 tools/sk_app: fWindowContext is unique_ptr<>
Change-Id: I828f298e336da22756588d981481c76b890af2ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/231648
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-08-02 16:16:34 +00:00
Hal Canary
3f4a2b3499 sk_app, editor: cursor blink
Change-Id: I43044727298265ddb711456346c2b544ca8d509d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/231477
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
2019-08-02 15:36:40 +00:00
Hal Canary
c876404e64 tools/sk_app/macos: support command key
Change-Id: Ie04918f2bfc296eedbba67d96f62ee37e0303061
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/231136
Commit-Queue: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-07-31 16:36:15 +00:00
Greg Daniel
00fb7243c0 Move read swizzle from GL ConfigInfo to FormatInfo.
With this change I also removed GrPixelConfig as param to supportedReadPixelsColorType().
This meant some updates had to be made to Vulkan and Metal to make sure they return the
right GrColorType.

Bug: skia:6718
Change-Id: I71b6360489cf499692c7b777e5915090fad05c56
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/228349
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-07-18 19:42:10 +00:00
Stephen White
985741a554 First draft of Dawn backend: clears are working.
First draft of (mostly stubbed-out) GrDawnGpu.
Skeletons of GrDawnCaps, GrDawnGpuCommandBuffer, GrDawnRenderTarget.
First draft of DawnTestContext.
First draft of psuedo-fences for Dawn, implemented with MapReadAsync.

Change-Id: I443f3370522639e82f2fa0eebe6b206c372f13a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/228137
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-07-18 18:09:12 +00:00
Greg Daniel
fad9fbc3c4 Revert "First draft of Dawn backend: clears are working."
This reverts commit 6cebea42a8.

Reason for revert: breaking google3 roll

Original change's description:
> First draft of Dawn backend: clears are working.
> 
> First draft of (mostly stubbed-out) GrDawnGpu.
> Skeletons of GrDawnCaps, GrDawnGpuCommandBuffer, GrDawnRenderTarget.
> First draft of DawnTestContext.
> First draft of psuedo-fences for Dawn, implemented with MapReadAsync.
> 
> Change-Id: Id009436f4441f26ffbc82d485d7af3a499b3281b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/226857
> Commit-Queue: Stephen White <senorblanco@chromium.org>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=egdaniel@google.com,jvanverth@google.com,bsalomon@google.com,senorblanco@chromium.org

Change-Id: Ie494b5a403e8537c6539551533ae8b9156e90a61
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/228120
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-07-17 17:23:02 +00:00
Stephen White
6cebea42a8 First draft of Dawn backend: clears are working.
First draft of (mostly stubbed-out) GrDawnGpu.
Skeletons of GrDawnCaps, GrDawnGpuCommandBuffer, GrDawnRenderTarget.
First draft of DawnTestContext.
First draft of psuedo-fences for Dawn, implemented with MapReadAsync.

Change-Id: Id009436f4441f26ffbc82d485d7af3a499b3281b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/226857
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-07-17 16:29:22 +00:00
Hal Canary
ff2e8fe65f sk_app, Sample: Unify InputState enum.
replace() {
      if git grep -q "$1")";
      then sed -i -e "s#${1}#${2}#g" $(git grep -l "$1");
      fi
    }
    replace 'k\([A-Za-z]*\)_InputState' 'InputState::k\1'
    replace '\(\(sk_app::\|\)Window\|Sample\|\)::InputState' 'InputState'

Change-Id: I4cc18814fb1fbdd1f240aabba05aae79c54a4841
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/227642
Commit-Queue: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-07-16 14:51:03 +00:00
Jim Van Verth
af545d7f8e Fix GL MSAA support in Mac Viewer.
The Mac GLContext is designed to not constantly teardown on resizes
and minor DisplayParams changes. However, for MSAA we do have to
tear it down.

Change-Id: I1a9d765068fa5f6b22dff49f6355c29e1affb686
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/226850
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-07-11 22:31:43 +00:00
Jim Van Verth
d361e64326 Enable MSAA for Metal.
Adds a separate resolve texture to GrMtlRenderTarget, which can be used
to do a resolve for the main multisample color texture. The resolve is
handled by setting a special Store action for the RenderCommandEncoder.

Bug: skia:8243
Change-Id: I1ffd756c01a9b363116ffefee2c4c50ba9a3e637
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/225536
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-07-11 20:57:24 +00:00
Jim Van Verth
658d499afc New approach to fixing Vulkan MSAA.
MakeFromBackendTextureAsRenderTarget is planned to be deprecated, so we
should use MakeFromBackendTexture with a sampleCount parameter instead.
On Vulkan, this ran into issues because we assumed an allocation for the
VkImage and the swapchain doesn't provide us with one. Fixed so we don't
need an allocation for Borrowed textures.

Bug: skia:
Change-Id: Ib26888020e093f4a734a4159eae898539c2273b7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/226839
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-07-11 18:34:19 +00:00
Hal Canary
3a85ed12bf ModifierKey unifies sk_app::Window::ModifierKey & Sample::Click::ModifierKey
Change-Id: Idb5dfe57a7f6e3d6078ab1e68d542b084114cfbe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/225735
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-07-09 16:16:41 +00:00
Jim Van Verth
778ba8a450 Re-enable Vulkan MSAA support in Viewer
Bug: skia:
Change-Id: I2e7fc5463ea73baa82e6f1a3340e9c88d1b8be32
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/226081
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-07-09 15:35:44 +00:00
Jim Van Verth
87bda3dabe Fix Mac viewer on command line launch.
If you launch the Mac viewer from the command line, it will sit there
until you click on the thumbnail in the dock, and only then will bring
up the window. This fixes that so it will open the window immediately.

Change-Id: I5628dc6c59833f808a61dedde457774114dd0e94
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/222783
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-06-21 15:45:22 +00:00
Jim Van Verth
d6199ec723 Use new retain() method to set up window context.
This makes our usage of sk_cf_obj consistent with Chrome.

Bug: skia:8243
Change-Id: I159339577a0e8595e7cdd47ffb9ab0653269e108
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/218973
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-06-11 13:08:58 +00:00
Jim Van Verth
8429422986 Change GrCFResource to sk_cf_obj and move to include/ports.
This makes GrCFResource a template class with similar semantics to sk_sp.

Change-Id: I9ae9988dac6b39477b16d65591ef6fff44903c36
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/218376
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-06-10 18:44:28 +00:00
Jim Van Verth
6e4fee8c81 Fix MetalWindowContext setup.
Previous changes fixed the zombie device and queue, assuming that
they're bridged correctly.

Bug: skia:8243
Change-Id: Id4c2d10beacbb2ac749187d8d54fc2d276cf7b3d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219378
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-06-06 17:04:42 +00:00
Jim Van Verth
57b177dc91 Fix resize and vsync issues in Mac Viewer
* Move OpenGL vsync setup out of initial context setup block
* Fix window repaints for OpenGL and Metal
* Also moved some Mac-specific code into Mac-specific Metal class

Bug: skia:9095
Change-Id: I221edfbd2292d949cc15232ed2791f8fe1bbe2ed
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214686
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-05-22 14:54:20 +00:00
Jim Van Verth
d063e8b6f1 Revise Mac windowing and context creation.
Windowing and events:
* Use a NSTrackingArea to only capture mouse events within the view.
* Use ViewDelegate to track events rather than pulling them out of the
  event pump.
* Sets up the autoreleasepool correctly to clear out old events

Context creation:
* Don't use a subview for OpenGL (it's not necessary).
* For Metal, use a CAMetalLayer rather than MTKView.
* Add vsync support to Metal.

Bug: skia:8737
Change-Id: I8ea5cc865df65f8dc2fef47082bf6a4d1657cf03
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213672
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-05-16 16:46:11 +00:00
Ben Wagner
51e15a69ce Use SkTextEncoding enum instead of macros.
Change-Id: I4b6259590fa0693ee0522b4999a1c0fe250b173d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212504
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-05-07 20:54:16 +00:00
Mike Klein
c0bd9f9fe5 rewrite includes to not need so much -Ifoo
Current strategy: everything from the top

Things to look at first are the manual changes:

   - added tools/rewrite_includes.py
   - removed -Idirectives from BUILD.gn
   - various compile.sh simplifications
   - tweak tools/embed_resources.py
   - update gn/find_headers.py to write paths from the top
   - update gn/gn_to_bp.py SkUserConfig.h layout
     so that #include "include/config/SkUserConfig.h" always
     gets the header we want.

No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-24 16:27:11 +00:00
Greg Daniel
e6bfb7daf0 Add struct to wrap all the gpu flush options.
Bug: skia:8802
Change-Id: Ia92807034a8f54067cead59e29c233f91e11f175
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208674
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-04-17 20:03:29 +00:00
Jim Van Verth
7a7a97d3c7 Make Metal render loop more stable
Bug: skia:8737
Change-Id: Ib825e5f0c9502692cbecc60fbb68d0d1a2bc635f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208672
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-04-17 14:41:11 +00:00
Greg Daniel
b9990e4492 Add more general flush call to GrContext.
This is to match the current features of SkSurface::flush and to prepare
for adding additional features to flush.

Bug: skia:8802
Change-Id: I5d68272e1277b416af357e6ffaf426841ceda943
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207301
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-04-10 21:19:10 +00:00
Greg Daniel
5e2c98d8f7 Add support to disable vsync on mac viewer.
Bug: skia:
Change-Id: I07f8086aaadf1b2dd0d8709bfbc20e2c694c95e3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/204441
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-03-28 14:57:23 +00:00
Greg Daniel
d0794cccd0 Add support for vsync on android viewer.
Bug: skia:
Change-Id: Idcb3e3b0a67c2da65c99c597686cb55961142a38
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/204263
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-03-27 20:57:01 +00:00
Greg Daniel
a8cee7afe1 Add vsync toggle for windows viewer.
Change-Id: I1a223c96fbffc24a3a9263304768c2d7946a7a9e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/204260
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-03-27 19:59:25 +00:00
Greg Daniel
bb792aae8c Add option to disable vsync on viewer unix.
This also fixes an issue where vulkan would crash any time we change a
display param on unix.

Bug: skia:
Change-Id: Ic6c3843e04bc77c2e9c5301ee38fcc58a409495d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203380
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-03-25 18:24:29 +00:00
Greg Daniel
655002b8b0 In viewer measure and show full frame times.
This updates viewer to show the full frametime including getting new buffers
and presenting buffers to the screen. This is more useful information than
simply the sum the flush and paint.

In a follow up CL we'll enable disabling vsync so we can truly measure how
long it takes us to draw.

Bug: skia:
Change-Id: Ibdbf16b37b44309fca6e771272ce38fd31a0e95c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202708
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-03-21 19:30:06 +00:00
Mike Klein
ea3f014e2b sk_tool_utils -> ToolUtils, and git clang-format
sk_tool_utils doesn't really fit the naming convention
the rest of code under tools/ tends to use.

Change-Id: I45326a174101c6eb4b6149e9c742f658f2fd23b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202313
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-20 18:05:42 +00:00
Robert Phillips
9882dae24d Reduce usage of SkCanvas::flush
SkCanvas::flush is problematic and we wish to deprecate it. As a first step, this CL begins to remove Skia's internal usage of it.

Ideally clients would use SkSurface::flush and/or GrContext::flush.

Change-Id: I39bb0702f8230134a97961a4ee70833fd5bd0dcc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/196641
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-03-04 22:09:39 +00:00
Greg Daniel
bae712104d Add flush call to take access type, flags, and semaphore.
Bug: skia:
Change-Id: I5e664939a446616ef57acc79d26a10e6908cda10
Reviewed-on: https://skia-review.googlesource.com/c/196643
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-03-02 03:45:36 +00:00
Jim Van Verth
e94af49a3f Fix a couple of Mac windowing issues.
* Set correct backing size for Metal and Vulkan
* Don't capture mouse events when resizing

Bug: skia:8737
Change-Id: I7798ca95aebe0c11b75b23a55a94514550317b32
Reviewed-on: https://skia-review.googlesource.com/c/196423
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-02-28 19:24:52 +00:00
Greg Daniel
cb32415753 Add support for VK_IMAGE_LAYOUT_PRESENT_SRC_KHR in skia vulkan.
This change allows Skia to handle transfering from the present layout.
Skia currently never changes to the present layout, though we are looking
at adding support for this in a different CL.

With this change a client can wrap a an VkImage into an SkSurface still in
the queue present layout and Skia will handle the transation to color
attachment. If a client uses this functiality they most likely will want
to immediately call wait(GrBackendSemaphore) on the SkSurface so that Skia
waits on the VkSemaphore that came from a call to vulkan aquire image before
doing any work on the wrapped VkImage.

Bug: skia:
Change-Id: Ia9bd12ad4e6cd972daaa972cce8698d396c002fc
Reviewed-on: https://skia-review.googlesource.com/c/194424
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-02-26 17:37:25 +00:00
Jim Van Verth
ce51c14d76 Add MoltenVK support to Viewer.
Works with v1.0.17, will probably need updating for later revisions.

Bug: skia:8737
Change-Id: I9e42fad90656a88efa12625856019a8282ff39fd
Reviewed-on: https://skia-review.googlesource.com/c/191298
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-02-14 20:56:38 +00:00
Jim Van Verth
2782b2872b Fix drag events in Mac viewer.
Rather than depend on the Cocoa event system we intercept the events
in our main loop and send them to the appropriate sk_app::Window. A
hashmap that maps from Cocoa windowNumbers to an sk_app::Window is
added to make this possible.

We continue to send the event on through the Cocoa system to catch
system level events -- e.g., window close and drag events. We also
continue to catch key events in an NSView to keep the app from beeping
annoyingly because it thinks it's capturing events outside its focus.
Finally we ensure that move events are always enabled for the window
so that imgui knows that the cursor is over it.

Bug: skia:8737
Change-Id: Id49df51f68942fbf51634d6484291df862074864
Reviewed-on: https://skia-review.googlesource.com/c/191574
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-02-13 19:26:39 +00:00
Jim Van Verth
be39f713e5 Add Metal context to Viewer.
Bug: skia:8737
Change-Id: I5c4c839bcf39f2cd3a9a32d005bf4bdb7c42e6a5
Reviewed-on: https://skia-review.googlesource.com/c/187925
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-02-08 21:26:52 +00:00
Jim Van Verth
3e8392e42c Manage Mac paint events more directly.
Trying to shuttle our paint events through the Mac event system seems
to be causing a number of problems, one being that we're refreshing
too often. This works around that by tracking the invalidation flag
per window.

Bug: skia:8737
Change-Id: Ib1b8041f1d9299ff366747831a466439bfd0db29
Reviewed-on: https://skia-review.googlesource.com/c/190673
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-02-08 20:35:00 +00:00
Jim Van Verth
98385ba6c5 Switch back to non-Retina display resolution.
Gives 1:1 pixel correspondence with GM resolutions, and fixes
viewport issues.

Bug: skia:8737
Change-Id: Ieb87ed32cbb3211bdb4cdfbcc486c7b57b1c1eda
Reviewed-on: https://skia-review.googlesource.com/c/188627
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-02-06 16:53:02 +00:00
Jim Van Verth
d426dd0dd9 Fix screen invalidation on MacOS
Bug: skia:
Change-Id: Ib5c88e78ebdfb4c420335d31807ab069422bf6f3
Reviewed-on: https://skia-review.googlesource.com/c/188033
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-01-30 19:36:11 +00:00
Jim Van Verth
d24cb80702 Fix up some event handling in MacOS
Bug: skia:
Change-Id: I46a1526cb6622c0ff04dbee9f64febca388f3571
Reviewed-on: https://skia-review.googlesource.com/c/187927
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-01-30 16:03:21 +00:00
Jim Van Verth
1f086ca625 Switch sk_app to use native window creation on MacOS.
Bug: skia:
Change-Id: I1763aab0b4bdb650128c1fcc3aa3a05d194496ca
Reviewed-on: https://skia-review.googlesource.com/c/186360
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-01-28 20:12:46 +00:00
Hal Canary
89a644b635 sed s/drawSimpleText/drawString/
for f in $(git grep -l drawSimpleText); do
    sed -i 's/wSimpleText(\([[:alnum:]]\), strlen(\1), kUTF8_SkTextEncoding,/wString(\1,/g' "$f"
    sed -i 's/wSimpleText(\([[:alnum:]]*\)\.c_str(), \1\.size(), kUTF8_SkTextEncoding,/wString(\1,/g' "$f"
done
git checkout @~ include/core/SkCanvas.h samplecode/SampleCusp.cpp
git cl format

Change-Id: Ibc0c3afd30f86465a645fadb26177d61919f57fd
Reviewed-on: https://skia-review.googlesource.com/c/181561
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
2019-01-08 19:50:09 +00:00
Kevin Lubick
13486cbf56 more extra semis
Hopefully with better grepping.

Bug: skia:
Change-Id: I434f2b1fedc2eff2d62cf80b13ebb1bd71a1c8a1
Reviewed-on: https://skia-review.googlesource.com/c/181166
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Joe Gregorio <jcgregorio@google.com>
Auto-Submit: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2019-01-04 15:35:14 +00:00
Mike Reed
919191365b use font instead of paint for text
Bug: skia:
Change-Id: I508ecbd6c4dad41f67f5f2ce6da6c0065dacba6c
Reviewed-on: https://skia-review.googlesource.com/c/180365
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-01-02 17:45:30 +00:00
Brian Salomon
8d2abe9a6c Manual ANGLE roll to ffda3e2985f18f4ff6e3778af8b9715109b21ad0
720ca44976..ffda3e2985

Change-Id: I30d421c35f6e844166c69dfb837006f46281a23f
Reviewed-on: https://skia-review.googlesource.com/c/179246
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
2018-12-19 21:16:02 +00:00
Brian Osman
0c75727f01 Disable OpenGL for Windows-on-ARM64
Bug: skia:8569
Change-Id: I4f526c8918a9a4aae4b6cd6d7c803b12e90e82ed
Reviewed-on: https://skia-review.googlesource.com/c/175984
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-12-10 15:59:14 +00:00