#include "tgsi/tgsi_scan.h"
#include "svga_state.h"
+#include "svga_hw_reg.h"
+#include "svga3d_shaderdefs.h"
#define SVGA_TEX_UNITS 8
float zero_stride_constants[PIPE_MAX_ATTRIBS*4];
};
-#define RS_MAX 97
-#define TS_MAX 30
-#define CB_MAX 256
-
struct svga_prescale {
float translate[4];
float scale[4];
*/
struct svga_hw_draw_state
{
- unsigned rs[RS_MAX];
- unsigned ts[16][TS_MAX];
- float cb[PIPE_SHADER_TYPES][CB_MAX][4];
+ unsigned rs[SVGA3D_RS_MAX];
+ unsigned ts[SVGA3D_PIXEL_SAMPLERREG_MAX][SVGA3D_TS_MAX];
+ float cb[PIPE_SHADER_TYPES][SVGA3D_CONSTREG_MAX][4];
struct svga_shader_result *fs;
struct svga_shader_result *vs;
{
enum pipe_error ret = PIPE_OK;
- assert(i < CB_MAX);
-
assert(shader < PIPE_SHADER_TYPES);
+ assert(i < SVGA3D_CONSTREG_MAX);
+
if (memcmp(svga->state.hw_draw.cb[shader][i], value, 4 * sizeof(float)) != 0) {
if (SVGA_DEBUG & DEBUG_CONSTS)
debug_printf("%s %s %u: %f %f %f %f\n",
enum pipe_error ret;
#ifdef DEBUG
- if (offset + count > CB_MAX) {
+ if (offset + count > SVGA3D_CONSTREG_MAX) {
debug_printf("svga: too many constants (offset + count = %u)\n",
offset + count);
}
#endif
- if (offset > CB_MAX) {
+ if (offset > SVGA3D_CONSTREG_MAX) {
/* This isn't OK, but if we propagate an error all the way up we'll
* just get into more trouble.
* XXX note that offset is always zero at this time so this is moot.
return PIPE_OK;
}
- if (offset + count > CB_MAX) {
+ if (offset + count > SVGA3D_CONSTREG_MAX) {
/* Just drop the extra constants for now.
* Ideally we should not have allowed the app to create a shader
* that exceeds our constant buffer size but there's no way to
* express that in gallium at this time.
*/
- count = CB_MAX - offset;
+ count = SVGA3D_CONSTREG_MAX - offset;
}
i = 0;
**********************************************************/
#include "util/u_inlines.h"
+#include "util/u_memory.h"
#include "pipe/p_defines.h"
#include "util/u_math.h"
#define EMIT_RS(svga, value, token, fail) \
do { \
+ assert(SVGA3D_RS_##token < Elements(svga->state.hw_draw.rs)); \
if (svga->state.hw_draw.rs[SVGA3D_RS_##token] != value) { \
svga_queue_rs( &queue, SVGA3D_RS_##token, value ); \
svga->state.hw_draw.rs[SVGA3D_RS_##token] = value; \
#define EMIT_RS_FLOAT(svga, fvalue, token, fail) \
do { \
unsigned value = fui(fvalue); \
+ assert(SVGA3D_RS_##token < Elements(svga->state.hw_draw.rs)); \
if (svga->state.hw_draw.rs[SVGA3D_RS_##token] != value) { \
svga_queue_rs( &queue, SVGA3D_RS_##token, value ); \
svga->state.hw_draw.rs[SVGA3D_RS_##token] = value; \
**********************************************************/
#include "util/u_inlines.h"
+#include "util/u_memory.h"
#include "pipe/p_defines.h"
#include "util/u_math.h"
#define EMIT_TS(svga, unit, val, token, fail) \
do { \
+ assert(unit < Elements(svga->state.hw_draw.ts)); \
+ assert(SVGA3D_TS_##token < Elements(svga->state.hw_draw.ts[unit])); \
if (svga->state.hw_draw.ts[unit][SVGA3D_TS_##token] != val) { \
svga_queue_tss( &queue, unit, SVGA3D_TS_##token, val ); \
svga->state.hw_draw.ts[unit][SVGA3D_TS_##token] = val; \
#define EMIT_TS_FLOAT(svga, unit, fvalue, token, fail) \
do { \
unsigned val = fui(fvalue); \
+ assert(unit < Elements(svga->state.hw_draw.ts)); \
+ assert(SVGA3D_TS_##token < Elements(svga->state.hw_draw.ts[unit])); \
if (svga->state.hw_draw.ts[unit][SVGA3D_TS_##token] != val) { \
svga_queue_tss( &queue, unit, SVGA3D_TS_##token, val ); \
svga->state.hw_draw.ts[unit][SVGA3D_TS_##token] = val; \