本文整理汇总了C++中GrGLGpu::glContext方法的典型用法代码示例。如果您正苦于以下问题:C++ GrGLGpu::glContext方法的具体用法?C++ GrGLGpu::glContext怎么用?C++ GrGLGpu::glContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrGLGpu
的用法示例。
在下文中一共展示了GrGLGpu::glContext方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: completeStencilAttachment
bool GrGLRenderTarget::completeStencilAttachment() {
GrGLGpu* gpu = this->getGLGpu();
const GrGLInterface* interface = gpu->glInterface();
GrStencilAttachment* stencil = this->renderTargetPriv().getStencilAttachment();
if (nullptr == stencil) {
GR_GL_CALL(interface, FramebufferRenderbuffer(GR_GL_FRAMEBUFFER,
GR_GL_STENCIL_ATTACHMENT,
GR_GL_RENDERBUFFER, 0));
GR_GL_CALL(interface, FramebufferRenderbuffer(GR_GL_FRAMEBUFFER,
GR_GL_DEPTH_ATTACHMENT,
GR_GL_RENDERBUFFER, 0));
#ifdef SK_DEBUG
if (kChromium_GrGLDriver != gpu->glContext().driver()) {
// This check can cause problems in Chromium if the context has been asynchronously
// abandoned (see skbug.com/5200)
GrGLenum status;
GR_GL_CALL_RET(interface, status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER));
SkASSERT(GR_GL_FRAMEBUFFER_COMPLETE == status);
}
#endif
return true;
} else {
const GrGLStencilAttachment* glStencil = static_cast<const GrGLStencilAttachment*>(stencil);
GrGLuint rb = glStencil->renderbufferID();
gpu->invalidateBoundRenderTarget();
gpu->stats()->incRenderTargetBinds();
GR_GL_CALL(interface, BindFramebuffer(GR_GL_FRAMEBUFFER, this->renderFBOID()));
GR_GL_CALL(interface, FramebufferRenderbuffer(GR_GL_FRAMEBUFFER,
GR_GL_STENCIL_ATTACHMENT,
GR_GL_RENDERBUFFER, rb));
if (glStencil->format().fPacked) {
GR_GL_CALL(interface, FramebufferRenderbuffer(GR_GL_FRAMEBUFFER,
GR_GL_DEPTH_ATTACHMENT,
GR_GL_RENDERBUFFER, rb));
} else {
GR_GL_CALL(interface, FramebufferRenderbuffer(GR_GL_FRAMEBUFFER,
GR_GL_DEPTH_ATTACHMENT,
GR_GL_RENDERBUFFER, 0));
}
#ifdef SK_DEBUG
if (kChromium_GrGLDriver != gpu->glContext().driver()) {
// This check can cause problems in Chromium if the context has been asynchronously
// abandoned (see skbug.com/5200)
GrGLenum status;
GR_GL_CALL_RET(interface, status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER));
SkASSERT(GR_GL_FRAMEBUFFER_COMPLETE == status);
}
#endif
return true;
}
}
示例2: compileAndAttachShaders
bool GrGLProgramBuilder::compileAndAttachShaders(const char* glsl,
int length,
GrGLuint programId,
GrGLenum type,
SkTDArray<GrGLuint>* shaderIds,
const SkSL::Program::Settings& settings,
const SkSL::Program::Inputs& inputs) {
GrGLGpu* gpu = this->gpu();
GrGLuint shaderId = GrGLCompileAndAttachShader(gpu->glContext(),
programId,
type,
glsl,
length,
gpu->stats(),
settings);
if (!shaderId) {
return false;
}
*shaderIds->append() = shaderId;
if (inputs.fFlipY) {
GrProgramDesc* d = this->desc();
d->setSurfaceOriginKey(GrGLSLFragmentShaderBuilder::KeyForSurfaceOrigin(
this->pipeline().proxy()->origin()));
d->finalize();
}
return true;
}
示例3: compileAndAttachShaders
bool GrGLFragmentShaderBuilder::compileAndAttachShaders(GrGLuint programId,
SkTDArray<GrGLuint>* shaderIds) const {
GrGLGpu* gpu = fProgramBuilder->gpu();
SkString fragShaderSrc(GrGetGLSLVersionDecl(gpu->ctxInfo()));
fragShaderSrc.append(fExtensions);
append_default_precision_qualifier(kDefault_GrSLPrecision,
gpu->glStandard(),
&fragShaderSrc);
fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kFragment_Visibility, &fragShaderSrc);
this->appendDecls(fInputs, &fragShaderSrc);
// We shouldn't have declared outputs on 1.10
SkASSERT(k110_GrGLSLGeneration != gpu->glslGeneration() || fOutputs.empty());
this->appendDecls(fOutputs, &fragShaderSrc);
fragShaderSrc.append(fFunctions);
fragShaderSrc.append("void main() {\n");
fragShaderSrc.append(fCode);
fragShaderSrc.append("}\n");
GrGLuint fragShaderId = GrGLCompileAndAttachShader(gpu->glContext(), programId,
GR_GL_FRAGMENT_SHADER, fragShaderSrc,
gpu->gpuStats());
if (!fragShaderId) {
return false;
}
*shaderIds->append() = fragShaderId;
return true;
}
示例4: compileAndAttachShaders
bool GrGLProgramBuilder::compileAndAttachShaders(GrGLSLShaderBuilder& shader,
GrGLuint programId,
GrGLenum type,
SkTDArray<GrGLuint>* shaderIds) {
GrGLGpu* gpu = this->gpu();
GrGLuint shaderId = GrGLCompileAndAttachShader(gpu->glContext(),
programId,
type,
shader.fCompilerStrings.begin(),
shader.fCompilerStringLengths.begin(),
shader.fCompilerStrings.count(),
gpu->stats());
if (!shaderId) {
return false;
}
*shaderIds->append() = shaderId;
return true;
}
示例5: compileAndAttachShaders
bool GrGLVertexBuilder::compileAndAttachShaders(GrGLuint programId,
SkTDArray<GrGLuint>* shaderIds) const {
GrGLGpu* gpu = fProgramBuilder->gpu();
const GrGLContext& glCtx = gpu->glContext();
const GrGLContextInfo& ctxInfo = gpu->ctxInfo();
SkString vertShaderSrc(GrGetGLSLVersionDecl(ctxInfo));
fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kVertex_Visibility, &vertShaderSrc);
this->appendDecls(fInputs, &vertShaderSrc);
this->appendDecls(fOutputs, &vertShaderSrc);
vertShaderSrc.append("void main() {");
vertShaderSrc.append(fCode);
vertShaderSrc.append("}\n");
GrGLuint vertShaderId = GrGLCompileAndAttachShader(glCtx, programId,
GR_GL_VERTEX_SHADER, vertShaderSrc,
gpu->gpuStats());
if (!vertShaderId) {
return false;
}
*shaderIds->append() = vertShaderId;
return true;
}