[Mesa-dev] [PATCH 7/8] intel/compiler: Use gl_image_format in fs_surface_builder
Jason Ekstrand
jason at jlekstrand.net
Thu Jul 13 07:32:17 UTC 2017
---
src/intel/compiler/brw_fs_nir.cpp | 5 +-
src/intel/compiler/brw_fs_surface_builder.cpp | 90 +++++++++++++--------------
src/intel/compiler/brw_fs_surface_builder.h | 4 +-
3 files changed, 50 insertions(+), 49 deletions(-)
diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp
index a9dce42..e698575 100644
--- a/src/intel/compiler/brw_fs_nir.cpp
+++ b/src/intel/compiler/brw_fs_nir.cpp
@@ -3592,7 +3592,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
const nir_intrinsic_info *info = &nir_intrinsic_infos[instr->intrinsic];
const unsigned arr_dims = type->sampler_array ? 1 : 0;
const unsigned surf_dims = type->coordinate_components() - arr_dims;
- const unsigned format = var->data.image.format;
+ const gl_image_format format = var->data.image.format;
/* Get the arguments of the image intrinsic. */
const fs_reg image = get_nir_image_deref(instr->variables[0]);
@@ -3612,7 +3612,8 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
else if (instr->intrinsic == nir_intrinsic_image_store)
emit_image_store(bld, image, addr, src0, surf_dims, arr_dims,
- var->data.image.write_only ? GL_NONE : format);
+ var->data.image.write_only ? IMAGE_FORMAT_NONE :
+ format);
else
tmp = emit_image_atomic(bld, image, addr, src0, src1,
diff --git a/src/intel/compiler/brw_fs_surface_builder.cpp b/src/intel/compiler/brw_fs_surface_builder.cpp
index 8990a5c..f2390ac 100644
--- a/src/intel/compiler/brw_fs_surface_builder.cpp
+++ b/src/intel/compiler/brw_fs_surface_builder.cpp
@@ -170,49 +170,49 @@ namespace {
* enum before we can use them.
*/
enum isl_format
- isl_format_for_gl_format(uint32_t gl_format)
+ isl_format_for_image_format(gl_image_format gl_format)
{
switch (gl_format) {
- case GL_R8: return ISL_FORMAT_R8_UNORM;
- case GL_R8_SNORM: return ISL_FORMAT_R8_SNORM;
- case GL_R8UI: return ISL_FORMAT_R8_UINT;
- case GL_R8I: return ISL_FORMAT_R8_SINT;
- case GL_RG8: return ISL_FORMAT_R8G8_UNORM;
- case GL_RG8_SNORM: return ISL_FORMAT_R8G8_SNORM;
- case GL_RG8UI: return ISL_FORMAT_R8G8_UINT;
- case GL_RG8I: return ISL_FORMAT_R8G8_SINT;
- case GL_RGBA8: return ISL_FORMAT_R8G8B8A8_UNORM;
- case GL_RGBA8_SNORM: return ISL_FORMAT_R8G8B8A8_SNORM;
- case GL_RGBA8UI: return ISL_FORMAT_R8G8B8A8_UINT;
- case GL_RGBA8I: return ISL_FORMAT_R8G8B8A8_SINT;
- case GL_R11F_G11F_B10F: return ISL_FORMAT_R11G11B10_FLOAT;
- case GL_RGB10_A2: return ISL_FORMAT_R10G10B10A2_UNORM;
- case GL_RGB10_A2UI: return ISL_FORMAT_R10G10B10A2_UINT;
- case GL_R16: return ISL_FORMAT_R16_UNORM;
- case GL_R16_SNORM: return ISL_FORMAT_R16_SNORM;
- case GL_R16F: return ISL_FORMAT_R16_FLOAT;
- case GL_R16UI: return ISL_FORMAT_R16_UINT;
- case GL_R16I: return ISL_FORMAT_R16_SINT;
- case GL_RG16: return ISL_FORMAT_R16G16_UNORM;
- case GL_RG16_SNORM: return ISL_FORMAT_R16G16_SNORM;
- case GL_RG16F: return ISL_FORMAT_R16G16_FLOAT;
- case GL_RG16UI: return ISL_FORMAT_R16G16_UINT;
- case GL_RG16I: return ISL_FORMAT_R16G16_SINT;
- case GL_RGBA16: return ISL_FORMAT_R16G16B16A16_UNORM;
- case GL_RGBA16_SNORM: return ISL_FORMAT_R16G16B16A16_SNORM;
- case GL_RGBA16F: return ISL_FORMAT_R16G16B16A16_FLOAT;
- case GL_RGBA16UI: return ISL_FORMAT_R16G16B16A16_UINT;
- case GL_RGBA16I: return ISL_FORMAT_R16G16B16A16_SINT;
- case GL_R32F: return ISL_FORMAT_R32_FLOAT;
- case GL_R32UI: return ISL_FORMAT_R32_UINT;
- case GL_R32I: return ISL_FORMAT_R32_SINT;
- case GL_RG32F: return ISL_FORMAT_R32G32_FLOAT;
- case GL_RG32UI: return ISL_FORMAT_R32G32_UINT;
- case GL_RG32I: return ISL_FORMAT_R32G32_SINT;
- case GL_RGBA32F: return ISL_FORMAT_R32G32B32A32_FLOAT;
- case GL_RGBA32UI: return ISL_FORMAT_R32G32B32A32_UINT;
- case GL_RGBA32I: return ISL_FORMAT_R32G32B32A32_SINT;
- case GL_NONE: return ISL_FORMAT_UNSUPPORTED;
+ case IMAGE_FORMAT_R8: return ISL_FORMAT_R8_UNORM;
+ case IMAGE_FORMAT_R8_SNORM: return ISL_FORMAT_R8_SNORM;
+ case IMAGE_FORMAT_R8UI: return ISL_FORMAT_R8_UINT;
+ case IMAGE_FORMAT_R8I: return ISL_FORMAT_R8_SINT;
+ case IMAGE_FORMAT_RG8: return ISL_FORMAT_R8G8_UNORM;
+ case IMAGE_FORMAT_RG8_SNORM: return ISL_FORMAT_R8G8_SNORM;
+ case IMAGE_FORMAT_RG8UI: return ISL_FORMAT_R8G8_UINT;
+ case IMAGE_FORMAT_RG8I: return ISL_FORMAT_R8G8_SINT;
+ case IMAGE_FORMAT_RGBA8: return ISL_FORMAT_R8G8B8A8_UNORM;
+ case IMAGE_FORMAT_RGBA8_SNORM: return ISL_FORMAT_R8G8B8A8_SNORM;
+ case IMAGE_FORMAT_RGBA8UI: return ISL_FORMAT_R8G8B8A8_UINT;
+ case IMAGE_FORMAT_RGBA8I: return ISL_FORMAT_R8G8B8A8_SINT;
+ case IMAGE_FORMAT_R11F_G11F_B10F: return ISL_FORMAT_R11G11B10_FLOAT;
+ case IMAGE_FORMAT_RGB10_A2: return ISL_FORMAT_R10G10B10A2_UNORM;
+ case IMAGE_FORMAT_RGB10_A2UI: return ISL_FORMAT_R10G10B10A2_UINT;
+ case IMAGE_FORMAT_R16: return ISL_FORMAT_R16_UNORM;
+ case IMAGE_FORMAT_R16_SNORM: return ISL_FORMAT_R16_SNORM;
+ case IMAGE_FORMAT_R16F: return ISL_FORMAT_R16_FLOAT;
+ case IMAGE_FORMAT_R16UI: return ISL_FORMAT_R16_UINT;
+ case IMAGE_FORMAT_R16I: return ISL_FORMAT_R16_SINT;
+ case IMAGE_FORMAT_RG16: return ISL_FORMAT_R16G16_UNORM;
+ case IMAGE_FORMAT_RG16_SNORM: return ISL_FORMAT_R16G16_SNORM;
+ case IMAGE_FORMAT_RG16F: return ISL_FORMAT_R16G16_FLOAT;
+ case IMAGE_FORMAT_RG16UI: return ISL_FORMAT_R16G16_UINT;
+ case IMAGE_FORMAT_RG16I: return ISL_FORMAT_R16G16_SINT;
+ case IMAGE_FORMAT_RGBA16: return ISL_FORMAT_R16G16B16A16_UNORM;
+ case IMAGE_FORMAT_RGBA16_SNORM: return ISL_FORMAT_R16G16B16A16_SNORM;
+ case IMAGE_FORMAT_RGBA16F: return ISL_FORMAT_R16G16B16A16_FLOAT;
+ case IMAGE_FORMAT_RGBA16UI: return ISL_FORMAT_R16G16B16A16_UINT;
+ case IMAGE_FORMAT_RGBA16I: return ISL_FORMAT_R16G16B16A16_SINT;
+ case IMAGE_FORMAT_R32F: return ISL_FORMAT_R32_FLOAT;
+ case IMAGE_FORMAT_R32UI: return ISL_FORMAT_R32_UINT;
+ case IMAGE_FORMAT_R32I: return ISL_FORMAT_R32_SINT;
+ case IMAGE_FORMAT_RG32F: return ISL_FORMAT_R32G32_FLOAT;
+ case IMAGE_FORMAT_RG32UI: return ISL_FORMAT_R32G32_UINT;
+ case IMAGE_FORMAT_RG32I: return ISL_FORMAT_R32G32_SINT;
+ case IMAGE_FORMAT_RGBA32F: return ISL_FORMAT_R32G32B32A32_FLOAT;
+ case IMAGE_FORMAT_RGBA32UI: return ISL_FORMAT_R32G32B32A32_UINT;
+ case IMAGE_FORMAT_RGBA32I: return ISL_FORMAT_R32G32B32A32_SINT;
+ case IMAGE_FORMAT_NONE: return ISL_FORMAT_UNSUPPORTED;
default:
assert(!"Invalid image format");
return ISL_FORMAT_UNSUPPORTED;
@@ -955,7 +955,7 @@ namespace brw {
emit_image_load(const fs_builder &bld,
const fs_reg &image, const fs_reg &addr,
unsigned surf_dims, unsigned arr_dims,
- unsigned gl_format)
+ gl_image_format gl_format)
{
using namespace image_format_info;
using namespace image_format_conversion;
@@ -963,7 +963,7 @@ namespace brw {
using namespace image_coordinates;
using namespace surface_access;
const gen_device_info *devinfo = bld.shader->devinfo;
- const isl_format format = isl_format_for_gl_format(gl_format);
+ const isl_format format = isl_format_for_image_format(gl_format);
const isl_format lower_format =
isl_lower_storage_image_format(devinfo, format);
fs_reg tmp;
@@ -1063,14 +1063,14 @@ namespace brw {
emit_image_store(const fs_builder &bld, const fs_reg &image,
const fs_reg &addr, const fs_reg &src,
unsigned surf_dims, unsigned arr_dims,
- unsigned gl_format)
+ gl_image_format gl_format)
{
using namespace image_format_info;
using namespace image_format_conversion;
using namespace image_validity;
using namespace image_coordinates;
using namespace surface_access;
- const isl_format format = isl_format_for_gl_format(gl_format);
+ const isl_format format = isl_format_for_image_format(gl_format);
const gen_device_info *devinfo = bld.shader->devinfo;
/* Transform the image coordinates into actual surface coordinates. */
diff --git a/src/intel/compiler/brw_fs_surface_builder.h b/src/intel/compiler/brw_fs_surface_builder.h
index 32b56d3..1d90eca 100644
--- a/src/intel/compiler/brw_fs_surface_builder.h
+++ b/src/intel/compiler/brw_fs_surface_builder.h
@@ -70,13 +70,13 @@ namespace brw {
emit_image_load(const fs_builder &bld,
const fs_reg &image, const fs_reg &addr,
unsigned surf_dims, unsigned arr_dims,
- unsigned gl_format);
+ gl_image_format gl_format);
void
emit_image_store(const fs_builder &bld, const fs_reg &image,
const fs_reg &addr, const fs_reg &src,
unsigned surf_dims, unsigned arr_dims,
- unsigned gl_format);
+ gl_image_format gl_format);
fs_reg
emit_image_atomic(const fs_builder &bld,
const fs_reg &image, const fs_reg &addr,
--
2.5.0.400.gff86faf
More information about the mesa-dev
mailing list