Previously, DSLVar represented local, global, and parameter variables.
This splits it into three separate subclasses.
In addition to just being a cleaner API in general, this also addresses
an issue we ran into with the upcoming DSLParser: previously, a global
DSLVar's storage was not set correctly until DeclareGlobal was called,
so an AddToSymbolTable call prior to DeclareGlobal would create the
SkSL variable with the wrong storage, causing spurious errors on
global-only modifiers. But holding off on the AddToSymbolTable tends to
break constructs like "int x = 0, y = x", so improving the API seemed
like the best way to address it.
Now that we have greater type safety around variables, we can
potentially avoid having to call AddToSymbolTable for DSLVar and
DSLGlobalVar altogether, since we know they are both supposed to end up
in the symbol table, but that isn't something I want to change in this
CL.
Change-Id: I5f390a7384ce0af6a2131d84f97fc5e5b318063f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/428576
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This unifies various chunks of error handling code and makes the DSL
more gracefully handle failed object construction.
Change-Id: I4edc581c9eba276ce2ee2a17125ea7bd6057134a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420237
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
RenderTargetContext was renamed several months ago; this CL just fixes
up a few related names which hadn't yet updated yet.
Change-Id: I59a6ea92fc5d309a9b45a83e3aca6e49cb8d662e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/415745
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This adds an explicit DeclareGlobal call, which must now be called for
variables that were previously implicitly global.
Change-Id: Iaf838880d1033ee52aac9246e31e3bda9a3b36f0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402399
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Replace with two methods in SkGr.h that make cached/uncached texture
proxies from SkBitmap. Move code that makes a GrFP from the proxy
to SkImage_Raster::asFragmentProcessor.
Bug: skia:11877
Change-Id: I51a0ae687561be9b0e44b98ee50f171e42476d94
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/401920
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
No functionality changes, just making the naming consistent with our
other enums.
Change-Id: Ic9bc4a89f8373e4dc1060067a41468fb626e5fa1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/394160
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Declare
This solves several issues caused by the lack of ordering guarantees in
C++; it was possible for the SkSL backend to look for the value of a
variable before its Declare() call gets processed. Moving the initial
value out of Declare should fix this whole class of problems.
Change-Id: I428fe230f1c312a0128c1f00c2a36cb95f4590a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380358
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
In addition to the unsurprising changes to eliminate references to
src/, we also had to tighten up some C++17-isms as they are not
permitted in public headers.
Change-Id: Ie5005a33d7a135e69fb66beca5e7a5f960dbd453
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378496
Reviewed-by: Brian Osman <brianosman@google.com>
Rename factory function from createGLSLInstance() to makeProgramImpl()
Bug: b/180759848
Bug: skia:11358
Change-Id: I095bdf1f26db5a8192fa8ab59000db4a1d561d96
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/373738
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Previously, a manual codeAppend call was required to add a statement. We
now automatically invoke codeAppend when a statement is destroyed.
Change-Id: I09eaf230b1d58242c3ff6abb85e970ed5ed3bce2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371141
Auto-Submit: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
This also adds the relevant Start() / End() calls so that the DSL
is put into the correct state.
Change-Id: I844b0ab5dff06e3f7b0a69458bf4442a5da0f33e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364857
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>