Skip to content

Commit

Permalink
Merge pull request #570 from billhollings/master
Browse files Browse the repository at this point in the history
 Update dependency libraries for SDK 1.1.106.
  • Loading branch information
billhollings authored Apr 11, 2019
2 parents c425602 + 189a41e commit d57704b
Show file tree
Hide file tree
Showing 18 changed files with 2,679 additions and 2,512 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

#pragma once

#include "mvk_vulkan.h"
#include "MVKFoundation.h"
#include <dispatch/dispatch.h>
#include <string>

Expand Down Expand Up @@ -111,32 +109,5 @@ bool mvkGetEnvVarBool(std::string varName, bool* pWasFound = nullptr);
bool wasFound = false; \
int64_t ev = mvkGetEnvVarInt64(#EV, &wasFound); \
int64_t val = wasFound ? ev : EV; \
cfgVal = (int32_t)mvkClamp(val, (int64_t)INT32_MIN, (int64_t)INT32_MAX); \
cfgVal = (int32_t)std::min(std::max(val, (int64_t)INT32_MIN), (int64_t)INT32_MAX); \
} while(false)


#ifdef __OBJC__

#import <Metal/Metal.h>


#pragma mark -
#pragma mark MTLDevice

/** Returns an approximation of how much memory, in bytes, the device can use with good performance. */
uint64_t mvkRecommendedMaxWorkingSetSize(id<MTLDevice> mtlDevice);

/** Populate the propertes with info about the GPU represented by the MTLDevice. */
void mvkPopulateGPUInfo(VkPhysicalDeviceProperties& devProps, id<MTLDevice> mtlDevice);

/** Returns the registry ID of the specified device, or zero if the device does not have a registry ID. */
uint64_t mvkGetRegistryID(id<MTLDevice> mtlDevice);

/**
* If the MTLDevice defines a texture memory alignment for the format, it is retrieved from
* the MTLDevice and returned, or returns zero if the MTLDevice does not define an alignment.
* The format must support linear texture memory (must not be depth, stencil, or compressed).
*/
VkDeviceSize mvkMTLPixelFormatLinearTextureAlignment(MTLPixelFormat mtlPixelFormat, id<MTLDevice> mtlDevice);

#endif // __OBJC__
96 changes: 96 additions & 0 deletions Common/MVKOSExtensions.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*
* MVKOSExtensions.mm
*
* Copyright (c) 2014-2019 The Brenwill Workshop Ltd. (http://www.brenwill.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


#include "MVKOSExtensions.h"
#include "MVKLogging.h"
#include <mach/mach_time.h>

#import <Foundation/Foundation.h>


using namespace std;

static const MVKOSVersion kMVKOSVersionUnknown = 0.0f;
static MVKOSVersion _mvkOSVersion = kMVKOSVersionUnknown;
MVKOSVersion mvkOSVersion() {
if (_mvkOSVersion == kMVKOSVersionUnknown) {
NSOperatingSystemVersion osVer = [[NSProcessInfo processInfo] operatingSystemVersion];
float maj = osVer.majorVersion;
float min = osVer.minorVersion;
float pat = osVer.patchVersion;
_mvkOSVersion = maj + (min / 100.0f) + + (pat / 10000.0f);
}
return _mvkOSVersion;
}

static uint64_t _mvkTimestampBase;
static double _mvkTimestampPeriod;

uint64_t mvkGetTimestamp() { return mach_absolute_time() - _mvkTimestampBase; }

double mvkGetTimestampPeriod() { return _mvkTimestampPeriod; }

double mvkGetElapsedMilliseconds(uint64_t startTimestamp, uint64_t endTimestamp) {
if (endTimestamp == 0) { endTimestamp = mvkGetTimestamp(); }
return (double)(endTimestamp - startTimestamp) * _mvkTimestampPeriod / 1e6;
}

/**
* Initialize timestamping capabilities on app startup.
* Called automatically when the framework is loaded and initialized.
*/
static bool _mvkTimestampsInitialized = false;
__attribute__((constructor)) static void MVKInitTimestamps() {
if (_mvkTimestampsInitialized ) { return; }
_mvkTimestampsInitialized = true;

_mvkTimestampBase = mach_absolute_time();
mach_timebase_info_data_t timebase;
mach_timebase_info(&timebase);
_mvkTimestampPeriod = (double)timebase.numer / (double)timebase.denom;
MVKLogDebug("Initializing MoltenVK timestamping. Mach time: %llu. Time period: %d / %d = %.6f.",
_mvkTimestampBase, timebase.numer, timebase.denom, _mvkTimestampPeriod);
}

void mvkDispatchToMainAndWait(dispatch_block_t block) {
if (NSThread.isMainThread) {
block();
} else {
dispatch_sync(dispatch_get_main_queue(), block);
}
}


#pragma mark -
#pragma mark Process environment

string mvkGetEnvVar(string varName, bool* pWasFound) {
NSDictionary* env = [[NSProcessInfo processInfo] environment];
NSString* envStr = env[@(varName.c_str())];
if (pWasFound) { *pWasFound = envStr != nil; }
return envStr ? envStr.UTF8String : "";
}

int64_t mvkGetEnvVarInt64(string varName, bool* pWasFound) {
return strtoll(mvkGetEnvVar(varName, pWasFound).c_str(), NULL, 0);
}

bool mvkGetEnvVarBool(std::string varName, bool* pWasFound) {
return mvkGetEnvVarInt64(varName, pWasFound) != 0;
}
40 changes: 34 additions & 6 deletions Docs/Whats_New.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,20 @@ For best results, use a Markdown reader.*
MoltenVK 1.0.34
---------------

Released TBD
Released 2019-04-12

- Add support for tessellation.
- Add correct function entry point handling.
- Add support for `VK_KHR_get_surface_capabilities2` extension.
- Implement newer `VK_KHR_swapchain` extension functions.
- Support the `VK_EXT_host_query_reset` extension.
- Add support for tracking device features enabled during `vkCreateDevice()`.
- Handle surface loss due to window moved between screens or a window style change.
- Allow zero offset and stride combo in `VkVertexInputBindingDescription`.
- API: Add MVKPhysicalDeviceMetalFeatures::depthSampleCompare.
- API: Add `MVKPhysicalDeviceMetalFeatures::depthSampleCompare`.
- Fix conditions under which functions return `VK_INCOMPLETE`.
- Fix potential memory leak on synchronous command buffer submission.
- Increase shader float constant accuracy beyond 6 digits of precision.
- MoltenVKShaderConverter tool support cs & csh for compute shader file extensions.
- MoltenVKShaderConverter tool validates converted MSL with a test compilation.
- `fetchDependencies`: Stop on first error.
- Clean up behaviour of sparse binding functions.
- Fix a possible race condition around `MVKMTLBufferAllocation`.
Expand All @@ -39,32 +38,61 @@ Released TBD
- Fix wrong offset for `vkCmdFillBuffer()` on `VK_WHOLE_SIZE`.
- Fixed crash within `MVKPushConstantsCommandEncoderState` when accessing absent
graphics pipeline during a compute stage.
- Fixed crash when `MTLRenderPassDescriptor renderTargetWidth` & `renderTargetHeight`
set on older devices.
- Renderpass width/height clamped to the `renderArea` includes `offset`, not just `extent`,
and are set only when layered rendering is supported on device.
- Set options properly on a buffer view's `MTLTextureDescriptor`.
- Don't set `MTLSamplerDescriptor.compareFunction` on devices that don't support it.
- Disable the `shaderStorageImageArrayDynamicIndexing` feature on iOS.
- Debug build mode includes `dSYM` file for each `dylib` file.
- Explicitly build dSYM files in `BUILT_PRODUCTS_DIR` to avoid conflict between
macOS and iOS build locations.
- `Makefile` supports `install` target to install `MoltenVK.framework`
- `Makefile` supports `install` target to install `MoltenVK.framework`.
into `/Library/Frameworks/`.
- Add `MVK_CONFIG_TRACE_VULKAN_CALLS` env var and build setting to log Vulkan calls made by application.
- Log shader performance statistics in any runtime if `MVKConfiguration::performanceLoggingFrameCount` non-zero.
- Suppress visibility warning spam when building Debug macOS from SPIRV-Cross Release build.
- Support Xcode 10.2.
- Update `VK_MVK_MOLTENVK_SPEC_VERSION` to 19.
- MoltenVKShaderConverter tool:
- Support `cs` & `csh` for compute shader file extensions.
- Validate converted MSL with a test compilation.
- Add option to log shader conversion performance.
- Update to latest SPIRV-Cross version:
- MSL: Add support for Metal 2 indirect argument buffers.
- MSL: Add support for tessellation control & evaluation shaders.
- MSL: Support `VK_KHR_push_descriptor`.
- MSL: Force unnamed array builtin attributes to have a name.
- MSL: Set location of builtins based on client input.
- MSL: Ignore duplicate builtin vertex attributes.
- MSL: Fix crash where variable storage buffer pointers are passed down.
- MSL: Fix depth2d 4-component fixup.
- MSL: Fix infinite CAS loop on atomic_compare_exchange_weak_explicit().
- MSL: Fix `depth2d` 4-component fixup.
- MSL: Expand quad `gl_TessCoord` to a float3.
- MSL: Fix depth textures which are sampled and compared against.
- MSL: Emit proper name for optimized UBO/SSBO arrays.
- MSL: Support emit two layers of address space.
- MSL: Declare `gl_WorkGroupSize` constant with `[[maybe_unused]]`.
- MSL: Fix OpLoad of array which is forced to a temporary.
- Add stable C API and ABI.
- Performance improvements & reduce pressure on global allocation.
- Fix case where a struct is loaded which contains a row-major matrix.
- Fix edge case where opaque types can be declared on stack.
- Ensure locale handling is safe for multi-threading.
- Add support for sanitizing address and threads.
- Add support for `SPV_NV_ray_tracing`.
- Support -1 index in `OpVectorShuffle`.
- Deal more flexibly with for-loop & while-loop variations.
- Detect invalid DoWhileLoop early.
- Force complex loop in certain rare access chain scenarios.
- Make locale handling threadsafe.
- Support do-while where test is negative.
- Emit loop header variables even for while and dowhile.
- Properly deal with sign-dependent GLSL opcodes.
- Deal with mismatched signs in S/U/F conversion opcodes.
- Rewrite how we deal with locales and decimal point.
- Fix crash when `backend.int16_t_literal_suffix` set to null.
- Introduce customizable SPIRV-Cross namespaces and use `MVK_spirv_cross` in MoltenVK.


Expand Down
Loading

0 comments on commit d57704b

Please sign in to comment.