summarylogtreecommitdiffstats
path: root/patch.diff
blob: fc397be5d148d02587474baa7fe055ff8e0e518c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
 renderdoc/CMakeLists.txt              |  3 +++
 renderdoc/driver/vulkan/vk_replay.cpp | 33 ++++++++++++++++++++++++++++++---
 renderdoc/maths/half_convert.h        |  9 +++++++--
 renderdoc/serialise/utf8printf.cpp    | 19 +++++++++++++++----
 4 files changed, 55 insertions(+), 9 deletions(-)

diff --git a/renderdoc/CMakeLists.txt b/renderdoc/CMakeLists.txt
index 0a7eed3..0051a2d 100644
--- a/renderdoc/CMakeLists.txt
+++ b/renderdoc/CMakeLists.txt
@@ -138,6 +138,9 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
         PROPERTIES COMPILE_FLAGS "-Wno-extra -Wno-unused-function")
 endif()
 
+set_source_files_properties(3rdparty/jpeg-compressor/jpgd.cpp
+    PROPERTIES COMPILE_FLAGS "-Wno-shift-negative-value")
+
 add_library(rdoc OBJECT ${sources})
 target_compile_definitions(rdoc ${RDOC_DEFINITIONS})
 target_include_directories(rdoc ${RDOC_INCLUDES})
diff --git a/renderdoc/driver/vulkan/vk_replay.cpp b/renderdoc/driver/vulkan/vk_replay.cpp
index d0b5738..6e9eb18 100644
--- a/renderdoc/driver/vulkan/vk_replay.cpp
+++ b/renderdoc/driver/vulkan/vk_replay.cpp
@@ -1584,7 +1584,8 @@ void VulkanReplay::RenderMesh(uint32_t eventID, const vector<MeshFormat> &second
 		MeshUBOData *data = (MeshUBOData *)GetDebugManager()->m_MeshUBO.Map(vt, dev, &uboOffs);
 
 		data->mvp = ModelViewProj;
-		data->color = (Vec4f &)cfg.prevMeshColour;
+    data->color = Vec4f(cfg.prevMeshColour.x, cfg.prevMeshColour.y, cfg.prevMeshColour.z,
+                        cfg.prevMeshColour.w);
 		data->homogenousInput = cfg.position.unproject;
 		data->pointSpriteSize = Vec2f(0.0f, 0.0f);
 		data->displayFormat = MESHDISPLAY_SOLID;
@@ -3257,7 +3258,20 @@ void VulkanReplay::SavePipelineState()
 									dst.bindings[b].binds[a].res = rm->GetOriginalID(c.m_BufferView[viewid].buffer);
 									dst.bindings[b].binds[a].offset = c.m_BufferView[viewid].offset;
 									if(dynamicOffset)
-										dst.bindings[b].binds[a].offset += *(uint32_t *)&info[a].imageInfo.imageLayout;
+                  {
+                    union
+                    {
+                      VkImageLayout l;
+                      uint32_t u;
+                    } offs;
+
+                    RDCCOMPILE_ASSERT(sizeof(VkImageLayout) == sizeof(uint32_t),
+                                      "VkImageLayout isn't 32-bit sized");
+
+                    offs.l = info[a].imageInfo.imageLayout;
+
+                    dst.bindings[b].binds[a].offset += offs.u;
+                  }
 									dst.bindings[b].binds[a].size = c.m_BufferView[viewid].size;
 								}
 								else
@@ -3280,7 +3294,20 @@ void VulkanReplay::SavePipelineState()
 
 								dst.bindings[b].binds[a].offset = info[a].bufferInfo.offset;
 								if(dynamicOffset)
-									dst.bindings[b].binds[a].offset += *(uint32_t *)&info[a].imageInfo.imageLayout;
+                {
+                  union
+                  {
+                    VkImageLayout l;
+                    uint32_t u;
+                  } offs;
+
+                  RDCCOMPILE_ASSERT(sizeof(VkImageLayout) == sizeof(uint32_t),
+                                    "VkImageLayout isn't 32-bit sized");
+
+                  offs.l = info[a].imageInfo.imageLayout;
+
+                  dst.bindings[b].binds[a].offset += offs.u;
+                }
 
 								dst.bindings[b].binds[a].size = info[a].bufferInfo.range;
 							}
diff --git a/renderdoc/maths/half_convert.h b/renderdoc/maths/half_convert.h
index b6f63d5..4577345 100644
--- a/renderdoc/maths/half_convert.h
+++ b/renderdoc/maths/half_convert.h
@@ -121,7 +121,12 @@ inline float ConvertFromHalf(uint16_t comp)
 	}
 	else //if(exponent = 0x1f)
 	{
-		int nan = 0x7F800001;
-		return *(float*)&nan;
+		union
+		{
+			int i;
+			float f;
+		} nan;
+		nan.i = 0x7F800001;
+		return nan.f;
 	}
 }
diff --git a/renderdoc/serialise/utf8printf.cpp b/renderdoc/serialise/utf8printf.cpp
index b9b7aa8..8aa949d 100644
--- a/renderdoc/serialise/utf8printf.cpp
+++ b/renderdoc/serialise/utf8printf.cpp
@@ -115,22 +115,33 @@ void PrintInteger(bool typeUnsigned, uint64_t argu, int base, uint64_t numbits,
 {
 	int64_t argi = 0;
 	
+  union
+  {
+    uint64_t *u64;
+    signed int *i;
+    signed char *c;
+    signed short *s;
+    int64_t *i64;
+  } typepun;
+
+  typepun.u64 = &argu;
+
 	// cast the appropriate size to signed version
 	switch(formatter.Length)
 	{
 		default:
 		case None:
 		case Long:
-			argi = (int64_t)*(signed int*)&argu;
+			argi = (int64_t)*typepun.i;
 			break;
 		case HalfHalf:
-			argi = (int64_t)*(signed char*)&argu;
+			argi = (int64_t)*typepun.c;
 			break;
 		case Half:
-			argi = (int64_t)*(signed short*)&argu;
+			argi = (int64_t)*typepun.s;
 			break;
 		case LongLong:
-			argi = (int64_t)*(int64_t*)&argu;
+			argi = (int64_t)*typepun.i64;
 			break;
 	}