Skip to content

Commit cad715b

Browse files
committed
Bug fixes
1 parent a876578 commit cad715b

4 files changed

Lines changed: 10 additions & 5 deletions

File tree

DVRViewPlugin/res/shaders/FullDataMaterialBlending.frag

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ layout(std430, binding = 2) buffer MeanPositions {
3232
float meanPositions[];
3333
};
3434

35-
float getMaterialID(float[5] materials, vec3 samplePos) {
35+
float getMaterialID(inout float[5] materials, vec3 samplePos) {
3636
float firstMaterial = materials[0];
3737
float previousMaterial = materials[1];
3838

DVRViewPlugin/res/shaders/MaterialTransition2D.frag

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ uniform vec3 u_maxClippingPlane;
2323
uniform bool useShading;
2424
uniform bool useClutterRemover;
2525

26-
float getMaterialID(float[5] materials, vec3[5] samplePositions) {
26+
float getMaterialID(inout float[5] materials, inout vec3[5] samplePositions) {
2727
float firstMaterial = materials[0];
2828
float previousMaterial = materials[1];
2929

DVRViewPlugin/src/VolumeRenderer.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ void VolumeRenderer::getGPUFullDataModeBatches(std::vector<float>& frontfacesDat
906906

907907
//Create small batches of pixels that are spread out over the whole image ---
908908

909-
int numBatches = 1024; // Number of batches to divide the data into. (Tune as needed.)
909+
int numBatches = 2048; // Number of batches to divide the data into. (Tune as needed.)
910910
std::vector<std::vector<int>> batches(numBatches); // Each element is a vector of pixel indices.
911911
// Instead of memory requirements (in bytes), we now record the number of samples per ray.
912912
std::vector<std::vector<int>> batchRaySampleAmount(numBatches);
@@ -979,7 +979,7 @@ void VolumeRenderer::getGPUFullDataModeBatches(std::vector<float>& frontfacesDat
979979
// Combine as many of the small batches as can possibly fit in the indicated GPU memory ---
980980

981981
// Calculate available GPU memory for the batch transfer
982-
size_t availableMemoryInBytes = _fullGPUMemorySize - _fullDataMemorySize - 100000; // ~100MB reserved for other data
982+
size_t availableMemoryInBytes = std::min(int(_fullGPUMemorySize - _fullDataMemorySize - 100000), 2000000); // ~100MB reserved for other data
983983
if (availableMemoryInBytes < 0 || availableMemoryInBytes < maxBatchMemory)
984984
throw std::runtime_error("Not enough GPU memory available for the GPU-CPU batch transfer.");
985985

@@ -1516,20 +1516,25 @@ void VolumeRenderer::renderCompositeColor()
15161516

15171517
mv::Vector3f volumeSize;
15181518
mv::Vector3f invVolumeSize;
1519+
mv::Vector3f dimesnionVolumeRatio;
15191520
if (_useCustomRenderSpace) {
15201521
volumeSize = _renderSpace;
15211522
invVolumeSize = mv::Vector3f(1.0f / _renderSpace.x, 1.0f / _renderSpace.y, 1.0f / _renderSpace.z);
1523+
dimesnionVolumeRatio = mv::Vector3f(_renderSpace.x / _volumeSize.x, _renderSpace.y / _volumeSize.y, _renderSpace.z / _volumeSize.z);
15221524
}
15231525
else {
15241526
volumeSize = _volumeSize;
15251527
invVolumeSize = mv::Vector3f(1.0f / _volumeSize.x, 1.0f / _volumeSize.y, 1.0f / _volumeSize.z);
1528+
dimesnionVolumeRatio = mv::Vector3f(1.0f, 1.0f, 1.0f); // No custom render space, so ratio is 1:1
15261529
}
15271530

15281531
_colorCompositeShader.uniform3fv("dimensions", 1, &volumeSize);
15291532
_colorCompositeShader.uniform3fv("invDimensions", 1, &invVolumeSize);
15301533
_colorCompositeShader.uniform2f("invFaceTexSize", 1.0f / _adjustedScreenSize.width(), 1.0f / _adjustedScreenSize.height());
15311534
_colorCompositeShader.uniform2f("invTfTexSize", 1.0f / _tfDataset->getImageSize().width(), 1.0f / _tfDataset->getImageSize().height());
15321535

1536+
//_colorCompositeShader.uniform3fv("dimensionVolumeRatio", 1, &dimesnionVolumeRatio);
1537+
15331538
drawDVRQuad(_colorCompositeShader);
15341539

15351540
_framebuffer.release();

DVRViewPlugin/src/VolumeRenderer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ class VolumeRenderer : protected QOpenGLFunctions_4_3_Core
230230
mv::Vector3f _cameraPos;
231231

232232
size_t _fullDataMemorySize = 0; // The size of the full data in bytes
233-
size_t _fullGPUMemorySize = static_cast<size_t>(2 * 1024 * 1024) * 1024; // The size of the full data in bytes on the GPU if we use normal int it causes a overflow; The SSBOs are limited to 2GB, so even if the GPU has more VRAM we limit the size to 2GB for the full data mode. This is a hard limit, so we need to make sure that the data fits into this limit.
233+
size_t _fullGPUMemorySize = static_cast<size_t>(2 * 1024 * 1024) * 1024; // The size of the full data in bytes on the GPU if we use normal int it causes a overflow; The SSBOs are limited to 2GB, so even if the GPU has more VRAM we limit the size to 2GB for the full data mode.
234234

235235
// HNSWLib-related members
236236
std::unique_ptr<hnswlib::L2Space> _hnswSpace;

0 commit comments

Comments
 (0)