mirror of
https://github.com/mamedev/mame.git
synced 2024-11-16 07:48:32 +01:00
macOS: Fixed deprecated warnings.
This commit is contained in:
parent
af9d39c250
commit
10a8cb61f8
1 changed files with 93 additions and 81 deletions
54
3rdparty/bgfx/src/renderer_mtl.mm
vendored
54
3rdparty/bgfx/src/renderer_mtl.mm
vendored
|
@ -425,8 +425,8 @@ static const char* s_accessNames[] = {
|
|||
|
||||
BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNames count");
|
||||
|
||||
#define SHADER_FUNCTION_NAME ("xlatMtlMain")
|
||||
#define SHADER_UNIFORM_NAME ("_mtl_u")
|
||||
#define SHADER_FUNCTION_NAME "xlatMtlMain"
|
||||
#define SHADER_UNIFORM_NAME "_mtl_u"
|
||||
|
||||
struct RendererContextMtl;
|
||||
static RendererContextMtl* s_renderMtl;
|
||||
|
@ -1931,8 +1931,8 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
|
|||
|
||||
void processArguments(
|
||||
PipelineStateMtl* ps
|
||||
, NSArray<MTLArgument*>* _vertexArgs
|
||||
, NSArray<MTLArgument*>* _fragmentArgs
|
||||
, NSArray<id<MTLBinding>>* _vertexArgs
|
||||
, NSArray<id<MTLBinding>>* _fragmentArgs
|
||||
)
|
||||
{
|
||||
ps->m_numPredefined = 0;
|
||||
|
@ -1945,32 +1945,39 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
|
|||
;
|
||||
const int8_t fragmentBit = (1 == shaderType ? kUniformFragmentBit : 0);
|
||||
|
||||
for (MTLArgument* arg in (shaderType == 0 ? _vertexArgs : _fragmentArgs) )
|
||||
for (id<MTLBinding> arg in (shaderType == 0 ? _vertexArgs : _fragmentArgs) )
|
||||
{
|
||||
BX_TRACE("arg: %s type:%d", utf8String(arg.name), arg.type);
|
||||
|
||||
if (arg.active)
|
||||
if (arg.used)
|
||||
{
|
||||
if (arg.type == MTLArgumentTypeBuffer
|
||||
&& 0 == bx::strCmp(utf8String(arg.name), SHADER_UNIFORM_NAME) )
|
||||
if (arg.type == MTLBindingTypeBuffer)
|
||||
{
|
||||
const id<MTLBufferBinding> binding = (id<MTLBufferBinding>)arg;
|
||||
|
||||
if (0 == bx::strCmp(utf8String(arg.name), SHADER_UNIFORM_NAME) )
|
||||
{
|
||||
BX_ASSERT(arg.index == 0, "Uniform buffer must be in the buffer slot 0.");
|
||||
BX_ASSERT(MTLDataTypeStruct == arg.bufferDataType, "%s's type must be a struct",SHADER_UNIFORM_NAME );
|
||||
|
||||
if (MTLDataTypeStruct == arg.bufferDataType)
|
||||
BX_ASSERT(
|
||||
MTLDataTypeStruct == binding.bufferDataType
|
||||
, SHADER_UNIFORM_NAME "'s type must be a struct"
|
||||
);
|
||||
|
||||
if (MTLDataTypeStruct == binding.bufferDataType)
|
||||
{
|
||||
if (shaderType == 0)
|
||||
{
|
||||
ps->m_vshConstantBufferSize = uint32_t(arg.bufferDataSize);
|
||||
ps->m_vshConstantBufferAlignment = uint32_t(arg.bufferAlignment);
|
||||
ps->m_vshConstantBufferSize = uint32_t(binding.bufferDataSize);
|
||||
ps->m_vshConstantBufferAlignment = uint32_t(binding.bufferAlignment);
|
||||
}
|
||||
else
|
||||
{
|
||||
ps->m_fshConstantBufferSize = uint32_t(arg.bufferDataSize);
|
||||
ps->m_fshConstantBufferAlignment = uint32_t(arg.bufferAlignment);
|
||||
ps->m_fshConstantBufferSize = uint32_t(binding.bufferDataSize);
|
||||
ps->m_fshConstantBufferAlignment = uint32_t(binding.bufferAlignment);
|
||||
}
|
||||
|
||||
for (MTLStructMember* uniform in arg.bufferStructType.members )
|
||||
for (MTLStructMember* uniform in binding.bufferStructType.members )
|
||||
{
|
||||
const char* name = utf8String(uniform.name);
|
||||
BX_TRACE("uniform: %s type:%d", name, uniform.dataType);
|
||||
|
@ -2024,9 +2031,8 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (arg.type == MTLArgumentTypeBuffer
|
||||
&& arg.index > 0
|
||||
&& NULL != arg.bufferStructType)
|
||||
else if (arg.index > 0
|
||||
&& NULL != binding.bufferStructType)
|
||||
{
|
||||
const char* name = utf8String(arg.name);
|
||||
BX_UNUSED(name);
|
||||
|
@ -2050,7 +2056,8 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
|
|||
BX_TRACE("Buffer %s index: %d", name, int32_t(arg.index-1) );
|
||||
}
|
||||
}
|
||||
else if (arg.type == MTLArgumentTypeTexture)
|
||||
}
|
||||
else if (arg.type == MTLBindingTypeTexture)
|
||||
{
|
||||
const char* name = utf8String(arg.name);
|
||||
|
||||
|
@ -2060,8 +2067,13 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
|
|||
}
|
||||
else
|
||||
{
|
||||
ps->m_bindingTypes[arg.index] = fragmentBit ? PipelineStateMtl::BindToFragmentShader : PipelineStateMtl::BindToVertexShader;
|
||||
ps->m_bindingTypes[arg.index] = fragmentBit
|
||||
? PipelineStateMtl::BindToFragmentShader
|
||||
: PipelineStateMtl::BindToVertexShader
|
||||
;
|
||||
|
||||
const UniformRegInfo* info = s_renderMtl->m_uniformReg.find(name);
|
||||
|
||||
if (info)
|
||||
{
|
||||
BX_TRACE("texture %s %d index:%d", name, info->m_handle, uint32_t(arg.index) );
|
||||
|
@ -2072,7 +2084,7 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (arg.type == MTLArgumentTypeSampler)
|
||||
else if (arg.type == MTLBindingTypeSampler)
|
||||
{
|
||||
BX_TRACE("sampler: %s index:%d", utf8String(arg.name), arg.index);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue