Fix OpenGL sampler and copy semantics
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "XCEngine/RHI/OpenGL/OpenGLRenderPass.h"
|
||||
#include "XCEngine/RHI/OpenGL/OpenGLDescriptorSet.h"
|
||||
#include "XCEngine/RHI/OpenGL/OpenGLEnums.h"
|
||||
#include <algorithm>
|
||||
#include <glad/glad.h>
|
||||
|
||||
namespace XCEngine {
|
||||
@@ -830,10 +831,17 @@ void OpenGLCommandList::CopyResource(RHIResourceView* dst, RHIResourceView* src)
|
||||
|
||||
GLuint dstTex = dstView->GetTexture();
|
||||
GLuint srcTex = srcView->GetTexture();
|
||||
if (dstTex && srcTex) {
|
||||
glCopyImageSubData(srcTex, GL_TEXTURE_2D, 0, 0, 0, 0,
|
||||
dstTex, GL_TEXTURE_2D, 0, 0, 0, 0,
|
||||
256, 256, 1);
|
||||
const OpenGLTexture* dstTexture = dstView->GetTextureResource();
|
||||
const OpenGLTexture* srcTexture = srcView->GetTextureResource();
|
||||
if (dstTex && srcTex && dstTexture != nullptr && srcTexture != nullptr) {
|
||||
const GLuint srcTarget = ToOpenGL(srcTexture->GetOpenGLType());
|
||||
const GLuint dstTarget = ToOpenGL(dstTexture->GetOpenGLType());
|
||||
const GLsizei copyWidth = static_cast<GLsizei>(std::min(srcTexture->GetWidth(), dstTexture->GetWidth()));
|
||||
const GLsizei copyHeight = static_cast<GLsizei>(std::min(srcTexture->GetHeight(), dstTexture->GetHeight()));
|
||||
const GLsizei copyDepth = static_cast<GLsizei>(std::max<uint32_t>(1u, std::min(srcTexture->GetDepth(), dstTexture->GetDepth())));
|
||||
glCopyImageSubData(srcTex, srcTarget, 0, 0, 0, 0,
|
||||
dstTex, dstTarget, 0, 0, 0, 0,
|
||||
copyWidth, copyHeight, copyDepth);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user