* This is especially relevant on Android where we fetch all function pointers at
init time, so any that we replace via emulation are gone, but it is also
generally true that we expect GL contexts to be representative.
This replaces WrappedMTLObject::Dealloc() which was not implemented or hooked up (it was a TODO).
Deleted WrappedMTLObject::Dealloc()
DeallocateObjCBridge calls resource manager ReleaseWrappedResource().
This constructs in-place the ObjC bridge class.
This fixes a bug where the reference count of the ObjC bridge class was not guaranteed to be initialized on construction.
* This may break on drivers old enough to not recognise the first non-legacy
ASIC, but that is much rarer than new drivers that have dropped support for
the old ones.
* D3D12 math shader was already precompiled, but on D3D11 we now allocate
everything up front and on D3D12 we also up-front compile sampling.
* The only exception is const offsets which can't be variable, so we cache these
(likely we'll only see a few variants per shader/capture) and create them on
demand.
Switch to caching the CA::MetalLayer & WrappedMTLTexture from the MTL::Drawable.
This is to avoid validation asserts about accessing the texture of a MTL::Drawable after calling MTLCommandBuffer::presentDrawable.
Switch "bool present" to "uint32_t flags" to future proof being able to store multiple flags on the command buffer recoring info
Previous API return goes back to usage for objective C calls and this is not required now the objective C and C++ wrapping/unwrapping has advanced and simplified.
More sense/natural/correct to return type without casting it.
Added temporary implementation of GetWrapped() and Unwrap() for the unimplemented Metal types used by MTLBlitCommandEncoder APIs (MTLFence, MTLIndirectCommandBuffer, MTLCounterSampleBuffer).
The API synchronizeResource uses ObjC inheritance for MTLResource, which uses new helper methods for MTLResource without implementing the complete type.
MTLResource helper methods: GetResID(), Unwrap(), GetWrapped().
The WrappedMTLResource* is cast to WrappedMTLObject* to get the ID and real resource.
For the unimplemented Metal types: MTLFence, MTLIndirectCommandBuffer, MTLCounterSampleBuffer have added temporary implementations of GetWrapped() and Unwrap().
These temporary implementations perform the appropriate casting. There is no actual implementation of the unimplemented wrapped types. These unimplemented wrapped types are a temporary solution to enable the ObjC bridge to be implemented.
The APIs related to retrieving GPU counters have been hooked with basic serialization. It is expected the replay and capture will need to be specific ie. capture & serialize the buffer data, then at replay upload the serialized buffer data to the GPU buffer.
Basic tests for public methods:
MakeResourceFormat(MTL::PixelFormat format);
GetByteSize(uint32_t width, uint32_t height, uint32_t depth, MTL::PixelFormat format, uint32_t mip);
One test for helper method:
GetPlaneByteSize(uint32_t width, uint32_t height, uint32_t depth, MTL::PixelFormat format, uint32_t mip, uint32_t plane);
* If a command buffer had an unbalanced begin/end, some chunks may still be left
in the record that haven't been baked. Delete these before beginning to record
again.
- add missing destroy resources call
- restore framebuffer binding after replaying draw
- disable more state bits for occlusion querying
- read back query results after executing all queries
The OpenGL Pixel History feature is hidden behind the OpenGL_PixelHistory config toggle.
For now, we only run an occlusion query and then replay the events
and read back the pixel values to return to the UI.
Fixes compilation on non i386/x86_64 Linux targets.
Don't use arch specific assembly for other architectures because
in most cases it breaks gdb ability to do next step.
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
* Normally we have to ignore subsequent states as potentially garbage pointers
if discard is enabled, but when it's dynamic state we have to ignore its
valid.
* If a draw has no effects (color mask writes off, no depth attachment) then
Intel will not return proper occlusion query results. Forcibly patching in a
storage write works around the problem.