Dave, This all looks good to me (modulo the glitch Tilman pointed out).
Keith On Thu, 2010-12-23 at 00:43 -0800, Dave Airlie wrote: > For GL fragColor semantics we need to tell the pipe drivers that the fragment > shader color result is to be replicated to all bound color buffers, this > adds the basic TGSI + documentation. > > Signed-off-by: Dave Airlie <airl...@redhat.com> > --- > src/gallium/auxiliary/tgsi/tgsi_text.c | 3 +++ > src/gallium/auxiliary/tgsi/tgsi_ureg.c | 16 +++++++++++++++- > src/gallium/auxiliary/tgsi/tgsi_ureg.h | 4 ++++ > src/gallium/docs/source/tgsi.rst | 5 +++++ > src/gallium/include/pipe/p_shader_tokens.h | 3 ++- > 5 files changed, 29 insertions(+), 2 deletions(-) > > diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c > b/src/gallium/auxiliary/tgsi/tgsi_text.c > index 9a38c37..d868b5b 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_text.c > +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c > @@ -1265,6 +1265,7 @@ static const char *property_names[] = > "GS_MAX_OUTPUT_VERTICES", > "FS_COORD_ORIGIN", > "FS_COORD_PIXEL_CENTER" > + "FS_COLOR0_WRITE_ALL_CBUFS" > }; > > static const char *primitive_names[] = > @@ -1398,6 +1399,8 @@ static boolean parse_property( struct translate_ctx > *ctx ) > return FALSE; > } > break; > + case TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS: > + break; > default: > if (!parse_uint(&ctx->cur, &values[0] )) { > report_error( ctx, "Expected unsigned integer as property!" ); > diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c > b/src/gallium/auxiliary/tgsi/tgsi_ureg.c > index 7d13a17..02de12d 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c > +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c > @@ -148,6 +148,7 @@ struct ureg_program > unsigned property_gs_max_vertices; > unsigned char property_fs_coord_origin; /* = TGSI_FS_COORD_ORIGIN_* */ > unsigned char property_fs_coord_pixel_center; /* = > TGSI_FS_COORD_PIXEL_CENTER_* */ > + unsigned char property_fs_color0_writes_all_cbufs; /* = > TGSI_FS_COLOR0_WRITES_ALL_CBUFS * */ > > unsigned nr_addrs; > unsigned nr_preds; > @@ -284,7 +285,12 @@ ureg_property_fs_coord_pixel_center(struct ureg_program > *ureg, > ureg->property_fs_coord_pixel_center = fs_coord_pixel_center; > } > > - > +void > +ureg_property_fs_color0_writes_all_cbufs(struct ureg_program *ureg, > + unsigned fs_color0_writes_all_cbufs) > +{ > + ureg->property_fs_color0_writes_all_cbufs = fs_color0_writes_all_cbufs; > +} > > struct ureg_src > ureg_DECL_fs_input_cyl_centroid(struct ureg_program *ureg, > @@ -1278,6 +1284,14 @@ static void emit_decls( struct ureg_program *ureg ) > ureg->property_fs_coord_pixel_center); > } > > + if (ureg->property_fs_color0_writes_all_cbufs) { > + assert(ureg->processor == TGSI_PROCESSOR_FRAGMENT); > + > + emit_property(ureg, > + TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS, > + ureg->property_fs_color0_writes_all_cbufs); > + } > + > if (ureg->processor == TGSI_PROCESSOR_VERTEX) { > for (i = 0; i < UREG_MAX_INPUT; i++) { > if (ureg->vs_inputs[i/32] & (1 << (i%32))) { > diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h > b/src/gallium/auxiliary/tgsi/tgsi_ureg.h > index acc4632..807128a 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h > +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h > @@ -153,6 +153,10 @@ void > ureg_property_fs_coord_pixel_center(struct ureg_program *ureg, > unsigned fs_coord_pixel_center); > > +void > +ureg_property_fs_color0_writes_all_cbufs(struct ureg_program *ureg, > + unsigned fs_color0_writes_all_cbufs); > + > /*********************************************************************** > * Build shader declarations: > */ > diff --git a/src/gallium/docs/source/tgsi.rst > b/src/gallium/docs/source/tgsi.rst > index 7eb6bd0..d986e66 100644 > --- a/src/gallium/docs/source/tgsi.rst > +++ b/src/gallium/docs/source/tgsi.rst > @@ -1516,6 +1516,11 @@ GL_ARB_fragment_coord_conventions extension. > DirectX 9 uses INTEGER. > DirectX 10 uses HALF_INTEGER. > > +FS_COLOR0_WRITES_ALL_CBUFS > +"""""""""""""""""""""""""" > +Specifies that writes to the fragment shader color 0 are replicated to all > +bound cbufs. This facilitates OpenGL's fragColor output vs fragData[0] where > +fragData is directed to a single color buffer, but fragColor is broadcast. > > > Texture Sampling and Texture Formats > diff --git a/src/gallium/include/pipe/p_shader_tokens.h > b/src/gallium/include/pipe/p_shader_tokens.h > index ba433b2..0a9e141 100644 > --- a/src/gallium/include/pipe/p_shader_tokens.h > +++ b/src/gallium/include/pipe/p_shader_tokens.h > @@ -177,7 +177,8 @@ union tgsi_immediate_data > #define TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES 2 > #define TGSI_PROPERTY_FS_COORD_ORIGIN 3 > #define TGSI_PROPERTY_FS_COORD_PIXEL_CENTER 4 > -#define TGSI_PROPERTY_COUNT 5 > +#define TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS 5 > +#define TGSI_PROPERTY_COUNT 6 > > struct tgsi_property { > unsigned Type : 4; /**< TGSI_TOKEN_TYPE_PROPERTY */ _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev