mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-24 14:54:02 +00:00
Fix GLES 2.0 build after the compute shader addition
This commit is contained in:
@@ -1257,11 +1257,17 @@ void CDeviceCommandContext::Dispatch(
|
||||
const uint32_t groupCountY,
|
||||
const uint32_t groupCountZ)
|
||||
{
|
||||
#if !CONFIG2_GLES
|
||||
ENSURE(m_InsideComputePass);
|
||||
glDispatchCompute(groupCountX, groupCountY, groupCountZ);
|
||||
// TODO: we might want to do binding tracking to avoid redundant barriers.
|
||||
glMemoryBarrier(
|
||||
GL_SHADER_IMAGE_ACCESS_BARRIER_BIT | GL_TEXTURE_FETCH_BARRIER_BIT | GL_TEXTURE_UPDATE_BARRIER_BIT | GL_FRAMEBUFFER_BARRIER_BIT);
|
||||
#else
|
||||
UNUSED2(groupCountX);
|
||||
UNUSED2(groupCountY);
|
||||
UNUSED2(groupCountZ);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::SetTexture(const int32_t bindingSlot, ITexture* texture)
|
||||
@@ -1308,6 +1314,7 @@ void CDeviceCommandContext::SetTexture(const int32_t bindingSlot, ITexture* text
|
||||
|
||||
void CDeviceCommandContext::SetStorageTexture(const int32_t bindingSlot, ITexture* texture)
|
||||
{
|
||||
#if !CONFIG2_GLES
|
||||
ENSURE(m_ShaderProgram);
|
||||
ENSURE(texture);
|
||||
ENSURE(texture->GetUsage() & Renderer::Backend::ITexture::Usage::STORAGE);
|
||||
@@ -1319,6 +1326,10 @@ void CDeviceCommandContext::SetStorageTexture(const int32_t bindingSlot, ITextur
|
||||
ENSURE(textureUnit.type == GL_IMAGE_2D);
|
||||
ENSURE(texture->GetFormat() == Format::R8G8B8A8_UNORM);
|
||||
glBindImageTexture(textureUnit.unit, texture->As<CTexture>()->GetHandle(), 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA8);
|
||||
#else
|
||||
UNUSED2(bindingSlot);
|
||||
UNUSED2(texture);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::SetUniform(
|
||||
|
||||
@@ -675,9 +675,11 @@ public:
|
||||
case GL_FRAGMENT_SHADER:
|
||||
stageDefine = "STAGE_FRAGMENT";
|
||||
break;
|
||||
#if !CONFIG2_GLES
|
||||
case GL_COMPUTE_SHADER:
|
||||
stageDefine = "STAGE_COMPUTE";
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1341,6 +1343,7 @@ std::unique_ptr<CShaderProgram> CShaderProgram::Create(CDevice* device, const CS
|
||||
|
||||
if (isGLSL)
|
||||
{
|
||||
#if !CONFIG2_GLES
|
||||
if (!computeFile.empty())
|
||||
{
|
||||
ENSURE(streamFlags == 0);
|
||||
@@ -1349,6 +1352,10 @@ std::unique_ptr<CShaderProgram> CShaderProgram::Create(CDevice* device, const CS
|
||||
const PS::StaticVector<std::tuple<VfsPath, GLenum>, 2> shaderStages{computeFile.empty()
|
||||
? PS::StaticVector<std::tuple<VfsPath, GLenum>, 2>{{vertexFile, GL_VERTEX_SHADER}, {fragmentFile, GL_FRAGMENT_SHADER}}
|
||||
: PS::StaticVector<std::tuple<VfsPath, GLenum>, 2>{{computeFile, GL_COMPUTE_SHADER}}};
|
||||
#else
|
||||
const PS::StaticVector<std::tuple<VfsPath, GLenum>, 2> shaderStages{{{vertexFile, GL_VERTEX_SHADER}, {fragmentFile, GL_FRAGMENT_SHADER}}};
|
||||
#endif
|
||||
|
||||
return std::make_unique<CShaderProgramGLSL>(
|
||||
device, name, xmlFilename, shaderStages, defines,
|
||||
vertexAttribs, streamFlags);
|
||||
|
||||
Reference in New Issue
Block a user