diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 831ed3be0b..6f7e30ed33 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -66,6 +66,8 @@ #define MAX_GLSL_TEXTURE_OFFSET 4 +#define NDEBUG 1 + #ifndef NDEBUG #include "util/u_atomic.h" #include "util/simple_mtx.h" diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi_array_merge.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi_array_merge.cpp index e54bb7b9f4..0555eed38c 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi_array_merge.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi_array_merge.cpp @@ -130,19 +130,12 @@ #include #include -#include - -#include "st_glsl_to_tgsi_array_merge.h" - -#if __cplusplus >= 201402L -#include -using std::unique_ptr; -using std::make_unique; -#endif #define ARRAY_MERGE_DEBUG 0 #if ARRAY_MERGE_DEBUG > 0 +#include + #define ARRAY_MERGE_DUMP(x) do std::cerr << x; while (0) #define ARRAY_MERGE_DUMP_BLOCK(x) do { x } while (0) #else @@ -150,6 +143,15 @@ using std::make_unique; #define ARRAY_MERGE_DUMP_BLOCK(x) #endif +#include "st_glsl_to_tgsi_array_merge.h" + +#if __cplusplus >= 201402L +#include +using std::unique_ptr; +using std::make_unique; +#endif + + static const char xyzw[] = "xyzw"; array_live_range::array_live_range(): @@ -302,6 +304,7 @@ void array_live_range::set_target(array_live_range *target) target_array = target; } +#if ARRAY_MERGE_DEBUG > 0 void array_live_range::print(std::ostream& os) const { os << "[id:" << id @@ -312,6 +315,7 @@ void array_live_range::print(std::ostream& os) const << ", nc:" << (int)used_component_count << "]"; } +#endif bool array_live_range::time_doesnt_overlap(const array_live_range& other) const { @@ -388,6 +392,7 @@ uint16_t array_remapping::map_swizzles(uint16_t old_swizzle) const return out_swizzle; } +#if ARRAY_MERGE_DEBUG > 0 void array_remapping::print(std::ostream& os) const { if (is_valid()) { @@ -399,6 +404,8 @@ void array_remapping::print(std::ostream& os) const os << "[unused]"; } } +#endif + /* Required by the unit tests */ bool operator == (const array_remapping& lhs, const array_remapping& rhs) diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi_array_merge.h b/src/mesa/state_tracker/st_glsl_to_tgsi_array_merge.h index 15738a817d..da8c0bc1ad 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi_array_merge.h +++ b/src/mesa/state_tracker/st_glsl_to_tgsi_array_merge.h @@ -68,7 +68,9 @@ public: bool time_doesnt_overlap(const array_live_range& other) const; +#if ARRAY_MERGE_DEBUG > 0 void print(std::ostream& os) const; +#endif bool is_mapped() const { return target_array != nullptr;} @@ -90,11 +92,13 @@ private: int8_t swizzle_map[4]; }; +#if ARRAY_MERGE_DEBUG > 0 inline std::ostream& operator << (std::ostream& os, const array_live_range& lt) { lt.print(os); return os; } +#endif namespace tgsi_array_merge { @@ -140,7 +144,9 @@ public: unsigned target_array_id() const {return target_id;} +#if ARRAY_MERGE_DEBUG > 0 void print(std::ostream& os) const; +#endif friend bool operator == (const array_remapping& lhs, const array_remapping& rhs); @@ -153,12 +159,14 @@ private: int8_t read_swizzle_map[4]; }; +#if ARRAY_MERGE_DEBUG > 0 inline std::ostream& operator << (std::ostream& os, const array_remapping& am) { am.print(os); return os; } +#endif /* Apply the array remapping (internal use, exposed here for testing) */ bool get_array_remapping(int narrays, array_live_range *array_live_ranges, diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp index 210c25e8ba..6455423992 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp @@ -20,6 +20,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ +#define NDEBUG 0 #include "st_glsl_to_tgsi_temprename.h" #include "st_glsl_to_tgsi_array_merge.h"