Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch to WebGPU instead of Vulkan for 3D / 2D rendering. #1112

Merged
merged 218 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
218 commits
Select commit Hold shift + click to select a range
8dec93a
start on webgpu version of vgpu as "gpu" -- basic device and queue st…
rcoreilly Jul 27, 2024
d40df22
BindGroupLayout implemented for VarSet..
rcoreilly Jul 27, 2024
98b57ed
progress on a lot of issues: going to just have a buffer for each val…
rcoreilly Jul 28, 2024
c325a25
values = buffers implemented; going to use vertex buffer for instanci…
rcoreilly Jul 28, 2024
e99a50c
more cleanup
rcoreilly Jul 28, 2024
43ee861
support for instance step mode in vertex vars, and for serializing a …
rcoreilly Jul 28, 2024
acf165f
vars, values progress
rcoreilly Jul 28, 2024
58d0a50
gpu: vars/ values etc all looiking good, Current index, BindGroup gen…
rcoreilly Jul 28, 2024
eaffbc5
gpu: basic texture from go image
rcoreilly Jul 28, 2024
b11e28f
gpu: pipelines sorted
rcoreilly Jul 28, 2024
d70019a
gpu: pipeline, graphics, shader entry
rcoreilly Jul 29, 2024
6694dd1
just down to the swapchain; drawtri is within reach..
rcoreilly Jul 29, 2024
9babf9c
gpu: all building!
rcoreilly Jul 29, 2024
9e52051
gpu: drawtri works!
rcoreilly Jul 29, 2024
bf38bc7
learning about how to copy data to the buffers.. getting closer
rcoreilly Jul 29, 2024
b14e945
drawtri working with CreateBufferInit strategy.. still some alignment…
rcoreilly Jul 29, 2024
b48a902
Merge branch 'main' into wgpu
kkoreilly Jul 29, 2024
fce0d02
tidy mod
kkoreilly Jul 29, 2024
15d7672
update to no _ enums
rcoreilly Jul 29, 2024
52a53c9
drawidx matches orig except flipped Y -- vulkan version has an extra …
rcoreilly Jul 29, 2024
c2c7be7
add GLFWCreateWindow helper function
kkoreilly Jul 29, 2024
92647da
add glfw_noop to gpu
kkoreilly Jul 29, 2024
ea4f99e
update drawtri to also use gpu.GLFWCreateWindow
kkoreilly Jul 29, 2024
0babdcf
more robustness and tests on buffer setting -- indexes can only be se…
rcoreilly Jul 29, 2024
0ea6c4a
add gpu_js
kkoreilly Jul 30, 2024
4c2b5fb
fix MaxAnisotropy typo
kkoreilly Jul 30, 2024
df399af
add clean quit fallback in gpu glfw for generatehtml
kkoreilly Jul 30, 2024
438b675
config jsfs in gpu glfw
kkoreilly Jul 30, 2024
410191e
embed wgsl files for examples and clean up error handling; drawtri no…
kkoreilly Jul 30, 2024
8d7739f
more error handling cleanup
kkoreilly Jul 30, 2024
573084c
start on texture and some other minor fixes
rcoreilly Jul 30, 2024
9a47b63
texture binding not quite working but not sure why..
rcoreilly Jul 30, 2024
bf67e83
texture working -- just need the group bind update
rcoreilly Jul 30, 2024
db1cace
texture fully working
rcoreilly Jul 30, 2024
daeaae7
fix typo again
kkoreilly Jul 30, 2024
51ed4e3
gpu error handling cleanup
kkoreilly Jul 30, 2024
28fc12b
texture uses embed, update texture more slowly
rcoreilly Jul 30, 2024
acd5886
progress on phong
rcoreilly Jul 30, 2024
8569b76
dynamic var and alignment plumbing in place, basic test cases all wor…
rcoreilly Jul 31, 2024
7efd368
state of things for core generate crash in phong
rcoreilly Jul 31, 2024
5758614
phong building and added convenience access methods for gpu; phong ne…
rcoreilly Jul 31, 2024
b984966
major updates to support setting mesh directly from shape and just us…
rcoreilly Jul 31, 2024
2074cbb
phong itself hopefully good -- starting on examlpe
rcoreilly Jul 31, 2024
4eb8940
fix examples
rcoreilly Aug 1, 2024
f4d0907
phong example builds.. now for the shaders
rcoreilly Aug 1, 2024
d974e6d
shader compiles finally; hanging in AddMeshFromShape
rcoreilly Aug 1, 2024
f439211
running but "no work has been submitted" somehow.
rcoreilly Aug 1, 2024
f0d88d5
misc fixes and cleanup but still no valid command encoder
rcoreilly Aug 1, 2024
6cfee73
phong finally starting to work: nil VertexColor was one problem; dyna…
rcoreilly Aug 1, 2024
a4fd176
phong dynamic offset objects now working!
rcoreilly Aug 1, 2024
2a44d27
upright projection
rcoreilly Aug 1, 2024
a5d78e0
comment out appCanvasCtx for now
kkoreilly Aug 1, 2024
3ae7525
clean up wgsl file whitespace
kkoreilly Aug 1, 2024
8cd2f94
gpu: rename all norm -> normal, and compute WorldMatrix on CPU based …
rcoreilly Aug 1, 2024
2c4a564
setup a dummy VertexColor when not using
rcoreilly Aug 2, 2024
84520c6
cleanup lots of texture cruft and got depth buffer working
rcoreilly Aug 2, 2024
abba641
multisampling working
rcoreilly Aug 2, 2024
5695042
IncludeFS for processing #include directives in wgsl files
rcoreilly Aug 2, 2024
412cb6d
omg spent way too long trying to get modulo operator to work: modf is…
rcoreilly Aug 2, 2024
a8399f7
alpha blending and changing the normal direction on the floor fixes e…
rcoreilly Aug 2, 2024
8fe9a25
Merge branch 'main' into wgpu
rcoreilly Aug 2, 2024
bef7228
final cleanup of phong -- pervertex srgb, readme, update names etc. …
rcoreilly Aug 2, 2024
e5f96c1
revert NormalNeg = true in plane -- set in phong.
rcoreilly Aug 2, 2024
c235254
full update / cleanup of gpu README
rcoreilly Aug 2, 2024
4e38be8
gpudraw running but getting validation error somewhere.
rcoreilly Aug 3, 2024
1c42b5c
at least it isn't invalid all the time.. still some rendering issues …
rcoreilly Aug 3, 2024
8694701
binding update always-- getting more.
rcoreilly Aug 3, 2024
cae0d97
gpudraw now fully working although the window mapping is not using th…
rcoreilly Aug 3, 2024
7aa6cac
gpudraw actually fully working, but is relying on weird z=1 coordinat…
rcoreilly Aug 3, 2024
8169d86
get rid of flipy on phong texture and test flipy on draw
rcoreilly Aug 3, 2024
7829350
full image/draw interface for draw routines, including Uniform -> fill
rcoreilly Aug 3, 2024
28c57a1
cleanup and documentation of gpudraw --- much cleaner API now.
rcoreilly Aug 3, 2024
76a165c
make tests actually tests -- could pull out matrix stuff to somewhere…
rcoreilly Aug 3, 2024
0bb7c09
move matrix stuff out into drawmatrix package -- could be used anywhe…
rcoreilly Aug 3, 2024
26f3cff
Rename SetColorBlend -> SetAlphaBlend and actually make it work; add …
rcoreilly Aug 3, 2024
e3bdd92
add drawmatrix.Transform test
rcoreilly Aug 4, 2024
8f38056
updating system to use new webgpu infrastructure and drawer. drawtri…
rcoreilly Aug 4, 2024
d61497b
core actually works with new webgpu driver!! not sure what is wrong …
rcoreilly Aug 4, 2024
bcb6447
get system/examples/drawtri working on web but not desktop with webgpu!
kkoreilly Aug 4, 2024
abcdba4
gpudraw: much imporoved image management logic that keeps images arou…
rcoreilly Aug 4, 2024
c56ec31
rendering all working.
rcoreilly Aug 4, 2024
86da411
need to quit on init in generatehtml; fixes hang in build
kkoreilly Aug 4, 2024
a7ee30c
InitGPU with correct size on web
kkoreilly Aug 4, 2024
e1bd864
add generate-html config flag
kkoreilly Aug 4, 2024
18aaed8
rewrite web.Drawer to handle both WebGPU and backup 2D image drawer
kkoreilly Aug 4, 2024
98e20e0
resizing finally working -- that was a nightmare. and getting a wgpu…
rcoreilly Aug 4, 2024
5ba1216
update to use web.Drawer
kkoreilly Aug 4, 2024
c552636
update GLFWCreateWindow api for other platforms
rcoreilly Aug 4, 2024
089aea2
fix system drawtri example; working on web again
kkoreilly Aug 4, 2024
a71a6c4
work on wgpu resizing logic
kkoreilly Aug 4, 2024
6621fb2
implement resize and actualWidth and actualHeight for js
kkoreilly Aug 4, 2024
15e6abe
set canvas width and height glfw js
kkoreilly Aug 4, 2024
406e859
fix canvas size logic; dpr not needed; gpu drawtri finally working on…
kkoreilly Aug 4, 2024
55c3f55
fix InitDrawer and Resize logic to fully work on web; go-webgpu, gpu,…
kkoreilly Aug 4, 2024
f750628
update all gpu examples to new GLFWCreateWindow changes
kkoreilly Aug 4, 2024
ef83508
fix system drawtri -- need present
rcoreilly Aug 4, 2024
687dcad
update system/drawidx to gpu api. not quite working.
rcoreilly Aug 4, 2024
55fa612
don't use VkPerspective in new gpu
rcoreilly Aug 4, 2024
43733ba
texture was using vk perspective -- now need to flip uv or something.
rcoreilly Aug 4, 2024
3d3f88e
remove unused appKeepBodyClean
kkoreilly Aug 4, 2024
6973f17
get 2D canvas context for backup image drawer
kkoreilly Aug 4, 2024
da800dd
fold displayImage js function into web.Drawer.End for backup 2D image…
kkoreilly Aug 5, 2024
612321a
Merge branch 'main' into wgpu
kkoreilly Aug 5, 2024
c057d3b
use UndefType for texture and phong; adds some issues but gets basic …
kkoreilly Aug 5, 2024
c73d49b
drawtri has Depth32 format which fails on web: kai to fix b/c somethi…
rcoreilly Aug 5, 2024
1f6c049
flipy on texture example now that we're not using Vk projection!
rcoreilly Aug 5, 2024
5ae9ae6
register ViewFormats of SRGB type for non-srgb formats in surface swa…
rcoreilly Aug 5, 2024
db53e88
Merge branch 'main' into wgpu
rcoreilly Aug 5, 2024
99523e7
use Depth32 for phong and not for drawtri
kkoreilly Aug 5, 2024
d1eabbc
rename UndefType to UndefinedType and Sten to Stencil
kkoreilly Aug 5, 2024
1b6b584
get srgb all working on web with temporary fixes
kkoreilly Aug 5, 2024
a19a347
update to use cogentcore/webgpu
kkoreilly Aug 6, 2024
7546755
merge with current
rcoreilly Aug 6, 2024
d78a829
major update to high-level api, introducing System and Renderer inter…
rcoreilly Aug 6, 2024
85495d9
truly baffled -- everything but the render
rcoreilly Aug 6, 2024
64ff88d
what? phong rendering works! that is a good clue hopefully..
rcoreilly Aug 6, 2024
05b7620
gpudraw also works except it is clearing instead of loading.. some ki…
rcoreilly Aug 6, 2024
363d7cf
damn pipeline wasn't setting initial graphics defaults.
rcoreilly Aug 6, 2024
979e49a
minor cleanup: phong is leaking but rest of demos are not.
rcoreilly Aug 6, 2024
6888170
core updated to use updated gpudraw / gpu Renderer updates. not seei…
rcoreilly Aug 6, 2024
6cdf878
fix quitting crash
rcoreilly Aug 6, 2024
0bb543c
system web working now
rcoreilly Aug 6, 2024
ce0b81a
major reorganization of bindgroup creation process -- no longer leaki…
rcoreilly Aug 6, 2024
f82ca36
phong and gpudraw no longer crashing: you do NOT release the bindgrou…
rcoreilly Aug 6, 2024
9ac2e65
use type-conversion safety check
rcoreilly Aug 6, 2024
91d1506
gpudraw fully working with no leaks! the key was to not continue to …
rcoreilly Aug 6, 2024
00e6755
offscreen rendering to RenderTexture working. Just need to be able t…
rcoreilly Aug 7, 2024
e4ac532
offscreen fully working including using the texture in gpudraw! all …
rcoreilly Aug 7, 2024
d117ad1
xyz mostly converted: need AddObjects logic, and general mesh setting…
rcoreilly Aug 7, 2024
3872848
phong updated with Set / Reset mechanism and full use of shape.Mesh i…
rcoreilly Aug 7, 2024
9a744b1
phong update complete -- much more robust and simple vs. all the conf…
rcoreilly Aug 7, 2024
4ae6591
update shape docs
rcoreilly Aug 7, 2024
9c7f3f0
xyz and xyzcore updated with cleaner set / reset mechanism: no more N…
rcoreilly Aug 8, 2024
1708874
xyz example building..
rcoreilly Aug 8, 2024
61c1473
xyz example runs but nothing is visible.. some kind of camera problem?
rcoreilly Aug 8, 2024
e7b506b
xyz basically working -- some issues with the gopher..
rcoreilly Aug 8, 2024
d1dac86
ok key fix: need to use WorldMatrix for object matrix! that is what …
rcoreilly Aug 8, 2024
df78578
fixed lighting issues: loaded obj normals are not actually normalized…
rcoreilly Aug 8, 2024
64161ce
rename Properties to Info for wgpu
kkoreilly Aug 7, 2024
278e8fb
update to new webgpu changes removing SwapChain etc; everything worki…
kkoreilly Aug 8, 2024
b62ce80
update webgpu
kkoreilly Aug 8, 2024
41a96a6
text rendering fixed: plane direction and rotation and texture opacit…
rcoreilly Aug 8, 2024
0d68b16
implement hacky srgb fix to get things mostly working on web; xyz sti…
kkoreilly Aug 8, 2024
e4276d9
don't save png on web for gpu offscreen example
kkoreilly Aug 8, 2024
db49698
use Texture GetMipLevelCount and GetDepthOrArrayLayers
kkoreilly Aug 8, 2024
31010b5
documented the coordinate system and fixed the Plane to generate the …
rcoreilly Aug 8, 2024
3fb8d2c
add gpudraw.AsGPUDrawer interface to get xyz working on web!
kkoreilly Aug 8, 2024
58ffa66
vertex color works better when you actully set the colors..
rcoreilly Aug 9, 2024
9f28d5e
xyz.rebuild method, called during xyzcore rebuild so light / dark swi…
rcoreilly Aug 9, 2024
aca9a45
update light options in xyz example -- fun to try the different optio…
rcoreilly Aug 9, 2024
7009c15
update webgpu
kkoreilly Aug 9, 2024
fa676bf
OnMainThread added to app, used in RunOnMain -- prevents blocking but…
rcoreilly Aug 9, 2024
c3b646b
Revert "OnMainThread added to app, used in RunOnMain -- prevents bloc…
kkoreilly Aug 9, 2024
5c36cb3
added note in gpu/surface about how Reconfig should be called on main…
rcoreilly Aug 9, 2024
80eafec
start updating android to use wgpu
kkoreilly Aug 9, 2024
07e6be5
get android building with wgpu
kkoreilly Aug 9, 2024
30ca409
start updating ios to use wgpu
kkoreilly Aug 9, 2024
5078d65
get iOS almost building with wgpu
kkoreilly Aug 10, 2024
27c1670
add support for resizing on web
kkoreilly Aug 10, 2024
ab0e36e
clean up desktop resize code
kkoreilly Aug 10, 2024
2707d4a
call wgpu.SetLogLevel based on gpu.Debug in NewSurface; suppresses wg…
kkoreilly Aug 10, 2024
ada2ab1
put wasm on window so that it can be accessed in Go syscall/js; web b…
kkoreilly Aug 10, 2024
ef7f8a9
set default log level for gpu.Debug to Info
kkoreilly Aug 10, 2024
8ecd430
go back to LogLevelDebug for gpu.Debug
kkoreilly Aug 10, 2024
4900195
disable gpu.Debug in examples
kkoreilly Aug 10, 2024
708c755
try placeholder android size and no srgb fix to get further with andr…
kkoreilly Aug 10, 2024
60192c4
allow viewing wgpu debug logs on android
kkoreilly Aug 11, 2024
05f5e2f
remove MoltenVK.framework logic from core command and get layerClass …
kkoreilly Aug 11, 2024
65beff5
remove vulkan install from core setup on macOS
kkoreilly Aug 11, 2024
4a22c2f
gpu: fix clear color so it matches vgpu: all colors need to be srgb c…
rcoreilly Aug 11, 2024
36d268d
set Renderer size in android.App.MainUI
kkoreilly Aug 11, 2024
411eed1
add SetSize logic for iOS
kkoreilly Aug 11, 2024
03ede54
guard SetSize in updateConfig on iOS
kkoreilly Aug 11, 2024
141c76e
update webgpu
kkoreilly Aug 12, 2024
2e6b010
no longer need custom options for android logging with wgpu since it …
kkoreilly Aug 12, 2024
9fc40dd
support GoLogWGPU tag
kkoreilly Aug 12, 2024
e8d684d
update to latest webgpu
rcoreilly Aug 12, 2024
6b40278
improve plot docs example
kkoreilly Aug 12, 2024
f15c69d
added vcs.Types enum and use that everywhere instead of VersionContro…
rcoreilly Aug 12, 2024
db2fd62
update yaegicore
rcoreilly Aug 12, 2024
ddb85a0
add docs for making a canvas grow to fill the available space for #1126
kkoreilly Aug 12, 2024
4c09b85
move wgpu.SetLogLevel Debug logic to GPU.Config
kkoreilly Aug 12, 2024
6e50847
fix windows include: have to use path for fs, not filepath.
rcoreilly Aug 12, 2024
8c7ffe0
only add static preview message if there is one to show
kkoreilly Aug 13, 2024
503ee15
add gpu.SetDebug function
kkoreilly Aug 13, 2024
320ae34
gpu now working on linux: the byte alignment values provided by wgpu …
rcoreilly Aug 13, 2024
716f3eb
update system drawtri to gpu changes
kkoreilly Aug 13, 2024
15fb1c8
formatting cleanup
kkoreilly Aug 13, 2024
bdc3505
update system drawidx example to new gpu structure
kkoreilly Aug 13, 2024
9dd8ab2
fix some xyz example build errors; still not all working
kkoreilly Aug 13, 2024
07fc4c1
remove old and unnecessary gpu/opts.go code
kkoreilly Aug 14, 2024
1d82ba5
use MaxInt instead of MaxInt64 in minmax so it works on 32-bit platforms
kkoreilly Aug 14, 2024
49ef9d2
remove old and unnecessary gpu.PlatformDefaults
kkoreilly Aug 14, 2024
0cae8ba
convert CALayer to void * in ios; still not working
kkoreilly Aug 14, 2024
f73778c
add elide.AppName and use it on iOS
kkoreilly Aug 14, 2024
191c16e
also use elide.AppName for android and web
kkoreilly Aug 14, 2024
6f04da9
restore prior logic that should not have been removed -- everything w…
rcoreilly Aug 14, 2024
00192b9
xyz physics builds and works in gui mode -- still needs maker / build…
rcoreilly Aug 14, 2024
7277cee
add scenegeom.pos offset to RenderDraw for xyz, video and sprites -- …
rcoreilly Aug 14, 2024
fa6ff27
switch to our version of reisen and fix typo in video code. not gett…
rcoreilly Aug 14, 2024
914215e
wgpu cleanup
kkoreilly Aug 14, 2024
3a42b6c
install more relevant libraries on linux in core setup
kkoreilly Aug 14, 2024
59136e8
updated core setup to use w64devkit for gcc instead of old and unmain…
rcoreilly Aug 15, 2024
b50e719
improve windows path message
kkoreilly Aug 15, 2024
e7ab7fb
windows registry add path working -- needs to be run as admin to actu…
rcoreilly Aug 15, 2024
7366016
fix misc kai comments
rcoreilly Aug 15, 2024
e23e44b
failure in switching between graphs and netview in emer sims fixed by…
rcoreilly Aug 15, 2024
69857f9
update install docs to wgpu changes
kkoreilly Aug 15, 2024
5de2d8f
attempts to get rendering to work on web while running sim. not gett…
rcoreilly Aug 15, 2024
ec85486
get webgpu working on ios! needed to call layer instead of layerClass
kkoreilly Aug 16, 2024
55e15cf
clarify iOS winptr docs
kkoreilly Aug 16, 2024
c2dfc65
windows core setup cleanup
kkoreilly Aug 16, 2024
f3cd652
improve error handling to display snackbar instead of crashing when W…
kkoreilly Aug 16, 2024
d326e38
do not use WebGPU in Firefox for now since it does not support it in …
kkoreilly Aug 16, 2024
b2b1344
add todo to remove RenderUpdateWindow
kkoreilly Aug 17, 2024
4760cbf
Merge branch 'main' into wgpu
kkoreilly Aug 17, 2024
3dc74bd
exclude mobile platforms from WebGPU on web due to shaky support
kkoreilly Aug 17, 2024
032add4
disable webgpu on web linux for now
kkoreilly Aug 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions base/elide/elide.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

/*
Package elide provides basic text eliding functions.
*/
// Package elide provides basic text eliding functions.
package elide

import "strings"

// End elides from the end of the string if it is longer than given
// size parameter. The resulting string will not exceed sz in length,
// with space reserved for … at the end.
Expand All @@ -31,3 +31,16 @@ func Middle(s string, sz int) string {
rest := en - mid
return s[:mid] + "…" + s[n-rest:]
}

// AppName elides the given app name to be twelve characters or less
// by removing word(s) from the middle of the string if necessary and possible.
func AppName(s string) string {
if len(s) <= 12 {
return s
}
words := strings.Fields(s)
if len(words) < 3 {
return s
}
return words[0] + " " + words[len(words)-1]
}
2 changes: 1 addition & 1 deletion base/ordmap/ordmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The implementation is fully visible and the API provides a minimal
subset of methods, compared to other implementations that are heavier,
so that additional functionality can be added as needed.

The slice structure holds the Key and Val for items as they are added,
The slice structure holds the Key and Value for items as they are added,
enabling direct updating of the corresponding map, which holds the
index into the slice. Adding and access are fast, while deleting
and inserting are relatively slow, requiring updating of the index map,
Expand Down
39 changes: 39 additions & 0 deletions base/vcs/enumgen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions base/vcs/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

package vcs

//go:generate core generate

import (
"os"
"path/filepath"
Expand Down
4 changes: 4 additions & 0 deletions base/vcs/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ type GitRepo struct {
vcs.GitRepo
}

func (gr *GitRepo) Type() Types {
return Git
}

func (gr *GitRepo) Files() (Files, error) {
f := make(Files)

Expand Down
4 changes: 4 additions & 0 deletions base/vcs/svn.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ type SvnRepo struct {
vcs.SvnRepo
}

func (gr *SvnRepo) Type() Types {
return Svn
}

func (gr *SvnRepo) CharToStat(stat byte) FileStatus {
switch stat {
case 'M', 'R':
Expand Down
25 changes: 19 additions & 6 deletions base/vcs/vcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,25 @@ import (
"github.com/Masterminds/vcs"
)

type Types int32 //enums:enum -accept-lower

const (
NoVCS Types = iota
Git
Svn
Bzr
Hg
)

// Repo provides an interface extending [vcs.Repo]
// (https://github.com/Masterminds/vcs)
// with support for file status information and operations.
type Repo interface {
vcs.Repo

// Type returns the type of repo we are using
Type() Types

// Files returns a map of the current files and their status.
Files() (Files, error)

Expand Down Expand Up @@ -104,19 +117,19 @@ func NewRepo(remote, local string) (Repo, error) {
}

// DetectRepo attempts to detect the presence of a repository at the given
// directory path -- returns type of repository if found, else vcs.NoVCS.
// directory path -- returns type of repository if found, else NoVCS.
// Very quickly just looks for signature file name:
// .git for git
// .svn for svn -- but note that this will find any subdir in svn repo
func DetectRepo(path string) vcs.Type {
// .svn for svn -- but note that this will find any subdir in svn rep.o
func DetectRepo(path string) Types {
if fsx.HasFile(path, ".git") {
return vcs.Git
return Git
}
if fsx.HasFile(path, ".svn") {
return vcs.Svn
return Svn
}
// todo: rest later..
return vcs.NoVCS
return NoVCS
}

// relPath return the path relative to the repository LocalPath()
Expand Down
2 changes: 1 addition & 1 deletion cmd/core/cmd/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func Log(c *config.Config) error { //types:add
}
}
// we are logging continiously so we can't buffer, and we must be verbose
err := exec.Verbose().SetBuffer(false).Run("adb", "logcat", "*:"+c.Log.All, "Go:D", "GoLog:D")
err := exec.Verbose().SetBuffer(false).Run("adb", "logcat", "*:"+c.Log.All, "Go:D", "GoLog:D", "GoLogWGPU:D")
if err != nil {
return fmt.Errorf("erroring getting logs: %w", err)
}
Expand Down
7 changes: 7 additions & 0 deletions cmd/core/cmd/registry_notwindows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//go:build !windows

package cmd

func windowsRegistryAddPath(path string) error {
return nil // no-op
}
42 changes: 42 additions & 0 deletions cmd/core/cmd/registry_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright (c) 2024, Cogent Core. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package cmd

import (
"fmt"
"strings"

"cogentcore.org/core/base/logx"
"golang.org/x/sys/windows/registry"
)

// windowsRegistryAddPath adds the given filepath to the system path in the
// Windows registry. If you are adding multiple paths, put a semicolon between
// them, but do NOT add a leading or trailing semicolon; these will be handled
// automatically.
func windowsRegistryAddPath(path string) error {
k, err := registry.OpenKey(registry.LOCAL_MACHINE, `System\CurrentControlSet\Control\Session Manager\Environment`, registry.QUERY_VALUE|registry.SET_VALUE)
if err != nil {
return err
}
defer k.Close()

s, _, err := k.GetStringValue("Path")
if err != nil {
return err
}
scpath := ";" + path + ";"
if strings.Contains(s, scpath) {
fmt.Printf("Path %s already in existing Path: %s\n", path, s)
return nil
}
s += path + ";"
err = k.SetStringValue("Path", s)
if err != nil {
return err
}
logx.PrintfDebug("Path %q added to system PATH\n", path)
return nil
}
34 changes: 5 additions & 29 deletions cmd/core/cmd/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ import (
"cogentcore.org/core/base/exec"
"cogentcore.org/core/base/logx"
"cogentcore.org/core/cmd/core/config"
"github.com/mitchellh/go-homedir"
)

const vulkanVersion = "1.3.283.0"

// Setup installs platform-specific dependencies for the current platform.
// It only needs to be called once per system.
func Setup(c *config.Config) error { //types:add
Expand All @@ -32,27 +29,6 @@ func Setup(c *config.Config) error { //types:add
} else {
logx.PrintlnWarn("xcode tools already installed")
}
if _, err := exec.LookPath("vulkaninfo"); err == nil {
logx.PrintlnWarn("vulkan already installed")
return nil
}
err = vc.Run("curl", "-OL", "https://sdk.lunarg.com/sdk/download/"+vulkanVersion+"/mac/vulkansdk-macos-"+vulkanVersion+".dmg")
if err != nil {
return err
}
err = exec.Run("sudo", "hdiutil", "attach", "vulkansdk-macos-"+vulkanVersion+".dmg")
if err != nil {
return err
}
home, err := homedir.Dir()
if err != nil {
return err
}
root := filepath.Join(home, "VulkanSDK", vulkanVersion)
err = vc.Run("sudo", "/Volumes/vulkansdk-macos-"+vulkanVersion+"/InstallVulkan.app/Contents/MacOS/InstallVulkan", "--root", root, "--accept-licenses", "--default-answer", "--confirm-command", "install", "com.lunarg.vulkan.core", "com.lunarg.vulkan.usr", "com.lunarg.vulkan.sdl2", "com.lunarg.vulkan.glm", "com.lunarg.vulkan.volk", "com.lunarg.vulkan.vma")
if err != nil {
return err
}
return nil
case "linux":
_, err := exec.LookPath("apt-get")
Expand All @@ -61,7 +37,7 @@ func Setup(c *config.Config) error { //types:add
if err != nil {
return err
}
return vc.Run("sudo", "apt-get", "install", "libgl1-mesa-dev", "xorg-dev")
return vc.Run("sudo", "apt-get", "install", "-f", "-y", "libgl1-mesa-dev", "libegl1-mesa-dev", "mesa-vulkan-drivers", "xorg-dev")
}
_, err = exec.LookPath("dnf")
if err == nil {
Expand All @@ -70,19 +46,19 @@ func Setup(c *config.Config) error { //types:add
return fmt.Errorf("unknown Linux distro (apt-get and dnf not found); file an issue at https://github.com/cogentcore/core/issues")
case "windows":
if _, err := exec.LookPath("gcc"); err != nil {
err := vc.Run("curl", "-OL", "https://github.com/jmeubank/tdm-gcc/releases/download/v10.3.0-tdm64-2/tdm64-gcc-10.3.0-2.exe")
err := vc.Run("curl", "-OL", "https://github.com/skeeto/w64devkit/releases/download/v2.0.0/w64devkit-x64-2.0.0.exe")
if err != nil {
return err
}
path, err := filepath.Abs("tdm64-gcc-10.3.0-2.exe")
path, err := filepath.Abs("w64devkit-x64-2.0.0.exe")
if err != nil {
return err
}
err = vc.Run(path)
err = vc.Run(path, "x", "-oC:", "-aoa")
if err != nil {
return err
}
err = exec.Run("cmd.exe", "/c", `cd C:\TDM-GCC-64 && mingwvars.bat`)
err = windowsRegistryAddPath(`C:\w64devkit\bin`)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/core/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ type Config struct { //types:add
// the configuration information for web
Web Web `cmd:"build,install,run,pack"`

// the configuration options for the log command
Log Log `cmd:"log"`
// the configuration options for the log and run commands
Log Log `cmd:"log,run"`

// the configuration options for the generate command
Generate Generate `cmd:"generate"`
Expand Down
2 changes: 1 addition & 1 deletion cmd/core/config/typegen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions cmd/core/config/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ type Web struct { //types:add
// and serve it as a gzip-encoded file in the run command.
Gzip bool

// GenerateHTML is whether to generate an HTML version of app content for
// preview and SEO purposes.
GenerateHTML bool `default:"true"`

// The page language.
//
// DEFAULT: en.
Expand Down
3 changes: 2 additions & 1 deletion cmd/core/mobile/build_androidapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"os"
"path/filepath"

"cogentcore.org/core/base/elide"
"cogentcore.org/core/base/exec"
"cogentcore.org/core/base/logx"
"cogentcore.org/core/cmd/core/config"
Expand Down Expand Up @@ -54,7 +55,7 @@ func goAndroidBuild(c *config.Config, pkg *packages.Package, targets []config.Pl
buf.WriteString(`<?xml version="1.0" encoding="utf-8"?>`)
err := manifestTmpl.Execute(buf, manifestTmplData{
JavaPkgPath: c.ID,
Name: c.Name,
Name: elide.AppName(c.Name),
LibName: libName,
})
if err != nil {
Expand Down
Loading
Loading