Fix GLES 2.0 build after the compute shader addition
This commit is contained in:
parent
26994b156b
commit
de9dab27ab
@ -43,7 +43,7 @@ extern void* wutil_GetAppHDC();
|
|||||||
#include <boost/algorithm/string/classification.hpp>
|
#include <boost/algorithm/string/classification.hpp>
|
||||||
#include <boost/algorithm/string/split.hpp>
|
#include <boost/algorithm/string/split.hpp>
|
||||||
|
|
||||||
#if !CONFIG2_GLES && (defined(SDL_VIDEO_DRIVER_X11) || defined(SDL_VIDEO_DRIVER_WAYLAND))
|
#if !OS_MACOSX && !OS_MAC && !CONFIG2_GLES && (defined(SDL_VIDEO_DRIVER_X11) || defined(SDL_VIDEO_DRIVER_WAYLAND))
|
||||||
|
|
||||||
#if defined(SDL_VIDEO_DRIVER_X11)
|
#if defined(SDL_VIDEO_DRIVER_X11)
|
||||||
#include <glad/glx.h>
|
#include <glad/glx.h>
|
||||||
|
@ -1257,11 +1257,17 @@ void CDeviceCommandContext::Dispatch(
|
|||||||
const uint32_t groupCountY,
|
const uint32_t groupCountY,
|
||||||
const uint32_t groupCountZ)
|
const uint32_t groupCountZ)
|
||||||
{
|
{
|
||||||
|
#if !CONFIG2_GLES
|
||||||
ENSURE(m_InsideComputePass);
|
ENSURE(m_InsideComputePass);
|
||||||
glDispatchCompute(groupCountX, groupCountY, groupCountZ);
|
glDispatchCompute(groupCountX, groupCountY, groupCountZ);
|
||||||
// TODO: we might want to do binding tracking to avoid redundant barriers.
|
// TODO: we might want to do binding tracking to avoid redundant barriers.
|
||||||
glMemoryBarrier(
|
glMemoryBarrier(
|
||||||
GL_SHADER_IMAGE_ACCESS_BARRIER_BIT | GL_TEXTURE_FETCH_BARRIER_BIT | GL_TEXTURE_UPDATE_BARRIER_BIT | GL_FRAMEBUFFER_BARRIER_BIT);
|
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)
|
void CDeviceCommandContext::SetTexture(const int32_t bindingSlot, ITexture* texture)
|
||||||
@ -1316,9 +1322,13 @@ void CDeviceCommandContext::SetStorageTexture(const int32_t bindingSlot, ITextur
|
|||||||
m_ShaderProgram->GetTextureUnit(bindingSlot);
|
m_ShaderProgram->GetTextureUnit(bindingSlot);
|
||||||
if (!textureUnit.type)
|
if (!textureUnit.type)
|
||||||
return;
|
return;
|
||||||
|
#if !CONFIG2_GLES
|
||||||
ENSURE(textureUnit.type == GL_IMAGE_2D);
|
ENSURE(textureUnit.type == GL_IMAGE_2D);
|
||||||
|
#endif
|
||||||
ENSURE(texture->GetFormat() == Format::R8G8B8A8_UNORM);
|
ENSURE(texture->GetFormat() == Format::R8G8B8A8_UNORM);
|
||||||
|
#if !CONFIG2_GLES
|
||||||
glBindImageTexture(textureUnit.unit, texture->As<CTexture>()->GetHandle(), 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA8);
|
glBindImageTexture(textureUnit.unit, texture->As<CTexture>()->GetHandle(), 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA8);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDeviceCommandContext::SetUniform(
|
void CDeviceCommandContext::SetUniform(
|
||||||
|
@ -675,9 +675,11 @@ public:
|
|||||||
case GL_FRAGMENT_SHADER:
|
case GL_FRAGMENT_SHADER:
|
||||||
stageDefine = "STAGE_FRAGMENT";
|
stageDefine = "STAGE_FRAGMENT";
|
||||||
break;
|
break;
|
||||||
|
#if !CONFIG2_GLES
|
||||||
case GL_COMPUTE_SHADER:
|
case GL_COMPUTE_SHADER:
|
||||||
stageDefine = "STAGE_COMPUTE";
|
stageDefine = "STAGE_COMPUTE";
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1341,6 +1343,7 @@ std::unique_ptr<CShaderProgram> CShaderProgram::Create(CDevice* device, const CS
|
|||||||
|
|
||||||
if (isGLSL)
|
if (isGLSL)
|
||||||
{
|
{
|
||||||
|
#if !CONFIG2_GLES
|
||||||
if (!computeFile.empty())
|
if (!computeFile.empty())
|
||||||
{
|
{
|
||||||
ENSURE(streamFlags == 0);
|
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()
|
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>{{vertexFile, GL_VERTEX_SHADER}, {fragmentFile, GL_FRAGMENT_SHADER}}
|
||||||
: PS::StaticVector<std::tuple<VfsPath, GLenum>, 2>{{computeFile, GL_COMPUTE_SHADER}}};
|
: PS::StaticVector<std::tuple<VfsPath, GLenum>, 2>{{computeFile, GL_COMPUTE_SHADER}}};
|
||||||
|
#else
|
||||||
|
const PS::StaticVector<std::tuple<VfsPath, GLenum>, 2> shaderStages{PS::StaticVector<std::tuple<VfsPath, GLenum>, 2>{{vertexFile, GL_VERTEX_SHADER}, {fragmentFile, GL_FRAGMENT_SHADER}}};
|
||||||
|
#endif
|
||||||
|
|
||||||
return std::make_unique<CShaderProgramGLSL>(
|
return std::make_unique<CShaderProgramGLSL>(
|
||||||
device, name, xmlFilename, shaderStages, defines,
|
device, name, xmlFilename, shaderStages, defines,
|
||||||
vertexAttribs, streamFlags);
|
vertexAttribs, streamFlags);
|
||||||
|
Loading…
Reference in New Issue
Block a user