Commit a17a1d237b5cbfa7ac0ed363fa060028e066b4ce
1 parent
a9b45efe
fixed more stuff, broke even more stuff, but complise and runs
Showing
3 changed files
with
14 additions
and
12 deletions
Show diff stats
cuda/cost.h
@@ -13,7 +13,7 @@ typedef unsigned char uchar; | @@ -13,7 +13,7 @@ typedef unsigned char uchar; | ||
13 | //surface<void, 2> texOut; ///// maybe just do a normal array instead of a surface. | 13 | //surface<void, 2> texOut; ///// maybe just do a normal array instead of a surface. |
14 | //we may not need a surface at all. | 14 | //we may not need a surface at all. |
15 | //texture<float, cudaTextureType2D, cudaReadModeElementType> texTemplate | 15 | //texture<float, cudaTextureType2D, cudaReadModeElementType> texTemplate |
16 | -texture<float, cudaTextureType2D, cudaReadModeElementType> texIn; | 16 | +texture<uchar, cudaTextureType2D, cudaReadModeElementType> texIn; |
17 | float *result; | 17 | float *result; |
18 | float* v_dif; | 18 | float* v_dif; |
19 | cudaArray* srcArray; | 19 | cudaArray* srcArray; |
@@ -60,13 +60,13 @@ void get_diff (float *result) | @@ -60,13 +60,13 @@ void get_diff (float *result) | ||
60 | //cuPrintf("Hello"); | 60 | //cuPrintf("Hello"); |
61 | int x = threadIdx.x + blockIdx.x * blockDim.x; | 61 | int x = threadIdx.x + blockIdx.x * blockDim.x; |
62 | int y = threadIdx.y + blockIdx.y * blockDim.y; | 62 | int y = threadIdx.y + blockIdx.y * blockDim.y; |
63 | - int idx = y*DIM_Y+x; | 63 | + int idx = y*DIM_X+x; |
64 | //int idx = x*DIM_X+y; | 64 | //int idx = x*DIM_X+y; |
65 | 65 | ||
66 | //uchar4 color = tex2D(texIn, x, y); | 66 | //uchar4 color = tex2D(texIn, x, y); |
67 | //float3 tempcolor = make_float3(color.x, color.y, color.z); | 67 | //float3 tempcolor = make_float3(color.x, color.y, color.z); |
68 | //float valIn = tempcolor.x + tempcolor.y + tempcolor.z; | 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 | float valTemp = Template(x); | 70 | float valTemp = Template(x); |
71 | result[idx] = valIn; | 71 | result[idx] = valIn; |
72 | // - valTemp; | 72 | // - valTemp; |
cuda/glbind.h
@@ -7,12 +7,14 @@ | @@ -7,12 +7,14 @@ | ||
7 | #include <stdio.h> | 7 | #include <stdio.h> |
8 | #include <cstring> | 8 | #include <cstring> |
9 | 9 | ||
10 | -#include <cudaHandleError.h> | 10 | +//#include <cudaHandleError.h> |
11 | #include "cuda_gl_interop.h" | 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 | //Initialize the GLEW toolkit | 19 | //Initialize the GLEW toolkit |
18 | 20 | ||
@@ -24,7 +26,7 @@ static void rtsInitGLEW() | @@ -24,7 +26,7 @@ static void rtsInitGLEW() | ||
24 | fprintf(stdout, "Status: Using GLEW %s\n", glewGetString(GLEW_VERSION)); | 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 | cudaDeviceProp prop; | 31 | cudaDeviceProp prop; |
30 | int dev; | 32 | int dev; |
@@ -41,7 +43,7 @@ static void rts_cudaSetDevice(int major = 1, int minor = 3) | @@ -41,7 +43,7 @@ static void rts_cudaSetDevice(int major = 1, int minor = 3) | ||
41 | HANDLE_ERROR(cudaGLSetGLDevice(dev)); | 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 | //this function takes a predefined CUDA resource and maps it to a pointer | 48 | //this function takes a predefined CUDA resource and maps it to a pointer |
47 | void* buffer; | 49 | void* buffer; |
@@ -50,13 +52,13 @@ static void* rts_cudaMapResource(cudaGraphicsResource* cudaBufferResource) | @@ -50,13 +52,13 @@ static void* rts_cudaMapResource(cudaGraphicsResource* cudaBufferResource) | ||
50 | HANDLE_ERROR(cudaGraphicsResourceGetMappedPointer( (void**)&buffer, &size, cudaBufferResource)); | 52 | HANDLE_ERROR(cudaGraphicsResourceGetMappedPointer( (void**)&buffer, &size, cudaBufferResource)); |
51 | return buffer; | 53 | return buffer; |
52 | } | 54 | } |
53 | -static void rts_cudaUnmapResource(cudaGraphicsResource* resource) | 55 | +static void cudaUnmapResource(cudaGraphicsResource* resource) |
54 | { | 56 | { |
55 | //this function unmaps the CUDA resource so it can be used by OpenGL | 57 | //this function unmaps the CUDA resource so it can be used by OpenGL |
56 | HANDLE_ERROR(cudaGraphicsUnmapResources(1, &resource, NULL)); | 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 | //delete the previous buffer name and resource | 63 | //delete the previous buffer name and resource |
62 | if(cudaBufferResource != 0) | 64 | if(cudaBufferResource != 0) |
@@ -73,5 +75,5 @@ static void rts_cudaCreateRenderBuffer(GLuint &glBufferName, cudaGraphicsResourc | @@ -73,5 +75,5 @@ static void rts_cudaCreateRenderBuffer(GLuint &glBufferName, cudaGraphicsResourc | ||
73 | CHECK_OPENGL_ERROR | 75 | CHECK_OPENGL_ERROR |
74 | HANDLE_ERROR(cudaGraphicsGLRegisterBuffer(&cudaBufferResource, glBufferName, cudaGraphicsMapFlagsNone)); | 76 | HANDLE_ERROR(cudaGraphicsGLRegisterBuffer(&cudaBufferResource, glBufferName, cudaGraphicsMapFlagsNone)); |
75 | } | 77 | } |
76 | - | 78 | +} |
77 | #endif | 79 | #endif |
gl/gl_spider.h
@@ -31,7 +31,7 @@ class gl_spider : public virtual gl_texture<T> | @@ -31,7 +31,7 @@ class gl_spider : public virtual gl_texture<T> | ||
31 | //mag[0] = length. | 31 | //mag[0] = length. |
32 | //mag[1] = width. | 32 | //mag[1] = width. |
33 | using gl_texture<T>::texID; | 33 | using gl_texture<T>::texID; |
34 | - using image_stack<T>::S; | 34 | + //using image_stack<T>::S; |
35 | cudaArray* c_Array; | 35 | cudaArray* c_Array; |
36 | //void** devPtr; | 36 | //void** devPtr; |
37 | //size_t size; | 37 | //size_t size; |