Switches default wrap mode to work with linear textures.

This commit is contained in:
Erik Abair 2022-02-01 21:21:24 -08:00
parent ecd36991da
commit 1ab88ced4d
3 changed files with 6 additions and 4 deletions

View File

@ -146,8 +146,8 @@ void TextureBorderTests::Test2D() {
stage.SetBorderColor(0xF00000CC);
stage.SetDimensions(kTextureWidth, kTextureHeight);
stage.SetUWrap(TextureStage::WRAP_WRAP, false);
stage.SetVWrap(TextureStage::WRAP_WRAP, false);
stage.SetUWrap(TextureStage::WRAP_REPEAT, false);
stage.SetVWrap(TextureStage::WRAP_REPEAT, false);
host_.SetupTextureStages();
host_.SetVertexBuffer(vertex_buffers_[0]);
host_.DrawArrays();
@ -178,6 +178,7 @@ void TextureBorderTests::Test2D() {
host_.SetVertexBuffer(vertex_buffers_[4]);
host_.DrawArrays();
stage.SetBorderFromColor(true);
stage.SetUWrap(TextureStage::WRAP_CLAMP_TO_EDGE_OGL, false);
stage.SetVWrap(TextureStage::WRAP_CLAMP_TO_EDGE_OGL, false);
host_.SetupTextureStages();

View File

@ -67,6 +67,7 @@ void TextureStage::Commit(uint32_t memory_dma_offset, uint32_t palette_dma_offse
// NV097_SET_TEXTURE_IMAGE_RECT
p = pb_push1(p, NV20_TCL_PRIMITIVE_3D_TX_NPOT_SIZE(stage_), size_param);
// NV097_SET_TEXTURE_ADDRESS
uint32_t texture_address = MASK(NV097_SET_TEXTURE_ADDRESS_U, wrap_modes_[0]) |
MASK(NV097_SET_TEXTURE_ADDRESS_CYLINDERWRAP_U, cylinder_wrap_[0]) |
MASK(NV097_SET_TEXTURE_ADDRESS_V, wrap_modes_[1]) |

View File

@ -30,7 +30,7 @@ class TextureStage {
MAG_CONVOLUTION_2D_LOD0 = 4,
};
enum WrapMode { WRAP_WRAP = 1, WRAP_MIRROR, WRAP_CLAMP_TO_EDGE, WRAP_BORDER, WRAP_CLAMP_TO_EDGE_OGL };
enum WrapMode { WRAP_REPEAT = 1, WRAP_MIRROR, WRAP_CLAMP_TO_EDGE, WRAP_BORDER, WRAP_CLAMP_TO_EDGE_OGL };
public:
void SetUWrap(WrapMode mode, bool cylinder_wrap = false) {
@ -122,7 +122,7 @@ class TextureStage {
bool cubemap_enable_{false};
bool border_source_color_{true};
WrapMode wrap_modes_[3]{WRAP_WRAP, WRAP_WRAP, WRAP_WRAP};
WrapMode wrap_modes_[3]{WRAP_CLAMP_TO_EDGE, WRAP_CLAMP_TO_EDGE, WRAP_CLAMP_TO_EDGE};
bool cylinder_wrap_[4] = {false};
float bump_env_material[4] = {0.0f, 0.0f, 0.0f, 0.0f};