Skip to content

Commit

Permalink
Remove depthstencil resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
bdero committed Oct 8, 2024
1 parent 7e6b9ea commit 281c668
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 58 deletions.
45 changes: 4 additions & 41 deletions lib/gpu/lib/src/render_pass.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,43 +74,8 @@ base class DepthStencilAttachment {
int stencilClearValue;

Texture texture;
Texture? resolveTexture;

void _validate() {
if (resolveTexture != null) {
if (resolveTexture!.format != texture.format) {
throw Exception(
"DepthStencilAttachment MSAA resolve texture must have the same format as the texture");
}
if (resolveTexture!.width != texture.width ||
resolveTexture!.height != texture.height) {
throw Exception(
"DepthStencilAttachment MSAA resolve texture must have the same dimensions as the texture");
}
if (resolveTexture!.sampleCount != 1) {
throw Exception(
"DepthStencilAttachment MSAA resolve texture must have a sample count of 1");
}
if (texture.sampleCount <= 1) {
throw Exception(
"DepthStencilAttachment must have a sample count greater than 1 when a MSAA resolve texture is set");
}
if (depthStoreAction != StoreAction.multisampleResolve &&
depthStoreAction != StoreAction.storeAndMultisampleResolve) {
throw Exception(
"DepthStencilAttachment depthStoreAction must be multisampleResolve or storeAndMultisampleResolve when a resolve texture is set");
}
if (stencilStoreAction != StoreAction.multisampleResolve &&
stencilStoreAction != StoreAction.storeAndMultisampleResolve) {
throw Exception(
"DepthStencilAttachment stencilStoreAction must be multisampleResolve or storeAndMultisampleResolve when a resolve texture is set");
}
if (resolveTexture!.storageMode == StorageMode.deviceTransient) {
throw Exception(
"DepthStencilAttachment MSAA resolve texture must not have a storage mode of deviceTransient");
}
}

if (texture.storageMode == StorageMode.deviceTransient) {
if (depthLoadAction == LoadAction.load) {
throw Exception(
Expand Down Expand Up @@ -244,8 +209,7 @@ base class RenderPass extends NativeFieldWrapperClass1 {
ds.stencilLoadAction.index,
ds.stencilStoreAction.index,
ds.stencilClearValue,
ds.texture,
ds.resolveTexture);
ds.texture);
if (error != null) {
throw Exception(error);
}
Expand Down Expand Up @@ -396,8 +360,8 @@ base class RenderPass extends NativeFieldWrapperClass1 {
Texture? resolveTexture);

@Native<
Handle Function(Pointer<Void>, Int, Int, Float, Int, Int, Int,
Pointer<Void>, Handle)>(
Handle Function(
Pointer<Void>, Int, Int, Float, Int, Int, Int, Pointer<Void>)>(
symbol: 'InternalFlutterGpu_RenderPass_SetDepthStencilAttachment')
external String? _setDepthStencilAttachment(
int depthLoadAction,
Expand All @@ -406,8 +370,7 @@ base class RenderPass extends NativeFieldWrapperClass1 {
int stencilLoadAction,
int stencilStoreAction,
int stencilClearValue,
Texture texture,
Texture? resolveTexture);
Texture texture);

@Native<Handle Function(Pointer<Void>, Pointer<Void>)>(
symbol: 'InternalFlutterGpu_RenderPass_Begin')
Expand Down
16 changes: 1 addition & 15 deletions lib/gpu/render_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -238,24 +238,13 @@ Dart_Handle InternalFlutterGpu_RenderPass_SetDepthStencilAttachment(
int stencil_load_action,
int stencil_store_action,
int stencil_clear_value,
flutter::gpu::Texture* texture,
Dart_Handle resolve_texture_wrapper) {
flutter::gpu::Texture* resolve_texture = nullptr;

if (!Dart_IsNull(resolve_texture_wrapper)) {
resolve_texture = tonic::DartConverter<flutter::gpu::Texture*>::FromDart(
resolve_texture_wrapper);
}

flutter::gpu::Texture* texture) {
{
impeller::DepthAttachment desc;
desc.load_action = flutter::gpu::ToImpellerLoadAction(depth_load_action);
desc.store_action = flutter::gpu::ToImpellerStoreAction(depth_store_action);
desc.clear_depth = depth_clear_value;
desc.texture = texture->GetTexture();
if (resolve_texture) {
desc.resolve_texture = resolve_texture->GetTexture();
}
wrapper->GetRenderTarget().SetDepthAttachment(desc);
}
{
Expand All @@ -265,9 +254,6 @@ Dart_Handle InternalFlutterGpu_RenderPass_SetDepthStencilAttachment(
flutter::gpu::ToImpellerStoreAction(stencil_store_action);
desc.clear_stencil = stencil_clear_value;
desc.texture = texture->GetTexture();
if (resolve_texture) {
desc.resolve_texture = resolve_texture->GetTexture();
}
wrapper->GetRenderTarget().SetStencilAttachment(desc);
}

Expand Down
3 changes: 1 addition & 2 deletions lib/gpu/render_pass.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ extern Dart_Handle InternalFlutterGpu_RenderPass_SetDepthStencilAttachment(
int stencil_load_action,
int stencil_store_action,
int stencil_clear_value,
flutter::gpu::Texture* texture,
Dart_Handle resolve_texture_wrapper);
flutter::gpu::Texture* texture);

FLUTTER_GPU_EXPORT
extern Dart_Handle InternalFlutterGpu_RenderPass_Begin(
Expand Down

0 comments on commit 281c668

Please sign in to comment.