let uniform float count / sampler count be reset (flutter/engine#34833)

This commit is contained in:
Jonah Williams
2022-07-22 11:40:04 -07:00
committed by GitHub
parent ef548d97e9
commit 971d9b9410
3 changed files with 53 additions and 2 deletions

View File

@@ -4155,10 +4155,10 @@ class FragmentProgram extends NativeFieldWrapperClass1 {
}
@pragma('vm:entry-point')
late final int _uniformFloatCount;
late int _uniformFloatCount;
@pragma('vm:entry-point')
late final int _samplerCount;
late int _samplerCount;
@FfiNative<Void Function(Handle)>('FragmentProgram::Create')
external void _constructor();

View File

@@ -7,6 +7,7 @@ import("//flutter/testing/dart/compile_test.gni")
tests = [
"skp_test.dart",
"tracing_test.dart",
"shader_reload_test.dart",
]
foreach(test, tests) {

View File

@@ -0,0 +1,50 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:developer' as developer;
import 'dart:typed_data';
import 'dart:ui';
import 'package:litetest/litetest.dart';
import 'package:vm_service/vm_service.dart' as vms;
import 'package:vm_service/vm_service_io.dart';
void main() {
test('simple iplr shader can be re-initialized', () async {
vms.VmService? vmService;
try {
final FragmentProgram program = FragmentProgram.fromAsset(
'functions.frag.iplr',
);
final Shader shader = program.shader(
floatUniforms: Float32List.fromList(<double>[1]),
);
final developer.ServiceProtocolInfo info = await developer.Service.getInfo();
if (info.serverUri == null) {
fail('This test must not be run with --disable-observatory.');
}
vmService = await vmServiceConnectUri(
'ws://localhost:${info.serverUri!.port}${info.serverUri!.path}ws',
);
final vms.VM vm = await vmService.getVM();
expect(vm.isolates!.isNotEmpty, true);
for (final vms.IsolateRef isolateRef in vm.isolates!) {
final vms.Response response = await vmService.callServiceExtension(
'ext.ui.window.reinitializeShader',
isolateId: isolateRef.id,
args: <String, Object>{
'assetKey': 'functions.frag.iplr',
},
);
expect(response.type == 'Success', true);
}
} finally {
await vmService?.dispose();
}
});
}