[core] add getResource template to gfx::*Resource classes

This commit is contained in:
Konstantin Käfer
2019-04-02 22:47:24 +02:00
parent c02010ab6c
commit ebd8508032
20 changed files with 117 additions and 74 deletions

View File

@@ -259,7 +259,7 @@ void ImageManager::upload(gfx::Context& context) {
gfx::TextureBinding ImageManager::textureBinding(gfx::Context& context) {
upload(context);
return { *atlasTexture->resource, gfx::TextureFilterType::Linear };
return { atlasTexture->getResource(), gfx::TextureFilterType::Linear };
}
} // namespace mbgl

View File

@@ -162,7 +162,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource*
patternPosA,
patternPosB,
FillExtrusionPatternProgram::TextureBindings{
textures::image::Value{ *geometryTile.iconAtlasTexture->resource, gfx::TextureFilterType::Linear },
textures::image::Value{ geometryTile.iconAtlasTexture->getResource(), gfx::TextureFilterType::Linear },
}
);
}
@@ -209,7 +209,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource*
allUniformValues,
allAttributeBindings,
ExtrusionTextureProgram::TextureBindings{
textures::image::Value{ *renderTexture->getTexture().resource },
textures::image::Value{ renderTexture->getTexture().getResource() },
},
getID());
}

View File

@@ -215,7 +215,7 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) {
*bucket.triangleIndexBuffer,
bucket.triangleSegments,
FillPatternProgram::TextureBindings{
textures::image::Value{ *geometryTile.iconAtlasTexture->resource, gfx::TextureFilterType::Linear },
textures::image::Value{ geometryTile.iconAtlasTexture->getResource(), gfx::TextureFilterType::Linear },
});
if (evaluated.get<FillAntialias>() && unevaluated.get<FillOutlineColor>().isUndefined()) {
@@ -225,7 +225,7 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) {
*bucket.lineIndexBuffer,
bucket.lineSegments,
FillOutlinePatternProgram::TextureBindings{
textures::image::Value{ *geometryTile.iconAtlasTexture->resource, gfx::TextureFilterType::Linear },
textures::image::Value{ geometryTile.iconAtlasTexture->getResource(), gfx::TextureFilterType::Linear },
});
}
}

View File

@@ -177,8 +177,8 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) {
allUniformValues,
allAttributeBindings,
HeatmapTextureProgram::TextureBindings{
textures::image::Value{ *renderTexture->getTexture().resource, gfx::TextureFilterType::Linear },
textures::color_ramp::Value{ *colorRampTexture->resource, gfx::TextureFilterType::Linear },
textures::image::Value{ renderTexture->getTexture().getResource(), gfx::TextureFilterType::Linear },
textures::color_ramp::Value{ colorRampTexture->getResource(), gfx::TextureFilterType::Linear },
},
getID()
);

View File

@@ -169,7 +169,7 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource* src
allUniformValues,
allAttributeBindings,
HillshadePrepareProgram::TextureBindings{
textures::image::Value{ *bucket.dem->resource },
textures::image::Value{ bucket.dem->getResource() },
},
getID()
);
@@ -186,7 +186,7 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource* src
bucket.segments,
tile.id,
HillshadeProgram::TextureBindings{
textures::image::Value{ *bucket.texture->resource, gfx::TextureFilterType::Linear },
textures::image::Value{ bucket.texture->getResource(), gfx::TextureFilterType::Linear },
});
} else {
// Draw the full tile.
@@ -196,7 +196,7 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource* src
parameters.staticData.rasterSegments,
tile.id,
HillshadeProgram::TextureBindings{
textures::image::Value{ *bucket.texture->resource, gfx::TextureFilterType::Linear },
textures::image::Value{ bucket.texture->getResource(), gfx::TextureFilterType::Linear },
});
}
}

View File

@@ -143,7 +143,7 @@ void RenderLineLayer::render(PaintParameters& parameters, RenderSource*) {
posA,
posB,
LinePatternProgram::TextureBindings{
textures::image::Value{ *geometryTile.iconAtlasTexture->resource, gfx::TextureFilterType::Linear },
textures::image::Value{ geometryTile.iconAtlasTexture->getResource(), gfx::TextureFilterType::Linear },
});
} else if (!unevaluated.get<LineGradient>().getValue().isUndefined()) {
if (!colorRampTexture) {
@@ -159,7 +159,7 @@ void RenderLineLayer::render(PaintParameters& parameters, RenderSource*) {
{},
{},
LineGradientProgram::TextureBindings{
textures::image::Value{ *colorRampTexture->resource, gfx::TextureFilterType::Linear },
textures::image::Value{ colorRampTexture->getResource(), gfx::TextureFilterType::Linear },
});
} else {
draw(parameters.programs.getLineLayerPrograms().line,

View File

@@ -137,8 +137,8 @@ void RenderRasterLayer::render(PaintParameters& parameters, RenderSource* source
*bucket.indexBuffer,
bucket.segments,
RasterProgram::TextureBindings{
textures::image0::Value{ *bucket.texture->resource, filter },
textures::image1::Value{ *bucket.texture->resource, filter },
textures::image0::Value{ bucket.texture->getResource(), filter },
textures::image1::Value{ bucket.texture->getResource(), filter },
});
}
}
@@ -161,8 +161,8 @@ void RenderRasterLayer::render(PaintParameters& parameters, RenderSource* source
*bucket.indexBuffer,
bucket.segments,
RasterProgram::TextureBindings{
textures::image0::Value{ *bucket.texture->resource, filter },
textures::image1::Value{ *bucket.texture->resource, filter },
textures::image0::Value{ bucket.texture->getResource(), filter },
textures::image1::Value{ bucket.texture->getResource(), filter },
});
} else {
// Draw the full tile.
@@ -171,8 +171,8 @@ void RenderRasterLayer::render(PaintParameters& parameters, RenderSource* source
parameters.staticData.quadTriangleIndexBuffer,
parameters.staticData.rasterSegments,
RasterProgram::TextureBindings{
textures::image0::Value{ *bucket.texture->resource, filter },
textures::image1::Value{ *bucket.texture->resource, filter },
textures::image0::Value{ bucket.texture->getResource(), filter },
textures::image1::Value{ bucket.texture->getResource(), filter },
});
}
}

View File

@@ -171,7 +171,7 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) {
const bool iconScaled = layout.get<IconSize>().constantOr(1.0) != 1.0 || bucket.iconsNeedLinear;
const bool iconTransformed = values.rotationAlignment == AlignmentType::Map || parameters.state.getPitch() != 0;
const gfx::TextureBinding textureBinding{ *geometryTile.iconAtlasTexture->resource,
const gfx::TextureBinding textureBinding{ geometryTile.iconAtlasTexture->getResource(),
bucket.sdfIcons ||
parameters.state.isChanging() ||
iconScaled || iconTransformed
@@ -221,7 +221,7 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) {
}
if (bucket.hasTextData()) {
const gfx::TextureBinding textureBinding{ *geometryTile.glyphAtlasTexture->resource,
const gfx::TextureBinding textureBinding{ geometryTile.glyphAtlasTexture->getResource(),
gfx::TextureFilterType::Linear };
auto values = textPropertyValues(evaluated_, layout);