[Mesa-dev] [PATCH 1/2] tgsi/scan: set maximum index for each constant buffer
Marek Olšák
maraeo at gmail.com
Wed Oct 30 14:37:31 CET 2013
From: Marek Olšák <marek.olsak at amd.com>
---
src/gallium/auxiliary/tgsi/tgsi_scan.c | 13 ++++++++++++-
src/gallium/auxiliary/tgsi/tgsi_scan.h | 1 +
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 05b7111..0f10556 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -60,6 +60,8 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
memset(info, 0, sizeof(*info));
for (i = 0; i < TGSI_FILE_COUNT; i++)
info->file_max[i] = -1;
+ for (i = 0; i < Elements(info->const_file_max); i++)
+ info->const_file_max[i] = -1;
/**
** Setup to begin parsing input shader
@@ -172,7 +174,16 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
info->file_count[file]++;
info->file_max[file] = MAX2(info->file_max[file], (int)reg);
- if (file == TGSI_FILE_INPUT) {
+ if (file == TGSI_FILE_CONSTANT) {
+ int buffer = 0;
+
+ if (fulldecl->Declaration.Dimension)
+ buffer = fulldecl->Dim.Index2D;
+
+ info->const_file_max[buffer] =
+ MAX2(info->const_file_max[buffer], (int)reg);
+ }
+ else if (file == TGSI_FILE_INPUT) {
info->input_semantic_name[reg] = (ubyte) semName;
info->input_semantic_index[reg] = (ubyte) semIndex;
info->input_interpolate[reg] = (ubyte)fulldecl->Interp.Interpolate;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h
index d9147bd..9f45c36 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
@@ -59,6 +59,7 @@ struct tgsi_shader_info
uint file_mask[TGSI_FILE_COUNT]; /**< bitmask of declared registers */
uint file_count[TGSI_FILE_COUNT]; /**< number of declared registers */
int file_max[TGSI_FILE_COUNT]; /**< highest index of declared registers */
+ int const_file_max[PIPE_MAX_CONSTANT_BUFFERS];
uint immediate_count; /**< number of immediates declared */
uint num_instructions;
--
1.8.1.2
More information about the mesa-dev
mailing list