Commit a508d2dd authored by Luca Barbieri's avatar Luca Barbieri

gallium: introduce get_shader_param (ALL DRIVERS CHANGED) (v3)

Changes in v3:
- Also change trace, which I forgot about

Changes in v2:
- No longer adds tessellation shaders

Currently each shader cap has FS and VS versions.

However, we want a version of them for geometry, tessellation control,
and tessellation evaluation shaders, and want to be able to easily
query a given cap type for a given shader stage.

Since having 5 duplicates of each shader cap is unmanageable, add
a new get_shader_param function that takes both a shader cap from a
new enum and a shader stage.

Drivers with non-unified shaders will first switch on the shader
and, within each case, switch on the cap.

Drivers with unified shaders instead first check whether the shader
is supported, and then switch on the cap.

MAX_CONST_BUFFERS is now per-stage.
The geometry shader cap is removed in favor of checking whether the
limit of geometry shader instructions is greater than 0, which is also
used for tessellation shaders.

WARNING: all drivers changed and compiled but only nvfx tested
parent 309cd411
......@@ -39,6 +39,7 @@
#include "pipe/p_state.h"
#include "tgsi/tgsi_exec.h"
struct pipe_context;
struct draw_context;
......@@ -225,4 +226,16 @@ boolean draw_need_pipeline(const struct draw_context *draw,
const struct pipe_rasterizer_state *rasterizer,
unsigned prim );
static INLINE int
draw_get_shader_param(unsigned shader, enum pipe_cap param)
{
switch(shader) {
case PIPE_SHADER_VERTEX:
case PIPE_SHADER_GEOMETRY:
return tgsi_exec_get_shader_param(param);
default:
return 0;
}
}
#endif /* DRAW_CONTEXT_H */
......@@ -377,6 +377,36 @@ tgsi_exec_set_constant_buffers(struct tgsi_exec_machine *mach,
const unsigned *buf_sizes);
static INLINE int
tgsi_exec_get_shader_param(enum pipe_shader_cap param)
{
switch(param) {
case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
return INT_MAX;
case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
return TGSI_EXEC_MAX_NESTING;
case PIPE_SHADER_CAP_MAX_INPUTS:
return TGSI_EXEC_MAX_INPUT_ATTRIBS;
case PIPE_SHADER_CAP_MAX_CONSTS:
return TGSI_EXEC_MAX_CONST_BUFFER;
case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
return PIPE_MAX_CONSTANT_BUFFERS;
case PIPE_SHADER_CAP_MAX_TEMPS:
return TGSI_EXEC_NUM_TEMPS;
case PIPE_SHADER_CAP_MAX_ADDRS:
return TGSI_EXEC_NUM_ADDRS;
case PIPE_SHADER_CAP_MAX_PREDS:
return TGSI_EXEC_NUM_PREDS;
case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
return 1;
default:
return 0;
}
}
#if defined __cplusplus
} /* extern "C" */
#endif
......
......@@ -75,6 +75,13 @@ util_check_caps_out(struct pipe_screen *screen, const unsigned *list, int *out)
return FALSE;
}
break;
case UTIL_CAPS_CHECK_SHADER:
tmpi = screen->get_shader_param(screen, list[i] >> 24, list[i] & ((1 << 24) - 1));
++i;
if (tmpi < (int)list[i++]) {
*out = i - 3;
return FALSE;
}
case UTIL_CAPS_CHECK_UNIMPLEMENTED:
*out = i - 1;
return FALSE;
......@@ -188,17 +195,17 @@ static unsigned caps_opengl_2_1[] = {
/* Shader Model 3 */
static unsigned caps_sm3[] = {
UTIL_CHECK_INT(MAX_FS_INSTRUCTIONS, 512),
UTIL_CHECK_INT(MAX_FS_INPUTS, 10),
UTIL_CHECK_INT(MAX_FS_TEMPS, 32),
UTIL_CHECK_INT(MAX_FS_ADDRS, 1),
UTIL_CHECK_INT(MAX_FS_CONSTS, 224),
UTIL_CHECK_SHADER(FRAGMENT, MAX_INSTRUCTIONS, 512),
UTIL_CHECK_SHADER(FRAGMENT, MAX_INPUTS, 10),
UTIL_CHECK_SHADER(FRAGMENT, MAX_TEMPS, 32),
UTIL_CHECK_SHADER(FRAGMENT, MAX_ADDRS, 1),
UTIL_CHECK_SHADER(FRAGMENT, MAX_CONSTS, 224),
UTIL_CHECK_INT(MAX_VS_INSTRUCTIONS, 512),
UTIL_CHECK_INT(MAX_VS_INPUTS, 16),
UTIL_CHECK_INT(MAX_VS_TEMPS, 32),
UTIL_CHECK_INT(MAX_VS_ADDRS, 2),
UTIL_CHECK_INT(MAX_VS_CONSTS, 256),
UTIL_CHECK_SHADER(VERTEX, MAX_INSTRUCTIONS, 512),
UTIL_CHECK_SHADER(VERTEX, MAX_INPUTS, 16),
UTIL_CHECK_SHADER(VERTEX, MAX_TEMPS, 32),
UTIL_CHECK_SHADER(VERTEX, MAX_ADDRS, 2),
UTIL_CHECK_SHADER(VERTEX, MAX_CONSTS, 256),
UTIL_CHECK_TERMINATE
};
......
......@@ -38,6 +38,7 @@ enum u_caps_check_enum {
UTIL_CAPS_CHECK_INT,
UTIL_CAPS_CHECK_FLOAT,
UTIL_CAPS_CHECK_FORMAT,
UTIL_CAPS_CHECK_SHADER,
UTIL_CAPS_CHECK_UNIMPLEMENTED,
};
......@@ -54,6 +55,9 @@ enum u_caps_check_enum {
#define UTIL_CHECK_FORMAT(format) \
UTIL_CAPS_CHECK_FORMAT, PIPE_FORMAT_##format
#define UTIL_CHECK_SHADER(shader, cap, higher) \
UTIL_CAPS_CHECK_SHADER, (PIPE_SHADER_##shader << 24) | PIPE_SHADER_CAP_##cap, (unsigned)(higher)
#define UTIL_CHECK_UNIMPLEMENTED \
UTIL_CAPS_CHECK_UNIMPLEMENTED
......
......@@ -399,7 +399,6 @@ static INLINE boolean util_get_offset(
}
}
#ifdef __cplusplus
}
#endif
......
......@@ -90,8 +90,6 @@ cell_get_param(struct pipe_screen *screen, enum pipe_cap param)
return 1; /* XXX not really true */
case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
return 0; /* XXX to do */
case PIPE_CAP_TGSI_CONT_SUPPORTED:
return 1;
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
return 1;
......@@ -105,6 +103,20 @@ cell_get_param(struct pipe_screen *screen, enum pipe_cap param)
}
}
static int
cell_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param)
{
switch(shader)
{
case PIPE_SHADER_FRAGMENT:
return tgsi_exec_get_shader_param(param);
case PIPE_SHADER_VERTEX:
case PIPE_SHADER_GEOMETRY:
return draw_get_shader_param(shader, param);
default:
return 0;
}
}
static float
cell_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
......@@ -200,6 +212,7 @@ cell_create_screen(struct sw_winsys *winsys)
screen->base.get_name = cell_get_name;
screen->base.get_vendor = cell_get_vendor;
screen->base.get_param = cell_get_param;
screen->base.get_shader_param = cell_get_shader_param;
screen->base.get_paramf = cell_get_paramf;
screen->base.is_format_supported = cell_is_format_supported;
screen->base.context_create = cell_create_context;
......
......@@ -116,6 +116,7 @@ struct pipe_context *failover_create( struct pipe_context *hw,
failover->pipe.get_name = hw->get_name;
failover->pipe.get_vendor = hw->get_vendor;
failover->pipe.get_param = hw->get_param;
failover->pipe.get_shader_param = hw->get_shader_param;
failover->pipe.get_paramf = hw->get_paramf;
#endif
......
......@@ -469,11 +469,11 @@ galahad_set_constant_buffer(struct pipe_context *_pipe,
if (index &&
index >=
pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_CONST_BUFFERS)) {
pipe->screen->get_shader_param(pipe->screen, shader, PIPE_SHADER_CAP_MAX_CONST_BUFFERS)) {
glhd_error("Access to constant buffer %u requested, "
"but only %d are supported",
index,
pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_CONST_BUFFERS));
pipe->screen->get_shader_param(pipe->screen, shader, PIPE_SHADER_CAP_MAX_CONST_BUFFERS));
}
/* XXX hmm? unwrap the input state */
......
......@@ -79,6 +79,17 @@ galahad_screen_get_param(struct pipe_screen *_screen,
param);
}
static int
galahad_screen_get_shader_param(struct pipe_screen *_screen,
unsigned shader, enum pipe_shader_cap param)
{
struct galahad_screen *glhd_screen = galahad_screen(_screen);
struct pipe_screen *screen = glhd_screen->screen;
return screen->get_shader_param(screen, shader,
param);
}
static float
galahad_screen_get_paramf(struct pipe_screen *_screen,
enum pipe_cap param)
......@@ -341,6 +352,7 @@ galahad_screen_create(struct pipe_screen *screen)
glhd_screen->base.get_name = galahad_screen_get_name;
glhd_screen->base.get_vendor = galahad_screen_get_vendor;
glhd_screen->base.get_param = galahad_screen_get_param;
glhd_screen->base.get_shader_param = galahad_screen_get_shader_param;
glhd_screen->base.get_paramf = galahad_screen_get_paramf;
glhd_screen->base.is_format_supported = galahad_screen_is_format_supported;
glhd_screen->base.context_create = galahad_screen_context_create;
......
......@@ -139,6 +139,49 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap param)
}
}
static int
i915_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param)
{
switch(shader) {
case PIPE_SHADER_VERTEX:
return draw_get_shader_param(shader, param);
case PIPE_SHADER_FRAGMENT:
break;
default:
return 0;
}
/* XXX: these are just shader model 2.0 values, fix this! */
switch(param) {
case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
return 96;
case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
return 64;
case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
return 32;
case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
return 8;
case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
return 0;
case PIPE_SHADER_CAP_MAX_INPUTS:
return 10;
case PIPE_SHADER_CAP_MAX_CONSTS:
return 32;
case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
return 1;
case PIPE_SHADER_CAP_MAX_TEMPS:
return 12; /* XXX: 12 -> 32 ? */
case PIPE_SHADER_CAP_MAX_ADDRS:
return 0;
case PIPE_SHADER_CAP_MAX_PREDS:
return 0;
case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
return 0;
default:
break;
}
}
static float
i915_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
{
......@@ -320,6 +363,7 @@ i915_screen_create(struct i915_winsys *iws)
is->base.get_name = i915_get_name;
is->base.get_vendor = i915_get_vendor;
is->base.get_param = i915_get_param;
is->base.get_shader_param = i915_get_shader_param;
is->base.get_paramf = i915_get_paramf;
is->base.is_format_supported = i915_is_format_supported;
......
......@@ -197,6 +197,49 @@ brw_get_param(struct pipe_screen *screen, enum pipe_cap param)
}
}
static int
brw_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param)
{
switch(shader) {
case PIPE_SHADER_VERTEX:
case PIPE_SHADER_FRAGMENT:
case PIPE_SHADER_GEOMETRY:
break;
default:
return 0;
}
/* XXX: these are just shader model 4.0 values, fix this! */
switch(param) {
case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
return 65536;
case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
return 65536;
case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
return 65536;
case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
return 65536;
case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
return 65536;
case PIPE_SHADER_CAP_MAX_INPUTS:
return 32;
case PIPE_SHADER_CAP_MAX_CONSTS:
return 4096;
case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
return PIPE_MAX_CONSTANT_BUFFERS;
case PIPE_SHADER_CAP_MAX_TEMPS:
return 4096;
case PIPE_SHADER_CAP_MAX_ADDRS:
return 0;
case PIPE_SHADER_CAP_MAX_PREDS:
return 0;
case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
return 1;
default:
break;
}
}
static float
brw_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
{
......@@ -410,6 +453,7 @@ brw_screen_create(struct brw_winsys_screen *sws)
bscreen->base.get_name = brw_get_name;
bscreen->base.get_vendor = brw_get_vendor;
bscreen->base.get_param = brw_get_param;
bscreen->base.get_shader_param = brw_get_shader_param;
bscreen->base.get_paramf = brw_get_paramf;
bscreen->base.is_format_supported = brw_is_format_supported;
bscreen->base.context_create = brw_create_context;
......
......@@ -67,7 +67,7 @@ identity_screen_get_vendor(struct pipe_screen *_screen)
static int
identity_screen_get_param(struct pipe_screen *_screen,
enum pipe_cap param)
unsigned shader, enum pipe_cap param)
{
struct identity_screen *id_screen = identity_screen(_screen);
struct pipe_screen *screen = id_screen->screen;
......@@ -76,6 +76,17 @@ identity_screen_get_param(struct pipe_screen *_screen,
param);
}
static int
identity_screen_get_shader_param(struct pipe_screen *_screen,
unsigned shader, enum pipe_shader_cap param)
{
struct identity_screen *id_screen = identity_screen(_screen);
struct pipe_screen *screen = id_screen->screen;
return screen->get_shader_param(screen, shader,
param);
}
static float
identity_screen_get_paramf(struct pipe_screen *_screen,
enum pipe_cap param)
......@@ -304,6 +315,7 @@ identity_screen_create(struct pipe_screen *screen)
id_screen->base.get_name = identity_screen_get_name;
id_screen->base.get_vendor = identity_screen_get_vendor;
id_screen->base.get_param = identity_screen_get_param;
id_screen->base.get_shader_param = identity_screen_get_shader_param;
id_screen->base.get_paramf = identity_screen_get_paramf;
id_screen->base.is_format_supported = identity_screen_is_format_supported;
id_screen->base.context_create = identity_screen_context_create;
......
......@@ -33,6 +33,7 @@
#include "util/u_format_s3tc.h"
#include "pipe/p_defines.h"
#include "pipe/p_screen.h"
#include "draw/draw_context.h"
#include "gallivm/lp_bld_limits.h"
#include "lp_texture.h"
......@@ -132,8 +133,6 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
return LP_MAX_TEXTURE_3D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
return LP_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_TGSI_CONT_SUPPORTED:
return 1;
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
return 1;
case PIPE_CAP_INDEP_BLEND_ENABLE:
......@@ -146,47 +145,29 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
return 0;
case PIPE_CAP_MAX_VS_INSTRUCTIONS:
case PIPE_CAP_MAX_FS_INSTRUCTIONS:
case PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS:
case PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS:
case PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS:
case PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS:
case PIPE_CAP_MAX_VS_TEX_INDIRECTIONS:
case PIPE_CAP_MAX_FS_TEX_INDIRECTIONS:
/* There is no limit in number of instructions beyond available memory */
return 32768;
case PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH:
case PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH:
return LP_MAX_TGSI_NESTING;
case PIPE_CAP_MAX_VS_INPUTS:
case PIPE_CAP_MAX_FS_INPUTS:
return PIPE_MAX_ATTRIBS;
case PIPE_CAP_MAX_FS_CONSTS:
case PIPE_CAP_MAX_VS_CONSTS:
/* There is no limit in number of constants beyond available memory */
return 32768;
case PIPE_CAP_MAX_VS_TEMPS:
case PIPE_CAP_MAX_FS_TEMPS:
return LP_MAX_TGSI_TEMPS;
case PIPE_CAP_MAX_VS_ADDRS:
case PIPE_CAP_MAX_FS_ADDRS:
return LP_MAX_TGSI_ADDRS;
case PIPE_CAP_MAX_VS_PREDS:
case PIPE_CAP_MAX_FS_PREDS:
return LP_MAX_TGSI_PREDS;
case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE:
return 1;
case PIPE_CAP_GEOMETRY_SHADER4:
return 1;
case PIPE_CAP_DEPTH_CLAMP:
return 0;
default:
assert(0);
return 0;
}
}
static int
llvmpipe_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param)
{
switch(shader)
{
case PIPE_SHADER_FRAGMENT:
return tgsi_exec_get_shader_param(param);
case PIPE_SHADER_VERTEX:
case PIPE_SHADER_GEOMETRY:
return draw_get_shader_param(shader, param);
default:
return 0;
}
}
static float
llvmpipe_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
......@@ -402,6 +383,7 @@ llvmpipe_create_screen(struct sw_winsys *winsys)
screen->base.get_name = llvmpipe_get_name;
screen->base.get_vendor = llvmpipe_get_vendor;
screen->base.get_param = llvmpipe_get_param;
screen->base.get_shader_param = llvmpipe_get_shader_param;
screen->base.get_paramf = llvmpipe_get_paramf;
screen->base.is_format_supported = llvmpipe_is_format_supported;
......
......@@ -142,8 +142,6 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
return 1;
case PIPE_CAP_TGSI_CONT_SUPPORTED:
return 1;
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
return 1;
case PIPE_CAP_INDEP_BLEND_ENABLE:
......@@ -158,38 +156,51 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
return 0;
case PIPE_CAP_MAX_VS_INSTRUCTIONS:
case PIPE_CAP_MAX_FS_INSTRUCTIONS:
case PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS:
case PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS:
case PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS:
case PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS:
case PIPE_CAP_MAX_VS_TEX_INDIRECTIONS:
case PIPE_CAP_MAX_FS_TEX_INDIRECTIONS: /* arbitrary limit */
case PIPE_CAP_DEPTH_CLAMP:
return 1;
default:
NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
return 0;
}
}
static int
nv50_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader, enum pipe_shader_cap param)
{
switch(shader)
{
case PIPE_SHADER_FRAGMENT:
case PIPE_SHADER_VERTEX:
case PIPE_SHADER_GEOMETRY:
break;
default:
return 0;
}
switch(param) {
case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS: /* arbitrary limit */
return 16384;
case PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH:
case PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH: /* need stack bo */
case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH: /* need stack bo */
return 4;
case PIPE_CAP_MAX_VS_INPUTS:
return 16;
case PIPE_CAP_MAX_FS_INPUTS: /* 128 / 4 with GP */
return 64 / 4;
case PIPE_CAP_MAX_VS_CONSTS:
case PIPE_CAP_MAX_FS_CONSTS:
case PIPE_SHADER_CAP_MAX_INPUTS: /* 128 / 4 with GP */
if(shader == PIPE_SHADER_GEOMETRY)
return 128 / 4;
else
return 64 / 4;
case PIPE_SHADER_CAP_MAX_CONSTS:
return 65536 / 16;
case PIPE_CAP_MAX_VS_ADDRS:
case PIPE_CAP_MAX_FS_ADDRS: /* no spilling atm */
case PIPE_SHADER_CAP_MAX_ADDRS: /* no spilling atm */
return 1;
case PIPE_CAP_MAX_VS_PREDS:
case PIPE_CAP_MAX_FS_PREDS: /* not yet handled */
case PIPE_SHADER_CAP_MAX_PREDS: /* not yet handled */
return 0;
case PIPE_CAP_MAX_VS_TEMPS:
case PIPE_CAP_MAX_FS_TEMPS: /* no spilling atm */
case PIPE_SHADER_CAP_MAX_TEMPS: /* no spilling atm */
return 128 / 4;
case PIPE_CAP_DEPTH_CLAMP:
case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
return 1;
default:
NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
return 0;
}
}
......@@ -315,6 +326,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
pscreen->winsys = ws;
pscreen->destroy = nv50_screen_destroy;
pscreen->get_param = nv50_screen_get_param;
pscreen->get_shader_param = nv50_screen_get_shader_param;
pscreen->get_paramf = nv50_screen_get_paramf;
pscreen->is_format_supported = nv50_screen_is_format_supported;
pscreen->context_create = nv50_create;
......
......@@ -58,8 +58,6 @@ nvfx_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return 1;
case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
return 0; /* We have 4 on nv40 - but unsupported currently */
case PIPE_CAP_TGSI_CONT_SUPPORTED:
return 0;
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
return screen->advertise_blend_equation_separate;
case PIPE_CAP_MAX_COMBINED_SAMPLERS:
......@@ -77,49 +75,6 @@ nvfx_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
return 1;
case PIPE_CAP_MAX_FS_INSTRUCTIONS:
case PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS:
case PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS:
case PIPE_CAP_MAX_FS_TEX_INDIRECTIONS:
return 4096;
case PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH:
/* FIXME: is it the dynamic (nv30:0/nv40:24) or the static
value (nv30:0/nv40:4) ? */
return screen->use_nv4x ? 4 : 0;
case PIPE_CAP_MAX_FS_INPUTS:
return screen->use_nv4x ? 12 : 10;
case PIPE_CAP_MAX_FS_CONSTS:
return screen->use_nv4x ? 224 : 32;
case PIPE_CAP_MAX_FS_TEMPS:
return 32;
case PIPE_CAP_MAX_FS_ADDRS:
return screen->use_nv4x ? 1 : 0;
case PIPE_CAP_MAX_FS_PREDS:
return 0; /* we could expose these, but nothing uses them */
case PIPE_CAP_MAX_VS_INSTRUCTIONS:
case PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS:
return screen->use_nv4x ? 512 : 256;
case PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS:
case PIPE_CAP_MAX_VS_TEX_INDIRECTIONS:
return screen->use_nv4x ? 512 : 0;
case PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH:
/* FIXME: is it the dynamic (nv30:24/nv40:24) or the static
value (nv30:1/nv40:4) ? */
return screen->use_nv4x ? 4 : 1;
case PIPE_CAP_MAX_VS_INPUTS:
return 16;
case PIPE_CAP_MAX_VS_CONSTS:
/* - 6 is for clip planes; Gallium should be fixed to put
* them in the vertex shader itself, so we don't need to reserve these */
return (screen->use_nv4x ? 468 : 256) - 6;
case PIPE_CAP_MAX_VS_TEMPS:
return screen->use_nv4x ? 32 : 13;
case PIPE_CAP_MAX_VS_ADDRS:
return 2;
case PIPE_CAP_MAX_VS_PREDS:
return 0; /* we could expose these, but nothing uses them */
case PIPE_CAP_GEOMETRY_SHADER4:
return 0;
case PIPE_CAP_DEPTH_CLAMP:
return 0; // TODO: implement depth clamp
default:
......@@ -128,6 +83,79 @@ nvfx_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
}
}
static int
nvfx_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader, enum pipe_shader_cap param)
{
struct nvfx_screen *screen = nvfx_screen(pscreen);
switch(shader) {
case PIPE_SHADER_FRAGMENT:
switch(param) {
case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
return 4096;
case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
/* FIXME: is it the dynamic (nv30:0/nv40:24) or the static
value (nv30:0/nv40:4) ? */
return screen->use_nv4x ? 4 : 0;
case PIPE_SHADER_CAP_MAX_INPUTS:
return screen->use_nv4x ? 12 : 10;
case PIPE_SHADER_CAP_MAX_CONSTS:
return screen->use_nv4x ? 224 : 32;
case PIPE_SHADER_CAP_MAX_CONST_BUFFERS: