renderer_opengl: Fix shader compilation
* Also use glCopyImageSubData to do texture copies'
This commit is contained in:
@ -118,18 +118,18 @@ void OGLSampler::Release() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OGLShader::Create(std::string_view source, GLenum type) {
|
void OGLShader::Create(std::string_view source, GLenum type) {
|
||||||
if (handle != 0)
|
if (handle != 0 || source.empty()) {
|
||||||
return;
|
|
||||||
if (source == nullptr)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MICROPROFILE_SCOPE(OpenGL_ResourceCreation);
|
MICROPROFILE_SCOPE(OpenGL_ResourceCreation);
|
||||||
handle = LoadShader(source, type);
|
handle = LoadShader(source, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGLShader::Release() {
|
void OGLShader::Release() {
|
||||||
if (handle == 0)
|
if (handle == 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MICROPROFILE_SCOPE(OpenGL_ResourceDeletion);
|
MICROPROFILE_SCOPE(OpenGL_ResourceDeletion);
|
||||||
glDeleteShader(handle);
|
glDeleteShader(handle);
|
||||||
@ -137,8 +137,9 @@ void OGLShader::Release() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OGLProgram::Create(bool separable_program, const std::vector<GLuint>& shaders) {
|
void OGLProgram::Create(bool separable_program, const std::vector<GLuint>& shaders) {
|
||||||
if (handle != 0)
|
if (handle != 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MICROPROFILE_SCOPE(OpenGL_ResourceCreation);
|
MICROPROFILE_SCOPE(OpenGL_ResourceCreation);
|
||||||
handle = LoadProgram(separable_program, shaders);
|
handle = LoadProgram(separable_program, shaders);
|
||||||
|
@ -222,18 +222,12 @@ bool TextureRuntime::ClearTexture(Surface& surface, const VideoCore::TextureClea
|
|||||||
|
|
||||||
bool TextureRuntime::CopyTextures(Surface& source, Surface& dest,
|
bool TextureRuntime::CopyTextures(Surface& source, Surface& dest,
|
||||||
const VideoCore::TextureCopy& copy) {
|
const VideoCore::TextureCopy& copy) {
|
||||||
// Emulate texture copy with blit for now
|
glCopyImageSubData(source.texture.handle, GL_TEXTURE_2D,
|
||||||
const VideoCore::TextureBlit blit = {
|
copy.src_level, copy.src_offset.x, copy.src_offset.y, 0,
|
||||||
.src_level = copy.src_level,
|
dest.texture.handle, GL_TEXTURE_2D,
|
||||||
.dst_level = copy.dst_level,
|
copy.dst_level, copy.dst_offset.x, copy.dst_offset.y, 0,
|
||||||
.src_layer = copy.src_layer,
|
copy.extent.width, copy.extent.height, 1);
|
||||||
.dst_layer = copy.dst_layer,
|
return true;
|
||||||
.src_rect = {copy.src_offset.x, copy.src_offset.y + copy.extent.height,
|
|
||||||
copy.src_offset.x + copy.extent.width, copy.src_offset.y},
|
|
||||||
.dst_rect = {copy.dst_offset.x, copy.dst_offset.y + copy.extent.height,
|
|
||||||
copy.dst_offset.x + copy.extent.width, copy.dst_offset.y}};
|
|
||||||
|
|
||||||
return BlitTextures(source, dest, blit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TextureRuntime::BlitTextures(Surface& source, Surface& dest,
|
bool TextureRuntime::BlitTextures(Surface& source, Surface& dest,
|
||||||
|
@ -338,6 +338,7 @@ ImageAlloc TextureRuntime::Allocate(u32 width, u32 height, VideoCore::PixelForma
|
|||||||
alloc.storage_view = device.createImageView(storage_view_info);
|
alloc.storage_view = device.createImageView(storage_view_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderpass_cache.ExitRenderpass();
|
||||||
scheduler.Record([image = alloc.image, aspect = alloc.aspect](vk::CommandBuffer cmdbuf) {
|
scheduler.Record([image = alloc.image, aspect = alloc.aspect](vk::CommandBuffer cmdbuf) {
|
||||||
const vk::ImageMemoryBarrier init_barrier = {
|
const vk::ImageMemoryBarrier init_barrier = {
|
||||||
.srcAccessMask = vk::AccessFlagBits::eNone,
|
.srcAccessMask = vk::AccessFlagBits::eNone,
|
||||||
|
Reference in New Issue
Block a user