fix: 修复 V15 WeatherColor Metal 纹理生命周期
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include <mbgl/renderer/layers/render_weather_color_layer.hpp>
|
||||
#include <mbgl/renderer/layers/weather_color_texture_lifecycle.hpp>
|
||||
|
||||
#include <mbgl/gfx/color_mode.hpp>
|
||||
#include <mbgl/gfx/context.hpp>
|
||||
@@ -104,9 +105,6 @@ public:
|
||||
wrap(wrap_) {}
|
||||
void init(gfx::Drawable&) override {}
|
||||
void execute(gfx::Drawable& drawable, PaintParameters& parameters) override {
|
||||
drawable.setTexture(resources->texture0, shaders::idParticleGpuValidationPreviousTexture);
|
||||
drawable.setTexture(resources->texture0, shaders::idParticleGpuValidationFieldTexture);
|
||||
drawable.setTexture(resources->texture1, shaders::idParticleGpuValidationNextFieldTexture);
|
||||
shaders::ParticleGpuValidationUBO ubo = {
|
||||
.pass = {5.0f, 0.0f, 0.0f, 0.0f},
|
||||
.marker = {resources->mix, 0.0f, 0.0f, 0.0f},
|
||||
@@ -268,6 +266,8 @@ void RenderWeatherColorLayer::update(gfx::ShaderRegistry& shaders,
|
||||
sourceNextField = timelineFrame.t1;
|
||||
}
|
||||
auto state = std::static_pointer_cast<Resources>(resources);
|
||||
const auto previousTexture0 = state ? state->texture0.get() : nullptr;
|
||||
const auto previousTexture1 = state ? state->texture1.get() : nullptr;
|
||||
if (!state) {
|
||||
state = std::make_shared<Resources>();
|
||||
state->shader = context.getGenericShader(shaders, ShaderName);
|
||||
@@ -348,7 +348,13 @@ void RenderWeatherColorLayer::update(gfx::ShaderRegistry& shaders,
|
||||
const auto centerWrap = static_cast<int16_t>(std::floor((center.longitude() + 180.0) / 360.0));
|
||||
const int16_t firstWrap = centerWrap - 1;
|
||||
const int16_t lastWrap = centerWrap + 1;
|
||||
if (state->firstWrap == firstWrap && state->lastWrap == lastWrap) return;
|
||||
const bool wrapsChanged = state->firstWrap != firstWrap || state->lastWrap != lastWrap;
|
||||
if (!weatherColorDrawableBindingsChanged(previousTexture0,
|
||||
previousTexture1,
|
||||
state->texture0.get(),
|
||||
state->texture1.get(),
|
||||
wrapsChanged))
|
||||
return;
|
||||
group.clearDrawables();
|
||||
state->firstWrap = firstWrap;
|
||||
state->lastWrap = lastWrap;
|
||||
|
||||
Reference in New Issue
Block a user