From adefa84d66b13a4892bbc544194bacdc410fcc4e Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Fri, 18 Oct 2013 16:25:36 -0700 Subject: [PATCH] clover: Add a pixel_size() method to the image class. Tested-by: Tom Stellard --- src/gallium/state_trackers/clover/core/memory.cpp | 6 ++++++ src/gallium/state_trackers/clover/core/memory.hpp | 1 + 2 files changed, 7 insertions(+) diff --git a/src/gallium/state_trackers/clover/core/memory.cpp b/src/gallium/state_trackers/clover/core/memory.cpp index 1c38597215f..87a9f7a5488 100644 --- a/src/gallium/state_trackers/clover/core/memory.cpp +++ b/src/gallium/state_trackers/clover/core/memory.cpp @@ -22,6 +22,7 @@ #include "core/memory.hpp" #include "core/resource.hpp" +#include "util/u_format.h" using namespace clover; @@ -165,6 +166,11 @@ image::depth() const { return _depth; } +size_t +image::pixel_size() const { + return util_format_get_blocksize(translate_format(_format)); +} + size_t image::row_pitch() const { return _row_pitch; diff --git a/src/gallium/state_trackers/clover/core/memory.hpp b/src/gallium/state_trackers/clover/core/memory.hpp index 5b179ac8413..6ccf3da58b5 100644 --- a/src/gallium/state_trackers/clover/core/memory.hpp +++ b/src/gallium/state_trackers/clover/core/memory.hpp @@ -120,6 +120,7 @@ namespace clover { size_t width() const; size_t height() const; size_t depth() const; + size_t pixel_size() const; size_t row_pitch() const; size_t slice_pitch() const; -- 2.30.2