minor update
This commit is contained in:
@@ -5,17 +5,18 @@
|
|||||||
|
|
||||||
struct kernel_arg_t {
|
struct kernel_arg_t {
|
||||||
uint32_t num_tasks;
|
uint32_t num_tasks;
|
||||||
uint32_t format;
|
uint8_t format;
|
||||||
uint32_t filter;
|
uint8_t filter;
|
||||||
uint32_t wrap;
|
uint8_t wrap;
|
||||||
uint32_t src_logWidth;
|
uint8_t use_sw;
|
||||||
uint32_t src_logHeight;
|
uint8_t src_logWidth;
|
||||||
uint32_t src_stride;
|
uint8_t src_logHeight;
|
||||||
uint32_t src_pitch;
|
uint8_t src_stride;
|
||||||
uint8_t src_ptr;
|
uint8_t src_pitch;
|
||||||
|
uint32_t src_ptr;
|
||||||
uint32_t dst_width;
|
uint32_t dst_width;
|
||||||
uint32_t dst_height;
|
uint32_t dst_height;
|
||||||
uint32_t dst_stride;
|
uint8_t dst_stride;
|
||||||
uint32_t dst_pitch;
|
uint32_t dst_pitch;
|
||||||
uint32_t dst_ptr;
|
uint32_t dst_ptr;
|
||||||
};
|
};
|
||||||
|
|||||||
Binary file not shown.
@@ -3,9 +3,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "texsw.h"
|
#include "texsw.h"
|
||||||
|
|
||||||
uint32_t ilog2 (uint32_t value) {
|
#define ENABLE_SW
|
||||||
return (uint32_t)(sizeof(uint32_t) * 8UL) - (uint32_t)__builtin_clzl((value << 1) - 1UL) - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct tile_arg_t {
|
struct tile_arg_t {
|
||||||
struct kernel_arg_t* state;
|
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) {
|
for (uint32_t x = 0; x < _arg->tile_width; ++x) {
|
||||||
int32_t u = (int32_t)(fu * (1<<20));
|
int32_t u = (int32_t)(fu * (1<<20));
|
||||||
int32_t v = (int32_t)(fv * (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);
|
dst_row[x] = vx_tex(0, u, v, 0x0);
|
||||||
|
#ifdef ENABLE_SW
|
||||||
|
}
|
||||||
|
#endif
|
||||||
fu += _arg->deltaX;
|
fu += _arg->deltaX;
|
||||||
}
|
}
|
||||||
dst_ptr += state->dst_pitch;
|
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 <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <cmath>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <vortex.h>
|
#include <vortex.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
@@ -27,6 +28,7 @@ int wrap = 0;
|
|||||||
int filter = 0;
|
int filter = 0;
|
||||||
float scale = 1.0f;
|
float scale = 1.0f;
|
||||||
int format = 0;
|
int format = 0;
|
||||||
|
bool use_sw = false;
|
||||||
ePixelFormat eformat = FORMAT_A8R8G8B8;
|
ePixelFormat eformat = FORMAT_A8R8G8B8;
|
||||||
|
|
||||||
vx_device_h device = nullptr;
|
vx_device_h device = nullptr;
|
||||||
@@ -34,7 +36,7 @@ vx_buffer_h buffer = nullptr;
|
|||||||
|
|
||||||
static void show_usage() {
|
static void show_usage() {
|
||||||
std::cout << "Vortex Texture Test." << std::endl;
|
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) {
|
static void parse_args(int argc, char **argv) {
|
||||||
@@ -53,6 +55,9 @@ static void parse_args(int argc, char **argv) {
|
|||||||
case 'w':
|
case 'w':
|
||||||
wrap = std::atoi(optarg);
|
wrap = std::atoi(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'z':
|
||||||
|
use_sw = std::atoi(optarg);
|
||||||
|
break;
|
||||||
case 'f': {
|
case 'f': {
|
||||||
format = std::atoi(optarg);
|
format = std::atoi(optarg);
|
||||||
switch (format) {
|
switch (format) {
|
||||||
@@ -124,7 +129,7 @@ int run_test(const kernel_arg_t& kernel_arg,
|
|||||||
|
|
||||||
// save output image
|
// save output image
|
||||||
std::cout << "save output image" << std::endl;
|
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));
|
RT_CHECK(SaveTGA(output_file, dst_pixels, width, height, bpp));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -201,9 +206,10 @@ int main(int argc, char *argv[]) {
|
|||||||
kernel_arg.format = format;
|
kernel_arg.format = format;
|
||||||
kernel_arg.filter = filter;
|
kernel_arg.filter = filter;
|
||||||
kernel_arg.wrap = wrap;
|
kernel_arg.wrap = wrap;
|
||||||
|
kernel_arg.use_sw = use_sw;
|
||||||
|
|
||||||
kernel_arg.src_logWidth = ilog2(src_width);
|
kernel_arg.src_logWidth = (uint32_t)std::log2(src_width);
|
||||||
kernel_arg.src_logHeight = ilog2(src_height);
|
kernel_arg.src_logHeight = (uint32_t)std::log2(src_height);
|
||||||
kernel_arg.src_stride = src_bpp;
|
kernel_arg.src_stride = src_bpp;
|
||||||
kernel_arg.src_pitch = src_bpp * src_width;
|
kernel_arg.src_pitch = src_bpp * src_width;
|
||||||
kernel_arg.src_ptr = src_addr;
|
kernel_arg.src_ptr = src_addr;
|
||||||
|
|||||||
Reference in New Issue
Block a user