Starting to expose the number of changes to the input format

This commit is contained in:
samcake 2016-04-19 12:03:57 -07:00
parent 9ff9682b2a
commit fb363180c8
4 changed files with 35 additions and 5 deletions

View file

@ -173,6 +173,11 @@ Item {
prop: "frameSetPipelineCount",
label: "Pipelines",
color: "#E2334D"
},
{
prop: "frameSetInputFormatCount",
label: "Input Formats",
color: "#1AC567"
}
]
}

View file

@ -12,12 +12,33 @@
using namespace gpu;
GLBackend::GLInputFormat::GLInputFormat() {
}
GLBackend::GLInputFormat:: ~GLInputFormat() {
}
GLBackend::GLInputFormat* GLBackend::syncGPUObject(const Stream::Format& inputFormat) {
GLInputFormat* object = Backend::getGPUObject<GLBackend::GLInputFormat>(inputFormat);
if (object) {
return object;
}
object = new GLInputFormat();
Backend::setGPUObject(inputFormat, object);
}
void GLBackend::do_setInputFormat(Batch& batch, size_t paramOffset) {
Stream::FormatPointer format = batch._streamFormats.get(batch._params[paramOffset]._uint);
if (format != _input._format) {
_input._format = format;
_input._invalidFormat = true;
GLInputFormat* ifo = GLBackend::syncGPUObject(*format);
if (ifo) {
if (format != _input._format) {
_input._format = format;
_input._invalidFormat = true;
}
}
}
@ -89,7 +110,7 @@ void GLBackend::syncInputStateCache() {
// Core 41 doesn't expose the features to really separate the vertex format from the vertex buffers binding
// Core 43 does :)
// FIXME crashing problem with glVertexBindingDivisor / glVertexAttribFormat
#if 1 || (GPU_INPUT_PROFILE == GPU_CORE_41)
#if(GPU_INPUT_PROFILE == GPU_CORE_41)
#define NO_SUPPORT_VERTEX_ATTRIB_FORMAT
#else
#define SUPPORT_VERTEX_ATTRIB_FORMAT

View file

@ -50,6 +50,7 @@ void EngineStats::run(const SceneContextPointer& sceneContext, const RenderConte
config->frameTextureMemoryUsage = _gpuStats._RSAmountTextureMemoryBounded - gpuStats._RSAmountTextureMemoryBounded;
config->frameSetPipelineCount = _gpuStats._PSNumSetPipelines - gpuStats._PSNumSetPipelines;
config->frameSetInputFormatCount = _gpuStats._ISNumFormatChanges - gpuStats._ISNumFormatChanges;
config->emitDirty();
}

View file

@ -48,6 +48,7 @@ namespace render {
Q_PROPERTY(quint32 frameTextureMemoryUsage MEMBER frameTextureMemoryUsage NOTIFY dirty)
Q_PROPERTY(quint32 frameSetPipelineCount MEMBER frameSetPipelineCount NOTIFY dirty)
Q_PROPERTY(quint32 frameSetInputFormatCount MEMBER frameSetInputFormatCount NOTIFY dirty)
public:
@ -78,6 +79,8 @@ namespace render {
quint32 frameSetPipelineCount{ 0 };
quint32 frameSetInputFormatCount{ 0 };
void emitDirty() { emit dirty(); }