mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 02:38:04 +02:00
trace: Dump shaders as text.
This commit is contained in:
parent
673489fa5c
commit
696067e781
2 changed files with 44 additions and 5 deletions
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "tgsi/tgsi_parse.h"
|
||||
#include "tgsi/tgsi_dump.h"
|
||||
|
||||
#include "tr_dump.h"
|
||||
#include "tr_state.h"
|
||||
|
|
@ -240,18 +240,19 @@ void trace_dump_constant_buffer(struct trace_stream *stream,
|
|||
void trace_dump_shader_state(struct trace_stream *stream,
|
||||
const struct pipe_shader_state *state)
|
||||
{
|
||||
static char str[8192];
|
||||
assert(state);
|
||||
if(!state) {
|
||||
trace_dump_null(stream);
|
||||
return;
|
||||
}
|
||||
|
||||
tgsi_dump_str(state->tokens, 0, str, sizeof(str));
|
||||
|
||||
trace_dump_struct_begin(stream, "pipe_shader_state");
|
||||
|
||||
trace_dump_member_begin(stream, "tokens");
|
||||
trace_dump_bytes(stream,
|
||||
state->tokens,
|
||||
sizeof(struct tgsi_token) * tgsi_num_tokens(state->tokens));
|
||||
trace_dump_string(stream, str);
|
||||
trace_dump_member_end(stream);
|
||||
|
||||
trace_dump_struct_end(stream);
|
||||
|
|
|
|||
|
|
@ -109,7 +109,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
<xsl:template match="string">
|
||||
<span class="lit">
|
||||
<xsl:text>"</xsl:text>
|
||||
<xsl:value-of select="text()"/>
|
||||
<xsl:call-template name="break">
|
||||
<xsl:with-param name="text" select="text()"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text>"</xsl:text>
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
|
@ -144,4 +146,40 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
<xsl:value-of select="."/>
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="break">
|
||||
<xsl:param name="text" select="."/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($text, '
')">
|
||||
<xsl:value-of select="substring-before($text, '
')"/>
|
||||
<br/>
|
||||
<xsl:call-template name="break">
|
||||
<xsl:with-param name="text" select="substring-after($text, '
')"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$text"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="replace">
|
||||
<xsl:param name="text"/>
|
||||
<xsl:param name="from"/>
|
||||
<xsl:param name="to"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($text,$from)">
|
||||
<xsl:value-of select="concat(substring-before($text,$from),$to)"/>
|
||||
<xsl:call-template name="replace">
|
||||
<xsl:with-param name="text" select="substring-after($text,$from)"/>
|
||||
<xsl:with-param name="from" select="$from"/>
|
||||
<xsl:with-param name="to" select="$to"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$text"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:transform>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue