common/v3d_debug.c \
common/v3d_debug.h \
common/v3d_device_info.h \
+ common/v3d_limits.h \
common/v3d_macros.h \
compiler/nir_to_vir.c \
compiler/vir.c \
--- /dev/null
+/*
+ * Copyright © 2019 Broadcom
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef V3D_LIMITS_H
+#define V3D_LIMITS_H
+
+#define V3D_MAX_FS_INPUTS 64
+#define V3D_MAX_VS_INPUTS 64
+
+/* Not specifically a hardware limit, just coordination between compiler and
+ * driver.
+ */
+#define V3D_MAX_TEXTURE_SAMPLERS 32
+
+#define V3D_MAX_MIP_LEVELS 12
+
+#define V3D_MAX_SAMPLES 4
+
+#define V3D_MAX_DRAW_BUFFERS 4
+
+#endif /* V3D_LIMITS_H */
#include "util/macros.h"
#include "common/v3d_debug.h"
#include "common/v3d_device_info.h"
+#include "common/v3d_limits.h"
#include "compiler/nir/nir.h"
#include "util/list.h"
#include "util/u_math.h"
#include "qpu/qpu_instr.h"
#include "pipe/p_state.h"
-#define V3D_MAX_TEXTURE_SAMPLERS 32
-#define V3D_MAX_SAMPLES 4
-#define V3D_MAX_FS_INPUTS 64
-#define V3D_MAX_VS_INPUTS 64
-
struct nir_builder;
struct v3d_fs_inputs {
#include "v3d_screen.h"
#include "v3d_context.h"
#include "v3d_resource.h"
+#include "broadcom/compiler/v3d_compiler.h"
void
v3d_flush(struct pipe_context *pctx)
#include "xf86drm.h"
#include "v3d_drm.h"
#include "v3d_screen.h"
+#include "broadcom/common/v3d_limits.h"
struct v3d_job;
struct v3d_bo;
};
struct v3d_vertex_stateobj {
- struct pipe_vertex_element pipe[V3D_MAX_ATTRIBUTES];
+ struct pipe_vertex_element pipe[V3D_MAX_VS_INPUTS / 4];
unsigned num_elements;
- uint8_t attrs[16 * V3D_MAX_ATTRIBUTES];
+ uint8_t attrs[16 * (V3D_MAX_VS_INPUTS / 4)];
struct pipe_resource *defaults;
uint32_t defaults_offset;
};
if (shader == PIPE_SHADER_FRAGMENT)
return V3D_MAX_FS_INPUTS / 4;
else
- return V3D_MAX_ATTRIBUTES;
+ return V3D_MAX_VS_INPUTS / 4;
case PIPE_SHADER_CAP_MAX_OUTPUTS:
if (shader == PIPE_SHADER_FRAGMENT)
return 4;
struct v3d_bo;
-#define V3D_MAX_MIP_LEVELS 12
-#define V3D_MAX_TEXTURE_SAMPLERS 32
-#define V3D_MAX_SAMPLES 4
-#define V3D_MAX_DRAW_BUFFERS 4
-#define V3D_MAX_ATTRIBUTES 16
-
/* These are tunable parameters in the HW design, but all the V3D
* implementations agree.
*/
attr.maximum_index = 0xffffff;
#endif
}
- STATIC_ASSERT(sizeof(vtx->attrs) >= V3D_MAX_ATTRIBUTES * size);
+ STATIC_ASSERT(sizeof(vtx->attrs) >= V3D_MAX_VS_INPUTS / 4 * size);
}
if (vtx->num_elements == 0) {
#include "v3d_context.h"
#include "v3d_tiling.h"
#include "broadcom/common/v3d_macros.h"
+#include "broadcom/compiler/v3d_compiler.h"
#include "broadcom/cle/v3dx_pack.h"
static void
*/
uint32_t *attrs;
u_upload_alloc(v3d->state_uploader, 0,
- V3D_MAX_ATTRIBUTES * 4 * sizeof(float), 16,
+ V3D_MAX_VS_INPUTS * sizeof(float), 16,
&so->defaults_offset, &so->defaults, (void **)&attrs);
- for (int i = 0; i < V3D_MAX_ATTRIBUTES; i++) {
+ for (int i = 0; i < V3D_MAX_VS_INPUTS / 4; i++) {
attrs[i * 4 + 0] = 0;
attrs[i * 4 + 1] = 0;
attrs[i * 4 + 2] = 0;