Skip to content

Commit

Permalink
Remove various obsolete APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
hyazinthh committed Jun 13, 2024
1 parent 6067b06 commit 199ed9a
Show file tree
Hide file tree
Showing 13 changed files with 7 additions and 107 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- IRuntime.PrepareEffect now takes an optional topology for layered effects.
- [GL] Cleanup up shader program creation and caching. Removed various methods for creating and compiling shaders from `Context`.
- Removed obsolete IResourceManager interface
- Removed various other obsolete APIs

### 5.4.10
- [OpenVR] changed GL texture submit to 2 textures (previously side by side, issue with Quest 3)
Expand Down
4 changes: 0 additions & 4 deletions src/Aardvark.Rendering.GL/Core/Context.fs
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,6 @@ type Context(runtime : IRuntime, createContext : ContextHandle option -> Context

member x.MemoryUsage = memoryUsage

[<Obsolete("Use ContextHandle.Current instead.")>]
member x.CurrentContextHandle
with get() = ContextHandle.Current

member x.Runtime = runtime

member x.IsDisposed = isDisposed = 1
Expand Down
21 changes: 2 additions & 19 deletions src/Aardvark.Rendering.Vulkan/Resources/Buffer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -443,20 +443,8 @@ module Buffer =
let internal updateWriter (writer : nativeint -> unit) (buffer : Buffer) =
updateRangeWriter 0L buffer.Size writer buffer

[<Obsolete("Use uploadRangeSet instead.")>]
let uploadRanges (ptr : nativeint) (ranges : RangeSet) (buffer : Buffer) =
let baseOffset = int64 ranges.Min
let totalSize = int64 (ranges.Max - ranges.Min)

buffer |> updateRangeWriter baseOffset totalSize (fun dst ->
for r in ranges do
let srcOffset = nativeint r.Min
let dstOffset = nativeint (r.Min - ranges.Min)
Marshal.Copy(ptr + srcOffset, dst + dstOffset, r.Size + 1)
)

// TODO: Rename back to uploadRanges with next major update
let uploadRangeSet (ptr : nativeint) (ranges : RangeSet1i) (buffer : Buffer) =
let uploadRanges (ptr : nativeint) (ranges : RangeSet1i) (buffer : Buffer) =
let baseOffset = int64 ranges.Min
let totalSize = int64 (ranges.Max - ranges.Min + 1)

Expand Down Expand Up @@ -654,14 +642,9 @@ type ContextBufferExtensions private() =
use token = memory.Device.Token
token |> Buffer.ofBufferWithMemory export flags data memory

[<Obsolete("Use overload with RangeSet1i parameter instead.")>]
[<Extension>]
static member inline UploadRanges(buffer : Buffer, ptr : nativeint, ranges : RangeSet) =
buffer |> Buffer.uploadRanges ptr ranges

[<Extension>]
static member inline UploadRanges(buffer : Buffer, ptr : nativeint, ranges : RangeSet1i) =
buffer |> Buffer.uploadRangeSet ptr ranges
buffer |> Buffer.uploadRanges ptr ranges

[<Extension>]
static member inline TryUpdate(buffer : Buffer, b : IBuffer) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ module SparseTextureImplemetation =
let texture =
AVal.custom (fun t ->
if isDisposed then
NullTexture() :> ITexture
nullTexture
else
swapBuffers()
)
Expand Down
4 changes: 0 additions & 4 deletions src/Aardvark.Rendering/Common/ClearValues.fs
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,6 @@ module ``Clear Utlities`` =
member inline x.Color(s : ClearValues, semantic : Symbol, color : ^Color) =
s |> ClearValues.colorAttachment semantic color

[<CustomOperation("color"); Obsolete("Use untupled overload of this builder operation instead.")>]
member inline x.Color(s : ClearValues, (semantic : Symbol, color : ^Color)) =
s |> ClearValues.colorAttachment semantic color

[<CustomOperation("colors")>]
member inline x.Colors(s : ClearValues, colors : Map<Symbol, ^Color>) =
s |> ClearValues.colors colors
Expand Down
7 changes: 1 addition & 6 deletions src/Aardvark.Rendering/Effects/Interop/ShaderDebugger.fs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,4 @@ module ShaderDebuggerExtensions =
if ShaderDebugger.isInitialized() then
set |> ASet.mapA hookRenderObject
else
set

[<Obsolete("Use ShaderDebugger module instead.")>]
type EffectDebugger private() =
static member Hook (o : IRenderObject) = ShaderDebugger.hookRenderObject o
static member Hook (set : aset<IRenderObject>) = ShaderDebugger.hookRenderObjects set
set
3 changes: 0 additions & 3 deletions src/Aardvark.Rendering/Pipeline/RenderObject.fs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@ and RenderObject private (id : RenderObjectId,
static member Clone(ro : RenderObject) =
RenderObject(id = RenderObjectId.New(), other = ro)

[<Obsolete("Use default constructor instead.")>]
static member Create() = RenderObject()

member x.Path =
if System.Object.ReferenceEquals(x.AttributeScope,Ag.Scope.Root) then "EMPTY"
else string x.AttributeScope
Expand Down
25 changes: 0 additions & 25 deletions src/Aardvark.Rendering/Resources/Buffers/BufferExtensions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,6 @@ type IBufferRangeExtensions private() =
let slice = range.GetSlice(startIndex, endIndex)
slice.Upload(Array.create (int slice.Count) value)

[<Extension; Obsolete("Use range.Upload(src, srcIndex, dstIndex, count) instead.")>]
static member Upload(range : IBufferRange<'T>, src : 'T[], dstIndex : int, count : int) =
range.Upload(src, 0, dstIndex, count)

// ================================================================================================================
// Download
// ================================================================================================================
Expand Down Expand Up @@ -227,14 +223,6 @@ type IBufferRangeExtensions private() =
src.Download(pDst, byteSize<'T> count)
)

[<Extension; Obsolete("Use range.Download(dst, srcIndex, dstIndex, count) instead.")>]
static member Download(src : IBufferRange<'T>, srcIndex : int, dst : 'T[], dstIndex : int, count : int) =
src.Download(dst, srcIndex, dstIndex, count)

[<Extension; Obsolete("Use range.Download(dst, srcIndex, dstIndex, count) instead.")>]
static member Download(src : IBufferRange<'T>, srcIndex : int, dst : 'T[], count : int) =
src.Download(dst, srcIndex, 0, count)

// ================================================================================================================
// DownloadAsync
// ================================================================================================================
Expand Down Expand Up @@ -376,19 +364,6 @@ type IBufferRuntimeExtensions private() =
buffer.Upload(data)
buffer

[<Extension; Obsolete("Use Upload instead.")>]
static member Copy(this : IBufferRuntime, srcData : nativeint, dst : IBackendBuffer, dstOffset : nativeint, size : nativeint) =
this.Upload(srcData, dst, dstOffset, size)

[<Extension; Obsolete("Use Download instead.")>]
static member Copy(this : IBufferRuntime, srcBuffer : IBackendBuffer, srcOffset : nativeint, dstData : nativeint, size : nativeint) =
this.Download(srcBuffer, srcOffset, dstData, size)

[<Extension; Obsolete("Use DownloadAsync instead.")>]
static member CopyAsync(this : IBufferRuntime, srcBuffer : IBackendBuffer, srcOffset : nativeint, dstData : nativeint, size : nativeint) =
this.DownloadAsync(srcBuffer, srcOffset, dstData, size)


[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module Buffer =

Expand Down
3 changes: 0 additions & 3 deletions src/Aardvark.Rendering/Resources/Buffers/SingleValueBuffer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ type SingleValueBuffer<'T when 'T : unmanaged>(value : aval<'T>) =

static let zero = SingleValueBuffer(Unchecked.defaultof<'T>)

[<Obsolete("Use SingleValueBuffer<'T>.Zero instead.")>]
new() = SingleValueBuffer(~~Unchecked.defaultof<'T>)

new(value : 'T) = SingleValueBuffer(~~value)

/// Buffer containing zero as value.
Expand Down
2 changes: 1 addition & 1 deletion src/Aardvark.Rendering/Resources/NullResources.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ open FSharp.Data.Adaptive

#nowarn "44"

type NullTexture [<Obsolete("Use nullTexture or NullTexture.Instance instead.")>] () =
type NullTexture private () =
static let instance = NullTexture() :> ITexture
static let instanceConst = AVal.constant instance

Expand Down
24 changes: 0 additions & 24 deletions src/Aardvark.Rendering/Runtime/Compute/Compute.fs
Original file line number Diff line number Diff line change
Expand Up @@ -112,24 +112,12 @@ and [<RequireQualifiedAccess>]
if dstIndex >= dst.Length then raise <| ArgumentException($"Array index {dstIndex} out of bounds (length = {dst.Length}).")
ComputeCommand.DownloadBufferCmd(src, HostMemory.Managed (dst, dstIndex))

[<Obsolete("Use ComputeCommand.Download() instead.")>]
static member inline Copy<'T when 'T : unmanaged>(src : IBufferRange<'T>, dst : 'T[], dstIndex : int) =
ComputeCommand.Download(src, dst, dstIndex)

static member inline Download<'T when 'T : unmanaged>(src : IBufferRange<'T>, dst : 'T[]) =
ComputeCommand.DownloadBufferCmd(src, HostMemory.Managed (dst, 0))

[<Obsolete("Use ComputeCommand.Download() instead.")>]
static member inline Copy<'T when 'T : unmanaged>(src : IBufferRange<'T>, dst : 'T[]) =
ComputeCommand.Download(src, dst)

static member inline Download<'T when 'T : unmanaged>(src : IBufferRange<'T>, dst : nativeptr<'T>) =
ComputeCommand.DownloadBufferCmd(src, HostMemory.Unmanaged (NativePtr.toNativeInt dst))

[<Obsolete("Use ComputeCommand.Download() instead.")>]
static member inline Copy<'T when 'T : unmanaged>(src : IBufferRange<'T>, dst : nativeptr<'T>) =
ComputeCommand.Download(src, dst)


static member inline Upload(src : nativeint, dst : IBufferRange) =
ComputeCommand.UploadBufferCmd(HostMemory.Unmanaged src, dst)
Expand All @@ -139,24 +127,12 @@ and [<RequireQualifiedAccess>]
if srcIndex >= src.Length then raise <| ArgumentException($"Array index {srcIndex} out of bounds (length = {src.Length}).")
ComputeCommand.UploadBufferCmd(HostMemory.Managed (src :> Array, srcIndex), dst)

[<Obsolete("Use ComputeCommand.Upload() instead.")>]
static member inline Copy<'T when 'T : unmanaged>(src : 'T[], srcIndex : int, dst : IBufferRange<'T>) =
ComputeCommand.Upload(src, srcIndex, dst)

static member inline Upload<'T when 'T : unmanaged>(src : 'T[], dst : IBufferRange<'T>) =
ComputeCommand.UploadBufferCmd(HostMemory.Managed (src :> Array, 0), dst)

[<Obsolete("Use ComputeCommand.Upload() instead.")>]
static member inline Copy<'T when 'T : unmanaged>(src : 'T[], dst : IBufferRange<'T>) =
ComputeCommand.Upload(src, dst)

static member inline Upload<'T when 'T : unmanaged>(src : nativeptr<'T>, dst : IBufferRange<'T>) =
ComputeCommand.UploadBufferCmd(HostMemory.Unmanaged (NativePtr.toNativeInt src), dst)

[<Obsolete("Use ComputeCommand.Upload() instead.")>]
static member inline Copy<'T when 'T : unmanaged>(src : nativeptr<'T>, dst : IBufferRange<'T>) =
ComputeCommand.Upload(src, dst)


static member inline Sync(buffer : IBackendBuffer,
[<Optional; DefaultParameterValue(ResourceAccess.All)>] srcAccess : ResourceAccess,
Expand Down
12 changes: 0 additions & 12 deletions src/Aardvark.Rendering/Runtime/Compute/ComputeExtensions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ type IComputeRuntimeExtensions private() =
static member CompileCompute(runtime : IComputeRuntime, commands : list<ComputeCommand>) =
runtime.CompileCompute(commands |> AList.ofList)

[<Extension; Obsolete("Use IComputeRuntime.CompileCompute() instead.")>]
static member Compile(runtime : IComputeRuntime, commands : list<ComputeCommand>) =
runtime.CompileCompute(commands)

[<Extension>]
static member Run(runtime : IComputeRuntime, commands : list<ComputeCommand>, renderToken : RenderToken) =
use task = runtime.CompileCompute(commands)
Expand All @@ -75,14 +71,6 @@ type IComputeShaderExtensions private() =
static member CreateInputBinding(shader : IComputeShader, inputs : IUniformProvider) =
shader.Runtime.CreateInputBinding(shader, inputs)

[<Extension; Obsolete("Use CreateInputBinding instead.")>]
static member NewInputBinding(_runtime : IComputeRuntime, shader : IComputeShader, inputs : IUniformProvider) =
_runtime.CreateInputBinding(shader, inputs)

[<Extension; Obsolete("Use CreateInputBinding instead.")>]
static member NewInputBinding(shader : IComputeShader, inputs : IUniformProvider) =
shader.Runtime.CreateInputBinding(shader, inputs)

[<Extension>]
static member Invoke(shader : IComputeShader, groupCount : V3i, input : IComputeInputBinding, renderToken : RenderToken) =
shader.Runtime.Run([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,4 @@ type IComputeRuntimeMutableInputBindingExtensions private() =
/// For backwards-compatible only, new code should create input bindings from an IUniformProvider.
[<Extension>]
static member CreateInputBinding(_runtime : IComputeRuntime, shader : IComputeShader) =
new MutableComputeInputBinding(shader)

[<Extension; Obsolete("Use CreateInputBinding instead.")>]
static member NewInputBinding(_runtime : IComputeRuntime, shader : IComputeShader) =
_runtime.CreateInputBinding(shader)
new MutableComputeInputBinding(shader)

0 comments on commit 199ed9a

Please sign in to comment.