mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-11-18 05:46:19 +00:00
Fixed 08-update texture update size, WebGPU cube slice count, Vulkan init order. (#3901)
This commit is contained in:
@@ -714,16 +714,15 @@ public:
|
||||
// Fill rect.
|
||||
const uint32_t pitch = kTexture2dSize*4;
|
||||
|
||||
const uint16_t tw = m_rng.gen()% kTexture2dSize;
|
||||
const uint16_t th = m_rng.gen()% kTexture2dSize;
|
||||
const uint16_t tw = bx::max<uint16_t>(1, m_rng.gen()% kTexture2dSize);
|
||||
const uint16_t th = bx::max<uint16_t>(1, m_rng.gen()% kTexture2dSize);
|
||||
const uint16_t tx = m_rng.gen()%(kTexture2dSize-tw);
|
||||
const uint16_t ty = m_rng.gen()%(kTexture2dSize-th);
|
||||
|
||||
uint8_t* dst = &m_texture2dData[(ty*kTexture2dSize+tx)*4];
|
||||
uint8_t* next = dst + pitch;
|
||||
|
||||
// Using makeRef to pass texture memory without copying.
|
||||
const bgfx::Memory* mem = bgfx::makeRef(dst, tw*th*4);
|
||||
const bgfx::Memory* mem = bgfx::makeRef(dst, (th-1)*pitch + tw*4);
|
||||
|
||||
for (uint32_t yy = 0; yy < th; ++yy, dst = next, next += pitch)
|
||||
{
|
||||
@@ -797,7 +796,7 @@ public:
|
||||
bgfx::setViewFrameBuffer(mipRtView, m_mipFb);
|
||||
bgfx::setViewRect(mipRtView, 0, 0, 256, 256);
|
||||
bgfx::setViewClear(mipRtView
|
||||
, BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH
|
||||
, BGFX_CLEAR_COLOR
|
||||
, 0x306080ff
|
||||
, 1.0f
|
||||
, 0
|
||||
@@ -814,7 +813,12 @@ public:
|
||||
bgfx::setVertexBuffer(0, m_vbh);
|
||||
bgfx::setIndexBuffer(m_ibh);
|
||||
bgfx::setTexture(0, s_texCube, m_textureCube[0]);
|
||||
bgfx::setState(BGFX_STATE_DEFAULT);
|
||||
bgfx::setState(0
|
||||
| BGFX_STATE_WRITE_RGB
|
||||
| BGFX_STATE_WRITE_A
|
||||
| BGFX_STATE_CULL_CW
|
||||
| BGFX_STATE_MSAA
|
||||
);
|
||||
bgfx::submit(mipRtView, m_program);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -769,9 +769,9 @@ VK_DESTROY_FUNC(DescriptorSet);
|
||||
SwapChainVK()
|
||||
: m_nwh(NULL)
|
||||
, m_swapChain(VK_NULL_HANDLE)
|
||||
, m_needPresent(false)
|
||||
, m_lastImageRenderedSemaphore(VK_NULL_HANDLE)
|
||||
, m_lastImageAcquiredSemaphore(VK_NULL_HANDLE)
|
||||
, m_needPresent(false)
|
||||
, m_backBufferDepthStencilImageView(VK_NULL_HANDLE)
|
||||
, m_backBufferColorMsaaImageView(VK_NULL_HANDLE)
|
||||
{
|
||||
|
||||
@@ -4015,6 +4015,7 @@ WGPU_IMPORT
|
||||
m_height = ti.height;
|
||||
m_depth = ti.depth;
|
||||
m_numLayers = ti.numLayers;
|
||||
m_numSides = ti.numLayers * (imageContainer.m_cubeMap ? 6 : 1);
|
||||
m_requestedFormat = uint8_t(imageContainer.m_format);
|
||||
m_textureFormat = uint8_t(getViableTextureFormat(imageContainer) );
|
||||
const bool convert = m_textureFormat != m_requestedFormat;
|
||||
@@ -4030,7 +4031,7 @@ WGPU_IMPORT
|
||||
? WGPUTextureViewDimension_CubeArray
|
||||
: WGPUTextureViewDimension_Cube
|
||||
;
|
||||
depthOrArrayLayers = 6;
|
||||
depthOrArrayLayers = m_numSides;
|
||||
}
|
||||
else if (isVolume(imageContainer) )
|
||||
{
|
||||
@@ -4051,7 +4052,6 @@ WGPU_IMPORT
|
||||
}
|
||||
|
||||
m_numMips = ti.numMips;
|
||||
const uint16_t numSides = ti.numLayers * (imageContainer.m_cubeMap ? 6 : 1);
|
||||
|
||||
const bool compressed = bimg::isCompressed(bimg::TextureFormat::Enum(m_textureFormat) );
|
||||
const bool swizzle = TextureFormat::BGRA8 == m_textureFormat && 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE);
|
||||
@@ -4136,7 +4136,7 @@ WGPU_IMPORT
|
||||
|
||||
uint8_t* temp = convert ? (uint8_t*)bx::alloc(g_allocator, m_width*m_height*bpp/8) : NULL;
|
||||
|
||||
for (uint16_t side = 0; side < numSides; ++side)
|
||||
for (uint16_t side = 0; side < m_numSides; ++side)
|
||||
{
|
||||
copyTextureDst.origin.z = side;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user