Skip to content

Pre-calculate texture buffer size#394

Merged
oitel merged 3 commits intomasterfrom
render_texture_size
Aug 23, 2022
Merged

Pre-calculate texture buffer size#394
oitel merged 3 commits intomasterfrom
render_texture_size

Conversation

@oitel
Copy link
Contributor

@oitel oitel commented Aug 23, 2022

No description provided.

@oitel oitel requested a review from Grantim August 23, 2022 11:39
Comment on lines -359 to +355
auto res = calcTextureRes( int( facesColorMap.size() ), maxTexSize );
auto res = calcTextureRes( int( facesColorMap.size() ), maxTexSize_ );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we calc texture resolution only in update_ and not calc it twice

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

facesColorMap is pre-calculated outside this class.

Comment on lines 33 to 44

Buffer<Vector4f> computePerFaceNormals4( const Mesh & mesh )
Buffer<Vector4f> computePerFaceNormals4( const Mesh & mesh, size_t bufferSize )
{
MR_TIMER
FaceId lastValidFace = mesh.topology.lastValidFace();

const auto & edgePerFace = mesh.topology.edgePerFace();
Buffer<Vector4f> res( lastValidFace + 1 );
if ( bufferSize != 0 )
assert( bufferSize >= lastValidFace + 1 );
else
bufferSize = lastValidFace + 1;
Buffer<Vector4f> res( bufferSize );
tbb::parallel_for( tbb::blocked_range<FaceId>( FaceId{0}, lastValidFace + 1 ), [&]( const tbb::blocked_range<FaceId> & range )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mb better Buffer<Vector4f>& outBuffer as arg?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or simply pointer Vector4f* as arg

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewritten.

@oitel oitel requested a review from Fedr August 23, 2022 11:56
@oitel oitel merged commit dd51206 into master Aug 23, 2022
@oitel oitel deleted the render_texture_size branch August 23, 2022 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants