<div dir="ltr"><div>Thanks!<br><br></div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 11, 2016 at 10:39 AM, Anuj Phogat <span dir="ltr"><<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Suggested-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
Signed-off-by: Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com">anuj.phogat@gmail.com</a>><br>
---<br>
src/intel/vulkan/genX_<wbr>multisample.h | 95 ++++++++++++++++++++++++++++++<wbr>+++++<br>
src/intel/vulkan/genX_<wbr>pipeline_util.h | 35 ++-----------<br>
src/intel/vulkan/genX_state.c | 68 +++----------------------<br>
3 files changed, 106 insertions(+), 92 deletions(-)<br>
create mode 100644 src/intel/vulkan/genX_<wbr>multisample.h<br>
<br>
diff --git a/src/intel/vulkan/genX_<wbr>multisample.h b/src/intel/vulkan/genX_<wbr>multisample.h<br>
new file mode 100644<br>
index 0000000..0deb48f<br>
--- /dev/null<br>
+++ b/src/intel/vulkan/genX_<wbr>multisample.h<br>
@@ -0,0 +1,95 @@<br>
+/*<br>
+ * Copyright © 2016 Intel Corporation<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the next<br>
+ * paragraph) shall be included in all copies or substantial portions of the<br>
+ * Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL<br>
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS<br>
+ * IN THE SOFTWARE.<br>
+ */<br>
+#pragma once<br>
+<br>
+#define SAMPLE_POS_1X(prefix) \<br>
+prefix##0XOffset = 0.5; \<br>
+prefix##0YOffset = 0.5;<br>
+<br>
+#define SAMPLE_POS_2X(prefix) \<br>
+prefix##0XOffset = 0.25; \<br></blockquote><div><br></div><div>If I were to write the patch, I would probably make it "prefix##Sample0Offset = 0.25" but this is totally fine and you don't need to rework it.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+prefix##0YOffset = 0.25; \<br>
+prefix##1XOffset = 0.75; \<br>
+prefix##1YOffset = 0.75;<br>
+<br>
+#define SAMPLE_POS_4X(prefix) \<br>
+prefix##0XOffset = 0.375; \<br>
+prefix##0YOffset = 0.125; \<br>
+prefix##1XOffset = 0.875; \<br>
+prefix##1YOffset = 0.375; \<br>
+prefix##2XOffset = 0.125; \<br>
+prefix##2YOffset = 0.625; \<br>
+prefix##3XOffset = 0.625; \<br>
+prefix##3YOffset = 0.875;<br>
+<br>
+#define SAMPLE_POS_8X(prefix) \<br>
+prefix##0XOffset = 0.5625; \<br>
+prefix##0YOffset = 0.3125; \<br>
+prefix##1XOffset = 0.4375; \<br>
+prefix##1YOffset = 0.6875; \<br>
+prefix##2XOffset = 0.8125; \<br>
+prefix##2YOffset = 0.5625; \<br>
+prefix##3XOffset = 0.3125; \<br>
+prefix##3YOffset = 0.1875; \<br>
+prefix##4XOffset = 0.1875; \<br>
+prefix##4YOffset = 0.8125; \<br>
+prefix##5XOffset = 0.0625; \<br>
+prefix##5YOffset = 0.4375; \<br>
+prefix##6XOffset = 0.6875; \<br>
+prefix##6YOffset = 0.9375; \<br>
+prefix##7XOffset = 0.9375; \<br>
+prefix##7YOffset = 0.0625;<br>
+<br>
+#define SAMPLE_POS_16X(prefix) \<br>
+prefix##0XOffset = 0.5625; \<br>
+prefix##0YOffset = 0.5625; \<br>
+prefix##1XOffset = 0.4375; \<br>
+prefix##1YOffset = 0.3125; \<br>
+prefix##2XOffset = 0.3125; \<br>
+prefix##2YOffset = 0.6250; \<br>
+prefix##3XOffset = 0.7500; \<br>
+prefix##3YOffset = 0.4375; \<br>
+prefix##4XOffset = 0.1875; \<br>
+prefix##4YOffset = 0.3750; \<br>
+prefix##5XOffset = 0.6250; \<br>
+prefix##5YOffset = 0.8125; \<br>
+prefix##6XOffset = 0.8125; \<br>
+prefix##6YOffset = 0.6875; \<br>
+prefix##7XOffset = 0.6875; \<br>
+prefix##7YOffset = 0.1875; \<br>
+prefix##8XOffset = 0.3750; \<br>
+prefix##8YOffset = 0.8750; \<br>
+prefix##9XOffset = 0.5000; \<br>
+prefix##9YOffset = 0.0625; \<br>
+prefix##10XOffset = 0.2500; \<br>
+prefix##10YOffset = 0.1250; \<br>
+prefix##11XOffset = 0.1250; \<br>
+prefix##11YOffset = 0.7500; \<br>
+prefix##12XOffset = 0.0000; \<br>
+prefix##12YOffset = 0.5000; \<br>
+prefix##13XOffset = 0.9375; \<br>
+prefix##13YOffset = 0.2500; \<br>
+prefix##14XOffset = 0.8750; \<br>
+prefix##14YOffset = 0.9375; \<br>
+prefix##15XOffset = 0.0625; \<br>
+prefix##15YOffset = 0.0000;<br>
diff --git a/src/intel/vulkan/genX_<wbr>pipeline_util.h b/src/intel/vulkan/genX_<wbr>pipeline_util.h<br>
index 64b89cd..cf2adb0 100644<br>
--- a/src/intel/vulkan/genX_<wbr>pipeline_util.h<br>
+++ b/src/intel/vulkan/genX_<wbr>pipeline_util.h<br>
@@ -22,6 +22,7 @@<br>
*/<br>
<br>
#include "vk_format_info.h"<br>
+#include "genX_multisample.h"<br>
<br>
static uint32_t<br>
vertex_element_comp_control(<wbr>enum isl_format format, unsigned comp)<br>
@@ -488,42 +489,16 @@ emit_ms_state(struct anv_pipeline *pipeline,<br>
<br>
switch (samples) {<br>
case 1:<br>
- ms.Sample0XOffset = 0.5;<br>
- ms.Sample0YOffset = 0.5;<br>
+ SAMPLE_POS_1X(ms.Sample);<br>
break;<br>
case 2:<br>
- ms.Sample0XOffset = 0.25;<br>
- ms.Sample0YOffset = 0.25;<br>
- ms.Sample1XOffset = 0.75;<br>
- ms.Sample1YOffset = 0.75;<br>
+ SAMPLE_POS_2X(ms.Sample);<br>
break;<br>
case 4:<br>
- ms.Sample0XOffset = 0.375;<br>
- ms.Sample0YOffset = 0.125;<br>
- ms.Sample1XOffset = 0.875;<br>
- ms.Sample1YOffset = 0.375;<br>
- ms.Sample2XOffset = 0.125;<br>
- ms.Sample2YOffset = 0.625;<br>
- ms.Sample3XOffset = 0.625;<br>
- ms.Sample3YOffset = 0.875;<br>
+ SAMPLE_POS_4X(ms.Sample);<br>
break;<br>
case 8:<br>
- ms.Sample0XOffset = 0.5625;<br>
- ms.Sample0YOffset = 0.3125;<br>
- ms.Sample1XOffset = 0.4375;<br>
- ms.Sample1YOffset = 0.6875;<br>
- ms.Sample2XOffset = 0.8125;<br>
- ms.Sample2YOffset = 0.5625;<br>
- ms.Sample3XOffset = 0.3125;<br>
- ms.Sample3YOffset = 0.1875;<br>
- ms.Sample4XOffset = 0.1875;<br>
- ms.Sample4YOffset = 0.8125;<br>
- ms.Sample5XOffset = 0.0625;<br>
- ms.Sample5YOffset = 0.4375;<br>
- ms.Sample6XOffset = 0.6875;<br>
- ms.Sample6YOffset = 0.9375;<br>
- ms.Sample7XOffset = 0.9375;<br>
- ms.Sample7YOffset = 0.0625;<br>
+ SAMPLE_POS_8X(ms.Sample);<br>
break;<br>
default:<br>
break;<br>
diff --git a/src/intel/vulkan/genX_state.<wbr>c b/src/intel/vulkan/genX_state.<wbr>c<br>
index 8253a8b..2849b50 100644<br>
--- a/src/intel/vulkan/genX_state.<wbr>c<br>
+++ b/src/intel/vulkan/genX_state.<wbr>c<br>
@@ -28,6 +28,7 @@<br>
#include <fcntl.h><br>
<br>
#include "anv_private.h"<br>
+#include "genX_multisample.h"<br>
<br>
#include "genxml/gen_macros.h"<br>
#include "genxml/genX_pack.h"<br>
@@ -76,69 +77,12 @@ genX(init_device_state)(struct anv_device *device)<br>
* VkPhysicalDeviceFeatures::<wbr>standardSampleLocations.<br>
*/<br>
anv_batch_emit(&batch, GENX(3DSTATE_SAMPLE_PATTERN), sp) {<br>
- sp._1xSample0XOffset = 0.5;<br>
- sp._1xSample0YOffset = 0.5;<br>
- sp._2xSample0XOffset = 0.25;<br>
- sp._2xSample0YOffset = 0.25;<br>
- sp._2xSample1XOffset = 0.75;<br>
- sp._2xSample1YOffset = 0.75;<br>
- sp._4xSample0XOffset = 0.375;<br>
- sp._4xSample0YOffset = 0.125;<br>
- sp._4xSample1XOffset = 0.875;<br>
- sp._4xSample1YOffset = 0.375;<br>
- sp._4xSample2XOffset = 0.125;<br>
- sp._4xSample2YOffset = 0.625;<br>
- sp._4xSample3XOffset = 0.625;<br>
- sp._4xSample3YOffset = 0.875;<br>
- sp._8xSample0XOffset = 0.5625;<br>
- sp._8xSample0YOffset = 0.3125;<br>
- sp._8xSample1XOffset = 0.4375;<br>
- sp._8xSample1YOffset = 0.6875;<br>
- sp._8xSample2XOffset = 0.8125;<br>
- sp._8xSample2YOffset = 0.5625;<br>
- sp._8xSample3XOffset = 0.3125;<br>
- sp._8xSample3YOffset = 0.1875;<br>
- sp._8xSample4XOffset = 0.1875;<br>
- sp._8xSample4YOffset = 0.8125;<br>
- sp._8xSample5XOffset = 0.0625;<br>
- sp._8xSample5YOffset = 0.4375;<br>
- sp._8xSample6XOffset = 0.6875;<br>
- sp._8xSample6YOffset = 0.9375;<br>
- sp._8xSample7XOffset = 0.9375;<br>
- sp._8xSample7YOffset = 0.0625;<br>
+ SAMPLE_POS_1X(sp._1xSample);<br>
+ SAMPLE_POS_2X(sp._2xSample);<br>
+ SAMPLE_POS_4X(sp._4xSample);<br>
+ SAMPLE_POS_8X(sp._8xSample);<br>
#if GEN_GEN >= 9<br>
- sp._16xSample0XOffset = 0.5625;<br>
- sp._16xSample0YOffset = 0.5625;<br>
- sp._16xSample1XOffset = 0.4375;<br>
- sp._16xSample1YOffset = 0.3125;<br>
- sp._16xSample2XOffset = 0.3125;<br>
- sp._16xSample2YOffset = 0.6250;<br>
- sp._16xSample3XOffset = 0.7500;<br>
- sp._16xSample3YOffset = 0.4375;<br>
- sp._16xSample4XOffset = 0.1875;<br>
- sp._16xSample4YOffset = 0.3750;<br>
- sp._16xSample5XOffset = 0.6250;<br>
- sp._16xSample5YOffset = 0.8125;<br>
- sp._16xSample6XOffset = 0.8125;<br>
- sp._16xSample6YOffset = 0.6875;<br>
- sp._16xSample7XOffset = 0.6875;<br>
- sp._16xSample7YOffset = 0.1875;<br>
- sp._16xSample8XOffset = 0.3750;<br>
- sp._16xSample8YOffset = 0.8750;<br>
- sp._16xSample9XOffset = 0.5000;<br>
- sp._16xSample9YOffset = 0.0625;<br>
- sp._16xSample10XOffset = 0.2500;<br>
- sp._16xSample10YOffset = 0.1250;<br>
- sp._16xSample11XOffset = 0.1250;<br>
- sp._16xSample11YOffset = 0.7500;<br>
- sp._16xSample12XOffset = 0.0000;<br>
- sp._16xSample12YOffset = 0.5000;<br>
- sp._16xSample13XOffset = 0.9375;<br>
- sp._16xSample13YOffset = 0.2500;<br>
- sp._16xSample14XOffset = 0.8750;<br>
- sp._16xSample14YOffset = 0.9375;<br>
- sp._16xSample15XOffset = 0.0625;<br>
- sp._16xSample15YOffset = 0.0000;<br>
+ SAMPLE_POS_16X(sp._16xSample);<br>
#endif<br>
}<br>
#endif<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.5.5<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>