mirror of
https://github.com/GayPizzaSpecifications/voxelotl-engine.git
synced 2025-08-03 21:21:34 +00:00
use instance buffer storage mode most appropriate for the hardware
This commit is contained in:
@ -425,7 +425,7 @@ public class Renderer {
|
|||||||
if self._instances[self.currentFrame] == nil || instancesBytes > self._instances[self.currentFrame]!.length {
|
if self._instances[self.currentFrame] == nil || instancesBytes > self._instances[self.currentFrame]!.length {
|
||||||
guard let instanceBuffer = self.device.makeBuffer(
|
guard let instanceBuffer = self.device.makeBuffer(
|
||||||
length: instancesBytes,
|
length: instancesBytes,
|
||||||
options: .storageModeManaged)
|
options: self._defaultStorage)
|
||||||
else {
|
else {
|
||||||
fatalError("Failed to (re)create instance buffer")
|
fatalError("Failed to (re)create instance buffer")
|
||||||
}
|
}
|
||||||
@ -447,7 +447,11 @@ public class Renderer {
|
|||||||
color: SIMD4(instance.color))
|
color: SIMD4(instance.color))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if arch(x86_64)
|
||||||
|
if self._defaultStorage == .storageModeManaged {
|
||||||
instanceBuffer.didModifyRange(0..<instancesBytes)
|
instanceBuffer.didModifyRange(0..<instancesBytes)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
self._encoder.setCullMode(.init(environment.cullFace))
|
self._encoder.setCullMode(.init(environment.cullFace))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user