+++ /dev/null
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// 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.
-
-#ifndef sw_MetaMacro_hpp
-#define sw_MetaMacro_hpp
-
-// Disables the "identifier was truncated to '255' characters in the browser information" warning
-#ifdef _MSC_VER
-#pragma warning(disable: 4786)
-#endif
-
-namespace Meta
-{
-#define META_ASSERT(condition) typedef int COMPILE_TIME_ASSERT_##__LINE__[static_cast<bool>(condition) ? 1 : -1]
-
- template<class T>
- struct IsVoid
- {
- enum {res = false};
- };
-
- template<>
- struct IsVoid<void>
- {
- enum {res = true};
- };
-
-#define META_IS_VOID(T) Meta::IsVoid<T>::res
-
- template<bool>
- struct Select
- {
- template<class T0, class T1>
- struct Type
- {
- typedef T1 Res;
- };
- };
-
- template<>
- struct Select<true>
- {
- template<class T0, class T1>
- struct Type
- {
- typedef T0 Res;
- };
- };
-
-#define META_SELECT(i, T0, T1) Meta::Select<i>::template Type<T0, T1>::Res
-
- template<class B0, class B1>
- struct Inherit : B0, B1
- {
- };
-
-#define META_INHERIT(B0, B1) Meta::Inherit<B0, B1>
-
- template<class B0, class B1>
- class Catenate
- {
- typedef typename META_SELECT(META_IS_VOID(B0), B1, B0) T0;
- typedef typename META_SELECT(META_IS_VOID(B0), void, B1) T1;
-
- public:
- typedef typename META_INHERIT(T0, T1) T01;
- typedef typename META_SELECT(META_IS_VOID(T1), T0, T01) Res;
-
- private:
- typedef typename META_SELECT(META_IS_VOID(T1), int, T1) CheckedT1;
-
- META_ASSERT(META_IS_VOID(T1) || sizeof(Res) == sizeof(T0) + sizeof(CheckedT1));
- };
-
-#define META_CATENATE(B0, B1) Meta::Catenate<B0, B1>::Res
-
- template<bool condition, class B0, class B1>
- class ConditionalInherit
- {
- typedef typename META_CATENATE(B0, B1) MetaInherit;
-
- public:
- typedef typename META_SELECT(condition, MetaInherit, B0) Res;
- };
-
-#define META_CONDITIONAL_INHERIT(condition, B0, B1) Meta::ConditionalInherit<condition, B0, B1>::Res
-}
-
-#endif // sw_MetaMacro_hpp
#define D3D9_Capabilities_hpp
#include "Config.hpp"
-#include "MetaMacro.hpp"
#include <d3d9.h>
};
// Shader Model 3.0 requirements
- META_ASSERT(MAX_VERTEX_SHADER_CONST >= 256);
- META_ASSERT(MAX_PIXEL_SHADER_CONST == 224);
- META_ASSERT(MAX_VERTEX_INPUTS == 16);
- META_ASSERT(MAX_VERTEX_OUTPUTS == 12);
- META_ASSERT(MAX_PIXEL_INPUTS == 10);
+ static_assert(MAX_VERTEX_SHADER_CONST >= 256, "");
+ static_assert(MAX_PIXEL_SHADER_CONST == 224, "");
+ static_assert(MAX_VERTEX_INPUTS == 16, "");
+ static_assert(MAX_VERTEX_OUTPUTS == 12, "");
+ static_assert(MAX_PIXEL_INPUTS == 10, "");
// Back-end minimum requirements
- META_ASSERT(sw::VERTEX_UNIFORM_VECTORS >= MAX_VERTEX_SHADER_CONST);
- META_ASSERT(sw::FRAGMENT_UNIFORM_VECTORS >= MAX_PIXEL_SHADER_CONST);
- META_ASSERT(sw::MAX_VERTEX_INPUTS >= MAX_VERTEX_INPUTS);
- META_ASSERT(sw::MAX_VERTEX_OUTPUTS >= MAX_VERTEX_OUTPUTS);
- META_ASSERT(sw::MAX_FRAGMENT_INPUTS >= MAX_PIXEL_INPUTS);
+ static_assert(sw::VERTEX_UNIFORM_VECTORS >= MAX_VERTEX_SHADER_CONST, "");
+ static_assert(sw::FRAGMENT_UNIFORM_VECTORS >= MAX_PIXEL_SHADER_CONST, "");
+ static_assert(sw::MAX_VERTEX_INPUTS >= MAX_VERTEX_INPUTS, "");
+ static_assert(sw::MAX_VERTEX_OUTPUTS >= MAX_VERTEX_OUTPUTS, "");
+ static_assert(sw::MAX_FRAGMENT_INPUTS >= MAX_PIXEL_INPUTS, "");
}
#endif // D3D9_Capabilities_hpp
#endif // __ANDROID__
-// A macro functioning as a compile-time assert to validate constant conditions
-#define META_ASSERT(condition) typedef int COMPILE_TIME_ASSERT_##__LINE__[static_cast<bool>(condition) ? 1 : -1]
-
#endif // COMMON_DEBUG_H_
return x.attribute < y.attribute; \
}
- META_ASSERT(EGL_NONE < EGL_SLOW_CONFIG && EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG);
+ static_assert(EGL_NONE < EGL_SLOW_CONFIG && EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG, "");
SORT_SMALLER(mConfigCaveat);
- META_ASSERT(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER);
+ static_assert(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER, "");
SORT_SMALLER(mColorBufferType);
SORT_SMALLER(mRedSize);
return x->attribute < y->attribute; \
}
- META_ASSERT(EGL_NONE < EGL_SLOW_CONFIG && EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG);
+ static_assert(EGL_NONE < EGL_SLOW_CONFIG && EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG, "");
SORT_SMALLER(mConfigCaveat);
- META_ASSERT(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER);
+ static_assert(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER, "");
SORT_SMALLER(mColorBufferType);
// By larger total number of color bits, only considering those that are requested to be > 0.
<Unit filename="../../Common/Math.hpp" />
<Unit filename="../../Common/Memory.cpp" />
<Unit filename="../../Common/Memory.hpp" />
- <Unit filename="../../Common/MetaMacro.hpp" />
<Unit filename="../../Common/MutexLock.hpp" />
<Unit filename="../../Common/Resource.cpp" />
<Unit filename="../../Common/Resource.hpp" />
<Unit filename="../../Common/Math.hpp" />
<Unit filename="../../Common/Memory.cpp" />
<Unit filename="../../Common/Memory.hpp" />
- <Unit filename="../../Common/MetaMacro.hpp" />
<Unit filename="../../Common/MutexLock.hpp" />
<Unit filename="../../Common/Resource.cpp" />
<Unit filename="../../Common/Resource.hpp" />
#include "PixelPipeline.hpp"
#include "PixelProgram.hpp"
#include "PixelShader.hpp"
-#include "MetaMacro.hpp"
#include "Surface.hpp"
#include "Primitive.hpp"
#include "Constants.hpp"
#include "Sampler.hpp"
-#include "MetaMacro.hpp"
#include "Context.hpp"
#include "Surface.hpp"
#include "CPUID.hpp"
#define Vertex_hpp
#include "Color.hpp"
-#include "Common/MetaMacro.hpp"
#include "Common/Types.hpp"
#include "Main/Config.hpp"
int padding[3];
});
- META_ASSERT((sizeof(Vertex) & 0x0000000F) == 0);
+ static_assert((sizeof(Vertex) & 0x0000000F) == 0, "Vertex size not a multiple of 16 bytes (alignment requirement)");
}
#endif // Vertex_hpp
<ClInclude Include="..\Common\Half.hpp" />\r
<ClInclude Include="..\Common\Math.hpp" />\r
<ClInclude Include="..\Common\Memory.hpp" />\r
- <ClInclude Include="..\Common\MetaMacro.hpp" />\r
<ClInclude Include="..\Common\MutexLock.hpp" />\r
<ClInclude Include="..\Common\Resource.hpp" />\r
<ClInclude Include="..\Common\Timer.hpp" />\r
<ClInclude Include="..\Common\Memory.hpp">\r
<Filter>Header Files\Common</Filter>\r
</ClInclude>\r
- <ClInclude Include="..\Common\MetaMacro.hpp">\r
- <Filter>Header Files\Common</Filter>\r
- </ClInclude>\r
<ClInclude Include="..\Common\MutexLock.hpp">\r
<Filter>Header Files\Common</Filter>\r
</ClInclude>\r