Fixed a small bug regarding to AMD vs Intel OpenCL implementations

master
MitchellHansen 8 years ago
parent d2d759810f
commit 04a68c1dec

@ -29,10 +29,6 @@ struct XYZHasher {
} }
}; };
class Octree { class Octree {
public: public:
Octree() { Octree() {

@ -80,7 +80,7 @@ private:
int check_cl_khr_gl_sharing(); int check_cl_khr_gl_sharing();
int create_image_buffer(std::string buffer_name, cl_uint size, sf::Texture* texture); int create_image_buffer(std::string buffer_name, cl_uint size, sf::Texture* texture, cl_int access_type);
int create_buffer(std::string buffer_name, cl_uint size, void* data); int create_buffer(std::string buffer_name, cl_uint size, void* data);
int create_buffer(std::string buffer_name, cl_uint size, void* data, cl_mem_flags flags); int create_buffer(std::string buffer_name, cl_uint size, void* data, cl_mem_flags flags);
int store_buffer(cl_mem, std::string buffer_name); int store_buffer(cl_mem, std::string buffer_name);

@ -92,7 +92,7 @@ int main() {
_map.a.get_voxel(sf::Vector3i(5, 5, 0)); _map.a.get_voxel(sf::Vector3i(5, 5, 0));
// ============================= // =============================
return 0;
sf::RenderWindow window(sf::VideoMode(WINDOW_X, WINDOW_Y), "SFML"); sf::RenderWindow window(sf::VideoMode(WINDOW_X, WINDOW_Y), "SFML");
window.setMouseCursorVisible(false); window.setMouseCursorVisible(false);
@ -147,7 +147,7 @@ int main() {
// Load in the spritesheet texture // Load in the spritesheet texture
sf::Texture spritesheet; sf::Texture spritesheet;
spritesheet.loadFromFile("../assets/textures/minecraft_tiles.png"); spritesheet.loadFromFile("../assets/textures/minecraft_tiles.png");
spritesheet.getNativeHandle(); //spritesheet.getNativeHandle();
raycaster->create_texture_atlas(&spritesheet, sf::Vector2i(16, 16)); raycaster->create_texture_atlas(&spritesheet, sf::Vector2i(16, 16));

@ -99,7 +99,7 @@ void Hardware_Caster::validate()
void Hardware_Caster::create_texture_atlas(sf::Texture *t, sf::Vector2i tile_dim) { void Hardware_Caster::create_texture_atlas(sf::Texture *t, sf::Vector2i tile_dim) {
create_image_buffer("texture_atlas", t->getSize().x * t->getSize().x * 4 * sizeof(float), t); create_image_buffer("texture_atlas", t->getSize().x * t->getSize().x * 4 * sizeof(float), t, CL_MEM_READ_ONLY);
// create_buffer observes arg 3's // create_buffer observes arg 3's
@ -191,7 +191,7 @@ void Hardware_Caster::create_viewport(int width, int height, float v_fov, float
viewport_sprite.setTexture(viewport_texture); viewport_sprite.setTexture(viewport_texture);
// Pass the buffer to opencl // Pass the buffer to opencl
create_image_buffer("image", sizeof(sf::Uint8) * width * height * 4, &viewport_texture); create_image_buffer("image", sizeof(sf::Uint8) * width * height * 4, &viewport_texture, CL_MEM_WRITE_ONLY);
} }
@ -529,7 +529,7 @@ int Hardware_Caster::set_kernel_arg(
} }
int Hardware_Caster::create_image_buffer(std::string buffer_name, cl_uint size, sf::Texture* texture) { int Hardware_Caster::create_image_buffer(std::string buffer_name, cl_uint size, sf::Texture* texture, cl_int access_type) {
// I can imagine overwriting buffers will be common, so I think // I can imagine overwriting buffers will be common, so I think
// this is safe to overwrite / release old buffers quietly // this is safe to overwrite / release old buffers quietly
@ -539,7 +539,7 @@ int Hardware_Caster::create_image_buffer(std::string buffer_name, cl_uint size,
int error; int error;
cl_mem buff = clCreateFromGLTexture( cl_mem buff = clCreateFromGLTexture(
getContext(), CL_MEM_WRITE_ONLY, GL_TEXTURE_2D, getContext(), access_type, GL_TEXTURE_2D,
0, texture->getNativeHandle(), &error); 0, texture->getNativeHandle(), &error);
if (assert(error, "clCreateFromGLTexture")) if (assert(error, "clCreateFromGLTexture"))

Loading…
Cancel
Save