-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start preparations for QCerenkov GPU 2d(BetaInverse,u) float4 icdf te…
…xture for Cerenkov energy lookup
- Loading branch information
1 parent
73af7ee
commit 7ebbd54
Showing
10 changed files
with
117 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "QTexMaker.hh" | ||
|
||
#include "scuda.h" | ||
#include "NP.hh" | ||
#include "QTex.hh" | ||
|
||
QTex<float4>* QTexMaker::Make2d_f4( const NP* a, char filterMode ) // static | ||
{ | ||
assert( a->ebyte == 4 && "need to narrow double precision arrays first "); | ||
unsigned ndim = a->shape.size(); | ||
assert( ndim == 3 ); | ||
|
||
unsigned ni = a->shape[0] ; | ||
unsigned nj = a->shape[1] ; | ||
unsigned nk = a->shape[2] ; assert( nk == 4 ); | ||
|
||
size_t height = ni ; | ||
size_t width = nj ; | ||
const void* src = (const void*)a->bytes(); | ||
|
||
// note that from the point of view of array content, saying (height, width) | ||
// is a more appropriate ordering than the usual contrary convention | ||
|
||
QTex<float4>* tex = new QTex<float4>( width, height, src, filterMode ); | ||
return tex ; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
struct NP ; | ||
struct float4 ; | ||
template <typename T> struct QTex ; | ||
|
||
#include "QUDARAP_API_EXPORT.hh" | ||
|
||
struct QUDARAP_API QTexMaker | ||
{ | ||
static QTex<float4>* Make2d_f4( const NP* a, char filterMode ); | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ set(TEST_SOURCES | |
QEventTest.cc | ||
QSimWithEventTest.cc | ||
QUTest.cc | ||
QTexMakerTest.cc | ||
|
||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include "NP.hh" | ||
#include "QTexMaker.hh" | ||
#include "OPTICKS_LOG.hh" | ||
|
||
|
||
NP* make_array(unsigned ni, unsigned nj, unsigned nk) | ||
{ | ||
std::vector<float> src ; | ||
for(unsigned i=0 ; i < ni ; i++) | ||
for(unsigned j=0 ; j < nj ; j++) | ||
for(unsigned k=0 ; k < nk ; k++) | ||
{ | ||
float val = float(i*100 + j*10 + k) ; | ||
src.push_back(val); | ||
} | ||
|
||
NP* a = NP::Make<float>( ni, nj, nk ); | ||
a->read(src.data()) ; | ||
a->set_meta<unsigned>("hd_factor", 10); | ||
|
||
return a ; | ||
} | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
OPTICKS_LOG(argc, argv); | ||
|
||
const NP* a = make_array( 5, 10, 4 ); | ||
char filterMode = 'P' ; | ||
unsigned hd_factor = a->get_meta<unsigned>("hd_factor"); | ||
assert( hd_factor > 0 ); | ||
|
||
QTex<float4>* tex = QTexMaker::Make2d_f4(a, filterMode ); | ||
assert(tex); | ||
|
||
tex->setHDFactor(hd_factor); | ||
tex->uploadMeta(); | ||
|
||
// TODO: lookup checks on the GPU texture, like QScint | ||
|
||
|
||
return 0 ; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters