summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr/rasterizer/scripts
diff options
context:
space:
mode:
authorTim Rowley <[email protected]>2016-10-30 19:27:07 -0500
committerTim Rowley <[email protected]>2016-11-14 09:02:25 -0600
commit584b65ad442f8219c0216961641d4b9f4a1671da (patch)
tree92850c4dddbb624278fe20340f3f2c86be8522e4 /src/gallium/drivers/swr/rasterizer/scripts
parente6f7d8a0946822d2f90099df2bf2a3d0969ebd74 (diff)
swr: [rasterizer archrast] don't generate empty files
Don't generate files when no events have been generated outside the header events. Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/rasterizer/scripts')
-rw-r--r--src/gallium/drivers/swr/rasterizer/scripts/templates/ar_eventhandlerfile_h.template17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/scripts/templates/ar_eventhandlerfile_h.template b/src/gallium/drivers/swr/rasterizer/scripts/templates/ar_eventhandlerfile_h.template
index 97eca59f564..ada134d01c3 100644
--- a/src/gallium/drivers/swr/rasterizer/scripts/templates/ar_eventhandlerfile_h.template
+++ b/src/gallium/drivers/swr/rasterizer/scripts/templates/ar_eventhandlerfile_h.template
@@ -81,6 +81,12 @@ namespace ArchRast
{
if (mBufOffset > 0)
{
+ if (mBufOffset == mHeaderBufOffset)
+ {
+ // Nothing to flush. Only header has been generated.
+ return false;
+ }
+
std::ofstream file;
file.open(mFilename, std::ios::out | std::ios::app | std::ios::binary);
@@ -94,6 +100,7 @@ namespace ArchRast
file.close();
mBufOffset = 0;
+ mHeaderBufOffset = 0; // Reset header offset so its no longer considered.
}
return true;
}
@@ -121,7 +128,7 @@ namespace ArchRast
% for name in protos['event_names']:
//////////////////////////////////////////////////////////////////////////
/// @brief Handle ${name} event
- virtual void Handle(${name}& event)
+ virtual void Handle(${name}&& event)
{
% if protos['events'][name]['num_fields'] == 0:
Write(${protos['events'][name]['event_id']}, (char*)&event.data, 0);
@@ -131,10 +138,18 @@ namespace ArchRast
}
% endfor
+ //////////////////////////////////////////////////////////////////////////
+ /// @brief Everything written to buffer this point is the header.
+ virtual void MarkHeader()
+ {
+ mHeaderBufOffset = mBufOffset;
+ }
+
std::string mFilename;
static const uint32_t mBufferSize = 1024;
uint8_t mBuffer[mBufferSize];
uint32_t mBufOffset{0};
+ uint32_t mHeaderBufOffset{0};
};
}