i965/gen6+: Use non-normalized coordinates for GL_TEXTURE_RECTANGLE.

Improves performance of a GL_TEXTURE_RECTANGLE microbenchmark by 1.84%
+/- .15% (n=3)
This commit is contained in:
Eric Anholt 2011-08-17 13:41:43 -07:00
parent 4eeb4c1505
commit 9d4b98eb9e
4 changed files with 19 additions and 2 deletions

View file

@ -1056,7 +1056,8 @@ fs_visitor::visit(ir_texture *ir)
* texture coordinates. We use the program parameter state
* tracking to get the scaling factor.
*/
if (ir->sampler->type->sampler_dimensionality == GLSL_SAMPLER_DIM_RECT) {
if (intel->gen < 6 &&
ir->sampler->type->sampler_dimensionality == GLSL_SAMPLER_DIM_RECT) {
struct gl_program_parameter_list *params = c->fp->program.Base.Parameters;
int tokens[STATE_LENGTH] = {
STATE_INTERNAL,

View file

@ -664,6 +664,8 @@ static void precalc_lit( struct brw_wm_compile *c,
static void precalc_tex( struct brw_wm_compile *c,
const struct prog_instruction *inst )
{
struct brw_compile *p = &c->func;
struct intel_context *intel = &p->brw->intel;
struct prog_src_register coord;
struct prog_dst_register tmpcoord = { 0 };
const GLuint unit = c->fp->program.Base.SamplerUnits[inst->TexSrcUnit];
@ -727,7 +729,7 @@ static void precalc_tex( struct brw_wm_compile *c,
release_temp(c, tmp0);
release_temp(c, tmp1);
}
else if (inst->TexSrcTarget == TEXTURE_RECT_INDEX) {
else if (intel->gen < 6 && inst->TexSrcTarget == TEXTURE_RECT_INDEX) {
struct prog_src_register scale =
search_or_add_param5( c,
STATE_INTERNAL,

View file

@ -289,6 +289,13 @@ static void brw_update_sampler_state(struct brw_context *brw,
sampler->ss1.max_lod = U_FIXED(CLAMP(gl_sampler->MaxLod, 0, 13), 6);
sampler->ss1.min_lod = U_FIXED(CLAMP(gl_sampler->MinLod, 0, 13), 6);
/* On Gen6+, the sampler can handle non-normalized texture
* rectangle coordinates natively
*/
if (intel->gen >= 6 && texObj->Target == GL_TEXTURE_RECTANGLE) {
sampler->ss3.non_normalized_coord = 1;
}
upload_default_color(brw, gl_sampler, unit);
if (intel->gen >= 6) {

View file

@ -157,6 +157,13 @@ gen7_update_sampler_state(struct brw_context *brw, int unit,
sampler->ss1.max_lod = U_FIXED(CLAMP(gl_sampler->MaxLod, 0, 13), 8);
sampler->ss1.min_lod = U_FIXED(CLAMP(gl_sampler->MinLod, 0, 13), 8);
/* The sampler can handle non-normalized texture rectangle coordinates
* natively
*/
if (texObj->Target == GL_TEXTURE_RECTANGLE) {
sampler->ss3.non_normalized_coord = 1;
}
upload_default_color(brw, gl_sampler, unit);
sampler->ss2.default_color_pointer = brw->wm.sdc_offset[unit] >> 5;