Commit 663cca79 authored by Jakob Weiss's avatar Jakob Weiss

Fixes related to previous merge

* Updated TextureManager
* Fixed some warnings and minor cleanup
parent 9a834357
...@@ -37,17 +37,20 @@ GLuint cgt::TextureManager::generateId(GLenum type, const cgt::svec3 & dimension ...@@ -37,17 +37,20 @@ GLuint cgt::TextureManager::generateId(GLenum type, const cgt::svec3 & dimension
switch (type) { switch (type) {
case GL_TEXTURE_1D: case GL_TEXTURE_1D:
glTexImage1D(type, 0, internalFormat, dimensions.x, 0, Texture::calcMatchingFormat(internalFormat), Texture::calcMatchingDataType(internalFormat), nullptr); glTexImage1D(type, 0, internalFormat, static_cast<GLsizei>(dimensions.x), 0,
Texture::calcMatchingPixelFormat(internalFormat), Texture::calcMatchingPixelDataType(internalFormat), nullptr);
break; break;
case GL_TEXTURE_1D_ARRAY: // fallthrough case GL_TEXTURE_1D_ARRAY: // fallthrough
case GL_TEXTURE_2D: case GL_TEXTURE_2D:
glTexImage2D(type, 0, internalFormat, dimensions.x, dimensions.y, 0, Texture::calcMatchingFormat(internalFormat), Texture::calcMatchingDataType(internalFormat), nullptr); glTexImage2D(type, 0, internalFormat, static_cast<GLsizei>(dimensions.x), static_cast<GLsizei>(dimensions.y), 0,
Texture::calcMatchingPixelFormat(internalFormat), Texture::calcMatchingPixelDataType(internalFormat), nullptr);
break; break;
case GL_TEXTURE_2D_ARRAY: // fallthrough case GL_TEXTURE_2D_ARRAY: // fallthrough
case GL_TEXTURE_3D: case GL_TEXTURE_3D:
glTexImage3D(type, 0, internalFormat, dimensions.x, dimensions.y, dimensions.z, 0, Texture::calcMatchingFormat(internalFormat), Texture::calcMatchingDataType(internalFormat), nullptr); glTexImage3D(type, 0, internalFormat, static_cast<GLsizei>(dimensions.x), static_cast<GLsizei>(dimensions.y), static_cast<GLsizei>(dimensions.z), 0,
Texture::calcMatchingPixelFormat(internalFormat), Texture::calcMatchingPixelDataType(internalFormat), nullptr);
break; break;
} }
LGL_ERROR; LGL_ERROR;
...@@ -60,17 +63,20 @@ GLuint cgt::TextureManager::generateId(GLenum type, const cgt::svec3 & dimension ...@@ -60,17 +63,20 @@ GLuint cgt::TextureManager::generateId(GLenum type, const cgt::svec3 & dimension
switch (type) { switch (type) {
case GL_TEXTURE_1D: case GL_TEXTURE_1D:
glTexImage1D(type, 0, internalFormat, dimensions.x, 0, Texture::calcMatchingFormat(internalFormat), Texture::calcMatchingDataType(internalFormat), nullptr); glTexImage1D(type, 0, internalFormat, static_cast<GLsizei>(dimensions.x), 0,
Texture::calcMatchingPixelFormat(internalFormat), Texture::calcMatchingPixelDataType(internalFormat), nullptr);
break; break;
case GL_TEXTURE_1D_ARRAY: // fallthrough case GL_TEXTURE_1D_ARRAY: // fallthrough
case GL_TEXTURE_2D: case GL_TEXTURE_2D:
glTexImage2D(type, 0, internalFormat, dimensions.x, dimensions.y, 0, Texture::calcMatchingFormat(internalFormat), Texture::calcMatchingDataType(internalFormat), nullptr); glTexImage2D(type, 0, internalFormat, static_cast<GLsizei>(dimensions.x), static_cast<GLsizei>(dimensions.y), 0,
Texture::calcMatchingPixelFormat(internalFormat), Texture::calcMatchingPixelDataType(internalFormat), nullptr);
break; break;
case GL_TEXTURE_2D_ARRAY: // fallthrough case GL_TEXTURE_2D_ARRAY: // fallthrough
case GL_TEXTURE_3D: case GL_TEXTURE_3D:
glTexImage3D(type, 0, internalFormat, dimensions.x, dimensions.y, dimensions.z, 0, Texture::calcMatchingFormat(internalFormat), Texture::calcMatchingDataType(internalFormat), nullptr); glTexImage3D(type, 0, internalFormat, static_cast<GLsizei>(dimensions.x), static_cast<GLsizei>(dimensions.y), static_cast<GLsizei>(dimensions.z), 0,
Texture::calcMatchingPixelFormat(internalFormat), Texture::calcMatchingPixelDataType(internalFormat), nullptr);
break; break;
} }
LGL_ERROR; LGL_ERROR;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
// //
// ================================================================================================ // ================================================================================================
// (c) 2017 Jakob Weiss <jakob.weiss@tum.de>
// ==================== Shader for median filtering. ==================== // ==================== Shader for median filtering. ====================
// Expects the following dynamic defines: // Expects the following dynamic defines:
...@@ -62,18 +63,6 @@ layout(local_size_x = WORK_GROUP_SIZE_X, local_size_y = WORK_GROUP_SIZE_Y, local ...@@ -62,18 +63,6 @@ layout(local_size_x = WORK_GROUP_SIZE_X, local_size_y = WORK_GROUP_SIZE_Y, local
float sorted[KERNEL_S]; float sorted[KERNEL_S];
int end = 0; int end = 0;
void sorted_insert2(float val) {
for(int i=0; i < end; i++) {
if(sorted[i].x < val.x) {
float tmp = val;
val = sorted[i];
sorted[i] = tmp;
}
}
sorted[end] = val;
end++;
}
void sorted_insert(float val) { void sorted_insert(float val) {
int i=end-1; int i=end-1;
while( i >= 0) { while( i >= 0) {
...@@ -89,11 +78,6 @@ void sorted_insert(float val) { ...@@ -89,11 +78,6 @@ void sorted_insert(float val) {
end++; end++;
} }
void sorted_insert3(float val) {
sorted[end] = val;
end++;
}
void main() { void main() {
// get index in global work group i.e x,y position // get index in global work group i.e x,y position
ivec3 pixel_coords = ivec3(gl_GlobalInvocationID.xyz); ivec3 pixel_coords = ivec3(gl_GlobalInvocationID.xyz);
......
...@@ -86,7 +86,7 @@ namespace campvis { ...@@ -86,7 +86,7 @@ namespace campvis {
if (_shader) { if (_shader) {
cgt::ivec3 size = img->getSize(); cgt::ivec3 size = img->getSize();
cgt::ivec3 wgSize = p_workgroupSize.getValue(); cgt::ivec3 wgSize = p_workgroupSize.getValue();
cgt::vec3 groups = cgt::ceil(cgt::vec3(size) / cgt::vec3(wgSize)); cgt::ivec3 groups(cgt::ceil(cgt::vec3(size) / cgt::vec3(wgSize)));
cgt::TextureUnit inputUnit; cgt::TextureUnit inputUnit;
inputUnit.activate(); inputUnit.activate();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment