Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/opensubdiv/internal/evaluator/eval_output.h')
-rw-r--r--intern/opensubdiv/internal/evaluator/eval_output.h36
1 files changed, 24 insertions, 12 deletions
diff --git a/intern/opensubdiv/internal/evaluator/eval_output.h b/intern/opensubdiv/internal/evaluator/eval_output.h
index c0da108edca..e8480e8d816 100644
--- a/intern/opensubdiv/internal/evaluator/eval_output.h
+++ b/intern/opensubdiv/internal/evaluator/eval_output.h
@@ -27,6 +27,8 @@
#include "internal/base/type.h"
#include "internal/evaluator/evaluator_impl.h"
+#include "opensubdiv_evaluator_capi.h"
+
using OpenSubdiv::Far::PatchTable;
using OpenSubdiv::Far::StencilTable;
using OpenSubdiv::Osd::BufferDescriptor;
@@ -42,6 +44,8 @@ class EvalOutputAPI::EvalOutput {
public:
virtual ~EvalOutput() = default;
+ virtual void updateSettings(const OpenSubdiv_EvaluatorSettings *settings) = 0;
+
virtual void updateData(const float *src, int start_vertex, int num_vertices) = 0;
virtual void updateVaryingData(const float *src, int start_vertex, int num_vertices) = 0;
@@ -347,13 +351,13 @@ class VolatileEvalOutput : public EvalOutputAPI::EvalOutput {
const StencilTable *varying_stencils,
const vector<const StencilTable *> &all_face_varying_stencils,
const int face_varying_width,
- const int vertex_data_width,
const PatchTable *patch_table,
EvaluatorCache *evaluator_cache = NULL,
DEVICE_CONTEXT *device_context = NULL)
- : src_desc_(0, 3, 3),
+ : src_vertex_data_(NULL),
+ src_desc_(0, 3, 3),
src_varying_desc_(0, 3, 3),
- src_vertex_data_desc_(0, vertex_data_width, vertex_data_width),
+ src_vertex_data_desc_(0, 0, 0),
face_varying_width_(face_varying_width),
evaluator_cache_(evaluator_cache),
device_context_(device_context)
@@ -371,15 +375,6 @@ class VolatileEvalOutput : public EvalOutputAPI::EvalOutput {
varying_stencils_ = convertToCompatibleStencilTable<STENCIL_TABLE>(varying_stencils,
device_context_);
- // Optionally allocate additional data to be subdivided like vertex coordinates.
- if (vertex_data_width > 0) {
- src_vertex_data_ = SRC_VERTEX_BUFFER::Create(
- vertex_data_width, num_total_vertices, device_context_);
- }
- else {
- src_vertex_data_ = NULL;
- }
-
// Create evaluators for every face varying channel.
face_varying_evaluators_.reserve(all_face_varying_stencils.size());
int face_varying_channel = 0;
@@ -407,6 +402,23 @@ class VolatileEvalOutput : public EvalOutputAPI::EvalOutput {
}
}
+ void updateSettings(const OpenSubdiv_EvaluatorSettings *settings) override
+ {
+ // Optionally allocate additional data to be subdivided like vertex coordinates.
+ if (settings->num_vertex_data != src_vertex_data_desc_.length) {
+ delete src_vertex_data_;
+ if (settings->num_vertex_data > 0) {
+ src_vertex_data_ = SRC_VERTEX_BUFFER::Create(
+ settings->num_vertex_data, src_data_->GetNumVertices(), device_context_);
+ }
+ else {
+ src_vertex_data_ = NULL;
+ }
+ src_vertex_data_desc_ = BufferDescriptor(
+ 0, settings->num_vertex_data, settings->num_vertex_data);
+ }
+ }
+
// TODO(sergey): Implement binding API.
void updateData(const float *src, int start_vertex, int num_vertices) override