Commit 32c433c7906ef18759b3b687139e284351970a36
1 parent
f1e9fe98
recovered the majority of the code lost during the merge, code is functional, co…
…mpiles and runs with no error. There is still an error with the cuda aspect causing squashed impropper images. Encoding of the pixel dimensions is lost and needs to be redone
Showing
4 changed files
with
15 additions
and
13 deletions
Show diff stats
cuda/cost.h
... | ... | @@ -13,7 +13,7 @@ typedef unsigned char uchar; |
13 | 13 | //surface<void, 2> texOut; ///// maybe just do a normal array instead of a surface. |
14 | 14 | //we may not need a surface at all. |
15 | 15 | //texture<float, cudaTextureType2D, cudaReadModeElementType> texTemplate |
16 | -texture<float, cudaTextureType2D, cudaReadModeElementType> texIn; | |
16 | +texture<uchar, cudaTextureType2D, cudaReadModeElementType> texIn; | |
17 | 17 | float *result; |
18 | 18 | float* v_dif; |
19 | 19 | cudaArray* srcArray; |
... | ... | @@ -60,13 +60,13 @@ void get_diff (float *result) |
60 | 60 | //cuPrintf("Hello"); |
61 | 61 | int x = threadIdx.x + blockIdx.x * blockDim.x; |
62 | 62 | int y = threadIdx.y + blockIdx.y * blockDim.y; |
63 | - int idx = y*DIM_Y+x; | |
63 | + int idx = y*DIM_X+x; | |
64 | 64 | //int idx = x*DIM_X+y; |
65 | 65 | |
66 | 66 | //uchar4 color = tex2D(texIn, x, y); |
67 | 67 | //float3 tempcolor = make_float3(color.x, color.y, color.z); |
68 | 68 | //float valIn = tempcolor.x + tempcolor.y + tempcolor.z; |
69 | - float valIn = x;//tex2D(texIn, x, y); | |
69 | + float valIn = tex2D(texIn, x, y); | |
70 | 70 | float valTemp = Template(x); |
71 | 71 | result[idx] = valIn; |
72 | 72 | // - valTemp; | ... | ... |
cuda/glbind.h
... | ... | @@ -7,12 +7,14 @@ |
7 | 7 | #include <stdio.h> |
8 | 8 | #include <cstring> |
9 | 9 | |
10 | -#include <cudaHandleError.h> | |
10 | +//#include <cudaHandleError.h> | |
11 | 11 | #include "cuda_gl_interop.h" |
12 | -#include "rts/gl/error.h" | |
12 | +#include "../gl/error.h" | |
13 | 13 | |
14 | +namespace stim | |
15 | +{ | |
14 | 16 | |
15 | -static void rtsInitGLEW() | |
17 | +static void InitGLEW() | |
16 | 18 | { |
17 | 19 | //Initialize the GLEW toolkit |
18 | 20 | |
... | ... | @@ -24,7 +26,7 @@ static void rtsInitGLEW() |
24 | 26 | fprintf(stdout, "Status: Using GLEW %s\n", glewGetString(GLEW_VERSION)); |
25 | 27 | } |
26 | 28 | |
27 | -static void rts_cudaSetDevice(int major = 1, int minor = 3) | |
29 | +static void cudaSetDevice(int major = 1, int minor = 3) | |
28 | 30 | { |
29 | 31 | cudaDeviceProp prop; |
30 | 32 | int dev; |
... | ... | @@ -41,7 +43,7 @@ static void rts_cudaSetDevice(int major = 1, int minor = 3) |
41 | 43 | HANDLE_ERROR(cudaGLSetGLDevice(dev)); |
42 | 44 | } |
43 | 45 | |
44 | -static void* rts_cudaMapResource(cudaGraphicsResource* cudaBufferResource) | |
46 | +static void* cudaMapResource(cudaGraphicsResource* cudaBufferResource) | |
45 | 47 | { |
46 | 48 | //this function takes a predefined CUDA resource and maps it to a pointer |
47 | 49 | void* buffer; |
... | ... | @@ -50,13 +52,13 @@ static void* rts_cudaMapResource(cudaGraphicsResource* cudaBufferResource) |
50 | 52 | HANDLE_ERROR(cudaGraphicsResourceGetMappedPointer( (void**)&buffer, &size, cudaBufferResource)); |
51 | 53 | return buffer; |
52 | 54 | } |
53 | -static void rts_cudaUnmapResource(cudaGraphicsResource* resource) | |
55 | +static void cudaUnmapResource(cudaGraphicsResource* resource) | |
54 | 56 | { |
55 | 57 | //this function unmaps the CUDA resource so it can be used by OpenGL |
56 | 58 | HANDLE_ERROR(cudaGraphicsUnmapResources(1, &resource, NULL)); |
57 | 59 | } |
58 | 60 | |
59 | -static void rts_cudaCreateRenderBuffer(GLuint &glBufferName, cudaGraphicsResource* &cudaBufferResource, int resX, int resY) | |
61 | +static void cudaCreateRenderBuffer(GLuint &glBufferName, cudaGraphicsResource* &cudaBufferResource, int resX, int resY) | |
60 | 62 | { |
61 | 63 | //delete the previous buffer name and resource |
62 | 64 | if(cudaBufferResource != 0) |
... | ... | @@ -73,5 +75,5 @@ static void rts_cudaCreateRenderBuffer(GLuint &glBufferName, cudaGraphicsResourc |
73 | 75 | CHECK_OPENGL_ERROR |
74 | 76 | HANDLE_ERROR(cudaGraphicsGLRegisterBuffer(&cudaBufferResource, glBufferName, cudaGraphicsMapFlagsNone)); |
75 | 77 | } |
76 | - | |
78 | +} | |
77 | 79 | #endif | ... | ... |
gl/gl_spider.h
... | ... | @@ -31,7 +31,7 @@ class gl_spider : public virtual gl_texture<T> |
31 | 31 | //mag[0] = length. |
32 | 32 | //mag[1] = width. |
33 | 33 | using gl_texture<T>::texID; |
34 | - using image_stack<T>::S; | |
34 | + //using image_stack<T>::S; | |
35 | 35 | cudaArray* c_Array; |
36 | 36 | //void** devPtr; |
37 | 37 | //size_t size; | ... | ... |