diff options
author | egdaniel <egdaniel@google.com> | 2016-04-20 07:09:46 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-20 07:09:46 -0700 |
commit | 09aa1fce69b214714171db12c341aebd78dd29ea (patch) | |
tree | 2c57de3ceaa5ba5303278a3b04623df187ea97a6 /src/effects | |
parent | b0ec9836dbf7f2304a3a29289b818719ca0a39bd (diff) |
Refactor how we store and use samplers in Ganesh
The main goal of this refactorization is to allow Vulkan to use separate
sampler and texture objects in the shader and descriptor sets and combine
them into a sampler2d in the shader where needed.
A large part of this is separating how we store samplers and uniforms in the
UniformHandler. We no longer need to store handles to samplers besides when
we are initially emitting code. After we emit code all we ever do is loop over
all samplers and do some processor independent work on them, so we have no need
for direct access to individual samplers.
In the GLProgram all we ever do is set the sampler uniforms in the ctor and never
touch them again, so no need to save sampler info there. The texture access on
program reuse just assume that they come in the same order as we set the texture
units for the samplers
For Vulkan, it is a similar story. We create the descriptor set layouts with the samplers,
then when we get new textures, we just assume they come in in the same order as we
set the samplers on the descriptor sets. Thus no need to save direct vulkan info.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1885863004
Committed: https://skia.googlesource.com/skia/+/45b61a1c4c0be896e7b12fd1405abfece799114f
Review URL: https://codereview.chromium.org/1885863004
Diffstat (limited to 'src/effects')
-rw-r--r-- | src/effects/SkBlurMaskFilter.cpp | 2 | ||||
-rw-r--r-- | src/effects/gradients/SkGradientShader.cpp | 2 | ||||
-rw-r--r-- | src/effects/gradients/SkGradientShaderPriv.h | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp index a1acf659ba..2afb42f0fa 100644 --- a/src/effects/SkBlurMaskFilter.cpp +++ b/src/effects/SkBlurMaskFilter.cpp @@ -691,7 +691,7 @@ private: }; void OutputRectBlurProfileLookup(GrGLSLFPFragmentBuilder* fragBuilder, - const GrGLSLSampler& sampler, + GrGLSLFragmentProcessor::SamplerHandle sampler, const char *output, const char *profileSize, const char *loc, const char *blurred_width, diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp index 779756f3ba..fdb6e59e1c 100644 --- a/src/effects/gradients/SkGradientShader.cpp +++ b/src/effects/gradients/SkGradientShader.cpp @@ -1027,7 +1027,7 @@ void GrGLGradientEffect::emitColor(GrGLSLFPFragmentBuilder* fragBuilder, const char* gradientTValue, const char* outputColor, const char* inputColor, - const SamplerArray& texSamplers) { + const SamplerHandle* texSamplers) { if (SkGradientShaderBase::kTwo_GpuColorType == ge.getColorType()){ fragBuilder->codeAppendf("\tvec4 colorTemp = mix(%s, %s, clamp(%s, 0.0, 1.0));\n", uniformHandler->getUniformVariable(fColorStartUni).c_str(), diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h index 0677cf0fd3..0280fcac8c 100644 --- a/src/effects/gradients/SkGradientShaderPriv.h +++ b/src/effects/gradients/SkGradientShaderPriv.h @@ -423,7 +423,7 @@ protected: const char* gradientTValue, const char* outputColor, const char* inputColor, - const SamplerArray& texSamplers); + const SamplerHandle* texSamplers); private: enum { |