Reland "Add GrDisableColorXPFactory::makeXferProcessor()"
This is a reland of 11157ef97a
Original change's description:
> Add GrDisableColorXPFactory::makeXferProcessor()
>
> This allows us to access the actual XP for working directly with
> pipelines.
>
> Bug: skia:
> Change-Id: I71e7c2e9d69f464685e28b4f4a85847f0496b864
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208345
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
Bug: skia:
Change-Id: I185aeea1e5f7d95ff551163828508d622897061a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208683
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
cdd5914dc1
commit
fa971d6ceb
@ -19,36 +19,23 @@
|
||||
*/
|
||||
class DisableColorXP : public GrXferProcessor {
|
||||
public:
|
||||
DisableColorXP()
|
||||
: INHERITED(kDisableColorXP_ClassID) {}
|
||||
|
||||
const char* name() const override { return "Disable Color"; }
|
||||
|
||||
GrGLSLXferProcessor* createGLSLInstance() const override;
|
||||
DisableColorXP() : INHERITED(kDisableColorXP_ClassID) {}
|
||||
|
||||
private:
|
||||
|
||||
void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override;
|
||||
|
||||
void onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const override;
|
||||
|
||||
bool onIsEqual(const GrXferProcessor& xpBase) const override {
|
||||
return true;
|
||||
const char* name() const override { return "Disable Color"; }
|
||||
bool onIsEqual(const GrXferProcessor& xpBase) const override { return true; }
|
||||
void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override {
|
||||
return; // No key.
|
||||
}
|
||||
void onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const override {
|
||||
blendInfo->fWriteColor = false;
|
||||
}
|
||||
GrGLSLXferProcessor* createGLSLInstance() const override;
|
||||
|
||||
typedef GrXferProcessor INHERITED;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class GLDisableColorXP : public GrGLSLXferProcessor {
|
||||
public:
|
||||
GLDisableColorXP(const GrProcessor&) {}
|
||||
|
||||
~GLDisableColorXP() override {}
|
||||
|
||||
static void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*) {}
|
||||
|
||||
private:
|
||||
void emitOutputsForBlendState(const EmitArgs& args) override {
|
||||
if (args.fShaderCaps->mustWriteToFragColor()) {
|
||||
@ -72,26 +59,12 @@ private:
|
||||
typedef GrGLSLXferProcessor INHERITED;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void DisableColorXP::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
|
||||
GLDisableColorXP::GenKey(*this, caps, b);
|
||||
GrGLSLXferProcessor* DisableColorXP::createGLSLInstance() const {
|
||||
return new GLDisableColorXP();
|
||||
}
|
||||
|
||||
GrGLSLXferProcessor* DisableColorXP::createGLSLInstance() const { return new GLDisableColorXP(*this); }
|
||||
|
||||
void DisableColorXP::onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const {
|
||||
blendInfo->fWriteColor = false;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
sk_sp<const GrXferProcessor> GrDisableColorXPFactory::makeXferProcessor(
|
||||
const GrProcessorAnalysisColor&,
|
||||
GrProcessorAnalysisCoverage,
|
||||
bool hasMixedSamples,
|
||||
const GrCaps& caps,
|
||||
GrClampType clampType) const {
|
||||
return sk_sp<const GrXferProcessor>(new DisableColorXP);
|
||||
sk_sp<const GrXferProcessor> GrDisableColorXPFactory::MakeXferProcessor() {
|
||||
return sk_make_sp<DisableColorXP>();
|
||||
}
|
||||
|
||||
GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory);
|
||||
|
@ -23,24 +23,25 @@
|
||||
#endif
|
||||
class GrDisableColorXPFactory : public GrXPFactory {
|
||||
public:
|
||||
static const GrXPFactory* Get();
|
||||
static const GrDisableColorXPFactory* Get();
|
||||
|
||||
static sk_sp<const GrXferProcessor> MakeXferProcessor();
|
||||
|
||||
private:
|
||||
constexpr GrDisableColorXPFactory() {}
|
||||
|
||||
AnalysisProperties analysisProperties(const GrProcessorAnalysisColor&,
|
||||
const GrProcessorAnalysisCoverage&,
|
||||
const GrCaps&,
|
||||
GrClampType) const override {
|
||||
AnalysisProperties analysisProperties(
|
||||
const GrProcessorAnalysisColor&, const GrProcessorAnalysisCoverage&, const GrCaps&,
|
||||
GrClampType) const override {
|
||||
return AnalysisProperties::kCompatibleWithCoverageAsAlpha |
|
||||
AnalysisProperties::kIgnoresInputColor;
|
||||
}
|
||||
|
||||
sk_sp<const GrXferProcessor> makeXferProcessor(const GrProcessorAnalysisColor&,
|
||||
GrProcessorAnalysisCoverage,
|
||||
bool hasMixedSamples,
|
||||
const GrCaps&,
|
||||
GrClampType) const override;
|
||||
sk_sp<const GrXferProcessor> makeXferProcessor(
|
||||
const GrProcessorAnalysisColor&, GrProcessorAnalysisCoverage, bool hasMixedSamples,
|
||||
const GrCaps&, GrClampType) const override {
|
||||
return MakeXferProcessor();
|
||||
}
|
||||
|
||||
GR_DECLARE_XP_FACTORY_TEST
|
||||
|
||||
@ -53,7 +54,7 @@ private:
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
inline const GrXPFactory* GrDisableColorXPFactory::Get() {
|
||||
inline const GrDisableColorXPFactory* GrDisableColorXPFactory::Get() {
|
||||
// If this is constructed as static constexpr by cl.exe (2015 SP2) the vtable is null.
|
||||
#ifdef SK_BUILD_FOR_WIN
|
||||
static const GrDisableColorXPFactory gDisableColorXPFactory;
|
||||
|
Loading…
Reference in New Issue
Block a user