PTAL. I'm not convinced that a common base class for morphology and convolution was a ...
12 years, 5 months ago
(2012-05-30 13:31:24 UTC)
#1
PTAL. I'm not convinced that a common base class for morphology and convolution
was a great idea.
http://codereview.appspot.com/6250073/diff/5003/include/gpu/GrContext.h
File include/gpu/GrContext.h (right):
http://codereview.appspot.com/6250073/diff/5003/include/gpu/GrContext.h#newco...
include/gpu/GrContext.h:622: enum MorphologyType {
I'm not crazy about this enum being here but I wanted to remove the Filter enum
values from SampleState (since we are on the path of shrinking sampler state to
nothing as all its configurability is pushed into custom effects).
Longer term we probably should invent a way for SkImageFilters that require
multiple passes etc to be able to interact with a gpu device / GrContext and
embody their own multi-pass logic rather than sticking it on GrContext.
On 2012/05/30 13:31:24, bsalomon wrote: > PTAL. I'm not convinced that a common base class ...
12 years, 5 months ago
(2012-05-30 14:21:12 UTC)
#2
On 2012/05/30 13:31:24, bsalomon wrote:
> PTAL. I'm not convinced that a common base class for morphology and
convolution
> was a great idea.
Have you considered either creating a helper class that they could contain, so
that we avoid inheritance-of-implementation, or just putting utility functions
in an anonymous namespace? I did the latter in a previous version of
http://codereview.appspot.com/6251050/, before merging normal + degenerate into
the same class, and it seemed pretty practical in that case.
Here the complexity of emitFS*() seems to outweigh the little bit of
redundancy-savings.
Also, just because we share a base class in GrGL1DKernelEffect doesn't mean we
need to share a base class in Gr1DKernelEffect, or vice-versa.
> http://codereview.appspot.com/6250073/diff/5003/include/gpu/GrContext.h
> File include/gpu/GrContext.h (right):
>
>
http://codereview.appspot.com/6250073/diff/5003/include/gpu/GrContext.h#newco...
> include/gpu/GrContext.h:622: enum MorphologyType {
> I'm not crazy about this enum being here but I wanted to remove the Filter
enum
> values from SampleState (since we are on the path of shrinking sampler state
to
> nothing as all its configurability is pushed into custom effects).
Agreed that we haven't yet found a good home for this.
> Longer term we probably should invent a way for SkImageFilters that require
> multiple passes etc to be able to interact with a gpu device / GrContext and
> embody their own multi-pass logic rather than sticking it on GrContext.
AFAIK we're muddling along without a good high-level model. I'm at least going
to throw up what we currently seem to be doing at the Skia tapas on this and let
people take potshots; maybe something will come out of that.
On 2012/05/30 13:31:24, bsalomon wrote: > PTAL. I'm not convinced that a common base class ...
12 years, 5 months ago
(2012-05-30 14:22:57 UTC)
#3
On 2012/05/30 13:31:24, bsalomon wrote:
> PTAL. I'm not convinced that a common base class for morphology and
convolution
> was a great idea.
Actually, I agree. The motivation for re-using their parameters originally was
due to the performance hit for adding new parameters to the state hashing
function. Now that that's no longer an issue, I think we should just split them
into two independent effects. Do you think you would mind trying that out to
see what it looks like?
http://codereview.appspot.com/6250073/diff/5003/include/gpu/GrContext.h
> File include/gpu/GrContext.h (right):
>
>
http://codereview.appspot.com/6250073/diff/5003/include/gpu/GrContext.h#newco...
> include/gpu/GrContext.h:622: enum MorphologyType {
> I'm not crazy about this enum being here but I wanted to remove the Filter
enum
> values from SampleState (since we are on the path of shrinking sampler state
to
> nothing as all its configurability is pushed into custom effects).
>
> Longer term we probably should invent a way for SkImageFilters that require
> multiple passes etc to be able to interact with a gpu device / GrContext and
> embody their own multi-pass logic rather than sticking it on GrContext.
BTW, the width limit of 25 was based on the max. number of texture samples ...
12 years, 5 months ago
(2012-05-30 14:31:33 UTC)
#4
BTW, the width limit of 25 was based on the max. number of texture samples in
DX9SM2 (32). (25 was chosen simply so that it falls on an integer sigma (((25 -
1) / 2 / 3) = 4). Of course, it was undocumented...) Having the limit based on
the full width makes some sense, since it has a link to the hardware limits.
http://codereview.appspot.com/6250073/diff/5003/src/gpu/GrContext.cpp
File src/gpu/GrContext.cpp (right):
http://codereview.appspot.com/6250073/diff/5003/src/gpu/GrContext.cpp#newcode...
src/gpu/GrContext.cpp:2150: convolve(fGpu, srcTexture, srcRect, kernelX,
halfWidthX,
I find it a little misleading to be passing the half width here, when the buffer
is actually the full kernel size. I kind of preferred it the old way, where the
buffer and size match.
I'll post an updated patch that removes the base classes. I think we all agree ...
12 years, 5 months ago
(2012-05-30 14:43:14 UTC)
#5
I'll post an updated patch that removes the base classes. I think we all agree
it was a net negative.
http://codereview.appspot.com/6250073/diff/5003/src/gpu/GrContext.cpp
File src/gpu/GrContext.cpp (right):
http://codereview.appspot.com/6250073/diff/5003/src/gpu/GrContext.cpp#newcode...
src/gpu/GrContext.cpp:2150: convolve(fGpu, srcTexture, srcRect, kernelX,
halfWidthX,
On 2012/05/30 14:31:33, Stephen White wrote:
> I find it a little misleading to be passing the half width here, when the
buffer
> is actually the full kernel size. I kind of preferred it the old way, where
the
> buffer and size match.
I was trying to make the convolution and morphology agree about how the width is
specified. I chose morphology's notion that the width is specified as the offset
from the center pixel because it can't be wrong (the full width can't
accidentally be an even number). I suppose if they don't share any
implementation it isn't so important but it seems like it'd be nice for them to
agree.
The latest patch set both rebaselines against Tom's recent change to how uniforms are setup ...
12 years, 5 months ago
(2012-05-30 21:21:08 UTC)
#6
The latest patch set both rebaselines against Tom's recent change to how
uniforms are setup (r4083) and removes the common base class for the GL-specific
implementation classes. I kept the common GrCustomStage subclass,
Gr1DKernelEffect, but I could be convinced to split that up as well. It's pretty
small. I did like that it allows the two subclasses to share a Direction enum
type.
On 2012/05/30 21:21:08, bsalomon wrote: > The latest patch set both rebaselines against Tom's recent ...
12 years, 5 months ago
(2012-05-31 15:31:37 UTC)
#8
On 2012/05/30 21:21:08, bsalomon wrote:
> The latest patch set both rebaselines against Tom's recent change to how
> uniforms are setup (r4083) and removes the common base class for the
GL-specific
> implementation classes. I kept the common GrCustomStage subclass,
> Gr1DKernelEffect, but I could be convinced to split that up as well. It's
pretty
> small. I did like that it allows the two subclasses to share a Direction enum
> type.
New patch rebaselines against recent changes and fixes some GrCustomEffect
leaks.
Changes LGTM, but see comment #7 for some issues. http://codereview.appspot.com/6250073/diff/2006/src/gpu/gl/GrGpuGL_program.cpp File src/gpu/gl/GrGpuGL_program.cpp (right): http://codereview.appspot.com/6250073/diff/2006/src/gpu/gl/GrGpuGL_program.cpp#newcode369 src/gpu/gl/GrGpuGL_program.cpp:369: ...
12 years, 5 months ago
(2012-05-31 15:35:04 UTC)
#9
http://codereview.appspot.com/6250073/diff/2006/gyp/gpu.gyp File gyp/gpu.gyp (right): http://codereview.appspot.com/6250073/diff/2006/gyp/gpu.gyp#newcode279 gyp/gpu.gyp:279: '../src/gpu/effects/GrConvolutionEffect.cpp', GrConvolutionEffect.cpp seems to be in here twice http://codereview.appspot.com/6250073/diff/2006/src/gpu/effects/Gr1DKernelEffect.h ...
12 years, 5 months ago
(2012-05-31 15:45:45 UTC)
#10
http://codereview.appspot.com/6250073/diff/11023/src/gpu/GrContext.cpp File src/gpu/GrContext.cpp (right): http://codereview.appspot.com/6250073/diff/11023/src/gpu/GrContext.cpp#newcode2123 src/gpu/GrContext.cpp:2123: int width = GrConvolutionEffect::WidthFromRadius(radiusX); This variable now seems to ...
12 years, 5 months ago
(2012-05-31 18:16:16 UTC)
#13
Issue 6250073: Implement morphology as a custom effect
(Closed)
Created 12 years, 5 months ago by bsalomon
Modified 12 years, 5 months ago
Reviewers: TomH, Stephen White
Base URL: http://skia.googlecode.com/svn/trunk/
Comments: 23