Commit Graph

70 Commits

Author SHA1 Message Date
Jim Van Verth
7bb0ff05ce [graphite] Add support to Mac Viewer.
Adds a type enum to WindowContext to determine which kind of
GPU context (GrDirectContext or skgpu::Context) we're using.

Bug: skia:12466
Change-Id: I288878740392a43cd9e82c925fbe2c372d140dc5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/454699
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-09-30 21:38:25 +00:00
Ben Wagner
f6cc85844f Reland "Fix sk_app macOS raster window build conditions."
The "raster" window on macOS and iOS is actually backed by GL. Fix the
build rules and code conditions to reflect this. This allows for some
sk_app applications to run on macOS and iOS with skia_use_gl=false.

> Revert:
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397737
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

> Land:
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397256
> Commit-Queue: Ben Wagner <bungeman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

Change-Id: Ia8a421f4818856dd90cb4847095eee0d1836d1e6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398056
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-04-19 18:25:44 +00:00
Brian Osman
9d4741370c Revert "Fix sk_app macOS raster window build conditions."
This reverts commit 163ba10dde.

Reason for revert: Mac linker errors

Original change's description:
> Fix sk_app macOS raster window build conditions.
>
> The "raster" window on macOS is actually backed by GL. Fix the build
> rules and code conditions to reflect this. This allows for some sk_app
> applications to run on macOS with skia_use_gl=false.
>
> Change-Id: I5d7b37c4172079e163690faa4e55a622a6d4f844
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397256
> Commit-Queue: Ben Wagner <bungeman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

TBR=bungeman@google.com,brianosman@google.com

Change-Id: Ie5fa24138e4387784c21559f28528a4c4d335626
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397737
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-04-17 17:41:27 +00:00
Ben Wagner
163ba10dde Fix sk_app macOS raster window build conditions.
The "raster" window on macOS is actually backed by GL. Fix the build
rules and code conditions to reflect this. This allows for some sk_app
applications to run on macOS with skia_use_gl=false.

Change-Id: I5d7b37c4172079e163690faa4e55a622a6d4f844
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397256
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-17 15:18:05 +00:00
Jim Van Verth
2db4ba1caf Reland "Remove ARC from tools lib."
This is a reland of 4c4c80fa12

Original change's description:
> Remove ARC from tools lib.
>
> Trying this in baby steps to manage leaks better.
>
> Change-Id: Id8597ba236c752bcbf1c7ec94f6c1021e636d547
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372556
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Adlai Holler <adlai@google.com>

Change-Id: Ib5c949ee9e8ac9f47de1991297aec718f3185424
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/373616
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-02-22 17:55:52 +00:00
Jim Van Verth
e8a1c0150b Revert "Remove ARC from tools lib."
This reverts commit 4c4c80fa12.

Reason for revert: Need to update Flutter with sk_cf_obj renaming.

Original change's description:
> Remove ARC from tools lib.
>
> Trying this in baby steps to manage leaks better.
>
> Change-Id: Id8597ba236c752bcbf1c7ec94f6c1021e636d547
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372556
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Adlai Holler <adlai@google.com>

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

Change-Id: I7dc226d002184b80a1d8d2aee09d122d2e13d732
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372680
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-02-20 00:08:41 +00:00
Jim Van Verth
4c4c80fa12 Remove ARC from tools lib.
Trying this in baby steps to manage leaks better.

Change-Id: Id8597ba236c752bcbf1c7ec94f6c1021e636d547
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372556
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
2021-02-19 22:21:43 +00:00
Ben Wagner
fa8b5e4502 Add support for retina displays to sk_app.
The macOS view system is in "big pixel" units, so translate these
into "physical pixel" units.

To compensate, add sk_app::Window::scaleFactor() which returns the
scale factor. The viewer app is modified to apply the inverse of
this scale factor to the current zoom level.

Change-Id: I4fac066a230c87793fc5a0e5a582d60d25e46e7b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361558
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-01-29 17:33:48 +00:00
Greg Daniel
8c277bdbfe Revert "Fix crash on windows viewer when starting in vulkan."
This reverts commit fcd68167a2.

Reason for revert: going to do this a different way

Original change's description:
> Fix crash on windows viewer when starting in vulkan.
>
> setRequestedDisplayParams is called when setting up viewer before we've
> inited the Window. On windows this tries to attach the Window for a given
> backend. However, we haven't set fBackend yet. Later on we will directly
> call attach.
>
> Change-Id: I4bd6586478f2b040e5913314c4e47e92fc893a60
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344756
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

TBR=egdaniel@google.com,brianosman@google.com

Change-Id: Ie4d33b557868e4906df9b7a3988072fdc79a19c7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344897
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-12-16 14:52:07 +00:00
Greg Daniel
fcd68167a2 Fix crash on windows viewer when starting in vulkan.
setRequestedDisplayParams is called when setting up viewer before we've
inited the Window. On windows this tries to attach the Window for a given
backend. However, we haven't set fBackend yet. Later on we will directly
call attach.

Change-Id: I4bd6586478f2b040e5913314c4e47e92fc893a60
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344756
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-12-16 14:14:06 +00:00
John Stiles
f7da92372a Enable Mac to build with SK_VULKAN enabled.
We no longer support MoltenVK, so we can't render using Vulkan on Mac,
but this change allows Macs with the SDK installed to compile Vulkan
code and use SPIRV-Tools.

Change-Id: I5baaf80de259e406495002a5fbfec89dbd1357b8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/336678
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-11-20 16:32:36 +00:00
John Stiles
7571f9e490 Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'.
Mechanically updated via Xcode "Replace Regular Expression":

  typedef (.*) INHERITED;
    -->
  using INHERITED = $1;

The ClangTidy approach generated an even larger CL which would have
required a significant amount of hand-tweaking to be usable.

Change-Id: I671dc9d9efdf6d60151325c8d4d13fad7e10a15b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314999
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-03 03:41:26 +00:00
John Stiles
fe0de30a87 Enable ClangTidy check modernize-use-nullptr.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html

The check converts the usage of null pointer constants (eg. NULL, 0) to
use the new C++11 nullptr keyword.

Change-Id: Iaea2d843154c70e49d62affdc5dceb3bca8c1089
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310297
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-14 16:14:30 +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
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
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 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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