minor update
This commit is contained in:
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -41,7 +41,7 @@ static void show_usage() {
|
|||||||
|
|
||||||
static void parse_args(int argc, char **argv) {
|
static void parse_args(int argc, char **argv) {
|
||||||
int c;
|
int c;
|
||||||
while ((c = getopt(argc, argv, "i:o:k:w:f:g:h?")) != -1) {
|
while ((c = getopt(argc, argv, "zi:o:k:w:f:g:h?")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'i':
|
case 'i':
|
||||||
input_file = optarg;
|
input_file = optarg;
|
||||||
@@ -56,7 +56,7 @@ static void parse_args(int argc, char **argv) {
|
|||||||
wrap = std::atoi(optarg);
|
wrap = std::atoi(optarg);
|
||||||
break;
|
break;
|
||||||
case 'z':
|
case 'z':
|
||||||
use_sw = std::atoi(optarg);
|
use_sw = true;
|
||||||
break;
|
break;
|
||||||
case 'f': {
|
case 'f': {
|
||||||
format = std::atoi(optarg);
|
format = std::atoi(optarg);
|
||||||
@@ -129,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;
|
||||||
@@ -157,7 +157,7 @@ int main(int argc, char *argv[]) {
|
|||||||
RT_CHECK(ConvertImage(src_pixels, tmp_pixels, src_width, src_height, FORMAT_A8R8G8B8, eformat));
|
RT_CHECK(ConvertImage(src_pixels, tmp_pixels, src_width, src_height, FORMAT_A8R8G8B8, eformat));
|
||||||
src_bpp = Format::GetInfo(eformat).BytePerPixel;
|
src_bpp = Format::GetInfo(eformat).BytePerPixel;
|
||||||
|
|
||||||
dump_image(src_pixels, src_width, src_height, src_bpp);
|
//dump_image(src_pixels, src_width, src_height, src_bpp);
|
||||||
|
|
||||||
uint32_t src_bufsize = src_bpp * src_width * src_height;
|
uint32_t src_bufsize = src_bpp * src_width * src_height;
|
||||||
|
|
||||||
|
|||||||
@@ -66,26 +66,24 @@ inline int pack(int format, int l, int h) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline int tex_sw(struct kernel_arg_t* state, int stage, int u, int v, int lod) {
|
inline int tex_sw(struct kernel_arg_t* state, int stage, int u, int v, int lod) {
|
||||||
int base_addr = state->src_ptr;//vx_csr_read(CSR_TEX_ADDR(0));
|
int base_addr = state->src_ptr;
|
||||||
int mip_offset = 0;//vx_csr_read(CSR_TEX_MIPOFF(0));
|
int mip_offset = 0;
|
||||||
int log_width = state->src_logWidth;//vx_csr_read(CSR_TEX_WIDTH(0));
|
int log_width = state->src_logWidth;
|
||||||
int log_height = state->src_logHeight;//vx_csr_read(CSR_TEX_HEIGHT(0));
|
int log_height = state->src_logHeight;
|
||||||
int format = state->format;//vx_csr_read(CSR_TEX_FORMAT(0));
|
int format = state->format;
|
||||||
int wrap = state->wrap;//vx_csr_read(CSR_TEX_WRAP(0));
|
int wrap = state->wrap;
|
||||||
int filter = state->filter;//vx_csr_read(CSR_TEX_FILTER(0));
|
int filter = state->filter;
|
||||||
|
|
||||||
int32_t* pBits = ((uint32_t*)base_addr) + mip_offset;
|
int32_t* pBits = ((uint32_t*)base_addr) + mip_offset;
|
||||||
|
|
||||||
int u0 = address(wrap, u - (0x80000 >> log_width));
|
|
||||||
int v0 = address(wrap, v - (0x80000 >> log_height));
|
|
||||||
|
|
||||||
int x0 = u0 >> (20 - log_width);
|
|
||||||
int y0 = v0 >> (20 - log_height);
|
|
||||||
|
|
||||||
if (filter) {
|
if (filter) {
|
||||||
|
int u0 = address(wrap, u - (0x80000 >> log_width));
|
||||||
|
int v0 = address(wrap, v - (0x80000 >> log_height));
|
||||||
int u1 = address(wrap, u + (0x80000 >> log_width));
|
int u1 = address(wrap, u + (0x80000 >> log_width));
|
||||||
int v1 = address(wrap, v + (0x80000 >> log_height));
|
int v1 = address(wrap, v + (0x80000 >> log_height));
|
||||||
|
|
||||||
|
int x0 = u0 >> (20 - log_width);
|
||||||
|
int y0 = v0 >> (20 - log_height);
|
||||||
int x1 = u1 >> (20 - log_width);
|
int x1 = u1 >> (20 - log_width);
|
||||||
int y1 = v1 >> (20 - log_height);
|
int y1 = v1 >> (20 - log_height);
|
||||||
|
|
||||||
@@ -121,6 +119,12 @@ inline int tex_sw(struct kernel_arg_t* state, int stage, int u, int v, int lod)
|
|||||||
lerp(c01a, c01b, c23a, c23b, beta, &c4a, &c4b);
|
lerp(c01a, c01b, c23a, c23b, beta, &c4a, &c4b);
|
||||||
return pack(format, c4a, c4b);
|
return pack(format, c4a, c4b);
|
||||||
} else {
|
} else {
|
||||||
|
int u0 = address(wrap, u);
|
||||||
|
int v0 = address(wrap, v);
|
||||||
|
|
||||||
|
int x0 = u0 >> (20 - log_width);
|
||||||
|
int y0 = v0 >> (20 - log_height);
|
||||||
|
|
||||||
int c0 = pBits[x0 + (y0 <<log_width)];
|
int c0 = pBits[x0 + (y0 <<log_width)];
|
||||||
|
|
||||||
int c0a, c0b;
|
int c0a, c0b;
|
||||||
|
|||||||
Reference in New Issue
Block a user