本文整理匯總了C++中GR_STATIC_ASSERT函數的典型用法代碼示例。如果您正苦於以下問題:C++ GR_STATIC_ASSERT函數的具體用法?C++ GR_STATIC_ASSERT怎麽用?C++ GR_STATIC_ASSERT使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GR_STATIC_ASSERT函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: sample_offset_array_name
static const char* sample_offset_array_name(GrGLSLFPFragmentBuilder::Coordinates coords) {
static const char* kArrayNames[] = {
"deviceSpaceSampleOffsets",
"windowSpaceSampleOffsets"
};
return kArrayNames[coords];
GR_STATIC_ASSERT(0 == GrGLSLFPFragmentBuilder::kSkiaDevice_Coordinates);
GR_STATIC_ASSERT(1 == GrGLSLFPFragmentBuilder::kGLSLWindow_Coordinates);
GR_STATIC_ASSERT(SK_ARRAY_COUNT(kArrayNames) == GrGLSLFPFragmentBuilder::kLast_Coordinates + 1);
}
示例2: tile_to_vk_sampler_address
static inline VkSamplerAddressMode tile_to_vk_sampler_address(SkShader::TileMode tm) {
static const VkSamplerAddressMode gWrapModes[] = {
VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,
VK_SAMPLER_ADDRESS_MODE_REPEAT,
VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT
};
GR_STATIC_ASSERT(SkShader::kTileModeCount == SK_ARRAY_COUNT(gWrapModes));
GR_STATIC_ASSERT(0 == SkShader::kClamp_TileMode);
GR_STATIC_ASSERT(1 == SkShader::kRepeat_TileMode);
GR_STATIC_ASSERT(2 == SkShader::kMirror_TileMode);
return gWrapModes[tm];
}
示例3: GR_STATIC_ASSERT
GrPathRenderer* GrPathRendererChain::getPathRenderer(const GrDrawTarget* target,
const GrPipelineBuilder* pipelineBuilder,
const SkMatrix& viewMatrix,
const SkPath& path,
const GrStrokeInfo& stroke,
DrawType drawType,
StencilSupport* stencilSupport) {
if (!fInit) {
this->init();
}
bool antiAlias = (kColorAntiAlias_DrawType == drawType ||
kStencilAndColorAntiAlias_DrawType == drawType);
GR_STATIC_ASSERT(GrPathRenderer::kNoSupport_StencilSupport <
GrPathRenderer::kStencilOnly_StencilSupport);
GR_STATIC_ASSERT(GrPathRenderer::kStencilOnly_StencilSupport <
GrPathRenderer::kNoRestriction_StencilSupport);
GrPathRenderer::StencilSupport minStencilSupport;
if (kStencilOnly_DrawType == drawType) {
minStencilSupport = GrPathRenderer::kStencilOnly_StencilSupport;
} else if (kStencilAndColor_DrawType == drawType ||
kStencilAndColorAntiAlias_DrawType == drawType) {
minStencilSupport = GrPathRenderer::kNoRestriction_StencilSupport;
} else {
minStencilSupport = GrPathRenderer::kNoSupport_StencilSupport;
}
for (int i = 0; i < fChain.count(); ++i) {
GrPathRenderer::CanDrawPathArgs args;
args.fShaderCaps = target->caps()->shaderCaps();
args.fPipelineBuilder = pipelineBuilder;
args.fViewMatrix = &viewMatrix;
args.fPath = &path;
args.fStroke = &stroke;
args.fAntiAlias = antiAlias;
if (fChain[i]->canDrawPath(args)) {
if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport) {
GrPathRenderer::StencilSupport support =
fChain[i]->getStencilSupport(path, stroke);
if (support < minStencilSupport) {
continue;
} else if (stencilSupport) {
*stencilSupport = support;
}
}
return fChain[i];
}
}
return NULL;
}
示例4: draw_face_to_vk_cull_mode
VkCullModeFlags draw_face_to_vk_cull_mode(GrPipelineBuilder::DrawFace drawFace) {
// Assumes that we've set the front face to be ccw
static const VkCullModeFlags gTable[] = {
VK_CULL_MODE_NONE, // kBoth_DrawFace
VK_CULL_MODE_BACK_BIT, // kCCW_DrawFace, cull back face
VK_CULL_MODE_FRONT_BIT, // kCW_DrawFace, cull front face
};
GR_STATIC_ASSERT(0 == GrPipelineBuilder::kBoth_DrawFace);
GR_STATIC_ASSERT(1 == GrPipelineBuilder::kCCW_DrawFace);
GR_STATIC_ASSERT(2 == GrPipelineBuilder::kCW_DrawFace);
SkASSERT((unsigned)drawFace <= 2);
return gTable[drawFace];
}
示例5: path_key_from_data_size
// If the path is small enough to be keyed from its data this returns key length, otherwise -1.
static int path_key_from_data_size(const SkPath& path) {
const int verbCnt = path.countVerbs();
if (verbCnt > GrShape::kMaxKeyFromDataVerbCnt) {
return -1;
}
const int pointCnt = path.countPoints();
const int conicWeightCnt = SkPathPriv::ConicWeightCnt(path);
GR_STATIC_ASSERT(sizeof(SkPoint) == 2 * sizeof(uint32_t));
GR_STATIC_ASSERT(sizeof(SkScalar) == sizeof(uint32_t));
// 2 is for the verb cnt and a fill type. Each verb is a byte but we'll pad the verb data out to
// a uint32_t length.
return 2 + (SkAlign4(verbCnt) >> 2) + 2 * pointCnt + conicWeightCnt;
}
示例6: blend_equation_to_vk_blend_op
static VkBlendOp blend_equation_to_vk_blend_op(GrBlendEquation equation) {
static const VkBlendOp gTable[] = {
VK_BLEND_OP_ADD, // kAdd_GrBlendEquation
VK_BLEND_OP_SUBTRACT, // kSubtract_GrBlendEquation
VK_BLEND_OP_REVERSE_SUBTRACT, // kReverseSubtract_GrBlendEquation
};
GR_STATIC_ASSERT(SK_ARRAY_COUNT(gTable) == kFirstAdvancedGrBlendEquation);
GR_STATIC_ASSERT(0 == kAdd_GrBlendEquation);
GR_STATIC_ASSERT(1 == kSubtract_GrBlendEquation);
GR_STATIC_ASSERT(2 == kReverseSubtract_GrBlendEquation);
SkASSERT((unsigned)equation < kGrBlendCoeffCnt);
return gTable[equation];
}
示例7: GrPrintf
void GrGLCaps::print() const {
INHERITED::print();
GrPrintf("--- GL-Specific ---\n");
for (int i = 0; i < fStencilFormats.count(); ++i) {
GrPrintf("Stencil Format %d, stencil bits: %02d, total bits: %02d\n",
i,
fStencilFormats[i].fStencilBits,
fStencilFormats[i].fTotalBits);
}
GR_STATIC_ASSERT(0 == kNone_MSFBOType);
GR_STATIC_ASSERT(1 == kDesktopARB_MSFBOType);
GR_STATIC_ASSERT(2 == kDesktopEXT_MSFBOType);
GR_STATIC_ASSERT(3 == kAppleES_MSFBOType);
GR_STATIC_ASSERT(4 == kImaginationES_MSFBOType);
static const char* gMSFBOExtStr[] = {
"None",
"ARB",
"EXT",
"Apple",
"IMG",
};
GrPrintf("MSAA Type: %s\n", gMSFBOExtStr[fMSFBOType]);
GrPrintf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors);
GrPrintf("Max Vertex Attributes: %d\n", fMaxVertexAttributes);
GrPrintf("Support RGBA8 Render Buffer: %s\n", (fRGBA8RenderbufferSupport ? "YES": "NO"));
GrPrintf("BGRA support: %s\n", (fBGRAFormatSupport ? "YES": "NO"));
GrPrintf("BGRA is an internal format: %s\n", (fBGRAIsInternalFormat ? "YES": "NO"));
GrPrintf("Support texture swizzle: %s\n", (fTextureSwizzleSupport ? "YES": "NO"));
GrPrintf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES": "NO"));
GrPrintf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO"));
GrPrintf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": "NO"));
GrPrintf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO"));
GrPrintf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO"));
GrPrintf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO"));
GrPrintf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO"));
GrPrintf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO"));
GrPrintf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO"));
GrPrintf("Fragment coord conventions support: %s\n",
(fFragCoordsConventionSupport ? "YES": "NO"));
GrPrintf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO"));
GrPrintf("Use non-VBO for dynamic data: %s\n",
(fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO"));
GrPrintf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO"));
GrPrintf("Discard FrameBuffer support: %s\n", (fDiscardFBSupport ? "YES" : "NO"));
}
示例8: setup_quad_index_buffer
static uint32_t setup_quad_index_buffer(const GrGLInterface* gl) {
static const int kMaxQuads = 1;//1 << 12; // max possible: (1 << 14) - 1;
GR_STATIC_ASSERT(4 * kMaxQuads <= 65535);
static const uint16_t kPattern[] = { 0, 1, 2, 0, 2, 3 };
static const int kPatternSize = 6;
static const int kVertCount = 4;
static const int kIndicesCount = kPatternSize * kMaxQuads;
int size = kPatternSize * kMaxQuads * sizeof(uint16_t);
uint16_t* data = SkNEW_ARRAY(uint16_t, kMaxQuads * kPatternSize);
for (int i = 0; i < kMaxQuads; ++i) {
int baseIdx = i * kPatternSize;
uint16_t baseVert = (uint16_t)(i * kVertCount);
for (int j = 0; j < kPatternSize; ++j) {
data[baseIdx+j] = baseVert + kPattern[j];
}
}
GrGLuint quadIBO;
GR_GL_CALL(gl, GenBuffers(1, &quadIBO));
GR_GL_CALL(gl, BindBuffer(GR_GL_ELEMENT_ARRAY_BUFFER, quadIBO));
GR_GL_CALL(gl, BufferData(GR_GL_ELEMENT_ARRAY_BUFFER, size, data, GR_GL_STATIC_DRAW));
SkDELETE_ARRAY(data);
return kIndicesCount;
}
示例9: buffer_type_to_heap
static GrVkGpu::Heap buffer_type_to_heap(GrVkBuffer::Type type) {
const GrVkGpu::Heap kBufferToHeap[] {
GrVkGpu::kVertexBuffer_Heap,
GrVkGpu::kIndexBuffer_Heap,
GrVkGpu::kUniformBuffer_Heap,
GrVkGpu::kCopyReadBuffer_Heap,
GrVkGpu::kCopyWriteBuffer_Heap,
};
GR_STATIC_ASSERT(0 == GrVkBuffer::kVertex_Type);
GR_STATIC_ASSERT(1 == GrVkBuffer::kIndex_Type);
GR_STATIC_ASSERT(2 == GrVkBuffer::kUniform_Type);
GR_STATIC_ASSERT(3 == GrVkBuffer::kCopyRead_Type);
GR_STATIC_ASSERT(4 == GrVkBuffer::kCopyWrite_Type);
return kBufferToHeap[type];
}
示例10: get_blend_info_key
uint32_t get_blend_info_key(const GrPipeline& pipeline) {
GrXferProcessor::BlendInfo blendInfo;
pipeline.getXferProcessor().getBlendInfo(&blendInfo);
static const uint32_t kBlendWriteShift = 1;
static const uint32_t kBlendCoeffShift = 5;
GR_STATIC_ASSERT(kLast_GrBlendCoeff < (1 << kBlendCoeffShift));
GR_STATIC_ASSERT(kFirstAdvancedGrBlendEquation - 1 < 4);
uint32_t key = blendInfo.fWriteColor;
key |= (blendInfo.fSrcBlend << kBlendWriteShift);
key |= (blendInfo.fDstBlend << (kBlendWriteShift + kBlendCoeffShift));
key |= (blendInfo.fEquation << (kBlendWriteShift + 2 * kBlendCoeffShift));
return key;
}
示例11: GR_STATIC_ASSERT
void GrGLConvexPolyEffect::GenKey(const GrProcessor& processor, const GrGLSLCaps&,
GrProcessorKeyBuilder* b) {
const GrConvexPolyEffect& cpe = processor.cast<GrConvexPolyEffect>();
GR_STATIC_ASSERT(kGrProcessorEdgeTypeCnt <= 8);
uint32_t key = (cpe.getEdgeCount() << 3) | cpe.getEdgeType();
b->add32(key);
}
示例12: blend_coeff_refs_constant
bool blend_coeff_refs_constant(GrBlendCoeff coeff) {
static const bool gCoeffReferencesBlendConst[] = {
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
true,
true,
true,
true,
// extended blend coeffs
false,
false,
false,
false,
};
return gCoeffReferencesBlendConst[coeff];
GR_STATIC_ASSERT(kGrBlendCoeffCnt == SK_ARRAY_COUNT(gCoeffReferencesBlendConst));
// Individual enum asserts already made in blend_coeff_to_vk_blend
}
示例13: GR_STATIC_ASSERT
const GrIndexBuffer* GrResourceProvider::createQuadIndexBuffer() {
static const int kMaxQuads = 1 << 12; // max possible: (1 << 14) - 1;
GR_STATIC_ASSERT(4 * kMaxQuads <= 65535);
static const uint16_t kPattern[] = { 0, 1, 2, 0, 2, 3 };
return this->createInstancedIndexBuffer(kPattern, 6, kMaxQuads, 4, fQuadIndexBufferKey);
}
示例14: GR_STATIC_ASSERT
GrResourceKey GrTexture::ComputeScratchKey(const GrTextureDesc& desc) {
GrCacheID::Key idKey;
// Instead of a client-provided key of the texture contents we create a key from the
// descriptor.
GR_STATIC_ASSERT(sizeof(idKey) >= 16);
GrAssert(desc.fHeight < (1 << 16));
GrAssert(desc.fWidth < (1 << 16));
idKey.fData32[0] = (desc.fWidth) | (desc.fHeight << 16);
idKey.fData32[1] = desc.fConfig | desc.fSampleCnt << 16;
idKey.fData32[2] = desc.fFlags;
idKey.fData32[3] = resolve_origin(desc); // Only needs 2 bits actually
static const int kPadSize = sizeof(idKey) - 16;
GR_STATIC_ASSERT(kPadSize >= 0);
memset(idKey.fData8 + 16, 0, kPadSize);
GrCacheID cacheID(GrResourceKey::ScratchDomain(), idKey);
return GrResourceKey(cacheID, texture_resource_type(), 0);
}
示例15: SkASSERT
void GrLayerCache::initAtlas() {
SkASSERT(NULL == fAtlas.get());
GR_STATIC_ASSERT(kNumPlotsX*kNumPlotsX == GrPictureInfo::kNumPlots);
SkISize textureSize = SkISize::Make(kAtlasTextureWidth, kAtlasTextureHeight);
fAtlas.reset(SkNEW_ARGS(GrAtlas, (fContext->getGpu(), kSkia8888_GrPixelConfig,
kRenderTarget_GrSurfaceFlag,
textureSize, kNumPlotsX, kNumPlotsY, false)));
}