diff options
| author | Tor Aamodt <[email protected]> | 2010-07-16 21:34:35 -0800 |
|---|---|---|
| committer | Tor Aamodt <[email protected]> | 2010-07-16 21:34:35 -0800 |
| commit | 6ab0303a15ae4230cdea1495c0ca1a1a74e8df84 (patch) | |
| tree | 87b9e29788bac005b054c127bfed3b1d6dd26347 /src/cuda-sim/instructions.cc | |
| parent | 6941e2dc7c6fb5e9d365e4e96ae4bc8cece2bdac (diff) | |
- integrate Wilson's bug fixes from release
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 6852]
Diffstat (limited to 'src/cuda-sim/instructions.cc')
| -rw-r--r-- | src/cuda-sim/instructions.cc | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/cuda-sim/instructions.cc b/src/cuda-sim/instructions.cc index 5decd2b..7cdf0de 100644 --- a/src/cuda-sim/instructions.cc +++ b/src/cuda-sim/instructions.cc @@ -2721,7 +2721,33 @@ void tex_impl( const ptx_instruction *pI, ptx_thread_info *thread ) switch (dimension) { case GEOM_MODIFIER_1D: - x = ptx_tex_regs[0].u64; + width = cuArray->width; + height = cuArray->height; + if (texref->normalized) { + x_f32 = ptx_tex_regs[0].f32; + if (texref->addressMode[0] == cudaAddressModeClamp) { + x_f32 = (x_f32 > 1.0)? 1.0 : x_f32; + x_f32 = (x_f32 < 0.0)? 0.0 : x_f32; + } else if (texref->addressMode[0] == cudaAddressModeWrap) { + x_f32 = x_f32 - floor(x_f32); + } + + if( texref->filterMode == cudaFilterModeLinear ) { + float xb = x_f32 * width - 0.5; + alpha = xb - floor(xb); + alpha = reduce_precision(alpha,9); + beta = 0.0; + + x = (int)floor(xb); + y = 0; + } else { + x = (int) floor(x_f32 * width); + y = 0; + } + } else { + x = ptx_tex_regs[0].u64; + } + width *= (cuArray->desc.w+cuArray->desc.x+cuArray->desc.y+cuArray->desc.z)/8; x *= (cuArray->desc.w+cuArray->desc.x+cuArray->desc.y+cuArray->desc.z)/8; tex_array_index = tex_array_base + x; |
