summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/src/renderer_mtl.h
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bgfx/src/renderer_mtl.h')
-rw-r--r--3rdparty/bgfx/src/renderer_mtl.h38
1 files changed, 26 insertions, 12 deletions
diff --git a/3rdparty/bgfx/src/renderer_mtl.h b/3rdparty/bgfx/src/renderer_mtl.h
index 86893f70e4c..805fa1eaff7 100644
--- a/3rdparty/bgfx/src/renderer_mtl.h
+++ b/3rdparty/bgfx/src/renderer_mtl.h
@@ -224,14 +224,8 @@ namespace bgfx { namespace mtl
id<MTLLibrary> newLibraryWithSource(const char* _source)
{
- MTLCompileOptions* options = [MTLCompileOptions new];
- //NOTE: turned of as 'When using the fast variants, math functions execute more quickly,
- // but operate over a **LIMITED RANGE** and their behavior when handling NaN values is not defined.'
- if (BX_ENABLED(BX_PLATFORM_IOS))
- options.fastMathEnabled = NO;
-
NSError* error;
- id<MTLLibrary> lib = [m_obj newLibraryWithSource:@(_source) options:options error:&error];
+ id<MTLLibrary> lib = [m_obj newLibraryWithSource:@(_source) options:nil error:&error];
BX_WARN(NULL == error
, "Shader compilation failed: %s"
, [error.localizedDescription cStringUsingEncoding:NSASCIIStringEncoding]
@@ -332,6 +326,14 @@ namespace bgfx { namespace mtl
MTL_CLASS(Function)
NSArray* vertexAttributes() { return m_obj.vertexAttributes; }
+
+ void setLabel(const char* _label)
+ {
+ if ([m_obj respondsToSelector:@selector(setLabel:)])
+ {
+ [m_obj setLabel:@(_label)];
+ }
+ }
MTL_CLASS_END
MTL_CLASS(Library)
@@ -504,6 +506,11 @@ namespace bgfx { namespace mtl
{
return m_obj.textureType;
}
+
+ void setLabel(const char* _label)
+ {
+ [m_obj setLabel:@(_label)];
+ }
MTL_CLASS_END
typedef id<MTLComputePipelineState> ComputePipelineState;
@@ -732,8 +739,7 @@ namespace bgfx { namespace mtl
, m_vshConstantBufferAlignmentMask(0)
, m_fshConstantBufferSize(0)
, m_fshConstantBufferAlignmentMask(0)
- , m_usedVertexSamplerStages(0)
- , m_usedFragmentSamplerStages(0)
+ , m_samplerCount(0)
, m_numPredefined(0)
, m_processedUniforms(false)
{
@@ -759,8 +765,16 @@ namespace bgfx { namespace mtl
uint32_t m_vshConstantBufferAlignmentMask;
uint32_t m_fshConstantBufferSize;
uint32_t m_fshConstantBufferAlignmentMask;
- uint32_t m_usedVertexSamplerStages;
- uint32_t m_usedFragmentSamplerStages;
+
+ struct SamplerInfo
+ {
+ uint32_t m_index;
+ bgfx::UniformHandle m_uniform;
+ bool m_fragment;
+ };
+ SamplerInfo m_samplers[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS];
+ uint32_t m_samplerCount;
+
PredefinedUniform m_predefined[PredefinedUniform::Count*2];
uint8_t m_numPredefined;
bool m_processedUniforms;
@@ -818,7 +832,7 @@ namespace bgfx { namespace mtl
, m_pixelFormatHash(0)
, m_num(0)
{
- m_depthHandle.idx = invalidHandle;
+ m_depthHandle.idx = kInvalidHandle;
}
void create(uint8_t _num, const Attachment* _attachment);