<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, May 2, 2017 at 8:55 AM, Rafael Antognolli <span dir="ltr"><<a href="mailto:rafael.antognolli@intel.com" target="_blank">rafael.antognolli@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Tue, May 02, 2017 at 08:44:05AM -0700, Jason Ekstrand wrote:<br>
> On Tue, May 2, 2017 at 8:28 AM, Rafael Antognolli <<a href="mailto:rafael.antognolli@intel.com">rafael.antognolli@intel.com</a>><br>
> wrote:<br>
><br>
> On Tue, May 02, 2017 at 07:26:53AM -0700, Jason Ekstrand wrote:<br>
> > On Mon, May 1, 2017 at 6:43 PM, Rafael Antognolli <<br>
> <a href="mailto:rafael.antognolli@intel.com">rafael.antognolli@intel.com</a>><br>
> > wrote:<br>
> ><br>
> > We need to use some enums inside genX_state_upload.c, but including<br>
> the<br>
> > whole header will cause several conflicts between things defined in<br>
> this<br>
> > header and the genxml auto-generated headers.<br>
> ><br>
> > So create a separate header that is included both by brw_eu_defines.h<br>
> > and genX_state_upload.c.<br>
> ><br>
> > Signed-off-by: Rafael Antognolli <<a href="mailto:rafael.antognolli@intel.com">rafael.antognolli@intel.com</a>><br>
> > Acked-by: Reviewed-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
> > ---<br>
> > src/intel/Makefile.sources | 1 +-<br>
> > src/intel/compiler/brw_<wbr>defines_common.h | 46<br>
> ++++++++++++++++++++++++++-<br>
> > src/intel/compiler/brw_eu_<wbr>defines.h | 22 +------------<br>
> > 3 files changed, 48 insertions(+), 21 deletions(-)<br>
> > create mode 100644 src/intel/compiler/brw_<wbr>defines_common.h<br>
> ><br>
> > diff --git a/src/intel/Makefile.sources b/src/intel/Makefile.sources<br>
> > index e9a39a6..652f376 100644<br>
> > --- a/src/intel/Makefile.sources<br>
> > +++ b/src/intel/Makefile.sources<br>
> > @@ -27,6 +27,7 @@ COMPILER_FILES = \<br>
> > compiler/brw_compiler.h \<br>
> > compiler/brw_dead_control_<wbr>flow.cpp \<br>
> > compiler/brw_dead_control_<wbr>flow.h \<br>
> > + compiler/brw_defines_common.h \<br>
> > compiler/brw_disasm.c \<br>
> > compiler/brw_eu.c \<br>
> > compiler/brw_eu_compact.c \<br>
> > diff --git a/src/intel/compiler/brw_<wbr>defines_common.h b/src/intel/<br>
> compiler/<br>
> > brw_defines_common.h<br>
> > new file mode 100644<br>
> > index 0000000..fdae125<br>
> > --- /dev/null<br>
> > +++ b/src/intel/compiler/brw_<wbr>defines_common.h<br>
> > @@ -0,0 +1,46 @@<br>
> > +/*<br>
> > + * Copyright © 2017 Intel Corporation<br>
> > + *<br>
> > + * Permission is hereby granted, free of charge, to any person<br>
> obtaining a<br>
> > + * copy of this software and associated documentation files (the<br>
> > "Software"),<br>
> > + * to deal in the Software without restriction, including without<br>
> > limitation<br>
> > + * the rights to use, copy, modify, merge, publish, distribute,<br>
> > sublicense,<br>
> > + * and/or sell copies of the Software, and to permit persons to whom<br>
> the<br>
> > + * Software is furnished to do so, subject to the following<br>
> conditions:<br>
> > + *<br>
> > + * The above copyright notice and this permission notice (including<br>
> the<br>
> > next<br>
> > + * paragraph) shall be included in all copies or substantial<br>
> portions of<br>
> > the<br>
> > + * Software.<br>
> > + *<br>
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,<br>
> EXPRESS<br>
> > OR<br>
> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF<br>
> > MERCHANTABILITY,<br>
> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO<br>
> EVENT<br>
> > SHALL<br>
> > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES<br>
> OR<br>
> > OTHER<br>
> > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,<br>
> ARISING<br>
> > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR<br>
> OTHER<br>
> > DEALINGS<br>
> > + * IN THE SOFTWARE.<br>
> > + */<br>
> > +<br>
> > +#ifndef BRW_DEFINES_COMMON_H<br>
> > +#endif // BRW_DEFINES_COMMON_H<br>
> > +<br>
> > +enum brw_pixel_shader_computed_<wbr>depth_mode {<br>
> > + BRW_PSCDEPTH_OFF = 0, /* PS does not compute depth */<br>
> > + BRW_PSCDEPTH_ON = 1, /* PS computes depth; no guarantee about<br>
> value<br>
> > */<br>
> > + BRW_PSCDEPTH_ON_GE = 2, /* PS guarantees output depth >= source<br>
> depth *<br>
> > /<br>
> > + BRW_PSCDEPTH_ON_LE = 3, /* PS guarantees output depth <= source<br>
> depth *<br>
> > /<br>
> ><br>
> ><br>
> > These are provided by the pack header at least on gen8. If they're not<br>
> > available elsewhere, we should just add them.<br>
><br>
> Hmm... good point. They are values to "Pixel Shader Computed Depth Mode"<br>
> in 3DSTATE_PS_EXTRA, which is only available in gen7+, so where would be<br>
> a good place for gen6?<br>
><br>
><br>
> 3DSTATE_WM::<wbr>PixelShaderComputedDepthMode is a boolean so it doesn't have actual<br>
> enum values. That said, do we need the enum values for gen6?<br>
<br>
</div></div>We need writes_depth on gen6 too.<br>
<br>
So, I can just compare it to 0:<br>
bool writes_depth = wm_prog_data->computed_depth_<wbr>mode != 0;<br>
<br>
Is that fine?<br><div class="HOEnZb"><div class="h5"></div></div></blockquote><div><br></div><div>I think so. It's a little awkward to compare to a constant rather than an enum value but given that == 0 means OFF and != 0 means ON with potentially some extra information, I think that's fine. Then again...<br><br></div><div>One other thing that you could do given that these things live in wm_prog_data would be to move the enums into brw_compiler.h. That's probably a good thing to do anyway.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
> > +};<br>
> > +<br>
> > +enum brw_barycentric_mode {<br>
> > + BRW_BARYCENTRIC_PERSPECTIVE_<wbr>PIXEL = 0,<br>
> > + BRW_BARYCENTRIC_PERSPECTIVE_<wbr>CENTROID = 1,<br>
> > + BRW_BARYCENTRIC_PERSPECTIVE_<wbr>SAMPLE = 2,<br>
> > + BRW_BARYCENTRIC_<wbr>NONPERSPECTIVE_PIXEL = 3,<br>
> > + BRW_BARYCENTRIC_<wbr>NONPERSPECTIVE_CENTROID = 4,<br>
> > + BRW_BARYCENTRIC_<wbr>NONPERSPECTIVE_SAMPLE = 5,<br>
> ><br>
> ><br>
> > These are also in the pack header.<br>
><br>
> OK.<br>
><br>
> ><br>
> > + BRW_BARYCENTRIC_MODE_COUNT = 6<br>
> > +};<br>
> > +#define BRW_BARYCENTRIC_<wbr>NONPERSPECTIVE_BITS \<br>
> > + ((1 << BRW_BARYCENTRIC_<wbr>NONPERSPECTIVE_PIXEL) | \<br>
> > + (1 << BRW_BARYCENTRIC_<wbr>NONPERSPECTIVE_CENTROID) | \<br>
> > + (1 << BRW_BARYCENTRIC_<wbr>NONPERSPECTIVE_SAMPLE))<br>
> ><br>
> ><br>
><br>
> I think I can just define in genX_state_upload.c something like:<br>
><br>
> #define BARYCENTRYC_NONPERSPECTIVE_<wbr>BITS \<br>
> BIM_PERSPECTIVE_PIXEL | \<br>
> BIM_PERSPECTIVE_CENTROID | \<br>
> BIM_PERSPECTIVE_SAMPLE<br>
><br>
> And then I don't have to include that file.<br>
><br>
> ><br>
> > diff --git a/src/intel/compiler/brw_eu_<wbr>defines.h b/src/intel/compiler<br>
> /<br>
> > brw_eu_defines.h<br>
> > index 13a70f6..51f9cbc 100644<br>
> > --- a/src/intel/compiler/brw_eu_<wbr>defines.h<br>
> > +++ b/src/intel/compiler/brw_eu_<wbr>defines.h<br>
> > @@ -33,6 +33,7 @@<br>
> > #define BRW_EU_DEFINES_H<br>
> ><br>
> > #include "util/macros.h"<br>
> > +#include "brw_defines_common.h"<br>
> ><br>
> > /* The following hunk, up-to "Execution Unit" is used by both the<br>
> > * intel/compiler and i965 codebase. */<br>
> > @@ -72,27 +73,6 @@<br>
> > #define _3DPRIM_TRIFAN_NOSTIPPLE 0x16<br>
> > #define _3DPRIM_PATCHLIST(n) ({ assert(n > 0 && n <= 32); 0x20 + (n<br>
> - 1);<br>
> > })<br>
> ><br>
> > -enum brw_barycentric_mode {<br>
> > - BRW_BARYCENTRIC_PERSPECTIVE_<wbr>PIXEL = 0,<br>
> > - BRW_BARYCENTRIC_PERSPECTIVE_<wbr>CENTROID = 1,<br>
> > - BRW_BARYCENTRIC_PERSPECTIVE_<wbr>SAMPLE = 2,<br>
> > - BRW_BARYCENTRIC_<wbr>NONPERSPECTIVE_PIXEL = 3,<br>
> > - BRW_BARYCENTRIC_<wbr>NONPERSPECTIVE_CENTROID = 4,<br>
> > - BRW_BARYCENTRIC_<wbr>NONPERSPECTIVE_SAMPLE = 5,<br>
> > - BRW_BARYCENTRIC_MODE_COUNT = 6<br>
> > -};<br>
> > -#define BRW_BARYCENTRIC_<wbr>NONPERSPECTIVE_BITS \<br>
> > - ((1 << BRW_BARYCENTRIC_<wbr>NONPERSPECTIVE_PIXEL) | \<br>
> > - (1 << BRW_BARYCENTRIC_<wbr>NONPERSPECTIVE_CENTROID) | \<br>
> > - (1 << BRW_BARYCENTRIC_<wbr>NONPERSPECTIVE_SAMPLE))<br>
> > -<br>
> > -enum brw_pixel_shader_computed_<wbr>depth_mode {<br>
> > - BRW_PSCDEPTH_OFF = 0, /* PS does not compute depth */<br>
> > - BRW_PSCDEPTH_ON = 1, /* PS computes depth; no guarantee about<br>
> value<br>
> > */<br>
> > - BRW_PSCDEPTH_ON_GE = 2, /* PS guarantees output depth >= source<br>
> depth *<br>
> > /<br>
> > - BRW_PSCDEPTH_ON_LE = 3, /* PS guarantees output depth <= source<br>
> depth *<br>
> > /<br>
> > -};<br>
> > -<br>
> > /* Bitfields for the URB_WRITE message, DW2 of message header: */<br>
> > #define URB_WRITE_PRIM_END 0x1<br>
> > #define URB_WRITE_PRIM_START 0x2<br>
> > --<br>
> > git-series 0.9.1<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>
> ><br>
> ><br>
><br>
><br>
</div></div></blockquote></div><br></div></div>