mirror of
https://github.com/vortexgpgpu/vortex.git
synced 2025-04-23 21:39:10 -04:00
minor update
This commit is contained in:
parent
e1e4c8bc03
commit
0920d1e745
6 changed files with 869 additions and 541 deletions
|
@ -5,17 +5,18 @@
|
|||
|
||||
struct kernel_arg_t {
|
||||
uint32_t num_tasks;
|
||||
uint32_t format;
|
||||
uint32_t filter;
|
||||
uint32_t wrap;
|
||||
uint32_t src_logWidth;
|
||||
uint32_t src_logHeight;
|
||||
uint32_t src_stride;
|
||||
uint32_t src_pitch;
|
||||
uint8_t src_ptr;
|
||||
uint8_t format;
|
||||
uint8_t filter;
|
||||
uint8_t wrap;
|
||||
uint8_t use_sw;
|
||||
uint8_t src_logWidth;
|
||||
uint8_t src_logHeight;
|
||||
uint8_t src_stride;
|
||||
uint8_t src_pitch;
|
||||
uint32_t src_ptr;
|
||||
uint32_t dst_width;
|
||||
uint32_t dst_height;
|
||||
uint32_t dst_stride;
|
||||
uint8_t dst_stride;
|
||||
uint32_t dst_pitch;
|
||||
uint32_t dst_ptr;
|
||||
};
|
||||
|
|
Binary file not shown.
|
@ -3,9 +3,7 @@
|
|||
#include "common.h"
|
||||
#include "texsw.h"
|
||||
|
||||
uint32_t ilog2 (uint32_t value) {
|
||||
return (uint32_t)(sizeof(uint32_t) * 8UL) - (uint32_t)__builtin_clzl((value << 1) - 1UL) - 1;
|
||||
}
|
||||
#define ENABLE_SW
|
||||
|
||||
struct tile_arg_t {
|
||||
struct kernel_arg_t* state;
|
||||
|
@ -30,8 +28,15 @@ void kernel_body(int task_id, void* arg) {
|
|||
for (uint32_t x = 0; x < _arg->tile_width; ++x) {
|
||||
int32_t u = (int32_t)(fu * (1<<20));
|
||||
int32_t v = (int32_t)(fv * (1<<20));
|
||||
//dst_row[x] = tex_sw(state, 0, u, v, 0x0);
|
||||
#ifdef ENABLE_SW
|
||||
if (state->use_sw) {
|
||||
dst_row[x] = tex_sw(state, 0, u, v, 0x0);
|
||||
} else {
|
||||
#endif
|
||||
dst_row[x] = vx_tex(0, u, v, 0x0);
|
||||
#ifdef ENABLE_SW
|
||||
}
|
||||
#endif
|
||||
fu += _arg->deltaX;
|
||||
}
|
||||
dst_ptr += state->dst_pitch;
|
||||
|
|
File diff suppressed because it is too large
Load diff
Binary file not shown.
|
@ -3,6 +3,7 @@
|
|||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <chrono>
|
||||
#include <cmath>
|
||||
#include <assert.h>
|
||||
#include <vortex.h>
|
||||
#include "common.h"
|
||||
|
@ -27,6 +28,7 @@ int wrap = 0;
|
|||
int filter = 0;
|
||||
float scale = 1.0f;
|
||||
int format = 0;
|
||||
bool use_sw = false;
|
||||
ePixelFormat eformat = FORMAT_A8R8G8B8;
|
||||
|
||||
vx_device_h device = nullptr;
|
||||
|
@ -34,7 +36,7 @@ vx_buffer_h buffer = nullptr;
|
|||
|
||||
static void show_usage() {
|
||||
std::cout << "Vortex Texture Test." << std::endl;
|
||||
std::cout << "Usage: [-k: kernel] [-i image] [-o image] [-s scale] [-w wrap] [-f format] [-g filter] [-h: help]" << std::endl;
|
||||
std::cout << "Usage: [-k: kernel] [-i image] [-o image] [-s scale] [-w wrap] [-f format] [-g filter] [-z no_hw] [-h: help]" << std::endl;
|
||||
}
|
||||
|
||||
static void parse_args(int argc, char **argv) {
|
||||
|
@ -53,6 +55,9 @@ static void parse_args(int argc, char **argv) {
|
|||
case 'w':
|
||||
wrap = std::atoi(optarg);
|
||||
break;
|
||||
case 'z':
|
||||
use_sw = std::atoi(optarg);
|
||||
break;
|
||||
case 'f': {
|
||||
format = std::atoi(optarg);
|
||||
switch (format) {
|
||||
|
@ -124,7 +129,7 @@ int run_test(const kernel_arg_t& kernel_arg,
|
|||
|
||||
// save output image
|
||||
std::cout << "save output image" << std::endl;
|
||||
//dump_image(dst_pixels, width, height, bpp);
|
||||
dump_image(dst_pixels, width, height, bpp);
|
||||
RT_CHECK(SaveTGA(output_file, dst_pixels, width, height, bpp));
|
||||
|
||||
return 0;
|
||||
|
@ -201,9 +206,10 @@ int main(int argc, char *argv[]) {
|
|||
kernel_arg.format = format;
|
||||
kernel_arg.filter = filter;
|
||||
kernel_arg.wrap = wrap;
|
||||
kernel_arg.use_sw = use_sw;
|
||||
|
||||
kernel_arg.src_logWidth = ilog2(src_width);
|
||||
kernel_arg.src_logHeight = ilog2(src_height);
|
||||
kernel_arg.src_logWidth = (uint32_t)std::log2(src_width);
|
||||
kernel_arg.src_logHeight = (uint32_t)std::log2(src_height);
|
||||
kernel_arg.src_stride = src_bpp;
|
||||
kernel_arg.src_pitch = src_bpp * src_width;
|
||||
kernel_arg.src_ptr = src_addr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue