i965: SF: Move the computation of urb_entry_read_offset.

This patch moves the computation of the SF URB entry read offset from
upload_sf_unit() to its own function, so that it can be re-used when
creating the gen4-5 SF program.

Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Paul Berry
2011-08-23 13:49:19 -07:00
parent f3ecc90730
commit 39fc725b0c
2 changed files with 17 additions and 4 deletions
+1
View File
@@ -104,5 +104,6 @@ void brw_emit_line_setup( struct brw_sf_compile *c, GLboolean allocate );
void brw_emit_point_setup( struct brw_sf_compile *c, GLboolean allocate );
void brw_emit_point_sprite_setup( struct brw_sf_compile *c, GLboolean allocate );
void brw_emit_anyprim_setup( struct brw_sf_compile *c );
int brw_sf_compute_urb_entry_read_offset(struct intel_context *intel);
#endif
+16 -4
View File
@@ -35,6 +35,7 @@
#include "brw_state.h"
#include "brw_defines.h"
#include "main/macros.h"
#include "brw_sf.h"
static void upload_sf_vp(struct brw_context *brw)
{
@@ -121,6 +122,19 @@ const struct brw_tracked_state brw_sf_vp = {
.prepare = upload_sf_vp
};
/**
* Compute the offset within the URB (expressed in 256-bit register
* increments) that should be used to read the VUE in th efragment shader.
*/
int
brw_sf_compute_urb_entry_read_offset(struct intel_context *intel)
{
if (intel->gen == 5)
return 3;
else
return 1;
}
static void upload_sf_unit( struct brw_context *brw )
{
struct intel_context *intel = &brw->intel;
@@ -148,10 +162,8 @@ static void upload_sf_unit( struct brw_context *brw )
sf->thread3.dispatch_grf_start_reg = 3;
if (intel->gen == 5)
sf->thread3.urb_entry_read_offset = 3;
else
sf->thread3.urb_entry_read_offset = 1;
sf->thread3.urb_entry_read_offset =
brw_sf_compute_urb_entry_read_offset(intel);
/* CACHE_NEW_SF_PROG */
sf->thread3.urb_entry_read_length = brw->sf.prog_data->urb_read_length;