本文整理汇总了C++中GrPrimitiveProcessor::getGLSLProcessorKey方法的典型用法代码示例。如果您正苦于以下问题:C++ GrPrimitiveProcessor::getGLSLProcessorKey方法的具体用法?C++ GrPrimitiveProcessor::getGLSLProcessorKey怎么用?C++ GrPrimitiveProcessor::getGLSLProcessorKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrPrimitiveProcessor
的用法示例。
在下文中一共展示了GrPrimitiveProcessor::getGLSLProcessorKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Build
bool GrVkProgramDescBuilder::Build(GrProgramDesc* desc,
const GrPrimitiveProcessor& primProc,
const GrPipeline& pipeline,
const GrGLSLCaps& glslCaps) {
// The descriptor is used as a cache key. Thus when a field of the
// descriptor will not affect program generation (because of the attribute
// bindings in use or other descriptor field settings) it should be set
// to a canonical value to avoid duplicate programs with different keys.
GrVkProgramDesc* vkDesc = (GrVkProgramDesc*)desc;
GR_STATIC_ASSERT(0 == kProcessorKeysOffset % sizeof(uint32_t));
// Make room for everything up to the effect keys.
vkDesc->key().reset();
vkDesc->key().push_back_n(kProcessorKeysOffset);
GrProcessorKeyBuilder b(&vkDesc->key());
primProc.getGLSLProcessorKey(glslCaps, &b);
if (!gen_meta_key(primProc, glslCaps, 0, &b)) {
vkDesc->key().reset();
return false;
}
GrProcessor::RequiredFeatures requiredFeatures = primProc.requiredFeatures();
for (int i = 0; i < pipeline.numFragmentProcessors(); ++i) {
const GrFragmentProcessor& fp = pipeline.getFragmentProcessor(i);
if (!gen_frag_proc_and_meta_keys(primProc, fp, glslCaps, &b)) {
vkDesc->key().reset();
return false;
}
requiredFeatures |= fp.requiredFeatures();
}
const GrXferProcessor& xp = pipeline.getXferProcessor();
xp.getGLSLProcessorKey(glslCaps, &b);
if (!gen_meta_key(xp, glslCaps, 0, &b)) {
vkDesc->key().reset();
return false;
}
requiredFeatures |= xp.requiredFeatures();
// --------DO NOT MOVE HEADER ABOVE THIS LINE--------------------------------------------------
// Because header is a pointer into the dynamic array, we can't push any new data into the key
// below here.
KeyHeader* header = vkDesc->atOffset<KeyHeader, kHeaderOffset>();
// make sure any padding in the header is zeroed.
memset(header, 0, kHeaderSize);
GrRenderTarget* rt = pipeline.getRenderTarget();
if (requiredFeatures & (GrProcessor::kFragmentPosition_RequiredFeature |
GrProcessor::kSampleLocations_RequiredFeature)) {
header->fSurfaceOriginKey = GrGLSLFragmentShaderBuilder::KeyForSurfaceOrigin(rt->origin());
} else {
header->fSurfaceOriginKey = 0;
}
if (requiredFeatures & GrProcessor::kSampleLocations_RequiredFeature) {
SkASSERT(pipeline.isHWAntialiasState());
header->fSamplePatternKey =
rt->renderTargetPriv().getMultisampleSpecs(pipeline.getStencil()).fUniqueID;
} else {
header->fSamplePatternKey = 0;
}
header->fOutputSwizzle = glslCaps.configOutputSwizzle(rt->config()).asKey();
if (pipeline.ignoresCoverage()) {
header->fIgnoresCoverage = 1;
} else {
header->fIgnoresCoverage = 0;
}
header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters();
header->fColorEffectCnt = pipeline.numColorFragmentProcessors();
header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors();
vkDesc->finalize();
return true;
}
示例2: Build
bool GrGLProgramDescBuilder::Build(GrProgramDesc* desc,
const GrPrimitiveProcessor& primProc,
const GrPipeline& pipeline,
const GrGLGpu* gpu) {
// The descriptor is used as a cache key. Thus when a field of the
// descriptor will not affect program generation (because of the attribute
// bindings in use or other descriptor field settings) it should be set
// to a canonical value to avoid duplicate programs with different keys.
GrGLProgramDesc* glDesc = (GrGLProgramDesc*) desc;
GR_STATIC_ASSERT(0 == kProcessorKeysOffset % sizeof(uint32_t));
// Make room for everything up to the effect keys.
glDesc->key().reset();
glDesc->key().push_back_n(kProcessorKeysOffset);
GrProcessorKeyBuilder b(&glDesc->key());
primProc.getGLSLProcessorKey(*gpu->glCaps().glslCaps(), &b);
//**** use glslCaps here?
if (!gen_meta_key(primProc, gpu->glCaps(), 0, &b)) {
glDesc->key().reset();
return false;
}
for (int i = 0; i < pipeline.numFragmentProcessors(); ++i) {
const GrFragmentProcessor& fp = pipeline.getFragmentProcessor(i);
if (!gen_frag_proc_and_meta_keys(primProc, fp, gpu->glCaps(), &b)) {
glDesc->key().reset();
return false;
}
}
const GrXferProcessor& xp = *pipeline.getXferProcessor();
xp.getGLSLProcessorKey(*gpu->glCaps().glslCaps(), &b);
//**** use glslCaps here?
if (!gen_meta_key(xp, gpu->glCaps(), 0, &b)) {
glDesc->key().reset();
return false;
}
// --------DO NOT MOVE HEADER ABOVE THIS LINE--------------------------------------------------
// Because header is a pointer into the dynamic array, we can't push any new data into the key
// below here.
KeyHeader* header = glDesc->atOffset<KeyHeader, kHeaderOffset>();
// make sure any padding in the header is zeroed.
memset(header, 0, kHeaderSize);
if (pipeline.readsFragPosition()) {
header->fFragPosKey =
GrGLSLFragmentShaderBuilder::KeyForFragmentPosition(pipeline.getRenderTarget());
} else {
header->fFragPosKey = 0;
}
header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters();
header->fColorEffectCnt = pipeline.numColorFragmentProcessors();
header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors();
glDesc->finalize();
return true;
}