[Mesa-dev] [PATCH] clover: change image class to inherit from buffer

2013-04-06 Thread Dmitry Cherkassov
image2d is dynamic_cast-ed down from buffer, but is not it's
direct subclass. Make it inhernit buffer.

Signed-off-by: Dmitry Cherkassov dcherkas...@gmail.com
---
 src/gallium/state_trackers/clover/core/memory.cpp |4 ++--
 src/gallium/state_trackers/clover/core/memory.hpp |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/state_trackers/clover/core/memory.cpp 
b/src/gallium/state_trackers/clover/core/memory.cpp
index 8d8be2e..cb64dc1 100644
--- a/src/gallium/state_trackers/clover/core/memory.cpp
+++ b/src/gallium/state_trackers/clover/core/memory.cpp
@@ -119,7 +119,7 @@ image::image(clover::context ctx, cl_mem_flags flags,
  size_t width, size_t height, size_t depth,
  size_t row_pitch, size_t slice_pitch, size_t size,
  void *host_ptr) :
-   memory_obj(ctx, flags, size, host_ptr),
+   buffer(ctx, flags, size, host_ptr),
__format(*format), __width(width), __height(height), __depth(depth),
__row_pitch(row_pitch), __slice_pitch(slice_pitch) {
 }
@@ -174,7 +174,7 @@ image2d::image2d(clover::context ctx, cl_mem_flags flags,
  const cl_image_format *format, size_t width,
  size_t height, size_t row_pitch,
  void *host_ptr) :
-   image(ctx, flags, format, width, height, 0,
+   image(ctx, flags, format, width, height, 1,//
  row_pitch, 0, height * row_pitch, host_ptr) {
 }
 
diff --git a/src/gallium/state_trackers/clover/core/memory.hpp 
b/src/gallium/state_trackers/clover/core/memory.hpp
index 96f70e9..4cb58c4 100644
--- a/src/gallium/state_trackers/clover/core/memory.hpp
+++ b/src/gallium/state_trackers/clover/core/memory.hpp
@@ -104,7 +104,7 @@ namespace clover {
std::unique_ptrclover::sub_resource resources;
};
 
-   struct image : public memory_obj {
+   struct image : public buffer {
protected:
   image(clover::context ctx, cl_mem_flags flags,
 const cl_image_format *format,
-- 
1.7.10.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] clover: add dynamic_cast results checking down in clSetKernelArgument() code path.

2013-03-23 Thread Dmitry Cherkassov
Signed-off-by: Dmitry Cherkassov dcherkas...@gmail.com
---
 src/gallium/state_trackers/clover/core/kernel.cpp |   16 
 1 file changed, 16 insertions(+)

diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp 
b/src/gallium/state_trackers/clover/core/kernel.cpp
index 6fa8bd6..f664d79 100644
--- a/src/gallium/state_trackers/clover/core/kernel.cpp
+++ b/src/gallium/state_trackers/clover/core/kernel.cpp
@@ -222,6 +222,10 @@ _cl_kernel::global_argument::set(size_t size, const void 
*value) {
   throw error(CL_INVALID_ARG_SIZE);
 
obj = dynamic_castclover::buffer *(*(cl_mem *)value);
+
+   if (!obj)
+  throw error(CL_INVALID_MEM_OBJECT);
+
__set = true;
 }
 
@@ -286,6 +290,10 @@ _cl_kernel::constant_argument::set(size_t size, const void 
*value) {
   throw error(CL_INVALID_ARG_SIZE);
 
obj = dynamic_castclover::buffer *(*(cl_mem *)value);
+
+   if (!obj)
+  throw error(CL_INVALID_MEM_OBJECT);
+
__set = true;
 }
 
@@ -316,6 +324,10 @@ _cl_kernel::image_rd_argument::set(size_t size, const void 
*value) {
   throw error(CL_INVALID_ARG_SIZE);
 
obj = dynamic_castclover::image *(*(cl_mem *)value);
+
+   if (!obj)
+  throw error(CL_INVALID_MEM_OBJECT);
+
__set = true;
 }
 
@@ -346,6 +358,10 @@ _cl_kernel::image_wr_argument::set(size_t size, const void 
*value) {
   throw error(CL_INVALID_ARG_SIZE);
 
obj = dynamic_castclover::image *(*(cl_mem *)value);
+
+   if (!obj)
+  throw error(CL_INVALID_MEM_OBJECT);
+
__set = true;
 }
 
-- 
1.7.10.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] switching off -O2 with debugging build

2012-12-07 Thread Dmitry Cherkassov

 During the ./configure  make  make install process, I set

 export CFLAGS=-O0 -g3
 export CXXFLAGS=-O0 -g3



It works. Thanks!

-- 
With best regards,
Dmitry
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] gallium: Some function headers comment fixes in p_context.h

2012-11-14 Thread Dmitry Cherkassov
Signed-off-by: Dmitry Cherkassov dcherkas...@gmail.com
---
 src/gallium/include/pipe/p_context.h |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/gallium/include/pipe/p_context.h 
b/src/gallium/include/pipe/p_context.h
index 88e12b2..c5dcae5 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -230,21 +230,21 @@ struct pipe_context {
 
void (*set_compute_sampler_views)(struct pipe_context *,
  unsigned start_slot, unsigned num_views,
  struct pipe_sampler_view **);
 
/**
 * Bind an array of shader resources that will be used by the
 * graphics pipeline.  Any resources that were previously bound to
 * the specified range will be unbound after this call.
 *
-* \param first  first resource to bind.
+* \param start  first resource to bind.
 * \param count  number of consecutive resources to bind.
 * \param resources  array of pointers to the resources to bind, it
 *   should contain at least \a count elements
 *   unless it's NULL, in which case no new
 *   resources will be bound.
 */
void (*set_shader_resources)(struct pipe_context *,
 unsigned start, unsigned count,
 struct pipe_surface **resources);
 
@@ -359,21 +359,20 @@ struct pipe_context {
  struct pipe_resource 
*texture,
  const struct 
pipe_sampler_view *templat);
 
void (*sampler_view_destroy)(struct pipe_context *ctx,
 struct pipe_sampler_view *view);
 
 
/**
 * Get a surface which is a view into a resource, used by
 * render target / depth stencil stages.
-* \param usage  bitmaks of PIPE_BIND_* flags
 */
struct pipe_surface *(*create_surface)(struct pipe_context *ctx,
   struct pipe_resource *resource,
   const struct pipe_surface *templat);
 
void (*surface_destroy)(struct pipe_context *ctx,
struct pipe_surface *);
 
/**
 * Map a resource.
@@ -447,21 +446,21 @@ struct pipe_context {
void *(*create_compute_state)(struct pipe_context *context,
 const struct pipe_compute_state *);
void (*bind_compute_state)(struct pipe_context *, void *);
void (*delete_compute_state)(struct pipe_context *, void *);
 
/**
 * Bind an array of shader resources that will be used by the
 * compute program.  Any resources that were previously bound to
 * the specified range will be unbound after this call.
 *
-* \param first  first resource to bind.
+* \param start  first resource to bind.
 * \param count  number of consecutive resources to bind.
 * \param resources  array of pointers to the resources to bind, it
 *   should contain at least \a count elements
 *   unless it's NULL, in which case no new
 *   resources will be bound.
 */
void (*set_compute_resources)(struct pipe_context *,
  unsigned start, unsigned count,
  struct pipe_surface **resources);
 
-- 
1.7.10.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev