gallium: add caps for MIN/MAX texel offsets.
authorDave Airlie <airlied@redhat.com>
Mon, 29 Aug 2011 13:35:16 +0000 (14:35 +0100)
committerDave Airlie <airlied@redhat.com>
Fri, 2 Sep 2011 09:48:09 +0000 (10:48 +0100)
As per Brian's suggestion, add caps for drivers that support texture
offsets to advertise a min/max via TGSI, also use it in the state tracker.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/include/pipe/p_defines.h
src/mesa/state_tracker/st_extensions.c

index 821c0d759735b20f8d35f82a5b13d5b79f214fce..e02da6e4d980f79698f4ab907a6c6ea161a4bde0 100644 (file)
@@ -407,6 +407,12 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_TIMER_QUERY:
                return r600_get_clock_crystal_freq(rscreen->radeon) != 0;
 
+       case PIPE_CAP_MIN_TEXEL_OFFSET:
+               return -8;
+
+       case PIPE_CAP_MAX_TEXEL_OFFSET:
+               return 7;
+
        default:
                R600_ERR("r600: unknown param %d\n", param);
                return 0;
index 960ab8c96aed5841ef587796ed7e94b9e4c76733..d22ed4cdcafe03ac668b75172134c91409d1b807 100644 (file)
@@ -131,6 +131,10 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
       return 1;
    case PIPE_CAP_ARRAY_TEXTURES:
       return 1;
+   case PIPE_CAP_MIN_TEXEL_OFFSET:
+      return -8;
+   case PIPE_CAP_MAX_TEXEL_OFFSET:
+      return 7;
    default:
       return 0;
    }
index 795de1fbf62422a65bd7129c6c48d94e783b2ce1..19c0cab3d3c3f42ad0e862340259491348f540a0 100644 (file)
@@ -471,7 +471,9 @@ enum pipe_cap {
    PIPE_CAP_MIXED_COLORBUFFER_FORMATS = 46,
    PIPE_CAP_SEAMLESS_CUBE_MAP = 47,
    PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE = 48,
-   PIPE_CAP_SCALED_RESOLVE = 49
+   PIPE_CAP_SCALED_RESOLVE = 49,
+   PIPE_CAP_MIN_TEXEL_OFFSET = 50,
+   PIPE_CAP_MAX_TEXEL_OFFSET = 51,
 };
 
 /* Shader caps not specific to any single stage */
index 322dbbfd51d37e8fe8d6e2463aa7fc1ab384af55..aa7f3b52cb24287b6d3cc9714dd0bd5e795e922f 100644 (file)
@@ -203,6 +203,9 @@ void st_init_limits(struct st_context *st)
 
    /* XXX we'll need a better query here someday */
    if (screen->get_param(screen, PIPE_CAP_GLSL)) {
+      c->MinProgramTexelOffset = screen->get_param(screen, PIPE_CAP_MIN_TEXEL_OFFSET);
+      c->MaxProgramTexelOffset = screen->get_param(screen, PIPE_CAP_MAX_TEXEL_OFFSET);
+
       c->GLSLVersion = 120;
    }
 }